mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fetching hosted cluster inside Command Palette
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
97a88eb2b8
commit
e88e500722
@ -8,9 +8,8 @@ import { EventEmitter } from "../../../common/event-emitter";
|
|||||||
import { subscribeToBroadcast } from "../../../common/ipc";
|
import { subscribeToBroadcast } from "../../../common/ipc";
|
||||||
import { CommandDialog } from "./command-dialog";
|
import { CommandDialog } from "./command-dialog";
|
||||||
import { CommandRegistration, commandRegistry } from "../../../extensions/registries/command-registry";
|
import { CommandRegistration, commandRegistry } from "../../../extensions/registries/command-registry";
|
||||||
import { clusterStore } from "../../../common/cluster-store";
|
import { clusterStore, getHostedCluster } from "../../../common/cluster-store";
|
||||||
import { workspaceStore } from "../../../common/workspace-store";
|
import { workspaceStore } from "../../../common/workspace-store";
|
||||||
import { Cluster } from "../../../main/cluster";
|
|
||||||
|
|
||||||
export type CommandDialogEvent = {
|
export type CommandDialogEvent = {
|
||||||
component: React.ReactElement
|
component: React.ReactElement
|
||||||
@ -29,8 +28,9 @@ export class CommandOverlay {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class CommandContainer extends React.Component<{cluster?: Cluster}> {
|
export class CommandContainer extends React.Component {
|
||||||
@observable.ref commandComponent: React.ReactElement;
|
@observable.ref commandComponent: React.ReactElement;
|
||||||
|
@observable cluster = getHostedCluster();
|
||||||
|
|
||||||
private escHandler(event: KeyboardEvent) {
|
private escHandler(event: KeyboardEvent) {
|
||||||
if (event.key === "Escape") {
|
if (event.key === "Escape") {
|
||||||
@ -56,8 +56,8 @@ export class CommandContainer extends React.Component<{cluster?: Cluster}> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
if (this.props.cluster) {
|
if (this.cluster) {
|
||||||
subscribeToBroadcast(`command-palette:run-action:${this.props.cluster.id}`, (event, commandId: string) => {
|
subscribeToBroadcast(`command-palette:run-action:${this.cluster.id}`, (event, commandId: string) => {
|
||||||
const command = this.findCommandById(commandId);
|
const command = this.findCommandById(commandId);
|
||||||
|
|
||||||
if (command) {
|
if (command) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user