mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix: "disconnect" cluster from clusters context-menu
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
parent
70bbb9fa62
commit
a40a9fec0e
@ -9,24 +9,24 @@ export const clusterIpc = {
|
|||||||
const cluster = clusterStore.getById(clusterId);
|
const cluster = clusterStore.getById(clusterId);
|
||||||
if (cluster) {
|
if (cluster) {
|
||||||
await cluster.refreshStatus();
|
await cluster.refreshStatus();
|
||||||
cluster.pushState();
|
return cluster.pushState();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|
||||||
disconnect: createIpcChannel({
|
disconnect: createIpcChannel({
|
||||||
channel: "cluster:disconnect",
|
channel: "cluster:disconnect",
|
||||||
handle: (clusterId: ClusterId) => {
|
handle: (clusterId: ClusterId = clusterStore.activeClusterId) => {
|
||||||
tracker.event("cluster", "stop");
|
tracker.event("cluster", "stop");
|
||||||
clusterStore.getById(clusterId)?.disconnect();
|
return clusterStore.getById(clusterId)?.disconnect();
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|
||||||
reconnect: createIpcChannel({
|
reconnect: createIpcChannel({
|
||||||
channel: "cluster:reconnect",
|
channel: "cluster:reconnect",
|
||||||
handle: (clusterId: ClusterId) => {
|
handle: (clusterId: ClusterId = clusterStore.activeClusterId) => {
|
||||||
tracker.event("cluster", "reconnect");
|
tracker.event("cluster", "reconnect");
|
||||||
clusterStore.getById(clusterId)?.reconnect();
|
return clusterStore.getById(clusterId)?.reconnect();
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
@ -334,13 +334,14 @@ export class Cluster implements ClusterModel {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pushState = (clusterState = this.getState()) => {
|
pushState = (state = this.getState()): ClusterState => {
|
||||||
logger.debug(`[CLUSTER]: push-state`, clusterState);
|
logger.debug(`[CLUSTER]: push-state`, state);
|
||||||
broadcastIpc({
|
broadcastIpc({
|
||||||
// webContentId: viewId, // todo: send to cluster-view only
|
// webContentId: viewId, // todo: send to cluster-view only
|
||||||
channel: "cluster:state",
|
channel: "cluster:state",
|
||||||
args: [clusterState],
|
args: [state],
|
||||||
})
|
});
|
||||||
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get cluster system meta, e.g. use in "logger"
|
// get cluster system meta, e.g. use in "logger"
|
||||||
|
|||||||
@ -19,10 +19,10 @@ import { clusterSettingsURL } from "../+cluster-settings";
|
|||||||
import { landingURL } from "../+landing-page";
|
import { landingURL } from "../+landing-page";
|
||||||
import { Tooltip, TooltipContent } from "../tooltip";
|
import { Tooltip, TooltipContent } from "../tooltip";
|
||||||
import { ConfirmDialog } from "../confirm-dialog";
|
import { ConfirmDialog } from "../confirm-dialog";
|
||||||
|
import { clusterIpc } from "../../../common/cluster-ipc";
|
||||||
|
|
||||||
// fixme: refresh all cluster-icon badges in background (events-count per cluster)
|
// fixme: refresh all cluster-icon badges in background (events-count per cluster)
|
||||||
// fixme: allow to rearrange clusters with drag&drop
|
// fixme: allow to rearrange clusters with drag&drop
|
||||||
// fixme: disconnect cluster from context-menu
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
className?: IClassName;
|
className?: IClassName;
|
||||||
@ -57,6 +57,7 @@ export class ClustersMenu extends React.Component<Props> {
|
|||||||
label: _i18n._(t`Disconnect`),
|
label: _i18n._(t`Disconnect`),
|
||||||
click: () => {
|
click: () => {
|
||||||
navigate(landingURL());
|
navigate(landingURL());
|
||||||
|
clusterIpc.disconnect.invokeFromRenderer();
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
@ -100,12 +101,13 @@ export class ClustersMenu extends React.Component<Props> {
|
|||||||
)}
|
)}
|
||||||
<div className="clusters flex column gaps">
|
<div className="clusters flex column gaps">
|
||||||
{clusters.map(cluster => {
|
{clusters.map(cluster => {
|
||||||
|
const isActive = cluster.isReady && cluster.id === clusterStore.activeClusterId;
|
||||||
return (
|
return (
|
||||||
<ClusterIcon
|
<ClusterIcon
|
||||||
key={cluster.id}
|
key={cluster.id}
|
||||||
showErrors={true}
|
showErrors={true}
|
||||||
cluster={cluster}
|
cluster={cluster}
|
||||||
isActive={cluster.id === clusterStore.activeClusterId}
|
isActive={isActive}
|
||||||
onClick={() => this.showCluster(cluster.id)}
|
onClick={() => this.showCluster(cluster.id)}
|
||||||
onContextMenu={() => this.showContextMenu(cluster)}
|
onContextMenu={() => this.showContextMenu(cluster)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user