Hide disabled workspaces/clusters (#1573)

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen authored and GitHub committed 2020-12-01 15:27:54 +02:00
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)}>