@nocobase/plugin-multi-app-manager 0.10.0-alpha.5 → 0.11.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.d.ts +2 -3
- package/client.js +1 -30
- package/lib/client/AppManager.js +1 -1
- package/lib/client/AppNameInput.d.ts +1 -1
- package/lib/client/MultiAppManagerProvider.d.ts +2 -0
- package/lib/client/MultiAppManagerProvider.js +120 -0
- package/lib/client/index.d.ts +5 -3
- package/lib/client/index.js +14 -107
- package/lib/server/server.d.ts +2 -2
- package/lib/server/server.js +7 -7
- package/package.json +27 -5
- package/server.d.ts +2 -3
- package/server.js +1 -30
- package/src/client/AppManager.tsx +31 -0
- package/src/client/AppNameInput.tsx +22 -0
- package/src/client/MultiAppManagerProvider.tsx +91 -0
- package/src/client/Settings.tsx +15 -0
- package/src/client/index.ts +11 -0
- package/src/client/locale/es-ES.ts +9 -0
- package/src/client/locale/pt-BR.ts +9 -0
- package/src/client/locale/zh-CN.ts +11 -0
- package/src/client/settings/schemas/applications.ts +376 -0
- package/src/client/utils.tsx +10 -0
- package/src/index.ts +1 -0
- package/src/server/__tests__/mock-get-schema.test.ts +146 -0
- package/src/server/__tests__/multiple-apps.test.ts +209 -0
- package/src/server/collections/applications.ts +45 -0
- package/src/server/index.ts +4 -0
- package/src/server/models/application.ts +28 -0
- package/src/server/server.ts +297 -0
package/client.d.ts
CHANGED
package/client.js
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
4
|
-
|
|
5
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
6
|
-
|
|
7
|
-
var _index = _interopRequireWildcard(require("./lib/client"));
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, "__esModule", {
|
|
10
|
-
value: true
|
|
11
|
-
});
|
|
12
|
-
var _exportNames = {};
|
|
13
|
-
Object.defineProperty(exports, "default", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function get() {
|
|
16
|
-
return _index.default;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
Object.keys(_index).forEach(function (key) {
|
|
21
|
-
if (key === "default" || key === "__esModule") return;
|
|
22
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
23
|
-
if (key in exports && exports[key] === _index[key]) return;
|
|
24
|
-
Object.defineProperty(exports, key, {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _index[key];
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
});
|
|
1
|
+
module.exports = require('./lib/client/index.js');
|
package/lib/client/AppManager.js
CHANGED
|
@@ -31,7 +31,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
31
31
|
const useLink = () => {
|
|
32
32
|
var _record$options;
|
|
33
33
|
const record = (0, _client().useRecord)();
|
|
34
|
-
if ((
|
|
34
|
+
if ((_record$options = record.options) !== null && _record$options !== void 0 && _record$options.standaloneDeployment && record.cname) {
|
|
35
35
|
return `//${record.cname}`;
|
|
36
36
|
}
|
|
37
37
|
return `/apps/${record.name}/admin/`;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare const AppNameInput: React.ForwardRefExoticComponent<
|
|
2
|
+
export declare const AppNameInput: React.ForwardRefExoticComponent<Omit<Partial<import("antd").InputProps & React.RefAttributes<import("antd").InputRef>>, "ref"> & React.RefAttributes<unknown>>;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MultiAppManagerProvider = void 0;
|
|
7
|
+
function _client() {
|
|
8
|
+
const data = require("@nocobase/client");
|
|
9
|
+
_client = function _client() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _antd() {
|
|
15
|
+
const data = require("antd");
|
|
16
|
+
_antd = function _antd() {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _react() {
|
|
22
|
+
const data = _interopRequireDefault(require("react"));
|
|
23
|
+
_react = function _react() {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
function _reactRouterDom() {
|
|
29
|
+
const data = require("react-router-dom");
|
|
30
|
+
_reactRouterDom = function _reactRouterDom() {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
var _AppManager = require("./AppManager");
|
|
36
|
+
var _AppNameInput = require("./AppNameInput");
|
|
37
|
+
var _utils = require("./utils");
|
|
38
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
39
|
+
const MultiAppManager = () => {
|
|
40
|
+
const _useRequest = (0, _client().useRequest)({
|
|
41
|
+
resource: 'applications',
|
|
42
|
+
action: 'listPinned'
|
|
43
|
+
}, {
|
|
44
|
+
manual: true
|
|
45
|
+
}),
|
|
46
|
+
data = _useRequest.data,
|
|
47
|
+
loading = _useRequest.loading,
|
|
48
|
+
run = _useRequest.run;
|
|
49
|
+
const _usePluginUtils = (0, _utils.usePluginUtils)(),
|
|
50
|
+
t = _usePluginUtils.t;
|
|
51
|
+
const items = [...((data === null || data === void 0 ? void 0 : data.data) || []).map(app => {
|
|
52
|
+
var _app$options;
|
|
53
|
+
let link = `/apps/${app.name}/admin/`;
|
|
54
|
+
if ((_app$options = app.options) !== null && _app$options !== void 0 && _app$options.standaloneDeployment && app.cname) {
|
|
55
|
+
link = `//${app.cname}`;
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
key: app.name,
|
|
59
|
+
label: _react().default.createElement("a", {
|
|
60
|
+
href: link,
|
|
61
|
+
target: "_blank",
|
|
62
|
+
rel: "noopener noreferrer"
|
|
63
|
+
}, app.displayName || app.name)
|
|
64
|
+
};
|
|
65
|
+
}), {
|
|
66
|
+
key: '.manager',
|
|
67
|
+
label: _react().default.createElement(_reactRouterDom().Link, {
|
|
68
|
+
to: "/admin/settings/multi-app-manager/applications"
|
|
69
|
+
}, t('Manage applications'))
|
|
70
|
+
}];
|
|
71
|
+
return _react().default.createElement(_antd().Dropdown, {
|
|
72
|
+
onOpenChange: visible => {
|
|
73
|
+
run();
|
|
74
|
+
},
|
|
75
|
+
menu: {
|
|
76
|
+
items
|
|
77
|
+
}
|
|
78
|
+
}, _react().default.createElement(_antd().Button, {
|
|
79
|
+
title: 'Apps',
|
|
80
|
+
icon: _react().default.createElement(_client().Icon, {
|
|
81
|
+
type: 'AppstoreOutlined'
|
|
82
|
+
})
|
|
83
|
+
}));
|
|
84
|
+
};
|
|
85
|
+
const MultiAppManagerProvider = props => {
|
|
86
|
+
const _usePluginUtils2 = (0, _utils.usePluginUtils)(),
|
|
87
|
+
t = _usePluginUtils2.t;
|
|
88
|
+
return _react().default.createElement(_client().PinnedPluginListProvider, {
|
|
89
|
+
items: {
|
|
90
|
+
am: {
|
|
91
|
+
order: 201,
|
|
92
|
+
component: 'MultiAppManager',
|
|
93
|
+
pin: true
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}, _react().default.createElement(_client().SchemaComponentOptions, {
|
|
97
|
+
components: {
|
|
98
|
+
MultiAppManager,
|
|
99
|
+
AppNameInput: _AppNameInput.AppNameInput
|
|
100
|
+
}
|
|
101
|
+
}, _react().default.createElement(_client().SettingsCenterProvider, {
|
|
102
|
+
settings: {
|
|
103
|
+
'multi-app-manager': {
|
|
104
|
+
title: t('Multi-app manager'),
|
|
105
|
+
icon: 'AppstoreOutlined',
|
|
106
|
+
tabs: {
|
|
107
|
+
applications: {
|
|
108
|
+
title: t('Applications'),
|
|
109
|
+
component: () => _react().default.createElement(_AppManager.AppManager, null)
|
|
110
|
+
}
|
|
111
|
+
// settings: {
|
|
112
|
+
// title: 'Settings',
|
|
113
|
+
// component: () => <Settings />,
|
|
114
|
+
// },
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}, props.children)));
|
|
119
|
+
};
|
|
120
|
+
exports.MultiAppManagerProvider = MultiAppManagerProvider;
|
package/lib/client/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Plugin } from '@nocobase/client';
|
|
2
2
|
export { tableActionColumnSchema } from './settings/schemas/applications';
|
|
3
|
-
declare
|
|
4
|
-
|
|
3
|
+
export declare class MultiAppManagerPlugin extends Plugin {
|
|
4
|
+
load(): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export default MultiAppManagerPlugin;
|
package/lib/client/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.MultiAppManagerPlugin = void 0;
|
|
7
7
|
Object.defineProperty(exports, "tableActionColumnSchema", {
|
|
8
8
|
enumerable: true,
|
|
9
9
|
get: function get() {
|
|
@@ -17,111 +17,18 @@ function _client() {
|
|
|
17
17
|
};
|
|
18
18
|
return data;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
const data = require("antd");
|
|
22
|
-
_antd = function _antd() {
|
|
23
|
-
return data;
|
|
24
|
-
};
|
|
25
|
-
return data;
|
|
26
|
-
}
|
|
27
|
-
function _react() {
|
|
28
|
-
const data = _interopRequireDefault(require("react"));
|
|
29
|
-
_react = function _react() {
|
|
30
|
-
return data;
|
|
31
|
-
};
|
|
32
|
-
return data;
|
|
33
|
-
}
|
|
34
|
-
function _reactRouterDom() {
|
|
35
|
-
const data = require("react-router-dom");
|
|
36
|
-
_reactRouterDom = function _reactRouterDom() {
|
|
37
|
-
return data;
|
|
38
|
-
};
|
|
39
|
-
return data;
|
|
40
|
-
}
|
|
41
|
-
var _AppManager = require("./AppManager");
|
|
42
|
-
var _AppNameInput = require("./AppNameInput");
|
|
43
|
-
var _utils = require("./utils");
|
|
20
|
+
var _MultiAppManagerProvider = require("./MultiAppManagerProvider");
|
|
44
21
|
var _applications = require("./settings/schemas/applications");
|
|
45
|
-
function
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
t = _usePluginUtils.t;
|
|
58
|
-
const items = [...((data === null || data === void 0 ? void 0 : data.data) || []).map(app => {
|
|
59
|
-
var _app$options;
|
|
60
|
-
let link = `/apps/${app.name}/admin/`;
|
|
61
|
-
if (((_app$options = app.options) === null || _app$options === void 0 ? void 0 : _app$options.standaloneDeployment) && app.cname) {
|
|
62
|
-
link = `//${app.cname}`;
|
|
63
|
-
}
|
|
64
|
-
return {
|
|
65
|
-
key: app.name,
|
|
66
|
-
label: _react().default.createElement("a", {
|
|
67
|
-
href: link,
|
|
68
|
-
target: "_blank",
|
|
69
|
-
rel: "noopener noreferrer"
|
|
70
|
-
}, app.displayName || app.name)
|
|
71
|
-
};
|
|
72
|
-
}), {
|
|
73
|
-
key: '.manager',
|
|
74
|
-
label: _react().default.createElement(_reactRouterDom().Link, {
|
|
75
|
-
to: "/admin/settings/multi-app-manager/applications"
|
|
76
|
-
}, t('Manage applications'))
|
|
77
|
-
}];
|
|
78
|
-
return _react().default.createElement(_antd().Dropdown, {
|
|
79
|
-
onOpenChange: visible => {
|
|
80
|
-
run();
|
|
81
|
-
},
|
|
82
|
-
menu: {
|
|
83
|
-
items
|
|
84
|
-
}
|
|
85
|
-
}, _react().default.createElement(_antd().Button, {
|
|
86
|
-
title: 'Apps',
|
|
87
|
-
icon: _react().default.createElement(_client().Icon, {
|
|
88
|
-
type: 'AppstoreOutlined'
|
|
89
|
-
})
|
|
90
|
-
}));
|
|
91
|
-
};
|
|
92
|
-
var _default = props => {
|
|
93
|
-
const _usePluginUtils2 = (0, _utils.usePluginUtils)(),
|
|
94
|
-
t = _usePluginUtils2.t;
|
|
95
|
-
return _react().default.createElement(_client().PinnedPluginListProvider, {
|
|
96
|
-
items: {
|
|
97
|
-
am: {
|
|
98
|
-
order: 201,
|
|
99
|
-
component: 'MultiAppManager',
|
|
100
|
-
pin: true
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}, _react().default.createElement(_client().SchemaComponentOptions, {
|
|
104
|
-
components: {
|
|
105
|
-
MultiAppManager,
|
|
106
|
-
AppNameInput: _AppNameInput.AppNameInput
|
|
107
|
-
}
|
|
108
|
-
}, _react().default.createElement(_client().SettingsCenterProvider, {
|
|
109
|
-
settings: {
|
|
110
|
-
'multi-app-manager': {
|
|
111
|
-
title: t('Multi-app manager'),
|
|
112
|
-
icon: 'AppstoreOutlined',
|
|
113
|
-
tabs: {
|
|
114
|
-
applications: {
|
|
115
|
-
title: t('Applications'),
|
|
116
|
-
component: () => _react().default.createElement(_AppManager.AppManager, null)
|
|
117
|
-
}
|
|
118
|
-
// settings: {
|
|
119
|
-
// title: 'Settings',
|
|
120
|
-
// component: () => <Settings />,
|
|
121
|
-
// },
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}, props.children)));
|
|
126
|
-
};
|
|
22
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
23
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
24
|
+
class MultiAppManagerPlugin extends _client().Plugin {
|
|
25
|
+
load() {
|
|
26
|
+
var _this = this;
|
|
27
|
+
return _asyncToGenerator(function* () {
|
|
28
|
+
_this.app.use(_MultiAppManagerProvider.MultiAppManagerProvider);
|
|
29
|
+
})();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.MultiAppManagerPlugin = MultiAppManagerPlugin;
|
|
33
|
+
var _default = MultiAppManagerPlugin;
|
|
127
34
|
exports.default = _default;
|
package/lib/server/server.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IDatabaseOptions, Transactionable } from '@nocobase/database';
|
|
2
2
|
import Application, { Plugin } from '@nocobase/server';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type AppDbCreator = (app: Application, transaction?: Transactionable) => Promise<void>;
|
|
4
|
+
export type AppOptionsFactory = (appName: string, mainApp: Application) => any;
|
|
5
5
|
export declare class PluginMultiAppManager extends Plugin {
|
|
6
6
|
appDbCreator: AppDbCreator;
|
|
7
7
|
appOptionsFactory: AppOptionsFactory;
|
package/lib/server/server.js
CHANGED
|
@@ -18,9 +18,9 @@ function _server() {
|
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const data =
|
|
23
|
-
|
|
21
|
+
function _utils() {
|
|
22
|
+
const data = require("@nocobase/utils");
|
|
23
|
+
_utils = function _utils() {
|
|
24
24
|
return data;
|
|
25
25
|
};
|
|
26
26
|
return data;
|
|
@@ -130,7 +130,7 @@ class PluginMultiAppManager extends _server().Plugin {
|
|
|
130
130
|
}
|
|
131
131
|
static getDatabaseConfig(app) {
|
|
132
132
|
const oldConfig = app.options.database instanceof _database().default ? app.options.database.options : app.options.database;
|
|
133
|
-
return
|
|
133
|
+
return _utils().lodash.cloneDeep(_utils().lodash.omit(oldConfig, ['migrator']));
|
|
134
134
|
}
|
|
135
135
|
beforeLoad() {
|
|
136
136
|
this.db.registerModels({
|
|
@@ -216,7 +216,7 @@ class PluginMultiAppManager extends _server().Plugin {
|
|
|
216
216
|
});
|
|
217
217
|
const instanceOptions = applicationRecord.get('options');
|
|
218
218
|
// skip standalone deployment application
|
|
219
|
-
if (
|
|
219
|
+
if (instanceOptions !== null && instanceOptions !== void 0 && instanceOptions.standaloneDeployment && appManager.runningMode !== 'single') {
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
222
222
|
if (!applicationRecord) {
|
|
@@ -226,7 +226,7 @@ class PluginMultiAppManager extends _server().Plugin {
|
|
|
226
226
|
appOptionsFactory: _this.appOptionsFactory
|
|
227
227
|
});
|
|
228
228
|
// must skip load on upgrade
|
|
229
|
-
if (!(options
|
|
229
|
+
if (!(options !== null && options !== void 0 && options.upgrading)) {
|
|
230
230
|
yield subApp.load();
|
|
231
231
|
}
|
|
232
232
|
}));
|
|
@@ -304,7 +304,7 @@ class PluginMultiAppManager extends _server().Plugin {
|
|
|
304
304
|
const instance = _step2.value;
|
|
305
305
|
const instanceOptions = instance.get('options');
|
|
306
306
|
// skip standalone deployment application
|
|
307
|
-
if (
|
|
307
|
+
if (instanceOptions !== null && instanceOptions !== void 0 && instanceOptions.standaloneDeployment && appManager.runningMode !== 'single') {
|
|
308
308
|
continue;
|
|
309
309
|
}
|
|
310
310
|
const subApp = yield appManager.getApplication(instance.name, {
|
package/package.json
CHANGED
|
@@ -4,13 +4,35 @@
|
|
|
4
4
|
"displayName.zh-CN": "多应用管理",
|
|
5
5
|
"description": "manage app",
|
|
6
6
|
"description.zh-CN": "管理应用",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.11.0-alpha.1",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
|
-
"main": "./lib/index.js",
|
|
10
|
-
"
|
|
9
|
+
"main": "./lib/server/index.js",
|
|
10
|
+
"files": [
|
|
11
|
+
"lib",
|
|
12
|
+
"src",
|
|
13
|
+
"README.md",
|
|
14
|
+
"README.zh-CN.md",
|
|
15
|
+
"CHANGELOG.md",
|
|
16
|
+
"server.js",
|
|
17
|
+
"server.d.ts",
|
|
18
|
+
"client.js",
|
|
19
|
+
"client.d.ts"
|
|
20
|
+
],
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@formily/react": "2.2.26",
|
|
23
|
+
"@formily/shared": "2.2.26",
|
|
24
|
+
"@nocobase/client": "0.11.0-alpha.1",
|
|
25
|
+
"@nocobase/database": "0.11.0-alpha.1",
|
|
26
|
+
"@nocobase/server": "0.11.0-alpha.1",
|
|
27
|
+
"@nocobase/test": "0.11.0-alpha.1",
|
|
28
|
+
"@nocobase/utils": "0.11.0-alpha.1",
|
|
29
|
+
"antd": "^5.6.4",
|
|
30
|
+
"react": "18.x",
|
|
31
|
+
"react-i18next": "^11.15.1",
|
|
32
|
+
"react-router-dom": "^6.11.2"
|
|
33
|
+
},
|
|
11
34
|
"dependencies": {
|
|
12
|
-
"@nocobase/server": "0.10.0-alpha.5",
|
|
13
35
|
"async-mutex": "^0.3.2"
|
|
14
36
|
},
|
|
15
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "7581b6d3a3a54f09f06a9effb7e3e65328281b2b"
|
|
16
38
|
}
|
package/server.d.ts
CHANGED
package/server.js
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
4
|
-
|
|
5
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
6
|
-
|
|
7
|
-
var _index = _interopRequireWildcard(require("./lib/server"));
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, "__esModule", {
|
|
10
|
-
value: true
|
|
11
|
-
});
|
|
12
|
-
var _exportNames = {};
|
|
13
|
-
Object.defineProperty(exports, "default", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function get() {
|
|
16
|
-
return _index.default;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
Object.keys(_index).forEach(function (key) {
|
|
21
|
-
if (key === "default" || key === "__esModule") return;
|
|
22
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
23
|
-
if (key in exports && exports[key] === _index[key]) return;
|
|
24
|
-
Object.defineProperty(exports, key, {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _index[key];
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
});
|
|
1
|
+
module.exports = require('./lib/server/index.js');
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SchemaComponent, useRecord } from '@nocobase/client';
|
|
2
|
+
import { Card } from 'antd';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { schema } from './settings/schemas/applications';
|
|
5
|
+
import { usePluginUtils } from './utils';
|
|
6
|
+
|
|
7
|
+
const useLink = () => {
|
|
8
|
+
const record = useRecord();
|
|
9
|
+
if (record.options?.standaloneDeployment && record.cname) {
|
|
10
|
+
return `//${record.cname}`;
|
|
11
|
+
}
|
|
12
|
+
return `/apps/${record.name}/admin/`;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const AppVisitor = () => {
|
|
16
|
+
const { t } = usePluginUtils();
|
|
17
|
+
const link = useLink();
|
|
18
|
+
return (
|
|
19
|
+
<a href={link} target={'_blank'} rel="noreferrer">
|
|
20
|
+
{t('View', { ns: 'client' })}
|
|
21
|
+
</a>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const AppManager = () => {
|
|
26
|
+
return (
|
|
27
|
+
<Card bordered={false}>
|
|
28
|
+
<SchemaComponent schema={schema} components={{ AppVisitor }} />
|
|
29
|
+
</Card>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { connect, mapReadPretty } from '@formily/react';
|
|
2
|
+
import { Input as AntdInput } from 'antd';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
const ReadPretty = (props) => {
|
|
6
|
+
const content = props.value && (
|
|
7
|
+
<a target={'_blank'} href={`/apps/${props.value}/admin`} rel="noreferrer">
|
|
8
|
+
{props.value}
|
|
9
|
+
</a>
|
|
10
|
+
);
|
|
11
|
+
return (
|
|
12
|
+
<div style={props.style}>
|
|
13
|
+
{props.addonBefore}
|
|
14
|
+
{props.prefix}
|
|
15
|
+
{content}
|
|
16
|
+
{props.suffix}
|
|
17
|
+
{props.addonAfter}
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const AppNameInput = connect(AntdInput, mapReadPretty(ReadPretty));
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Icon,
|
|
3
|
+
PinnedPluginListProvider,
|
|
4
|
+
SchemaComponentOptions,
|
|
5
|
+
SettingsCenterProvider,
|
|
6
|
+
useRequest,
|
|
7
|
+
} from '@nocobase/client';
|
|
8
|
+
import { Button, Dropdown } from 'antd';
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { Link } from 'react-router-dom';
|
|
11
|
+
import { AppManager } from './AppManager';
|
|
12
|
+
import { AppNameInput } from './AppNameInput';
|
|
13
|
+
import { usePluginUtils } from './utils';
|
|
14
|
+
|
|
15
|
+
const MultiAppManager = () => {
|
|
16
|
+
const { data, loading, run } = useRequest(
|
|
17
|
+
{
|
|
18
|
+
resource: 'applications',
|
|
19
|
+
action: 'listPinned',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
manual: true,
|
|
23
|
+
},
|
|
24
|
+
);
|
|
25
|
+
const { t } = usePluginUtils();
|
|
26
|
+
const items = [
|
|
27
|
+
...(data?.data || []).map((app) => {
|
|
28
|
+
let link = `/apps/${app.name}/admin/`;
|
|
29
|
+
if (app.options?.standaloneDeployment && app.cname) {
|
|
30
|
+
link = `//${app.cname}`;
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
key: app.name,
|
|
34
|
+
label: (
|
|
35
|
+
<a href={link} target="_blank" rel="noopener noreferrer">
|
|
36
|
+
{app.displayName || app.name}
|
|
37
|
+
</a>
|
|
38
|
+
),
|
|
39
|
+
};
|
|
40
|
+
}),
|
|
41
|
+
{
|
|
42
|
+
key: '.manager',
|
|
43
|
+
label: <Link to="/admin/settings/multi-app-manager/applications">{t('Manage applications')}</Link>,
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
return (
|
|
47
|
+
<Dropdown
|
|
48
|
+
onOpenChange={(visible) => {
|
|
49
|
+
run();
|
|
50
|
+
}}
|
|
51
|
+
menu={{ items }}
|
|
52
|
+
>
|
|
53
|
+
<Button title={'Apps'} icon={<Icon type={'AppstoreOutlined'} />} />
|
|
54
|
+
</Dropdown>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
export const MultiAppManagerProvider = (props) => {
|
|
60
|
+
const { t } = usePluginUtils();
|
|
61
|
+
return (
|
|
62
|
+
<PinnedPluginListProvider
|
|
63
|
+
items={{
|
|
64
|
+
am: { order: 201, component: 'MultiAppManager', pin: true },
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
<SchemaComponentOptions components={{ MultiAppManager, AppNameInput }}>
|
|
68
|
+
<SettingsCenterProvider
|
|
69
|
+
settings={{
|
|
70
|
+
'multi-app-manager': {
|
|
71
|
+
title: t('Multi-app manager'),
|
|
72
|
+
icon: 'AppstoreOutlined',
|
|
73
|
+
tabs: {
|
|
74
|
+
applications: {
|
|
75
|
+
title: t('Applications'),
|
|
76
|
+
component: () => <AppManager />,
|
|
77
|
+
},
|
|
78
|
+
// settings: {
|
|
79
|
+
// title: 'Settings',
|
|
80
|
+
// component: () => <Settings />,
|
|
81
|
+
// },
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
}}
|
|
85
|
+
>
|
|
86
|
+
{props.children}
|
|
87
|
+
</SettingsCenterProvider>
|
|
88
|
+
</SchemaComponentOptions>
|
|
89
|
+
</PinnedPluginListProvider>
|
|
90
|
+
);
|
|
91
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SchemaComponent } from '@nocobase/client';
|
|
2
|
+
import { Card } from 'antd';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
const schema = {
|
|
6
|
+
type: 'object',
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const Settings = () => {
|
|
10
|
+
return (
|
|
11
|
+
<Card bordered={false}>
|
|
12
|
+
<SchemaComponent schema={schema} />
|
|
13
|
+
</Card>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Plugin } from '@nocobase/client';
|
|
2
|
+
import { MultiAppManagerProvider } from './MultiAppManagerProvider';
|
|
3
|
+
export { tableActionColumnSchema } from './settings/schemas/applications';
|
|
4
|
+
|
|
5
|
+
export class MultiAppManagerPlugin extends Plugin {
|
|
6
|
+
async load() {
|
|
7
|
+
this.app.use(MultiAppManagerProvider);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default MultiAppManagerPlugin;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"Multi-app manager": "Gestor de aplicaciones múltiples",
|
|
3
|
+
"Applications": "Aplicaciones",
|
|
4
|
+
"App display name": "Mostrar nombre de aplicación",
|
|
5
|
+
"App ID": "ID de aplicación",
|
|
6
|
+
"Pin to menu": " Fijar al menú",
|
|
7
|
+
"Custom domain": "Dominio personalizado",
|
|
8
|
+
"Manage applications": "Gestionar aplicaciones"
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
'Multi-app manager': 'Gerenciador de aplicativos múltiplos',
|
|
3
|
+
Applications: 'Aplicativos',
|
|
4
|
+
'App display name': 'Nome de exibição do aplicativo',
|
|
5
|
+
'App ID': 'ID do aplicativo',
|
|
6
|
+
'Pin to menu': 'Fixar no menu',
|
|
7
|
+
'Custom domain': 'Domínio personalizado',
|
|
8
|
+
'Manage applications': 'Gerenciar aplicativos',
|
|
9
|
+
};
|