From 5c97e7c3f97316753cd976cd8514a4aaa836a0ac Mon Sep 17 00:00:00 2001 From: Junyi Date: Wed, 8 Jan 2025 20:38:41 +0800 Subject: [PATCH 1/2] feat(plugin-workflow): allow to sort workflows when binding to action button (#6017) --- .../schema-component/antd/action/Action.Designer.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx b/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx index a92be9ecfc..82f717a900 100644 --- a/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx @@ -561,6 +561,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', From 1d2b237e738c1e6355fa88166cac93fb3af9c480 Mon Sep 17 00:00:00 2001 From: chenos Date: Wed, 8 Jan 2025 20:43:07 +0800 Subject: [PATCH 2/2] feat: add app.getFullUrl() method (#6019) * feat: add app.getFullUrl() method * fix: test error * fix: test only --- .../client/src/application/Application.tsx | 8 ++++++ .../__tests__/Application.test.tsx | 28 ++++++++++++++++++- .../src/client/desktop-mode/Header.tsx | 2 +- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/packages/core/client/src/application/Application.tsx b/packages/core/client/src/application/Application.tsx index feadcd2737..96700c9a15 100644 --- a/packages/core/client/src/application/Application.tsx +++ b/packages/core/client/src/application/Application.tsx @@ -208,6 +208,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; } diff --git a/packages/core/client/src/application/__tests__/Application.test.tsx b/packages/core/client/src/application/__tests__/Application.test.tsx index 8fdcb59b94..bbe257eb94 100644 --- a/packages/core/client/src/application/__tests__/Application.test.tsx +++ b/packages/core/client/src/application/__tests__/Application.test.tsx @@ -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({}); diff --git a/packages/plugins/@nocobase/plugin-mobile/src/client/desktop-mode/Header.tsx b/packages/plugins/@nocobase/plugin-mobile/src/client/desktop-mode/Header.tsx index 473cfac1cf..9ac87d8549 100644 --- a/packages/plugins/@nocobase/plugin-mobile/src/client/desktop-mode/Header.tsx +++ b/packages/plugins/@nocobase/plugin-mobile/src/client/desktop-mode/Header.tsx @@ -95,7 +95,7 @@ export const DesktopModeHeader: FC = () => { } `} > -