Skip to content

Commit

Permalink
Fix type errors from new asyncComputed
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Malton <sebastian@malton.name>
  • Loading branch information
Nokel81 committed Dec 1, 2022
1 parent 1eaf253 commit 03322e6
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 33 deletions.
8 changes: 5 additions & 3 deletions src/renderer/components/+namespaces/metrics.injectable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ const namespaceMetricsInjectable = getInjectable({
instantiate: (di, namespace) => {
const requestPodMetricsInNamespace = di.inject(requestPodMetricsInNamespaceInjectable);

return asyncComputed(async () => {
now(60 * 1000); // Update every minute
return asyncComputed({
getValueFromObservedPromise: async () => {
now(60 * 1000); // Update every minute

return requestPodMetricsInNamespace(namespace.getName());
return requestPodMetricsInNamespace(namespace.getName());
},
});
},
lifecycle: lifecycleEnum.keyedSingleton({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ const ingressMetricsInjectable = getInjectable({
instantiate: (di, ingress) => {
const requestIngressMetrics = di.inject(requestIngressMetricsInjectable);

return asyncComputed(async () => {
now(60 * 1000); // Update every minute
return asyncComputed({
getValueFromObservedPromise: async () => {
now(60 * 1000); // Update every minute

return requestIngressMetrics(ingress.getName(), ingress.getNs());
return requestIngressMetrics(ingress.getName(), ingress.getNs());
},
});
},
lifecycle: lifecycleEnum.keyedSingleton({
Expand Down
8 changes: 5 additions & 3 deletions src/renderer/components/+nodes/metrics.injectable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ const nodeMetricsInjectable = getInjectable({
instantiate: (di, node) => {
const requestClusterMetricsByNodeNames = di.inject(requestClusterMetricsByNodeNamesInjectable);

return asyncComputed(() => {
now(60 * 1000);
return asyncComputed({
getValueFromObservedPromise: () => {
now(60 * 1000);

return requestClusterMetricsByNodeNames([node.getName()]);
return requestClusterMetricsByNodeNames([node.getName()]);
},
});
},
lifecycle: lifecycleEnum.keyedSingleton({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ const persistentVolumeClaimMetricsInjectable = getInjectable({
instantiate: (di, persistentVolumeClaim) => {
const requestPersistentVolumeClaimMetrics = di.inject(requestPersistentVolumeClaimMetricsInjectable);

return asyncComputed(() => {
now(60 * 1000); // update every minute
return asyncComputed({
getValueFromObservedPromise: () => {
now(60 * 1000); // update every minute

return requestPersistentVolumeClaimMetrics(persistentVolumeClaim);
return requestPersistentVolumeClaimMetrics(persistentVolumeClaim);
},
});
},
lifecycle: lifecycleEnum.keyedSingleton({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ const daemonSetMetricsInjectable = getInjectable({
instantiate: (di, daemonSet) => {
const requestPodMetricsForDaemonSets = di.inject(requestPodMetricsForDaemonSetsInjectable);

return asyncComputed(() => {
now(60 * 1000); // update every minute
return asyncComputed({
getValueFromObservedPromise: () => {
now(60 * 1000); // update every minute

return requestPodMetricsForDaemonSets([daemonSet], daemonSet.getNs());
return requestPodMetricsForDaemonSets([daemonSet], daemonSet.getNs());
},
});
},
lifecycle: lifecycleEnum.keyedSingleton({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ const deploymentMetricsInjectable = getInjectable({
instantiate: (di, deployment) => {
const requestPodMetricsForDeployments = di.inject(requestPodMetricsForDeploymentsInjectable);

return asyncComputed(() => {
now(60 * 1000);
return asyncComputed({
getValueFromObservedPromise: () => {
now(60 * 1000);

return requestPodMetricsForDeployments([deployment], deployment.getNs());
return requestPodMetricsForDeployments([deployment], deployment.getNs());
},
});
},
lifecycle: lifecycleEnum.keyedSingleton({
Expand Down
8 changes: 5 additions & 3 deletions src/renderer/components/+workloads-jobs/metrics.injectable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ const jobMetricsInjectable = getInjectable({
instantiate: (di, job) => {
const requestPodMetricsForJobs = di.inject(requestPodMetricsForJobsInjectable);

return asyncComputed(() => {
now(60 * 1000);
return asyncComputed({
getValueFromObservedPromise: () => {
now(60 * 1000);

return requestPodMetricsForJobs([job], job.getNs());
return requestPodMetricsForJobs([job], job.getNs());
},
});
},
lifecycle: lifecycleEnum.keyedSingleton({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ const podContainerMetricsInjectable = getInjectable({
instantiate: (di, pod) => {
const requestPodMetrics = di.inject(requestPodMetricsInjectable);

return asyncComputed(() => {
now(60 * 1000);
return asyncComputed({
getValueFromObservedPromise: () => {
now(60 * 1000);

return requestPodMetrics([pod], pod.getNs(), "container, namespace");
return requestPodMetrics([pod], pod.getNs(), "container, namespace");
},
});
},
lifecycle: lifecycleEnum.keyedSingleton({
Expand Down
8 changes: 5 additions & 3 deletions src/renderer/components/+workloads-pods/metrics.injectable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ const podMetricsInjectable = getInjectable({
instantiate: (di, pod) => {
const requestPodMetrics = di.inject(requestPodMetricsInjectable);

return asyncComputed(() => {
now(60 * 1000);
return asyncComputed({
getValueFromObservedPromise: () => {
now(60 * 1000);

return requestPodMetrics([pod], pod.getNs());
return requestPodMetrics([pod], pod.getNs());
},
});
},
lifecycle: lifecycleEnum.keyedSingleton({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ const replicaSetMetricsInjectable = getInjectable({
instantiate: (di, replicaSet) => {
const requestPodMetricsForReplicaSets = di.inject(requestPodMetricsForReplicaSetsInjectable);

return asyncComputed(() => {
now(60 * 1000); // update every minute
return asyncComputed({
getValueFromObservedPromise: async () => {
now(60 * 1000); // update every minute

return requestPodMetricsForReplicaSets([replicaSet], replicaSet.getNs());
return requestPodMetricsForReplicaSets([replicaSet], replicaSet.getNs());
},
});
},
lifecycle: lifecycleEnum.keyedSingleton({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ const statefulSetMetricsInjectable = getInjectable({
instantiate: (di, statefulSet) => {
const requestPodMetricsForStatefulSets = di.inject(requestPodMetricsForStatefulSetsInjectable);

return asyncComputed(() => {
now(60 * 1000);
return asyncComputed({
getValueFromObservedPromise: async () => {
now(60 * 1000);

return requestPodMetricsForStatefulSets([statefulSet], statefulSet.getNs());
return requestPodMetricsForStatefulSets([statefulSet], statefulSet.getNs());
},
});
},
lifecycle: lifecycleEnum.keyedSingleton({
Expand Down

0 comments on commit 03322e6

Please sign in to comment.