fix(editor): Extend menu item and use it as a recursive component (#6618)

This commit is contained in:
Csaba Tuncsik
2023-07-10 12:39:47 +02:00
committed by GitHub
parent a95862b6e2
commit d617f63ae9
4 changed files with 41 additions and 32 deletions

View File

@@ -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',