479f64f197
* feat: i18next * multi language data * feat(client): locale support * en-US for collections * us-EN for routes * en-US for routes * en-US for attachments * feat: partial translations * translation * add AntdConfigProvider * translation * translation * feat: translation * feat: add translation * fix: improve translation * feat: improve translation * fix: SyntaxError: Unexpected token ) in JSON at position * typo * feat: improve translation * feat: improve translation * feat: language settings can be saved on the server * feat: lang option of init cli * demo translation * typo * change address field to textarea * address data * feat: chart translation * feat: chart translation * improve translation * signin,signup,signout... Co-authored-by: Zhou <zhou.working@gmail.com>
65 lines
1.7 KiB
TypeScript
65 lines
1.7 KiB
TypeScript
import path from 'path';
|
|
import { PluginOptions } from '@nocobase/server';
|
|
import { registerModels } from '@nocobase/database';
|
|
import * as models from './models';
|
|
import getAccessible from './actions/getAccessible';
|
|
import * as uiSchema from './ui-schema';
|
|
|
|
export default {
|
|
name: 'ui-router',
|
|
async load() {
|
|
const database = this.app.db;
|
|
registerModels(models);
|
|
|
|
database.import({
|
|
directory: path.resolve(__dirname, 'collections'),
|
|
});
|
|
|
|
this.app.resourcer.registerActionHandler('routes:getAccessible', getAccessible);
|
|
|
|
const Route = database.getModel('routes');
|
|
|
|
this.app.on('db.init', async () => {
|
|
const data = [
|
|
{
|
|
type: 'redirect',
|
|
from: '/',
|
|
to: '/admin',
|
|
exact: true,
|
|
},
|
|
{
|
|
type: 'route',
|
|
path: '/admin/:name(.+)?',
|
|
component: 'AdminLayout',
|
|
title: `NocoBase`,
|
|
uiSchema: uiSchema.menu,
|
|
},
|
|
{
|
|
type: 'route',
|
|
component: 'AuthLayout',
|
|
children: [
|
|
{
|
|
type: 'route',
|
|
path: '/signin',
|
|
component: 'RouteSchemaRenderer',
|
|
title: `{{t("Sign in")}}`,
|
|
uiSchema: uiSchema.signin,
|
|
},
|
|
{
|
|
type: 'route',
|
|
path: '/signup',
|
|
component: 'RouteSchemaRenderer',
|
|
title: `{{t("Sign up")}}`,
|
|
uiSchema: uiSchema.signup,
|
|
},
|
|
],
|
|
},
|
|
];
|
|
for (const item of data) {
|
|
const route = await Route.create(item);
|
|
await route.updateAssociations(item);
|
|
}
|
|
});
|
|
}
|
|
} as PluginOptions;
|