diff --git a/packages/design-system/src/components/N8nMenuItem/MenuItem.vue b/packages/design-system/src/components/N8nMenuItem/MenuItem.vue index b0789934f9..1647cfd873 100644 --- a/packages/design-system/src/components/N8nMenuItem/MenuItem.vue +++ b/packages/design-system/src/components/N8nMenuItem/MenuItem.vue @@ -1,7 +1,7 @@ - - - {{ child.label }} - - - - + {{ item.label }} - + - + diff --git a/packages/design-system/src/types/menu.ts b/packages/design-system/src/types/menu.ts index b4c00f9a8a..d65b328bfa 100644 --- a/packages/design-system/src/types/menu.ts +++ b/packages/design-system/src/types/menu.ts @@ -1,3 +1,5 @@ +import type { Tooltip } from 'element-ui'; + export type IMenuItem = { id: string; label: string; @@ -14,6 +16,7 @@ export type IMenuItem = { // For more specific matching, we can use paths activateOnRoutePaths?: string[]; children?: IMenuItem[]; + tooltip?: Tooltip & { bindTo?: 'menuItem' | 'secondaryIcon' }; }; export type ILinkMenuItemProperties = { diff --git a/packages/editor-ui/src/components/MainSidebar.vue b/packages/editor-ui/src/components/MainSidebar.vue index 38f14b69d1..4551a3ce2b 100644 --- a/packages/editor-ui/src/components/MainSidebar.vue +++ b/packages/editor-ui/src/components/MainSidebar.vue @@ -193,6 +193,22 @@ export default defineComponent({ const items: IMenuItem[] = []; const injectedItems = this.uiStore.sidebarMenuItems; + const workflows: IMenuItem = { + id: 'workflows', + icon: 'network-wired', + label: this.$locale.baseText('mainSidebar.workflows'), + position: 'top', + activateOnRouteNames: [VIEWS.WORKFLOWS], + }; + + if (this.sourceControlStore.preferences.branchReadOnly) { + workflows.secondaryIcon = { name: 'lock' }; + workflows.tooltip = { + content: this.$locale.baseText('mainSidebar.workflows.readOnlyEnv.tooltip'), + bindTo: 'secondaryIcon', + }; + } + if (injectedItems && injectedItems.length > 0) { for (const item of injectedItems) { items.push({ @@ -209,16 +225,7 @@ export default defineComponent({ } const regularItems: IMenuItem[] = [ - { - id: 'workflows', - icon: 'network-wired', - secondaryIcon: this.sourceControlStore.preferences.branchReadOnly - ? { name: 'lock' } - : undefined, - label: this.$locale.baseText('mainSidebar.workflows'), - position: 'top', - activateOnRouteNames: [VIEWS.WORKFLOWS], - }, + workflows, { id: 'templates', icon: 'box-open', diff --git a/packages/editor-ui/src/plugins/i18n/locales/en.json b/packages/editor-ui/src/plugins/i18n/locales/en.json index 55cafeeaa2..692ae2b9c6 100644 --- a/packages/editor-ui/src/plugins/i18n/locales/en.json +++ b/packages/editor-ui/src/plugins/i18n/locales/en.json @@ -619,6 +619,7 @@ "mainSidebar.showMessage.stopExecution.title": "Execution stopped", "mainSidebar.templates": "Templates", "mainSidebar.workflows": "Workflows", + "mainSidebar.workflows.readOnlyEnv.tooltip": "Protected mode is active, so no workflows changes are allowed. Change this in Settings, under 'Source Control'", "mainSidebar.executions": "All executions", "menuActions.duplicate": "Duplicate", "menuActions.download": "Download",