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)) { if (!(model instanceof Cluster)) {
cluster = new Cluster(model); cluster = new Cluster(model);
} }
if (!cluster.isManaged) {
cluster.enabled = true; cluster.enabled = true;
}
this.clusters.set(model.id, cluster); this.clusters.set(model.id, cluster);
return cluster; return cluster;
} }

View File

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

View File

@ -65,6 +65,7 @@ export class ClustersMenu extends React.Component<Props> {
} }
})); }));
} }
if (!cluster.isManaged) {
menu.append(new MenuItem({ menu.append(new MenuItem({
label: _i18n._(t`Remove`), label: _i18n._(t`Remove`),
click: () => { click: () => {
@ -85,6 +86,7 @@ export class ClustersMenu extends React.Component<Props> {
}); });
} }
})); }));
}
menu.popup({ menu.popup({
window: remote.getCurrentWindow() window: remote.getCurrentWindow()
}); });