diff --git a/src/extensions/registries/command-registry.ts b/src/extensions/registries/command-registry.ts
index 359702c29f..258f856b9c 100644
--- a/src/extensions/registries/command-registry.ts
+++ b/src/extensions/registries/command-registry.ts
@@ -12,6 +12,7 @@ export type CommandContext = {
export interface CommandRegistration {
id: string;
title: string;
+ scope: "cluster" | "global";
action: (context: CommandContext) => void;
isActive?: (context: CommandContext) => boolean;
}
diff --git a/src/renderer/components/+preferences/preferences.route.ts b/src/renderer/components/+preferences/preferences.route.ts
index 6937ecb0dd..2915b68a28 100644
--- a/src/renderer/components/+preferences/preferences.route.ts
+++ b/src/renderer/components/+preferences/preferences.route.ts
@@ -12,5 +12,6 @@ export const preferencesURL = buildURL(preferencesRoute.path);
commandRegistry.add({
id: "app.showPreferences",
title: "Preferences: Open",
- action: () => navigate(preferencesURL.toString())
+ scope: "global",
+ action: () => navigate(preferencesURL())
});
diff --git a/src/renderer/components/+workspaces/add-workspace.tsx b/src/renderer/components/+workspaces/add-workspace.tsx
new file mode 100644
index 0000000000..a7b24804e4
--- /dev/null
+++ b/src/renderer/components/+workspaces/add-workspace.tsx
@@ -0,0 +1,56 @@
+import React from "react";
+import { observer } from "mobx-react";
+import { Workspace, workspaceStore } from "../../../common/workspace-store";
+import { v4 as uuid } from "uuid";
+import { commandRegistry } from "../../../extensions/registries/command-registry";
+import { Input, InputValidator } from "../input";
+import { navigate } from "../../navigation";
+import { closeCommandDialog, openCommandDialog } from "../command-palette/command-container";
+
+const uniqueWorkspaceName: InputValidator = {
+ condition: ({ required }) => required,
+ message: () => `Workspace with this name already exists`,
+ validate: value => !workspaceStore.enabledWorkspacesList.find((workspace) => workspace.name === value),
+};
+
+@observer
+export class AddWorkspace extends React.Component {
+ handleKeyDown(name: string) {
+ if (name.trim() === "") {
+ return;
+ }
+ const workspace = workspaceStore.addWorkspace(new Workspace({
+ id: uuid(),
+ name
+ }));
+
+ workspaceStore.setActive(workspace.id);
+ navigate("/");
+ closeCommandDialog();
+ }
+
+ render() {
+ return (
+ <>
+ this.handleKeyDown(v)}
+ dirty={true}
+ showValidationLine={true} />
+
+ Please provide a new workspace name (Press "Enter" to confirm or "Escape" to cancel)
+
+ >
+ );
+ }
+}
+
+commandRegistry.add({
+ id: "workspace.addWorkspace",
+ title: "Workspace: Add workspace ...",
+ scope: "global",
+ action: () => openCommandDialog(
+ Are you sure you want remove workspace {workspace.name}? +
++ All clusters within workspace will be cleared as well +
+