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

fixes based on code review

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2021-02-01 08:27:03 +02:00
parent debdabb617
commit d12ff4c10d
3 changed files with 4 additions and 12 deletions

View File

@ -18,7 +18,7 @@ export async function requestMain(channel: string, ...args: any[]) {
}
function getSubFrames(): ClusterFrameInfo[] {
return Array.from(clusterFrameMap.values());
return toJS(Array.from(clusterFrameMap.values()));
}
export async function broadcastMessage(channel: string, ...args: any[]) {
@ -80,6 +80,6 @@ export function unsubscribeAllFromBroadcast(channel: string) {
export function bindBroadcastHandlers() {
handleRequest(subFramesChannel, async () => {
return toJS(await getSubFrames(), { recurseEverything: true });
return await getSubFrames(), { recurseEverything: true };
});
}

View File

@ -16,7 +16,7 @@ const uniqueWorkspaceName: InputValidator = {
@observer
export class AddWorkspace extends React.Component {
onSubmit(name: string) {
if (name.trim() === "") {
if (!name.trim()) {
return;
}
const workspace = workspaceStore.addWorkspace(new Workspace({

View File

@ -30,7 +30,7 @@ export class CommandOverlay {
@observer
export class CommandContainer extends React.Component<{cluster?: Cluster}> {
@observable commandComponent: React.ReactElement;
@observable.ref commandComponent: React.ReactElement;
private escHandler(event: KeyboardEvent) {
if (event.key === "Escape") {
@ -55,14 +55,6 @@ export class CommandContainer extends React.Component<{cluster?: Cluster}> {
});
}
onClusterAction(commandId: string) {
const command = this.findCommandById(commandId);
if (command) {
this.runCommand(command);
}
}
componentDidMount() {
if (this.props.cluster) {
subscribeToBroadcast(`command-palette:run-action:${this.props.cluster.id}`, (event, commandId: string) => {