Add the ability to hide metrics from the UI (#2036)

This commit is contained in:
Violetta authored and GitHub committed 2021-03-16 09:22:08 -04:00
1 parent 7d14ba5e48
commit a9a5766920
19 files changed
+303 -38

No files matched your search

+8 -2
View File
@@ -15,6 +15,7 @@ import { handleRequest, requestMain, subscribeToBroadcast, unsubscribeAllFromBro
import _ from "lodash";
import move from "array-move";
import type { WorkspaceId } from "./workspace-store";
import { ResourceType } from "../renderer/components/+cluster-settings/components/cluster-metrics-setting";
export interface ClusterIconUpload {
clusterId: string;
@@ -34,7 +35,7 @@ export type ClusterPrometheusMetadata = {
export interface ClusterStoreModel {
activeCluster?: ClusterId; // last opened cluster
clusters?: ClusterModel[]
clusters?: ClusterModel[];
}
export type ClusterId = string;
@@ -70,12 +71,13 @@ export interface ClusterModel {
kubeConfig?: string; // yaml
}
export interface ClusterPreferences extends ClusterPrometheusPreferences{
export interface ClusterPreferences extends ClusterPrometheusPreferences {
terminalCWD?: string;
clusterName?: string;
iconOrder?: number;
icon?: string;
httpsProxy?: string;
hiddenMetrics?: string[];
}
export interface ClusterPrometheusPreferences {
@@ -211,6 +213,10 @@ export class ClusterStore extends BaseStore<ClusterStoreModel> {
return this.activeCluster === id;
}
isMetricHidden(resource: ResourceType) {
return Boolean(this.active?.preferences.hiddenMetrics?.includes(resource));
}
@action
setActive(id: ClusterId) {
const clusterId = this.clusters.has(id) ? id : null;
+1 -1
View File
@@ -29,7 +29,7 @@ export interface UserPreferences {
downloadBinariesPath?: string;
kubectlBinariesPath?: string;
openAtLogin?: boolean;
hiddenTableColumns?: Record<string, string[]>
hiddenTableColumns?: Record<string, string[]>;
}
export class UserStore extends BaseStore<UserStoreModel> {