mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Hide disabled workspaces/clusters (#1573)
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
1 parent
832f29f666
commit
4161ee832c
7 files changed
+180
-32
No files matched your search
@@ -21,7 +21,7 @@ export class Workspaces extends React.Component {
|
||||
|
||||
@computed get workspaces(): Workspace[] {
|
||||
const currentWorkspaces: Map<WorkspaceId, Workspace> = new Map();
|
||||
workspaceStore.workspacesList.forEach((w) => {
|
||||
workspaceStore.enabledWorkspacesList.forEach((w) => {
|
||||
currentWorkspaces.set(w.id, w);
|
||||
});
|
||||
const allWorkspaces = new Map([
|
||||
|
||||
@@ -65,26 +65,28 @@ export class ClustersMenu extends React.Component<Props> {
|
||||
}
|
||||
}));
|
||||
}
|
||||
menu.append(new MenuItem({
|
||||
label: _i18n._(t`Remove`),
|
||||
click: () => {
|
||||
ConfirmDialog.open({
|
||||
okButtonProps: {
|
||||
primary: false,
|
||||
accent: true,
|
||||
label: _i18n._(t`Remove`),
|
||||
},
|
||||
ok: () => {
|
||||
if (clusterStore.activeClusterId === cluster.id) {
|
||||
navigate(landingURL());
|
||||
clusterStore.setActive(null);
|
||||
}
|
||||
clusterStore.removeById(cluster.id);
|
||||
},
|
||||
message: <p>Are you sure want to remove cluster <b title={cluster.id}>{cluster.contextName}</b>?</p>,
|
||||
});
|
||||
}
|
||||
}));
|
||||
if (!cluster.isManaged) {
|
||||
menu.append(new MenuItem({
|
||||
label: _i18n._(t`Remove`),
|
||||
click: () => {
|
||||
ConfirmDialog.open({
|
||||
okButtonProps: {
|
||||
primary: false,
|
||||
accent: true,
|
||||
label: _i18n._(t`Remove`),
|
||||
},
|
||||
ok: () => {
|
||||
if (clusterStore.activeClusterId === cluster.id) {
|
||||
navigate(landingURL());
|
||||
clusterStore.setActive(null);
|
||||
}
|
||||
clusterStore.removeById(cluster.id);
|
||||
},
|
||||
message: <p>Are you sure want to remove cluster <b title={cluster.id}>{cluster.contextName}</b>?</p>,
|
||||
});
|
||||
}
|
||||
}));
|
||||
}
|
||||
menu.popup({
|
||||
window: remote.getCurrentWindow()
|
||||
});
|
||||
@@ -106,7 +108,7 @@ export class ClustersMenu extends React.Component<Props> {
|
||||
const { className } = this.props;
|
||||
const { newContexts } = userStore;
|
||||
const workspace = workspaceStore.getById(workspaceStore.currentWorkspaceId);
|
||||
const clusters = clusterStore.getByWorkspaceId(workspace.id);
|
||||
const clusters = clusterStore.getByWorkspaceId(workspace.id).filter(cluster => cluster.enabled);
|
||||
const activeClusterId = clusterStore.activeCluster;
|
||||
return (
|
||||
<div className={cssNames("ClustersMenu flex column", className)}>
|
||||
|
||||
Reference in new issue
Block a user