@nocobase/plugin-multi-app-manager 0.11.1-alpha.5 → 0.12.0-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.
Files changed (61) hide show
  1. package/client.d.ts +1 -3
  2. package/client.js +1 -1
  3. package/dist/client/index.js +500 -0
  4. package/{lib → dist}/index.d.ts +1 -0
  5. package/dist/index.js +18 -0
  6. package/dist/locale/es-ES.js +13 -0
  7. package/dist/locale/pt-BR.js +13 -0
  8. package/dist/locale/zh-CN.js +15 -0
  9. package/dist/server/collections/applications.js +49 -0
  10. package/dist/server/index.js +21 -0
  11. package/dist/server/models/application.js +22 -0
  12. package/dist/server/server.js +260 -0
  13. package/package.json +15 -24
  14. package/server.d.ts +2 -3
  15. package/server.js +1 -1
  16. package/lib/client/AppManager.js +0 -61
  17. package/lib/client/AppNameInput.js +0 -40
  18. package/lib/client/MultiAppManagerProvider.js +0 -119
  19. package/lib/client/Settings.js +0 -39
  20. package/lib/client/index.js +0 -34
  21. package/lib/client/settings/schemas/applications.js +0 -404
  22. package/lib/client/utils.js +0 -25
  23. package/lib/index.js +0 -13
  24. package/lib/locale/es-ES.js +0 -16
  25. package/lib/locale/pt-BR.js +0 -16
  26. package/lib/locale/zh-CN.js +0 -18
  27. package/lib/server/collections/applications.js +0 -49
  28. package/lib/server/index.js +0 -19
  29. package/lib/server/models/application.js +0 -39
  30. package/lib/server/server.js +0 -367
  31. package/src/client/AppManager.tsx +0 -31
  32. package/src/client/AppNameInput.tsx +0 -22
  33. package/src/client/MultiAppManagerProvider.tsx +0 -93
  34. package/src/client/Settings.tsx +0 -15
  35. package/src/client/index.ts +0 -11
  36. package/src/client/settings/schemas/applications.ts +0 -376
  37. package/src/client/utils.tsx +0 -10
  38. package/src/index.ts +0 -1
  39. package/src/locale/es-ES.ts +0 -9
  40. package/src/locale/pt-BR.ts +0 -9
  41. package/src/locale/zh-CN.ts +0 -11
  42. package/src/server/__tests__/mock-get-schema.test.ts +0 -146
  43. package/src/server/__tests__/multiple-apps.test.ts +0 -209
  44. package/src/server/collections/applications.ts +0 -45
  45. package/src/server/index.ts +0 -4
  46. package/src/server/models/application.ts +0 -28
  47. package/src/server/server.ts +0 -297
  48. package/{lib → dist}/client/AppManager.d.ts +0 -0
  49. package/{lib → dist}/client/AppNameInput.d.ts +0 -0
  50. package/{lib → dist}/client/MultiAppManagerProvider.d.ts +0 -0
  51. package/{lib → dist}/client/Settings.d.ts +0 -0
  52. package/{lib → dist}/client/index.d.ts +1 -1
  53. /package/{lib → dist}/client/settings/schemas/applications.d.ts +0 -0
  54. /package/{lib → dist}/client/utils.d.ts +0 -0
  55. /package/{lib → dist}/locale/es-ES.d.ts +0 -0
  56. /package/{lib → dist}/locale/pt-BR.d.ts +0 -0
  57. /package/{lib → dist}/locale/zh-CN.d.ts +0 -0
  58. /package/{lib → dist}/server/collections/applications.d.ts +0 -0
  59. /package/{lib → dist}/server/index.d.ts +0 -0
  60. /package/{lib → dist}/server/models/application.d.ts +0 -0
  61. /package/{lib → dist}/server/server.d.ts +0 -0
package/client.d.ts CHANGED
@@ -1,3 +1 @@
1
- export * from './src/client';
2
- export { default } from './src/client';
3
-
1
+ export * from './dist/client/index';
package/client.js CHANGED
@@ -1 +1 @@
1
- module.exports = require('./lib/client/index.js');
1
+ module.exports = require('./dist/client/index.js');
@@ -0,0 +1,500 @@
1
+ (function(global, factory) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@nocobase/client"), require("react"), require("antd"), require("react-router-dom"), require("@formily/shared"), require("react-i18next"), require("@formily/react")) : typeof define === "function" && define.amd ? define(["exports", "@nocobase/client", "react", "antd", "react-router-dom", "@formily/shared", "react-i18next", "@formily/react"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["@nocobase/plugin-multi-app-manager"] = {}, global["@nocobase/client"], global.react, global.antd, global["react-router-dom"], global["@formily/shared"], global["react-i18next"], global["@formily/react"]));
3
+ })(this, function(exports2, client, require$$0, antd, reactRouterDom, shared, reactI18next, react) {
4
+ "use strict";
5
+ var jsxRuntime = { exports: {} };
6
+ var reactJsxRuntime_production_min = {};
7
+ /**
8
+ * @license React
9
+ * react-jsx-runtime.production.min.js
10
+ *
11
+ * Copyright (c) Facebook, Inc. and its affiliates.
12
+ *
13
+ * This source code is licensed under the MIT license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ */
16
+ var f = require$$0, k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: true, ref: true, __self: true, __source: true };
17
+ function q(c, a, g) {
18
+ var b, d = {}, e = null, h = null;
19
+ void 0 !== g && (e = "" + g);
20
+ void 0 !== a.key && (e = "" + a.key);
21
+ void 0 !== a.ref && (h = a.ref);
22
+ for (b in a)
23
+ m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
24
+ if (c && c.defaultProps)
25
+ for (b in a = c.defaultProps, a)
26
+ void 0 === d[b] && (d[b] = a[b]);
27
+ return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
28
+ }
29
+ reactJsxRuntime_production_min.Fragment = l;
30
+ reactJsxRuntime_production_min.jsx = q;
31
+ reactJsxRuntime_production_min.jsxs = q;
32
+ {
33
+ jsxRuntime.exports = reactJsxRuntime_production_min;
34
+ }
35
+ var jsxRuntimeExports = jsxRuntime.exports;
36
+ const usePluginUtils = () => {
37
+ const { t } = reactI18next.useTranslation("multi-app-manager");
38
+ return { t };
39
+ };
40
+ const i18nText = (text) => {
41
+ return `{{t("${text}", { ns: 'multi-app-manager' })}}`;
42
+ };
43
+ const collection = {
44
+ name: "applications",
45
+ targetKey: "name",
46
+ fields: [
47
+ {
48
+ type: "uid",
49
+ name: "name",
50
+ primaryKey: true,
51
+ prefix: "a",
52
+ interface: "input",
53
+ uiSchema: {
54
+ type: "string",
55
+ title: i18nText("App ID"),
56
+ required: true,
57
+ "x-component": "Input",
58
+ "x-validator": "uid"
59
+ }
60
+ },
61
+ {
62
+ type: "string",
63
+ name: "displayName",
64
+ interface: "input",
65
+ uiSchema: {
66
+ type: "string",
67
+ title: i18nText("App display name"),
68
+ required: true,
69
+ "x-component": "Input"
70
+ }
71
+ },
72
+ {
73
+ type: "string",
74
+ name: "pinned",
75
+ interface: "checkbox",
76
+ uiSchema: {
77
+ type: "boolean",
78
+ "x-content": i18nText("Pin to menu"),
79
+ "x-component": "Checkbox"
80
+ }
81
+ },
82
+ {
83
+ type: "string",
84
+ name: "status",
85
+ interface: "radioGroup",
86
+ defaultValue: "pending",
87
+ uiSchema: {
88
+ type: "string",
89
+ title: i18nText("App status"),
90
+ enum: [
91
+ { label: "Pending", value: "pending" },
92
+ { label: "Running", value: "running" }
93
+ ],
94
+ "x-component": "Radio.Group"
95
+ }
96
+ }
97
+ ]
98
+ };
99
+ const useDestroyAll = () => {
100
+ const { state, setState, refresh } = client.useResourceActionContext();
101
+ const { resource } = client.useResourceContext();
102
+ return {
103
+ async run() {
104
+ await resource.destroy({
105
+ filterByTk: (state == null ? void 0 : state.selectedRowKeys) || []
106
+ });
107
+ setState == null ? void 0 : setState({ selectedRowKeys: [] });
108
+ refresh();
109
+ }
110
+ };
111
+ };
112
+ const tableActionColumnSchema = {
113
+ properties: {
114
+ view: {
115
+ type: "void",
116
+ "x-component": "AppVisitor",
117
+ "x-component-props": {}
118
+ },
119
+ update: {
120
+ type: "void",
121
+ title: '{{t("Edit")}}',
122
+ "x-component": "Action.Link",
123
+ "x-component-props": {},
124
+ properties: {
125
+ drawer: {
126
+ type: "void",
127
+ "x-component": "Action.Drawer",
128
+ "x-decorator": "Form",
129
+ "x-decorator-props": {
130
+ useValues: "{{ cm.useValuesFromRecord }}"
131
+ },
132
+ title: '{{t("Edit")}}',
133
+ properties: {
134
+ displayName: {
135
+ "x-component": "CollectionField",
136
+ "x-decorator": "FormItem"
137
+ },
138
+ pinned: {
139
+ "x-component": "CollectionField",
140
+ "x-decorator": "FormItem"
141
+ },
142
+ "options.standaloneDeployment": {
143
+ "x-component": "Checkbox",
144
+ "x-decorator": "FormItem",
145
+ "x-content": i18nText("Standalone deployment")
146
+ },
147
+ "options.autoStart": {
148
+ "x-component": "Checkbox",
149
+ "x-decorator": "FormItem",
150
+ "x-content": i18nText("Auto start")
151
+ },
152
+ cname: {
153
+ title: i18nText("Custom domain"),
154
+ "x-component": "Input",
155
+ "x-decorator": "FormItem"
156
+ },
157
+ footer: {
158
+ type: "void",
159
+ "x-component": "Action.Drawer.Footer",
160
+ properties: {
161
+ cancel: {
162
+ title: '{{t("Cancel")}}',
163
+ "x-component": "Action",
164
+ "x-component-props": {
165
+ useAction: "{{ cm.useCancelAction }}"
166
+ }
167
+ },
168
+ submit: {
169
+ title: '{{t("Submit")}}',
170
+ "x-component": "Action",
171
+ "x-component-props": {
172
+ type: "primary",
173
+ useAction: "{{ cm.useUpdateAction }}"
174
+ }
175
+ }
176
+ }
177
+ }
178
+ }
179
+ }
180
+ }
181
+ },
182
+ delete: {
183
+ type: "void",
184
+ title: '{{ t("Delete") }}',
185
+ "x-component": "Action.Link",
186
+ "x-component-props": {
187
+ confirm: {
188
+ title: "{{t('Delete')}}",
189
+ content: "{{t('Are you sure you want to delete it?')}}"
190
+ },
191
+ useAction: "{{cm.useDestroyAction}}"
192
+ }
193
+ }
194
+ }
195
+ };
196
+ const schema = {
197
+ type: "object",
198
+ properties: {
199
+ [shared.uid()]: {
200
+ type: "void",
201
+ "x-decorator": "ResourceActionProvider",
202
+ "x-decorator-props": {
203
+ collection,
204
+ resourceName: "applications",
205
+ request: {
206
+ resource: "applications",
207
+ action: "list",
208
+ params: {
209
+ pageSize: 50,
210
+ sort: ["-createdAt"],
211
+ appends: []
212
+ }
213
+ }
214
+ },
215
+ "x-component": "CollectionProvider",
216
+ "x-component-props": {
217
+ collection
218
+ },
219
+ properties: {
220
+ actions: {
221
+ type: "void",
222
+ "x-component": "ActionBar",
223
+ "x-component-props": {
224
+ style: {
225
+ marginBottom: 16
226
+ }
227
+ },
228
+ properties: {
229
+ delete: {
230
+ type: "void",
231
+ title: '{{ t("Delete") }}',
232
+ "x-component": "Action",
233
+ "x-component-props": {
234
+ useAction: useDestroyAll,
235
+ confirm: {
236
+ title: "{{t('Delete')}}",
237
+ content: "{{t('Are you sure you want to delete it?')}}"
238
+ }
239
+ }
240
+ },
241
+ create: {
242
+ type: "void",
243
+ title: '{{t("Add new")}}',
244
+ "x-component": "Action",
245
+ "x-component-props": {
246
+ type: "primary"
247
+ },
248
+ properties: {
249
+ drawer: {
250
+ type: "void",
251
+ "x-component": "Action.Drawer",
252
+ "x-decorator": "Form",
253
+ "x-decorator-props": {
254
+ useValues(options) {
255
+ const ctx = client.useActionContext();
256
+ return client.useRequest(
257
+ () => Promise.resolve({
258
+ data: {
259
+ name: `a_${shared.uid()}`
260
+ }
261
+ }),
262
+ { ...options, refreshDeps: [ctx.visible] }
263
+ );
264
+ }
265
+ },
266
+ title: '{{t("Add new")}}',
267
+ properties: {
268
+ displayName: {
269
+ "x-component": "CollectionField",
270
+ "x-decorator": "FormItem"
271
+ },
272
+ name: {
273
+ "x-component": "CollectionField",
274
+ "x-decorator": "FormItem"
275
+ },
276
+ pinned: {
277
+ "x-component": "CollectionField",
278
+ "x-decorator": "FormItem"
279
+ },
280
+ "options.standaloneDeployment": {
281
+ "x-component": "Checkbox",
282
+ "x-decorator": "FormItem",
283
+ "x-content": i18nText("Standalone deployment")
284
+ },
285
+ "options.autoStart": {
286
+ "x-component": "Checkbox",
287
+ "x-decorator": "FormItem",
288
+ "x-content": i18nText("Auto start")
289
+ },
290
+ cname: {
291
+ title: i18nText("Custom domain"),
292
+ "x-component": "Input",
293
+ "x-decorator": "FormItem"
294
+ },
295
+ footer: {
296
+ type: "void",
297
+ "x-component": "Action.Drawer.Footer",
298
+ properties: {
299
+ cancel: {
300
+ title: '{{t("Cancel")}}',
301
+ "x-component": "Action",
302
+ "x-component-props": {
303
+ useAction: "{{ cm.useCancelAction }}"
304
+ }
305
+ },
306
+ submit: {
307
+ title: '{{t("Submit")}}',
308
+ "x-component": "Action",
309
+ "x-component-props": {
310
+ type: "primary",
311
+ useAction: "{{ cm.useCreateAction }}"
312
+ }
313
+ }
314
+ }
315
+ }
316
+ }
317
+ }
318
+ }
319
+ }
320
+ }
321
+ },
322
+ table: {
323
+ type: "void",
324
+ "x-uid": "input",
325
+ "x-component": "Table.Void",
326
+ "x-component-props": {
327
+ rowKey: "name",
328
+ rowSelection: {
329
+ type: "checkbox"
330
+ },
331
+ useDataSource: "{{ cm.useDataSourceFromRAC }}"
332
+ },
333
+ properties: {
334
+ displayName: {
335
+ type: "void",
336
+ "x-decorator": "Table.Column.Decorator",
337
+ "x-component": "Table.Column",
338
+ properties: {
339
+ displayName: {
340
+ type: "string",
341
+ "x-component": "CollectionField",
342
+ "x-read-pretty": true
343
+ }
344
+ }
345
+ },
346
+ name: {
347
+ type: "void",
348
+ "x-decorator": "Table.Column.Decorator",
349
+ "x-component": "Table.Column",
350
+ properties: {
351
+ name: {
352
+ type: "string",
353
+ "x-component": "CollectionField",
354
+ "x-read-pretty": true
355
+ }
356
+ }
357
+ },
358
+ pinned: {
359
+ type: "void",
360
+ title: i18nText("Pin to menu"),
361
+ "x-decorator": "Table.Column.Decorator",
362
+ "x-component": "Table.Column",
363
+ properties: {
364
+ pinned: {
365
+ type: "string",
366
+ "x-component": "CollectionField",
367
+ "x-read-pretty": true
368
+ }
369
+ }
370
+ },
371
+ actions: {
372
+ type: "void",
373
+ title: '{{t("Actions")}}',
374
+ "x-component": "Table.Column",
375
+ properties: {
376
+ actions: {
377
+ type: "void",
378
+ "x-component": "Space",
379
+ "x-component-props": {
380
+ split: "|"
381
+ },
382
+ ...tableActionColumnSchema
383
+ }
384
+ }
385
+ }
386
+ }
387
+ }
388
+ }
389
+ }
390
+ }
391
+ };
392
+ const useLink = () => {
393
+ var _a;
394
+ const record = client.useRecord();
395
+ if (((_a = record.options) == null ? void 0 : _a.standaloneDeployment) && record.cname) {
396
+ return `//${record.cname}`;
397
+ }
398
+ return `/apps/${record.name}/admin/`;
399
+ };
400
+ const AppVisitor = () => {
401
+ const { t } = usePluginUtils();
402
+ const link = useLink();
403
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: link, target: "_blank", rel: "noreferrer", children: t("View", { ns: "client" }) });
404
+ };
405
+ const AppManager = () => {
406
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Card, { bordered: false, children: /* @__PURE__ */ jsxRuntimeExports.jsx(client.SchemaComponent, { schema, components: { AppVisitor } }) });
407
+ };
408
+ const ReadPretty = (props) => {
409
+ const content = props.value && /* @__PURE__ */ jsxRuntimeExports.jsx("a", { target: "_blank", href: `/apps/${props.value}/admin`, rel: "noreferrer", children: props.value });
410
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: props.style, children: [
411
+ props.addonBefore,
412
+ props.prefix,
413
+ content,
414
+ props.suffix,
415
+ props.addonAfter
416
+ ] });
417
+ };
418
+ const AppNameInput = react.connect(antd.Input, react.mapReadPretty(ReadPretty));
419
+ const MultiAppManager = () => {
420
+ const { data, run } = client.useRequest(
421
+ {
422
+ resource: "applications",
423
+ action: "listPinned"
424
+ },
425
+ {
426
+ manual: true
427
+ }
428
+ );
429
+ const { t } = usePluginUtils();
430
+ const items = [
431
+ ...((data == null ? void 0 : data.data) || []).map((app) => {
432
+ var _a;
433
+ let link = `/apps/${app.name}/admin/`;
434
+ if (((_a = app.options) == null ? void 0 : _a.standaloneDeployment) && app.cname) {
435
+ link = `//${app.cname}`;
436
+ }
437
+ return {
438
+ key: app.name,
439
+ label: /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: link, target: "_blank", rel: "noopener noreferrer", children: app.displayName || app.name })
440
+ };
441
+ }),
442
+ {
443
+ key: ".manager",
444
+ label: /* @__PURE__ */ jsxRuntimeExports.jsx(reactRouterDom.Link, { to: "/admin/settings/multi-app-manager/applications", children: t("Manage applications") })
445
+ }
446
+ ];
447
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
448
+ antd.Dropdown,
449
+ {
450
+ onOpenChange: (visible) => {
451
+ run();
452
+ },
453
+ menu: { items },
454
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Button, { title: "Apps", icon: /* @__PURE__ */ jsxRuntimeExports.jsx(client.Icon, { type: "AppstoreOutlined" }) })
455
+ }
456
+ );
457
+ };
458
+ const MultiAppManagerProvider = (props) => {
459
+ const { t } = usePluginUtils();
460
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
461
+ client.PinnedPluginListProvider,
462
+ {
463
+ items: {
464
+ am: { order: 201, component: "MultiAppManager", pin: true }
465
+ },
466
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(client.SchemaComponentOptions, { components: { MultiAppManager, AppNameInput }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
467
+ client.SettingsCenterProvider,
468
+ {
469
+ settings: {
470
+ "multi-app-manager": {
471
+ title: t("Multi-app manager"),
472
+ icon: "AppstoreOutlined",
473
+ tabs: {
474
+ applications: {
475
+ title: t("Applications"),
476
+ component: () => /* @__PURE__ */ jsxRuntimeExports.jsx(AppManager, {})
477
+ }
478
+ // settings: {
479
+ // title: 'Settings',
480
+ // component: () => <Settings />,
481
+ // },
482
+ }
483
+ }
484
+ },
485
+ children: props.children
486
+ }
487
+ ) })
488
+ }
489
+ );
490
+ };
491
+ class MultiAppManagerPlugin extends client.Plugin {
492
+ async load() {
493
+ this.app.use(MultiAppManagerProvider);
494
+ }
495
+ }
496
+ exports2.MultiAppManagerPlugin = MultiAppManagerPlugin;
497
+ exports2.default = MultiAppManagerPlugin;
498
+ exports2.tableActionColumnSchema = tableActionColumnSchema;
499
+ Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
500
+ });
@@ -1 +1,2 @@
1
+ export * from './server';
1
2
  export { default } from './server';
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var server = require('./server');
6
+
7
+
8
+
9
+ Object.defineProperty(exports, 'default', {
10
+ enumerable: true,
11
+ get: function () { return server__namespace.default; }
12
+ });
13
+ Object.keys(server).forEach(function (k) {
14
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
15
+ enumerable: true,
16
+ get: function () { return server[k]; }
17
+ });
18
+ });
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ var es_ES_default = {
4
+ "Multi-app manager": "Gestor de aplicaciones m\xFAltiples",
5
+ Applications: "Aplicaciones",
6
+ "App display name": "Mostrar nombre de aplicaci\xF3n",
7
+ "App ID": "ID de aplicaci\xF3n",
8
+ "Pin to menu": " Fijar al men\xFA",
9
+ "Custom domain": "Dominio personalizado",
10
+ "Manage applications": "Gestionar aplicaciones"
11
+ };
12
+
13
+ module.exports = es_ES_default;
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ var pt_BR_default = {
4
+ "Multi-app manager": "Gerenciador de aplicativos m\xFAltiplos",
5
+ Applications: "Aplicativos",
6
+ "App display name": "Nome de exibi\xE7\xE3o do aplicativo",
7
+ "App ID": "ID do aplicativo",
8
+ "Pin to menu": "Fixar no menu",
9
+ "Custom domain": "Dom\xEDnio personalizado",
10
+ "Manage applications": "Gerenciar aplicativos"
11
+ };
12
+
13
+ module.exports = pt_BR_default;
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ var zh_CN_default = {
4
+ "Multi-app manager": "\u591A\u5E94\u7528\u7BA1\u7406",
5
+ Applications: "\u5E94\u7528",
6
+ "App display name": "\u5E94\u7528\u540D\u79F0",
7
+ "App ID": "\u5E94\u7528\u6807\u8BC6",
8
+ "Pin to menu": "\u5728\u83DC\u5355\u4E0A\u663E\u793A",
9
+ "Custom domain": "\u81EA\u5B9A\u4E49\u57DF\u540D",
10
+ "Manage applications": "\u7BA1\u7406\u5E94\u7528",
11
+ "Standalone deployment": "\u72EC\u7ACB\u90E8\u7F72",
12
+ "Auto start": "\u81EA\u52A8\u542F\u52A8"
13
+ };
14
+
15
+ module.exports = zh_CN_default;
@@ -0,0 +1,49 @@
1
+ 'use strict';
2
+
3
+ var database = require('@nocobase/database');
4
+
5
+ var applications_default = database.defineCollection({
6
+ namespace: "multi-app-manager.multi-apps",
7
+ duplicator: "optional",
8
+ name: "applications",
9
+ model: "ApplicationModel",
10
+ autoGenId: false,
11
+ title: '{{t("Applications")}}',
12
+ sortable: "sort",
13
+ filterTargetKey: "name",
14
+ fields: [
15
+ {
16
+ type: "uid",
17
+ name: "name",
18
+ primaryKey: true
19
+ },
20
+ {
21
+ type: "string",
22
+ name: "displayName"
23
+ },
24
+ {
25
+ type: "string",
26
+ name: "cname",
27
+ unique: true
28
+ },
29
+ {
30
+ type: "boolean",
31
+ name: "pinned"
32
+ },
33
+ {
34
+ type: "string",
35
+ name: "icon"
36
+ },
37
+ {
38
+ type: "string",
39
+ name: "status",
40
+ defaultValue: "pending"
41
+ },
42
+ {
43
+ type: "json",
44
+ name: "options"
45
+ }
46
+ ]
47
+ });
48
+
49
+ module.exports = applications_default;
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var application = require('./models/application');
6
+ var server = require('./server');
7
+
8
+
9
+
10
+ Object.defineProperty(exports, 'ApplicationModel', {
11
+ enumerable: true,
12
+ get: function () { return application.ApplicationModel; }
13
+ });
14
+ Object.defineProperty(exports, 'registerAppOptions', {
15
+ enumerable: true,
16
+ get: function () { return application.registerAppOptions; }
17
+ });
18
+ Object.defineProperty(exports, 'default', {
19
+ enumerable: true,
20
+ get: function () { return server.PluginMultiAppManager; }
21
+ });
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ var database = require('@nocobase/database');
4
+ var server = require('@nocobase/server');
5
+
6
+ class ApplicationModel extends database.Model {
7
+ registerToMainApp(mainApp, options) {
8
+ const appName = this.get("name");
9
+ const appOptions = this.get("options") || {};
10
+ const subAppOptions = {
11
+ ...options.appOptionsFactory(appName, mainApp),
12
+ ...appOptions,
13
+ name: appName
14
+ };
15
+ const subApp = new server.Application(subAppOptions);
16
+ mainApp.appManager.addSubApp(subApp);
17
+ console.log(`register application ${appName} to main app`);
18
+ return subApp;
19
+ }
20
+ }
21
+
22
+ exports.ApplicationModel = ApplicationModel;