mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-07 14:39:25 +08:00
Merge branch 'main' into next
This commit is contained in:
commit
4c7eb0b5c0
@ -266,6 +266,14 @@ export class Application {
|
||||
return this.getPublicPath() + pathname.replace(/^\//g, '');
|
||||
}
|
||||
|
||||
getFullUrl(pathname: string) {
|
||||
const name = this.name;
|
||||
if (name && name !== 'main') {
|
||||
return this.getPublicPath() + 'apps/' + name + '/' + pathname.replace(/^\//g, '');
|
||||
}
|
||||
return this.getPublicPath() + pathname.replace(/^\//g, '');
|
||||
}
|
||||
|
||||
getCollectionManager(dataSource?: string) {
|
||||
return this.dataSourceManager.getDataSource(dataSource)?.collectionManager;
|
||||
}
|
||||
|
@ -13,11 +13,11 @@ import MockAdapter from 'axios-mock-adapter';
|
||||
import React, { Component } from 'react';
|
||||
import { Link, Outlet } from 'react-router-dom';
|
||||
import { describe } from 'vitest';
|
||||
import { CollectionFieldInterface } from '../../data-source';
|
||||
import { OpenModeProvider } from '../../modules/popup/OpenModeProvider';
|
||||
import { Application } from '../Application';
|
||||
import { Plugin } from '../Plugin';
|
||||
import { useApp } from '../hooks';
|
||||
import { CollectionFieldInterface } from '../../data-source';
|
||||
|
||||
describe('Application', () => {
|
||||
beforeAll(() => {
|
||||
@ -85,6 +85,32 @@ describe('Application', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getFullUrl', () => {
|
||||
it('default', () => {
|
||||
const app = new Application({});
|
||||
expect(app.getFullUrl('test')).toBe('/test');
|
||||
expect(app.getFullUrl('/test')).toBe('/test');
|
||||
});
|
||||
|
||||
it('custom', () => {
|
||||
const app = new Application({ publicPath: '/nocobase' });
|
||||
expect(app.getFullUrl('/test')).toBe('/nocobase/test');
|
||||
expect(app.getFullUrl('test')).toBe('/nocobase/test');
|
||||
});
|
||||
|
||||
it('sub app', () => {
|
||||
const app = new Application({ name: 'sub1' });
|
||||
expect(app.getFullUrl('test')).toBe('/apps/sub1/test');
|
||||
expect(app.getFullUrl('/test')).toBe('/apps/sub1/test');
|
||||
});
|
||||
|
||||
it('sub app', () => {
|
||||
const app = new Application({ name: 'sub1', publicPath: '/nocobase/' });
|
||||
expect(app.getFullUrl('test')).toBe('/nocobase/apps/sub1/test');
|
||||
expect(app.getFullUrl('/test')).toBe('/nocobase/apps/sub1/test');
|
||||
});
|
||||
});
|
||||
|
||||
describe('publicPath', () => {
|
||||
it('default', () => {
|
||||
const app = new Application({});
|
||||
|
@ -571,6 +571,17 @@ export function WorkflowConfig() {
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
sort: {
|
||||
type: 'void',
|
||||
'x-component': 'ArrayTable.Column',
|
||||
'x-component-props': { width: 50, title: '', align: 'center' },
|
||||
properties: {
|
||||
sort: {
|
||||
type: 'void',
|
||||
'x-component': 'ArrayTable.SortHandle',
|
||||
},
|
||||
},
|
||||
},
|
||||
context: {
|
||||
type: 'void',
|
||||
'x-component': 'ArrayTable.Column',
|
||||
|
@ -95,7 +95,7 @@ export const DesktopModeHeader: FC = () => {
|
||||
}
|
||||
`}
|
||||
>
|
||||
<Button style={{ color: 'white' }} href={app.getRouteUrl('/admin')}>
|
||||
<Button style={{ color: 'white' }} href={app.getFullUrl('/admin')}>
|
||||
{t('Back')}
|
||||
</Button>
|
||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||
|
Loading…
x
Reference in New Issue
Block a user