fix(editor): Use web native <a> element in nav menus (#8385)

This commit is contained in:
Tomi Turtiainen
2024-01-19 12:52:39 +02:00
committed by GitHub
parent 6fcf5ddcdd
commit e606e841ee
22 changed files with 343 additions and 289 deletions

View File

@@ -49,7 +49,7 @@ export default defineComponent({
label: this.$locale.baseText('settings.usageAndPlan.title'),
position: 'top',
available: this.canAccessUsageAndPlan(),
activateOnRouteNames: [VIEWS.USAGE],
route: { to: { name: VIEWS.USAGE } },
},
{
id: 'settings-personal',
@@ -57,7 +57,7 @@ export default defineComponent({
label: this.$locale.baseText('settings.personal'),
position: 'top',
available: this.canAccessPersonalSettings(),
activateOnRouteNames: [VIEWS.PERSONAL_SETTINGS],
route: { to: { name: VIEWS.PERSONAL_SETTINGS } },
},
{
id: 'settings-users',
@@ -65,7 +65,7 @@ export default defineComponent({
label: this.$locale.baseText('settings.users'),
position: 'top',
available: this.canAccessUsersSettings(),
activateOnRouteNames: [VIEWS.USERS_SETTINGS],
route: { to: { name: VIEWS.USERS_SETTINGS } },
},
{
id: 'settings-api',
@@ -73,7 +73,7 @@ export default defineComponent({
label: this.$locale.baseText('settings.n8napi'),
position: 'top',
available: this.canAccessApiSettings(),
activateOnRouteNames: [VIEWS.API_SETTINGS],
route: { to: { name: VIEWS.API_SETTINGS } },
},
{
id: 'settings-external-secrets',
@@ -81,10 +81,7 @@ export default defineComponent({
label: this.$locale.baseText('settings.externalSecrets.title'),
position: 'top',
available: this.canAccessExternalSecrets(),
activateOnRouteNames: [
VIEWS.EXTERNAL_SECRETS_SETTINGS,
VIEWS.EXTERNAL_SECRETS_PROVIDER_SETTINGS,
],
route: { to: { name: VIEWS.EXTERNAL_SECRETS_SETTINGS } },
},
{
id: 'settings-audit-logs',
@@ -92,7 +89,7 @@ export default defineComponent({
label: this.$locale.baseText('settings.auditLogs.title'),
position: 'top',
available: this.canAccessAuditLogs(),
activateOnRouteNames: [VIEWS.AUDIT_LOGS],
route: { to: { name: VIEWS.AUDIT_LOGS } },
},
{
id: 'settings-source-control',
@@ -100,7 +97,7 @@ export default defineComponent({
label: this.$locale.baseText('settings.sourceControl.title'),
position: 'top',
available: this.canAccessSourceControl(),
activateOnRouteNames: [VIEWS.SOURCE_CONTROL],
route: { to: { name: VIEWS.SOURCE_CONTROL } },
},
{
id: 'settings-sso',
@@ -108,7 +105,7 @@ export default defineComponent({
label: this.$locale.baseText('settings.sso'),
position: 'top',
available: this.canAccessSso(),
activateOnRouteNames: [VIEWS.SSO_SETTINGS],
route: { to: { name: VIEWS.SSO_SETTINGS } },
},
{
id: 'settings-ldap',
@@ -116,7 +113,7 @@ export default defineComponent({
label: this.$locale.baseText('settings.ldap'),
position: 'top',
available: this.canAccessLdapSettings(),
activateOnRouteNames: [VIEWS.LDAP_SETTINGS],
route: { to: { name: VIEWS.LDAP_SETTINGS } },
},
{
id: 'settings-workersview',
@@ -126,7 +123,7 @@ export default defineComponent({
available:
this.settingsStore.isQueueModeEnabled &&
hasPermission(['rbac'], { rbac: { scope: 'workersView:manage' } }),
activateOnRouteNames: [VIEWS.WORKER_VIEW],
route: { to: { name: VIEWS.WORKER_VIEW } },
},
];
@@ -134,7 +131,7 @@ export default defineComponent({
if (item.uiLocations.includes('settings')) {
menuItems.push({
id: item.id,
icon: item.icon || 'question',
icon: item.icon ?? 'question',
label: this.$locale.baseText(item.featureName as BaseTextKey),
position: 'top',
available: true,
@@ -149,7 +146,7 @@ export default defineComponent({
label: this.$locale.baseText('settings.log-streaming'),
position: 'top',
available: this.canAccessLogStreamingSettings(),
activateOnRouteNames: [VIEWS.LOG_STREAMING_SETTINGS],
route: { to: { name: VIEWS.LOG_STREAMING_SETTINGS } },
});
menuItems.push({
@@ -158,7 +155,7 @@ export default defineComponent({
label: this.$locale.baseText('settings.communityNodes'),
position: 'top',
available: this.canAccessCommunityNodes(),
activateOnRouteNames: [VIEWS.COMMUNITY_NODES],
route: { to: { name: VIEWS.COMMUNITY_NODES } },
});
return menuItems;
@@ -211,51 +208,10 @@ export default defineComponent({
},
async handleSelect(key: string) {
switch (key) {
case 'settings-personal':
await this.navigateTo(VIEWS.PERSONAL_SETTINGS);
break;
case 'settings-users':
await this.navigateTo(VIEWS.USERS_SETTINGS);
break;
case 'settings-api':
await this.navigateTo(VIEWS.API_SETTINGS);
break;
case 'settings-ldap':
await this.navigateTo(VIEWS.LDAP_SETTINGS);
break;
case 'settings-log-streaming':
await this.navigateTo(VIEWS.LOG_STREAMING_SETTINGS);
break;
case 'users': // Fakedoor feature added via hooks when user management is disabled on cloud
case 'logging':
this.$router.push({ name: VIEWS.FAKE_DOOR, params: { featureId: key } }).catch(() => {});
break;
case 'settings-community-nodes':
await this.navigateTo(VIEWS.COMMUNITY_NODES);
break;
case 'settings-usage-and-plan':
await this.navigateTo(VIEWS.USAGE);
break;
case 'settings-sso':
await this.navigateTo(VIEWS.SSO_SETTINGS);
break;
case 'settings-external-secrets':
await this.navigateTo(VIEWS.EXTERNAL_SECRETS_SETTINGS);
break;
case 'settings-source-control':
if (this.$router.currentRoute.name !== VIEWS.SOURCE_CONTROL) {
void this.$router.push({ name: VIEWS.SOURCE_CONTROL });
}
break;
case 'settings-audit-logs':
if (this.$router.currentRoute.name !== VIEWS.AUDIT_LOGS) {
void this.$router.push({ name: VIEWS.AUDIT_LOGS });
}
break;
case 'settings-workersview': {
await this.navigateTo(VIEWS.WORKER_VIEW);
break;
}
default:
break;
}