mirror of
https://github.com/nocobase/nocobase.git
synced 2026-09-17 17:39:10 +08:00
* feat(client-v2): add standalone settings SPA * style(client-v2): use primary header color * fix(plugin-ui-layout): hide mobile menu * style(client-v2): regroup settings action * fix(client-v2): match settings header color * fix(client-v2): group portal manager * fix(client-v2): group topbar managers * feat(multi-portal): add portal routes * fix(app): normalize settings dev root * feat(auth): add settings SPA sign-in * docs(auth): add settings sign-in plan * fix(client-v2): align settings embed layout * fix(client-v2): normalize settings app URLs * feat(multi-portal): unify client v2 portals * fix(ci): repair PR validation failures * fix(client-v2): flatten scoped settings URLs * fix(client-v2): redirect roots to settings * fix(cli): initialize AI portal env defaults * fix(cli): remove portal setup from init * fix(cli): skip unsupported portal registry sync * fix(cli): narrow init env config types * refactor(multi-portal): use fixed portal uids * fix(cli): skip portal registry sync during install * fix(plugin-multi-portal): allow reserved slugs * fix(client-v2): normalize settings app roots --------- Co-authored-by: chenos <chenlinxh@gmail.com>
39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
/**
|
|
* This file is part of the NocoBase (R) project.
|
|
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
* Authors: NocoBase Team.
|
|
*
|
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
*/
|
|
|
|
import type { BaseApplication } from '../BaseApplication';
|
|
import { PluginSettingsManager } from '../PluginSettingsManager';
|
|
import { resolveSettingsAppScopeWithinPublicPath } from './settingsDocumentPath';
|
|
|
|
const SETTINGS_ROUTE_PREFIX = 'settings.';
|
|
const MAIN_SETTINGS_PATH_PREFIX = '/settings/';
|
|
|
|
export class SettingsPluginSettingsManager<
|
|
TApp extends BaseApplication<any> = BaseApplication<any>,
|
|
> extends PluginSettingsManager<TApp> {
|
|
getRouteName(name: string) {
|
|
return `${SETTINGS_ROUTE_PREFIX}${name}`;
|
|
}
|
|
|
|
getRoutePath(name: string) {
|
|
const appScope = resolveSettingsAppScopeWithinPublicPath(this.app.getPublicPath(), this.app.router.getBasename?.());
|
|
const pathPrefix = appScope ? '/' : MAIN_SETTINGS_PATH_PREFIX;
|
|
const separatorIndex = name.indexOf('.');
|
|
const menuName = separatorIndex < 0 ? name : name.slice(0, separatorIndex);
|
|
const pageName = separatorIndex < 0 ? undefined : name.slice(separatorIndex + 1);
|
|
const menuPath = `${pathPrefix}${menuName}`;
|
|
|
|
if (!pageName || pageName === 'index') {
|
|
return menuPath;
|
|
}
|
|
|
|
return `${menuPath}/${pageName}`;
|
|
}
|
|
}
|