mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add the ability to hide metrics from the UI (#2036)
This commit is contained in:
1 parent
7d14ba5e48
commit
a9a5766920
19 files changed
+303
-38
No files matched your search
@@ -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;
|
||||
|
||||
@@ -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> {
|
||||
|
||||
Reference in new issue
Block a user