@nocobase/plugin-multi-app-manager 0.13.0-alpha.4 → 0.13.0-alpha.5

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.
@@ -1,517 +1 @@
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: "Initializing", value: "initializing" },
92
- { label: "Initialized", value: "initialized" },
93
- { label: "Running", value: "running" },
94
- { label: "Commanding", value: "commanding" },
95
- { label: "Stopped", value: "stopped" },
96
- { label: "Error", value: "error" },
97
- { label: "Not found", value: "not_found" }
98
- ],
99
- "x-component": "Radio.Group"
100
- }
101
- }
102
- ]
103
- };
104
- const useDestroyAll = () => {
105
- const { state, setState, refresh } = client.useResourceActionContext();
106
- const { resource } = client.useResourceContext();
107
- return {
108
- async run() {
109
- await resource.destroy({
110
- filterByTk: (state == null ? void 0 : state.selectedRowKeys) || []
111
- });
112
- setState == null ? void 0 : setState({ selectedRowKeys: [] });
113
- refresh();
114
- }
115
- };
116
- };
117
- const tableActionColumnSchema = {
118
- properties: {
119
- view: {
120
- type: "void",
121
- "x-component": "AppVisitor",
122
- "x-component-props": {}
123
- },
124
- update: {
125
- type: "void",
126
- title: '{{t("Edit")}}',
127
- "x-component": "Action.Link",
128
- "x-component-props": {},
129
- properties: {
130
- drawer: {
131
- type: "void",
132
- "x-component": "Action.Drawer",
133
- "x-decorator": "Form",
134
- "x-decorator-props": {
135
- useValues: "{{ cm.useValuesFromRecord }}"
136
- },
137
- title: '{{t("Edit")}}',
138
- properties: {
139
- displayName: {
140
- "x-component": "CollectionField",
141
- "x-decorator": "FormItem"
142
- },
143
- pinned: {
144
- "x-component": "CollectionField",
145
- "x-decorator": "FormItem"
146
- },
147
- "options.standaloneDeployment": {
148
- "x-component": "Checkbox",
149
- "x-decorator": "FormItem",
150
- "x-content": i18nText("Standalone deployment")
151
- },
152
- "options.autoStart": {
153
- "x-component": "Checkbox",
154
- "x-decorator": "FormItem",
155
- "x-content": i18nText("Auto start")
156
- },
157
- cname: {
158
- title: i18nText("Custom domain"),
159
- "x-component": "Input",
160
- "x-decorator": "FormItem"
161
- },
162
- footer: {
163
- type: "void",
164
- "x-component": "Action.Drawer.Footer",
165
- properties: {
166
- cancel: {
167
- title: '{{t("Cancel")}}',
168
- "x-component": "Action",
169
- "x-component-props": {
170
- useAction: "{{ cm.useCancelAction }}"
171
- }
172
- },
173
- submit: {
174
- title: '{{t("Submit")}}',
175
- "x-component": "Action",
176
- "x-component-props": {
177
- type: "primary",
178
- useAction: "{{ cm.useUpdateAction }}"
179
- }
180
- }
181
- }
182
- }
183
- }
184
- }
185
- }
186
- },
187
- delete: {
188
- type: "void",
189
- title: '{{ t("Delete") }}',
190
- "x-component": "Action.Link",
191
- "x-component-props": {
192
- confirm: {
193
- title: "{{t('Delete')}}",
194
- content: "{{t('Are you sure you want to delete it?')}}"
195
- },
196
- useAction: "{{cm.useDestroyAction}}"
197
- }
198
- }
199
- }
200
- };
201
- const schema = {
202
- type: "object",
203
- properties: {
204
- [shared.uid()]: {
205
- type: "void",
206
- "x-decorator": "ResourceActionProvider",
207
- "x-decorator-props": {
208
- collection,
209
- resourceName: "applications",
210
- request: {
211
- resource: "applications",
212
- action: "list",
213
- params: {
214
- pageSize: 50,
215
- sort: ["-createdAt"],
216
- appends: []
217
- }
218
- }
219
- },
220
- "x-component": "CollectionProvider",
221
- "x-component-props": {
222
- collection
223
- },
224
- properties: {
225
- actions: {
226
- type: "void",
227
- "x-component": "ActionBar",
228
- "x-component-props": {
229
- style: {
230
- marginBottom: 16
231
- }
232
- },
233
- properties: {
234
- delete: {
235
- type: "void",
236
- title: '{{ t("Delete") }}',
237
- "x-component": "Action",
238
- "x-component-props": {
239
- useAction: useDestroyAll,
240
- confirm: {
241
- title: "{{t('Delete')}}",
242
- content: "{{t('Are you sure you want to delete it?')}}"
243
- }
244
- }
245
- },
246
- create: {
247
- type: "void",
248
- title: '{{t("Add new")}}',
249
- "x-component": "Action",
250
- "x-component-props": {
251
- type: "primary"
252
- },
253
- properties: {
254
- drawer: {
255
- type: "void",
256
- "x-component": "Action.Drawer",
257
- "x-decorator": "Form",
258
- "x-decorator-props": {
259
- useValues(options) {
260
- const ctx = client.useActionContext();
261
- return client.useRequest(
262
- () => Promise.resolve({
263
- data: {
264
- name: `a_${shared.uid()}`
265
- }
266
- }),
267
- { ...options, refreshDeps: [ctx.visible] }
268
- );
269
- }
270
- },
271
- title: '{{t("Add new")}}',
272
- properties: {
273
- displayName: {
274
- "x-component": "CollectionField",
275
- "x-decorator": "FormItem"
276
- },
277
- name: {
278
- "x-component": "CollectionField",
279
- "x-decorator": "FormItem"
280
- },
281
- pinned: {
282
- "x-component": "CollectionField",
283
- "x-decorator": "FormItem"
284
- },
285
- "options.standaloneDeployment": {
286
- "x-component": "Checkbox",
287
- "x-decorator": "FormItem",
288
- "x-content": i18nText("Standalone deployment")
289
- },
290
- "options.autoStart": {
291
- "x-component": "Checkbox",
292
- "x-decorator": "FormItem",
293
- "x-content": i18nText("Auto start")
294
- },
295
- cname: {
296
- title: i18nText("Custom domain"),
297
- "x-component": "Input",
298
- "x-decorator": "FormItem"
299
- },
300
- footer: {
301
- type: "void",
302
- "x-component": "Action.Drawer.Footer",
303
- properties: {
304
- cancel: {
305
- title: '{{t("Cancel")}}',
306
- "x-component": "Action",
307
- "x-component-props": {
308
- useAction: "{{ cm.useCancelAction }}"
309
- }
310
- },
311
- submit: {
312
- title: '{{t("Submit")}}',
313
- "x-component": "Action",
314
- "x-component-props": {
315
- type: "primary",
316
- useAction: "{{ cm.useCreateAction }}"
317
- }
318
- }
319
- }
320
- }
321
- }
322
- }
323
- }
324
- }
325
- }
326
- },
327
- table: {
328
- type: "void",
329
- "x-uid": "input",
330
- "x-component": "Table.Void",
331
- "x-component-props": {
332
- rowKey: "name",
333
- rowSelection: {
334
- type: "checkbox"
335
- },
336
- useDataSource: "{{ cm.useDataSourceFromRAC }}"
337
- },
338
- properties: {
339
- displayName: {
340
- type: "void",
341
- "x-decorator": "Table.Column.Decorator",
342
- "x-component": "Table.Column",
343
- properties: {
344
- displayName: {
345
- type: "string",
346
- "x-component": "CollectionField",
347
- "x-read-pretty": true
348
- }
349
- }
350
- },
351
- name: {
352
- type: "void",
353
- "x-decorator": "Table.Column.Decorator",
354
- "x-component": "Table.Column",
355
- properties: {
356
- name: {
357
- type: "string",
358
- "x-component": "CollectionField",
359
- "x-read-pretty": true
360
- }
361
- }
362
- },
363
- pinned: {
364
- type: "void",
365
- title: i18nText("Pin to menu"),
366
- "x-decorator": "Table.Column.Decorator",
367
- "x-component": "Table.Column",
368
- properties: {
369
- pinned: {
370
- type: "string",
371
- "x-component": "CollectionField",
372
- "x-read-pretty": true
373
- }
374
- }
375
- },
376
- status: {
377
- type: "void",
378
- "x-decorator": "Table.Column.Decorator",
379
- "x-component": "Table.Column",
380
- properties: {
381
- status: {
382
- type: "string",
383
- "x-component": "CollectionField",
384
- "x-read-pretty": true
385
- }
386
- }
387
- },
388
- actions: {
389
- type: "void",
390
- title: '{{t("Actions")}}',
391
- "x-component": "Table.Column",
392
- properties: {
393
- actions: {
394
- type: "void",
395
- "x-component": "Space",
396
- "x-component-props": {
397
- split: "|"
398
- },
399
- ...tableActionColumnSchema
400
- }
401
- }
402
- }
403
- }
404
- }
405
- }
406
- }
407
- }
408
- };
409
- const useLink = () => {
410
- var _a;
411
- const record = client.useRecord();
412
- if (((_a = record.options) == null ? void 0 : _a.standaloneDeployment) && record.cname) {
413
- return `//${record.cname}`;
414
- }
415
- return `/apps/${record.name}/admin/`;
416
- };
417
- const AppVisitor = () => {
418
- const { t } = usePluginUtils();
419
- const link = useLink();
420
- return /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: link, target: "_blank", rel: "noreferrer", children: t("View", { ns: "client" }) });
421
- };
422
- const AppManager = () => {
423
- return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Card, { bordered: false, children: /* @__PURE__ */ jsxRuntimeExports.jsx(client.SchemaComponent, { schema, components: { AppVisitor } }) });
424
- };
425
- const ReadPretty = (props) => {
426
- const content = props.value && /* @__PURE__ */ jsxRuntimeExports.jsx("a", { target: "_blank", href: `/apps/${props.value}/admin`, rel: "noreferrer", children: props.value });
427
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: props.style, children: [
428
- props.addonBefore,
429
- props.prefix,
430
- content,
431
- props.suffix,
432
- props.addonAfter
433
- ] });
434
- };
435
- const AppNameInput = react.connect(antd.Input, react.mapReadPretty(ReadPretty));
436
- const MultiAppManager = () => {
437
- const { data, run } = client.useRequest(
438
- {
439
- resource: "applications",
440
- action: "listPinned"
441
- },
442
- {
443
- manual: true
444
- }
445
- );
446
- const { t } = usePluginUtils();
447
- const items = [
448
- ...((data == null ? void 0 : data.data) || []).map((app) => {
449
- var _a;
450
- let link = `/apps/${app.name}/admin/`;
451
- if (((_a = app.options) == null ? void 0 : _a.standaloneDeployment) && app.cname) {
452
- link = `//${app.cname}`;
453
- }
454
- return {
455
- key: app.name,
456
- label: /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: link, target: "_blank", rel: "noopener noreferrer", children: app.displayName || app.name })
457
- };
458
- }),
459
- {
460
- key: ".manager",
461
- label: /* @__PURE__ */ jsxRuntimeExports.jsx(reactRouterDom.Link, { to: "/admin/settings/multi-app-manager/applications", children: t("Manage applications") })
462
- }
463
- ];
464
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
465
- antd.Dropdown,
466
- {
467
- onOpenChange: (visible) => {
468
- run();
469
- },
470
- menu: { items },
471
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Button, { title: "Apps", icon: /* @__PURE__ */ jsxRuntimeExports.jsx(client.Icon, { type: "AppstoreOutlined" }) })
472
- }
473
- );
474
- };
475
- const MultiAppManagerProvider = (props) => {
476
- const { t } = usePluginUtils();
477
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
478
- client.PinnedPluginListProvider,
479
- {
480
- items: {
481
- am: { order: 201, component: "MultiAppManager", pin: true }
482
- },
483
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(client.SchemaComponentOptions, { components: { MultiAppManager, AppNameInput }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
484
- client.SettingsCenterProvider,
485
- {
486
- settings: {
487
- "multi-app-manager": {
488
- title: t("Multi-app manager"),
489
- icon: "AppstoreOutlined",
490
- tabs: {
491
- applications: {
492
- title: t("Applications"),
493
- component: () => /* @__PURE__ */ jsxRuntimeExports.jsx(AppManager, {})
494
- }
495
- // settings: {
496
- // title: 'Settings',
497
- // component: () => <Settings />,
498
- // },
499
- }
500
- }
501
- },
502
- children: props.children
503
- }
504
- ) })
505
- }
506
- );
507
- };
508
- class MultiAppManagerPlugin extends client.Plugin {
509
- async load() {
510
- this.app.use(MultiAppManagerProvider);
511
- }
512
- }
513
- exports2.MultiAppManagerPlugin = MultiAppManagerPlugin;
514
- exports2.default = MultiAppManagerPlugin;
515
- exports2.tableActionColumnSchema = tableActionColumnSchema;
516
- Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
517
- });
1
+ (function(n,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@nocobase/client"),require("react/jsx-runtime"),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/jsx-runtime","antd","react-router-dom","@formily/shared","react-i18next","@formily/react"],t):(n=typeof globalThis!="undefined"?globalThis:n||self,t(n["@nocobase/plugin-multi-app-manager"]={},n["@nocobase/client"],n.jsxRuntime,n.antd,n["react-router-dom"],n["@formily/shared"],n["react-i18next"],n["@formily/react"]))})(this,function(n,t,o,c,l,m,d,s){"use strict";var V=Object.defineProperty,j=Object.defineProperties;var _=Object.getOwnPropertyDescriptors;var h=Object.getOwnPropertySymbols;var $=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var F=(n,t,o)=>t in n?V(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,y=(n,t)=>{for(var o in t||(t={}))$.call(t,o)&&F(n,o,t[o]);if(h)for(var o of h(t))z.call(t,o)&&F(n,o,t[o]);return n},D=(n,t)=>j(n,_(t));var A=(n,t,o)=>new Promise((c,l)=>{var m=a=>{try{s(o.next(a))}catch(i){l(i)}},d=a=>{try{s(o.throw(a))}catch(i){l(i)}},s=a=>a.done?c(a.value):Promise.resolve(a.value).then(m,d);s((o=o.apply(n,t)).next())});const a=()=>{const{t:e}=d.useTranslation("multi-app-manager");return{t:e}},i=e=>`{{t("${e}", { ns: 'multi-app-manager' })}}`,f={name:"applications",targetKey:"name",fields:[{type:"uid",name:"name",primaryKey:!0,prefix:"a",interface:"input",uiSchema:{type:"string",title:i("App ID"),required:!0,"x-component":"Input","x-validator":"uid"}},{type:"string",name:"displayName",interface:"input",uiSchema:{type:"string",title:i("App display name"),required:!0,"x-component":"Input"}},{type:"string",name:"pinned",interface:"checkbox",uiSchema:{type:"boolean","x-content":i("Pin to menu"),"x-component":"Checkbox"}},{type:"string",name:"status",interface:"radioGroup",defaultValue:"pending",uiSchema:{type:"string",title:i("App status"),enum:[{label:"Initializing",value:"initializing"},{label:"Initialized",value:"initialized"},{label:"Running",value:"running"},{label:"Commanding",value:"commanding"},{label:"Stopped",value:"stopped"},{label:"Error",value:"error"},{label:"Not found",value:"not_found"}],"x-component":"Radio.Group"}}]},S=()=>{const{state:e,setState:r,refresh:u}=t.useResourceActionContext(),{resource:x}=t.useResourceContext();return{run(){return A(this,null,function*(){yield x.destroy({filterByTk:(e==null?void 0:e.selectedRowKeys)||[]}),r==null||r({selectedRowKeys:[]}),u()})}}},C={properties:{view:{type:"void","x-component":"AppVisitor","x-component-props":{}},update:{type:"void",title:'{{t("Edit")}}',"x-component":"Action.Link","x-component-props":{},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ cm.useValuesFromRecord }}"},title:'{{t("Edit")}}',properties:{displayName:{"x-component":"CollectionField","x-decorator":"FormItem"},pinned:{"x-component":"CollectionField","x-decorator":"FormItem"},"options.standaloneDeployment":{"x-component":"Checkbox","x-decorator":"FormItem","x-content":i("Standalone deployment")},"options.autoStart":{"x-component":"Checkbox","x-decorator":"FormItem","x-content":i("Auto start")},cname:{title:i("Custom domain"),"x-component":"Input","x-decorator":"FormItem"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{cm.useDestroyAction}}"}}}},I={type:"object",properties:{[m.uid()]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:f,resourceName:"applications",request:{resource:"applications",action:"list",params:{pageSize:50,sort:["-createdAt"],appends:[]}}},"x-component":"CollectionProvider","x-component-props":{collection:f},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-component-props":{useAction:S,confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"Action","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues(e){const r=t.useActionContext();return t.useRequest(()=>Promise.resolve({data:{name:`a_${m.uid()}`}}),D(y({},e),{refreshDeps:[r.visible]}))}},title:'{{t("Add new")}}',properties:{displayName:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem"},pinned:{"x-component":"CollectionField","x-decorator":"FormItem"},"options.standaloneDeployment":{"x-component":"Checkbox","x-decorator":"FormItem","x-content":i("Standalone deployment")},"options.autoStart":{"x-component":"Checkbox","x-decorator":"FormItem","x-content":i("Auto start")},cname:{title:i("Custom domain"),"x-component":"Input","x-decorator":"FormItem"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}"}}}}}}}}}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"name",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{displayName:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{displayName:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},name:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},pinned:{type:"void",title:i("Pin to menu"),"x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{pinned:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},status:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{status:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:y({type:"void","x-component":"Space","x-component-props":{split:"|"}},C)}}}}}}}},k=()=>{var r;const e=t.useRecord();return(r=e.options)!=null&&r.standaloneDeployment&&e.cname?`//${e.cname}`:`/apps/${e.name}/admin/`},w=()=>{const{t:e}=a(),r=k();return o.jsx("a",{href:r,target:"_blank",rel:"noreferrer",children:e("View",{ns:"client"})})},P=()=>o.jsx(c.Card,{bordered:!1,children:o.jsx(t.SchemaComponent,{schema:I,components:{AppVisitor:w}})}),T=e=>{const r=e.value&&o.jsx("a",{target:"_blank",href:`/apps/${e.value}/admin`,rel:"noreferrer",children:e.value});return o.jsxs("div",{style:e.style,children:[e.addonBefore,e.prefix,r,e.suffix,e.addonAfter]})},M=s.connect(c.Input,s.mapReadPretty(T)),q=()=>{const{data:e,run:r}=t.useRequest({resource:"applications",action:"listPinned"},{manual:!0}),{t:u}=a(),x=[...((e==null?void 0:e.data)||[]).map(p=>{var v;let g=`/apps/${p.name}/admin/`;return(v=p.options)!=null&&v.standaloneDeployment&&p.cname&&(g=`//${p.cname}`),{key:p.name,label:o.jsx("a",{href:g,target:"_blank",rel:"noopener noreferrer",children:p.displayName||p.name})}}),{key:".manager",label:o.jsx(l.Link,{to:"/admin/settings/multi-app-manager/applications",children:u("Manage applications")})}];return o.jsx(c.Dropdown,{onOpenChange:p=>{r()},menu:{items:x},children:o.jsx(c.Button,{title:"Apps",icon:o.jsx(t.Icon,{type:"AppstoreOutlined"})})})},N=e=>{const{t:r}=a();return o.jsx(t.PinnedPluginListProvider,{items:{am:{order:201,component:"MultiAppManager",pin:!0}},children:o.jsx(t.SchemaComponentOptions,{components:{MultiAppManager:q,AppNameInput:M},children:o.jsx(t.SettingsCenterProvider,{settings:{"multi-app-manager":{title:r("Multi-app manager"),icon:"AppstoreOutlined",tabs:{applications:{title:r("Applications"),component:()=>o.jsx(P,{})}}}},children:e.children})})})};class b extends t.Plugin{load(){return A(this,null,function*(){this.app.use(N)})}}n.MultiAppManagerPlugin=b,n.default=b,n.tableActionColumnSchema=C,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/dist/index.js CHANGED
@@ -1,18 +1,39 @@
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; }
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var src_exports = {};
30
+ __export(src_exports, {
31
+ default: () => import_server.default
12
32
  });
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
- });
33
+ module.exports = __toCommonJS(src_exports);
34
+ __reExport(src_exports, require("./server"), module.exports);
35
+ var import_server = __toESM(require("./server"));
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ ...require("./server")
18
39
  });
@@ -1,5 +1,25 @@
1
- 'use strict';
2
-
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var es_ES_exports = {};
19
+ __export(es_ES_exports, {
20
+ default: () => es_ES_default
21
+ });
22
+ module.exports = __toCommonJS(es_ES_exports);
3
23
  var es_ES_default = {
4
24
  "Multi-app manager": "Gestor de aplicaciones m\xFAltiples",
5
25
  Applications: "Aplicaciones",
@@ -9,5 +29,3 @@ var es_ES_default = {
9
29
  "Custom domain": "Dominio personalizado",
10
30
  "Manage applications": "Gestionar aplicaciones"
11
31
  };
12
-
13
- module.exports = es_ES_default;
@@ -1,5 +1,25 @@
1
- 'use strict';
2
-
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var pt_BR_exports = {};
19
+ __export(pt_BR_exports, {
20
+ default: () => pt_BR_default
21
+ });
22
+ module.exports = __toCommonJS(pt_BR_exports);
3
23
  var pt_BR_default = {
4
24
  "Multi-app manager": "Gerenciador de aplicativos m\xFAltiplos",
5
25
  Applications: "Aplicativos",
@@ -9,5 +29,3 @@ var pt_BR_default = {
9
29
  "Custom domain": "Dom\xEDnio personalizado",
10
30
  "Manage applications": "Gerenciar aplicativos"
11
31
  };
12
-
13
- module.exports = pt_BR_default;