@nocobase/plugin-multi-app-manager 0.9.4-alpha.1 → 0.9.4-alpha.2
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/lib/client/index.js +18 -13
- package/lib/client/locale/zh-CN.d.ts +2 -0
- package/lib/client/locale/zh-CN.js +3 -1
- package/lib/client/settings/schemas/applications.d.ts +5 -0
- package/lib/client/settings/schemas/applications.js +12 -2
- package/lib/server/server.js +60 -10
- package/package.json +3 -3
package/lib/client/index.js
CHANGED
|
@@ -56,28 +56,33 @@ const MultiAppManager = () => {
|
|
|
56
56
|
run = _useRequest.run;
|
|
57
57
|
const _usePluginUtils = (0, _utils.usePluginUtils)(),
|
|
58
58
|
t = _usePluginUtils.t;
|
|
59
|
-
const
|
|
59
|
+
const items = [...((data === null || data === void 0 ? void 0 : data.data) || []).map(app => {
|
|
60
60
|
var _app$options;
|
|
61
61
|
let link = `/apps/${app.name}/admin/`;
|
|
62
62
|
if (((_app$options = app.options) === null || _app$options === void 0 ? void 0 : _app$options.standaloneDeployment) && app.cname) {
|
|
63
63
|
link = `//${app.cname}`;
|
|
64
64
|
}
|
|
65
|
-
return
|
|
65
|
+
return {
|
|
66
66
|
key: app.name,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
label: _react().default.createElement("a", {
|
|
68
|
+
href: link,
|
|
69
|
+
target: "_blank",
|
|
70
|
+
rel: "noopener noreferrer"
|
|
71
|
+
}, app.displayName || app.name)
|
|
72
|
+
};
|
|
73
|
+
}), {
|
|
74
|
+
key: '.manager',
|
|
75
|
+
label: _react().default.createElement(_reactRouterDom().Link, {
|
|
76
|
+
to: "/admin/settings/multi-app-manager/applications"
|
|
77
|
+
}, t('Manage applications'))
|
|
78
|
+
}];
|
|
76
79
|
return _react().default.createElement(_antd().Dropdown, {
|
|
77
|
-
|
|
80
|
+
onOpenChange: visible => {
|
|
78
81
|
run();
|
|
79
82
|
},
|
|
80
|
-
|
|
83
|
+
menu: {
|
|
84
|
+
items
|
|
85
|
+
}
|
|
81
86
|
}, _react().default.createElement(_antd().Button, {
|
|
82
87
|
title: 'Apps',
|
|
83
88
|
icon: _react().default.createElement(_client().Icon, {
|
|
@@ -40,6 +40,11 @@ export declare const tableActionColumnSchema: {
|
|
|
40
40
|
'x-decorator': string;
|
|
41
41
|
'x-content': string;
|
|
42
42
|
};
|
|
43
|
+
'options.autoStart': {
|
|
44
|
+
'x-component': string;
|
|
45
|
+
'x-decorator': string;
|
|
46
|
+
'x-content': string;
|
|
47
|
+
};
|
|
43
48
|
cname: {
|
|
44
49
|
title: string;
|
|
45
50
|
'x-component': string;
|
|
@@ -155,7 +155,12 @@ const tableActionColumnSchema = {
|
|
|
155
155
|
'options.standaloneDeployment': {
|
|
156
156
|
'x-component': 'Checkbox',
|
|
157
157
|
'x-decorator': 'FormItem',
|
|
158
|
-
'x-content': '
|
|
158
|
+
'x-content': (0, _utils.i18nText)('Standalone deployment')
|
|
159
|
+
},
|
|
160
|
+
'options.autoStart': {
|
|
161
|
+
'x-component': 'Checkbox',
|
|
162
|
+
'x-decorator': 'FormItem',
|
|
163
|
+
'x-content': (0, _utils.i18nText)('Auto start')
|
|
159
164
|
},
|
|
160
165
|
cname: {
|
|
161
166
|
title: (0, _utils.i18nText)('Custom domain'),
|
|
@@ -288,7 +293,12 @@ const schema = {
|
|
|
288
293
|
'options.standaloneDeployment': {
|
|
289
294
|
'x-component': 'Checkbox',
|
|
290
295
|
'x-decorator': 'FormItem',
|
|
291
|
-
'x-content': '
|
|
296
|
+
'x-content': (0, _utils.i18nText)('Standalone deployment')
|
|
297
|
+
},
|
|
298
|
+
'options.autoStart': {
|
|
299
|
+
'x-component': 'Checkbox',
|
|
300
|
+
'x-decorator': 'FormItem',
|
|
301
|
+
'x-content': (0, _utils.i18nText)('Auto start')
|
|
292
302
|
},
|
|
293
303
|
cname: {
|
|
294
304
|
title: (0, _utils.i18nText)('Custom domain'),
|
package/lib/server/server.js
CHANGED
|
@@ -225,8 +225,58 @@ class PluginMultiAppManager extends _server().Plugin {
|
|
|
225
225
|
return _ref5.apply(this, arguments);
|
|
226
226
|
};
|
|
227
227
|
}());
|
|
228
|
+
_this.app.on('afterStart', /*#__PURE__*/function () {
|
|
229
|
+
var _ref6 = _asyncToGenerator(function* (app) {
|
|
230
|
+
const repository = _this.db.getRepository('applications');
|
|
231
|
+
const appManager = _this.app.appManager;
|
|
232
|
+
if (appManager.runningMode == 'single') {
|
|
233
|
+
// If the sub application is running in single mode, register the application automatically
|
|
234
|
+
try {
|
|
235
|
+
const subApp = yield repository.findOne({
|
|
236
|
+
filter: {
|
|
237
|
+
name: appManager.singleAppName
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
const registeredApp = yield subApp.registerToMainApp(_this.app, {
|
|
241
|
+
appOptionsFactory: _this.appOptionsFactory
|
|
242
|
+
});
|
|
243
|
+
yield registeredApp.load();
|
|
244
|
+
} catch (err) {
|
|
245
|
+
console.error('Auto register sub application in single mode failed: ', appManager.singleAppName, err);
|
|
246
|
+
}
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
try {
|
|
250
|
+
const subApps = yield repository.find({
|
|
251
|
+
filter: {
|
|
252
|
+
'options.autoStart': true
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
var _iterator = _createForOfIteratorHelper(subApps),
|
|
256
|
+
_step;
|
|
257
|
+
try {
|
|
258
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
259
|
+
const subApp = _step.value;
|
|
260
|
+
const registeredApp = yield subApp.registerToMainApp(_this.app, {
|
|
261
|
+
appOptionsFactory: _this.appOptionsFactory
|
|
262
|
+
});
|
|
263
|
+
yield registeredApp.load();
|
|
264
|
+
}
|
|
265
|
+
} catch (err) {
|
|
266
|
+
_iterator.e(err);
|
|
267
|
+
} finally {
|
|
268
|
+
_iterator.f();
|
|
269
|
+
}
|
|
270
|
+
} catch (err) {
|
|
271
|
+
console.error('Auto register sub applications failed: ', err);
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
return function (_x7) {
|
|
275
|
+
return _ref6.apply(this, arguments);
|
|
276
|
+
};
|
|
277
|
+
}());
|
|
228
278
|
_this.app.on('afterUpgrade', /*#__PURE__*/function () {
|
|
229
|
-
var
|
|
279
|
+
var _ref7 = _asyncToGenerator(function* (app, options) {
|
|
230
280
|
const cliArgs = options === null || options === void 0 ? void 0 : options.cliArgs;
|
|
231
281
|
const repository = _this.db.getRepository('applications');
|
|
232
282
|
const findOptions = {};
|
|
@@ -237,11 +287,11 @@ class PluginMultiAppManager extends _server().Plugin {
|
|
|
237
287
|
};
|
|
238
288
|
}
|
|
239
289
|
const instances = yield repository.find(findOptions);
|
|
240
|
-
var
|
|
241
|
-
|
|
290
|
+
var _iterator2 = _createForOfIteratorHelper(instances),
|
|
291
|
+
_step2;
|
|
242
292
|
try {
|
|
243
|
-
for (
|
|
244
|
-
const instance =
|
|
293
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
294
|
+
const instance = _step2.value;
|
|
245
295
|
const instanceOptions = instance.get('options');
|
|
246
296
|
// skip standalone deployment application
|
|
247
297
|
if ((instanceOptions === null || instanceOptions === void 0 ? void 0 : instanceOptions.standaloneDeployment) && appManager.runningMode !== 'single') {
|
|
@@ -265,13 +315,13 @@ class PluginMultiAppManager extends _server().Plugin {
|
|
|
265
315
|
}
|
|
266
316
|
}
|
|
267
317
|
} catch (err) {
|
|
268
|
-
|
|
318
|
+
_iterator2.e(err);
|
|
269
319
|
} finally {
|
|
270
|
-
|
|
320
|
+
_iterator2.f();
|
|
271
321
|
}
|
|
272
322
|
});
|
|
273
|
-
return function (
|
|
274
|
-
return
|
|
323
|
+
return function (_x8, _x9) {
|
|
324
|
+
return _ref7.apply(this, arguments);
|
|
275
325
|
};
|
|
276
326
|
}());
|
|
277
327
|
_this.app.resourcer.registerActionHandlers({
|
|
@@ -284,7 +334,7 @@ class PluginMultiAppManager extends _server().Plugin {
|
|
|
284
334
|
});
|
|
285
335
|
ctx.body = items;
|
|
286
336
|
});
|
|
287
|
-
function applicationsListPinned(
|
|
337
|
+
function applicationsListPinned(_x10, _x11) {
|
|
288
338
|
return _applicationsListPinned.apply(this, arguments);
|
|
289
339
|
}
|
|
290
340
|
return applicationsListPinned;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-multi-app-manager",
|
|
3
|
-
"version": "0.9.4-alpha.
|
|
3
|
+
"version": "0.9.4-alpha.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"main": "./lib/index.js",
|
|
7
7
|
"types": "./lib/index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@nocobase/server": "0.9.4-alpha.
|
|
9
|
+
"@nocobase/server": "0.9.4-alpha.2"
|
|
10
10
|
},
|
|
11
|
-
"gitHead": "
|
|
11
|
+
"gitHead": "2bc19a85bf9425aa220b6c467315c8087f333a7e"
|
|
12
12
|
}
|