mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Reset active cluster when leaving dashboard
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
6c7d3efb3c
commit
720f62cc1f
@ -64,7 +64,7 @@ export class KubernetesCluster implements CatalogEntity {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
if (this.status.active) {
|
if (this.status.phase == "connected") {
|
||||||
context.menuItems.unshift({
|
context.menuItems.unshift({
|
||||||
icon: "link_off",
|
icon: "link_off",
|
||||||
title: "Disconnect",
|
title: "Disconnect",
|
||||||
|
|||||||
@ -27,6 +27,7 @@ export class ClusterManager extends React.Component {
|
|||||||
reaction(getMatchedClusterId, initView, {
|
reaction(getMatchedClusterId, initView, {
|
||||||
fireImmediately: true
|
fireImmediately: true
|
||||||
}),
|
}),
|
||||||
|
reaction(() => !getMatchedClusterId(), () => ClusterStore.getInstance().setActive(null)),
|
||||||
reaction(() => [
|
reaction(() => [
|
||||||
getMatchedClusterId(), // refresh when active cluster-view changed
|
getMatchedClusterId(), // refresh when active cluster-view changed
|
||||||
hasLoadedView(getMatchedClusterId()), // refresh when cluster's webview loaded
|
hasLoadedView(getMatchedClusterId()), // refresh when cluster's webview loaded
|
||||||
|
|||||||
@ -7,11 +7,12 @@ import { HotbarIcon } from "./hotbar-icon";
|
|||||||
import { cssNames, IClassName } from "../../utils";
|
import { cssNames, IClassName } from "../../utils";
|
||||||
import { catalogEntityRegistry } from "../../api/catalog-entity-registry";
|
import { catalogEntityRegistry } from "../../api/catalog-entity-registry";
|
||||||
import { defaultHotbarCells, HotbarItem, HotbarStore } from "../../../common/hotbar-store";
|
import { defaultHotbarCells, HotbarItem, HotbarStore } from "../../../common/hotbar-store";
|
||||||
import { catalogEntityRunContext } from "../../api/catalog-entity";
|
import { CatalogEntity, catalogEntityRunContext } from "../../api/catalog-entity";
|
||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
import { Badge } from "../badge";
|
import { Badge } from "../badge";
|
||||||
import { CommandOverlay } from "../command-palette";
|
import { CommandOverlay } from "../command-palette";
|
||||||
import { HotbarSwitchCommand } from "./hotbar-switch-command";
|
import { HotbarSwitchCommand } from "./hotbar-switch-command";
|
||||||
|
import { ClusterStore } from "../../../common/cluster-store";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
className?: IClassName;
|
className?: IClassName;
|
||||||
@ -23,6 +24,10 @@ export class HotbarMenu extends React.Component<Props> {
|
|||||||
return HotbarStore.getInstance().getActive();
|
return HotbarStore.getInstance().getActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isActive(item: CatalogEntity) {
|
||||||
|
return ClusterStore.getInstance().activeClusterId == item.getId();
|
||||||
|
}
|
||||||
|
|
||||||
getEntity(item: HotbarItem) {
|
getEntity(item: HotbarItem) {
|
||||||
const hotbar = HotbarStore.getInstance().getActive();
|
const hotbar = HotbarStore.getInstance().getActive();
|
||||||
|
|
||||||
@ -58,7 +63,7 @@ export class HotbarMenu extends React.Component<Props> {
|
|||||||
key={index}
|
key={index}
|
||||||
index={index}
|
index={index}
|
||||||
entity={entity}
|
entity={entity}
|
||||||
isActive={entity.status.active}
|
isActive={this.isActive(entity)}
|
||||||
onClick={() => entity.onRun(catalogEntityRunContext)}
|
onClick={() => entity.onRun(catalogEntityRunContext)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user