1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

auto-enable only objects without ownerRef

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2020-11-30 20:59:59 +02:00
parent 9271c23dc0
commit 7d805d81a1
3 changed files with 29 additions and 23 deletions

View File

@ -205,7 +205,9 @@ export class ClusterStore extends BaseStore<ClusterStoreModel> {
if (!(model instanceof Cluster)) {
cluster = new Cluster(model);
}
cluster.enabled = true;
if (!cluster.isManaged) {
cluster.enabled = true;
}
this.clusters.set(model.id, cluster);
return cluster;
}

View File

@ -94,7 +94,6 @@ export class WorkspaceStore extends BaseStore<WorkspaceStoreModel> {
if (ipcRenderer) {
logger.info("[WORKSPACE-STORE] requesting initial state sync");
const workspaceStates: workspaceStateSync[] = await requestMain(this.stateRequestChannel);
console.log(workspaceStates);
workspaceStates.forEach((workspaceState) => {
const workspace = this.getById(workspaceState.id);
if (workspace) {
@ -182,7 +181,10 @@ export class WorkspaceStore extends BaseStore<WorkspaceStoreModel> {
return;
}
this.workspaces.set(id, workspace);
workspace.enabled = true;
if (!workspace.isManaged) {
workspace.enabled = true;
}
appEventBus.emit({name: "workspace", action: "add"});
return workspace;
}

View File

@ -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()
});