@tachybase/module-multi-app 0.23.58 → 1.0.6

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 (39) hide show
  1. package/dist/client/base/collections/collectionMultiApp.d.ts +73 -0
  2. package/dist/client/base/kit.d.ts +5 -0
  3. package/dist/client/base/schemas/schemaForm.d.ts +2 -0
  4. package/dist/client/{settings/schemas/applications.d.ts → base/schemas/schemaTableActionColumn.d.ts} +0 -2
  5. package/dist/client/index.d.ts +3 -6
  6. package/dist/client/index.js +12 -1
  7. package/dist/client/plugin.d.ts +4 -0
  8. package/dist/client/system/AppManager.schema.d.ts +2 -0
  9. package/dist/client/system/hooks/useCreateDatabaseConnectionAction.d.ts +3 -0
  10. package/dist/client/system/hooks/useMultiAppUpdateAction.d.ts +3 -0
  11. package/dist/client/system/hooks/useRouteUrl.d.ts +4 -0
  12. package/dist/client/system/hooks/useStartAllAction.d.ts +3 -0
  13. package/dist/client/system/hooks/useStopAllAction.d.ts +3 -0
  14. package/dist/client/system/kit.d.ts +5 -0
  15. package/dist/client/usage/AppList.d.ts +1 -0
  16. package/dist/client/usage/AppList.style.d.ts +3 -0
  17. package/dist/client/usage/MultiAppBlockInitializer.schema.d.ts +15 -0
  18. package/dist/client/usage/ShowMultiAppBlockInitializer.d.ts +1 -0
  19. package/dist/client/usage/ShowMultiAppBlockInitializer.schema.d.ts +15 -0
  20. package/dist/client/usage/ViewMultiAppPane.d.ts +1 -0
  21. package/dist/client/usage/ViewMultiAppPane.schema.d.ts +94 -0
  22. package/dist/client/usage/kit.d.ts +5 -0
  23. package/dist/externalVersion.js +10 -10
  24. package/dist/locale/en-US.json +4 -0
  25. package/dist/locale/zh-CN.json +4 -0
  26. package/dist/node_modules/mariadb/package.json +1 -1
  27. package/dist/node_modules/qs/package.json +1 -1
  28. package/dist/server/actions/apps.js +1 -1
  29. package/dist/server/collections/applications.js +7 -1
  30. package/dist/server/server.js +1 -2
  31. package/package.json +9 -9
  32. package/dist/client/Settings.d.ts +0 -1
  33. package/dist/client/hooks/index.d.ts +0 -12
  34. /package/dist/client/{AppNameInput.d.ts → base/AppNameInput.d.ts} +0 -0
  35. /package/dist/client/{MultiAppManagerProvider.d.ts → base/MultiAppManagerProvider.d.ts} +0 -0
  36. /package/dist/client/{MultiAppManagerProvider.style.d.ts → base/MultiAppManagerProvider.style.d.ts} +0 -0
  37. /package/dist/client/{utils.d.ts → locale.d.ts} +0 -0
  38. /package/dist/client/{AppManager.d.ts → system/AppManager.d.ts} +0 -0
  39. /package/dist/client/{MultiAppBlockInitializer.d.ts → usage/MultiAppBlockInitializer.d.ts} +0 -0
@@ -0,0 +1,73 @@
1
+ export declare const collectionMultiApp: {
2
+ name: string;
3
+ filterTargetKey: string;
4
+ targetKey: string;
5
+ fields: ({
6
+ type: string;
7
+ name: string;
8
+ primaryKey: boolean;
9
+ prefix: string;
10
+ interface: string;
11
+ uiSchema: {
12
+ type: string;
13
+ title: string;
14
+ required: boolean;
15
+ 'x-component': string;
16
+ 'x-validator': string;
17
+ 'x-content'?: undefined;
18
+ enum?: undefined;
19
+ };
20
+ defaultValue?: undefined;
21
+ } | {
22
+ type: string;
23
+ name: string;
24
+ interface: string;
25
+ uiSchema: {
26
+ type: string;
27
+ title: string;
28
+ required: boolean;
29
+ 'x-component': string;
30
+ 'x-validator'?: undefined;
31
+ 'x-content'?: undefined;
32
+ enum?: undefined;
33
+ };
34
+ primaryKey?: undefined;
35
+ prefix?: undefined;
36
+ defaultValue?: undefined;
37
+ } | {
38
+ type: string;
39
+ name: string;
40
+ interface: string;
41
+ uiSchema: {
42
+ type: string;
43
+ 'x-content': string;
44
+ 'x-component': string;
45
+ title?: undefined;
46
+ required?: undefined;
47
+ 'x-validator'?: undefined;
48
+ enum?: undefined;
49
+ };
50
+ primaryKey?: undefined;
51
+ prefix?: undefined;
52
+ defaultValue?: undefined;
53
+ } | {
54
+ type: string;
55
+ name: string;
56
+ interface: string;
57
+ defaultValue: string;
58
+ uiSchema: {
59
+ type: string;
60
+ title: string;
61
+ enum: {
62
+ label: string;
63
+ value: string;
64
+ }[];
65
+ 'x-component': string;
66
+ required?: undefined;
67
+ 'x-validator'?: undefined;
68
+ 'x-content'?: undefined;
69
+ };
70
+ primaryKey?: undefined;
71
+ prefix?: undefined;
72
+ })[];
73
+ };
@@ -0,0 +1,5 @@
1
+ import { Plugin } from '@tachybase/client';
2
+ /** 基础机制设置部分 */
3
+ export declare class KitBase extends Plugin {
4
+ load(): Promise<void>;
5
+ }
@@ -0,0 +1,2 @@
1
+ import { ISchema } from '@tachybase/schema';
2
+ export declare const formSchema: ISchema;
@@ -1,4 +1,2 @@
1
1
  import { ISchema } from '@tachybase/schema';
2
- export declare const formSchema: ISchema;
3
2
  export declare const tableActionColumnSchema: ISchema;
4
- export declare const schema: ISchema;
@@ -1,6 +1,3 @@
1
- import { Plugin } from '@tachybase/client';
2
- export declare class MultiAppManagerPlugin extends Plugin {
3
- load(): Promise<void>;
4
- }
5
- export default MultiAppManagerPlugin;
6
- export { formSchema, tableActionColumnSchema } from './settings/schemas/applications';
1
+ export { default } from './plugin';
2
+ export { formSchema } from './base/schemas/schemaForm';
3
+ export { tableActionColumnSchema } from './base/schemas/schemaTableActionColumn';
@@ -1 +1,12 @@
1
- (function(a,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("react/jsx-runtime"),require("@tachybase/client"),require("@ant-design/icons"),require("react"),require("antd"),require("@tachybase/schema"),require("react-i18next"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@tachybase/client","@ant-design/icons","react","antd","@tachybase/schema","react-i18next","react-router-dom"],e):(a=typeof globalThis!="undefined"?globalThis:a||self,e(a["@tachybase/module-multi-app"]={},a.jsxRuntime,a["@tachybase/client"],a["@ant-design/icons"],a.react,a.antd,a["@tachybase/schema"],a["react-i18next"],a["react-router-dom"]))})(this,function(a,e,o,A,v,r,x,b,y){"use strict";var X=Object.defineProperty,Z=Object.defineProperties;var R=Object.getOwnPropertyDescriptors;var O=Object.getOwnPropertySymbols;var ee=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable;var V=(a,e,o)=>e in a?X(a,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[e]=o,C=(a,e)=>{for(var o in e||(e={}))ee.call(e,o)&&V(a,o,e[o]);if(O)for(var o of O(e))te.call(e,o)&&V(a,o,e[o]);return a},I=(a,e)=>Z(a,R(e));var g=(a,e,o)=>new Promise((A,v)=>{var r=y=>{try{b(o.next(y))}catch(m){v(m)}},x=y=>{try{b(o.throw(y))}catch(m){v(m)}},b=y=>y.done?A(y.value):Promise.resolve(y.value).then(r,x);b((o=o.apply(a,e)).next())});const m="multi-app",z="subAppsChange",f="subAppsChange",S=()=>{const{t}=b.useTranslation([m,"core"]);return{t}},s=t=>`{{t("${t}", { ns: ["${m}", "client"] })}}`,N=()=>{const t=x.useForm(),n=x.useField(),c=o.useActionContext(),p=o.useDataBlockRequest(),i=o.useDataBlockResource();return{onClick(){return g(this,null,function*(){try{yield t.submit(),n.data=n.data||{},n.data.loading=!0,yield i.create({values:t.values}),c.setVisible(!1),yield t.reset(),n.data.loading=!1,p.refresh()}catch(u){n.data&&(n.data.loading=!1)}})}}},q=t=>{const n=x.useField(),c=x.useForm(),p=o.useActionContext(),i=o.useDataBlockRequest(),d=o.useDataBlockResource(),u=o.useCollectionRecordData(),h=u==null?void 0:u.name;return{onClick(){return g(this,null,function*(){var k;yield c.submit(),n.data=n.data||{},n.data.loading=!0;try{const l=yield d.update({filterByTk:h,values:c.values});p.setVisible(!1),yield c.reset(),i.refresh(),t==null||t(h,(k=l==null?void 0:l.data)==null?void 0:k.data)}catch(l){console.error(l)}finally{n.data.loading=!1}})}}},E=()=>{const t=o.useDataBlockResource(),{t:n}=S();return{onClick(){return g(this,null,function*(){var i,d;const p=yield t.startAll();r.notification.info({key:f,message:e.jsxs("span",{children:[n("Processing..."),"    ",e.jsx(r.Spin,{indicator:e.jsx(A.LoadingOutlined,{style:{fontSize:24},spin:!0})})]}),duration:0}),((d=(i=p==null?void 0:p.data)==null?void 0:i.data)==null?void 0:d.all)===0&&r.notification.info({key:f,message:`${n("Start count")}: 0/0!`})})}}},$=()=>{const t=o.useDataBlockResource(),{t:n}=S();return{onClick(){return g(this,null,function*(){var i,d;const p=yield t.stopAll();if(((d=(i=p==null?void 0:p.data)==null?void 0:i.data)==null?void 0:d.all)===0){r.notification.info({key:f,message:`${n("Stop count")}: 0/0!`});return}r.notification.info({key:f,message:e.jsxs("span",{children:[n("Processing..."),"    ",e.jsx(r.Spin,{indicator:e.jsx(A.LoadingOutlined,{style:{fontSize:24},spin:!0})})]}),duration:0})})}}},_={name:"applications",filterTargetKey:"name",targetKey:"name",fields:[{type:"uid",name:"name",primaryKey:!0,prefix:"a",interface:"input",uiSchema:{type:"string",title:s("App ID"),required:!0,"x-component":"Input","x-validator":"uid"}},{type:"string",name:"displayName",interface:"input",uiSchema:{type:"string",title:s("App display name"),required:!0,"x-component":"Input"}},{type:"string",name:"pinned",interface:"checkbox",uiSchema:{type:"boolean","x-content":s("Pin to menu"),"x-component":"Checkbox"}},{type:"string",name:"status",interface:"radioGroup",defaultValue:"pending",uiSchema:{type:"string",title:s("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"}},{type:"string",name:"isTemplate",interface:"checkbox",uiSchema:{type:"boolean","x-content":s("Is template"),"x-component":"Checkbox"}}]},T={type:"void","x-component":"div",properties:{displayName:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem","x-disabled":"{{ !createOnly }}","x-hidden":"{{ !admin }}"},"options.autoStart":{title:s("Start mode"),"x-component":"Radio.Group","x-decorator":"FormItem",default:!1,enum:[{label:s("Start on first visit"),value:!1},{label:s("Start with main application"),value:!0}],"x-hidden":"{{ !admin }}"},cnamePrefix:{title:s("Custom domain prefix"),"x-component":"Input","x-decorator":"FormItem","x-component-props":{addonAfter:`.${window.location.hostname}`},"x-reactions":{dependencies:["cname"],fulfill:{state:{value:'{{($deps[0] && $deps[0].replace(new RegExp("\\."+window.location.hostname+"$"), "")) || ""}}'}}}},cname:{"x-hidden":!0,"x-component":"Input","x-decorator":"FormItem","x-read-pretty":!0,"x-reactions":{dependencies:["cnamePrefix"],fulfill:{state:{value:`{{$deps[0] ? $deps[0] + ".${window.location.hostname}" : null}}`}}}},tmpl:{title:s("Template"),"x-component":"RemoteSelect","x-component-props":{fieldNames:{label:"displayName",value:"name"},service:{resource:"applications",params:{filter:{$or:[{isTemplate:!0},{createdById:"{{ userId }}"}]}}}},"x-decorator":"FormItem","x-disabled":"{{ !createOnly }}"},"options.startEnvs":{type:"string",title:s("Start environment variables"),"x-component":"Input.TextArea","x-decorator":"FormItem","x-hidden":!0},pinned:{"x-component":"CollectionField","x-decorator":"FormItem","x-hidden":"{{ !admin }}"},isTemplate:{"x-component":"CollectionField","x-decorator":"FormItem","x-hidden":"{{ !admin }}"}}},D={properties:{view:{type:"void","x-component":"AppVisitor","x-component-props":{admin:"{{ admin }}"}},update:{type:"void",title:'{{t("Edit")}}',"x-component":"Action.Link",properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ cm.useValuesFromRecord }}"},title:'{{t("Edit")}}',properties:{formSchema:T,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{t("Submit")}}',"x-action":"submit","x-component":"Action","x-use-component-props":"useMultiAppUpdateAction","x-component-props":{type:"primary"}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-hidden":"{{ !admin }}","x-use-component-props":"useDestroyActionProps","x-component-props":{confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}},L={type:"void",properties:{applicationsTable:{type:"void","x-decorator":"TableBlockProvider","x-decorator-props":{collection:_,action:"list",params:{pageSize:50,sort:["-createdAt"],appends:[],filter:{createdById:"{{ admin ? undefined : userId }}"}},rowKey:"name"},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{refresh:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-action":"destroy","x-component":"Action","x-decorator":"ACLActionProvider","x-use-component-props":"useBulkDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}},"x-hidden":"{{ !admin }}"},startAll:{type:"void",title:'{{ t("Start all") }}',"x-component":"Action","x-use-component-props":"useStartAllAction","x-component-props":{icon:"FastForwardOutlined",danger:!0,confirm:{title:s("Start all"),content:s("Starting all sub-applications may cause lag. The more applications you have, the longer the waiting time")}},"x-hidden":"{{ !admin }}"},stopAll:{type:"void",title:'{{ t("Stop all") }}',"x-component":"Action","x-use-component-props":"useStopAllAction","x-component-props":{icon:"StopOutlined",danger:!0,confirm:{title:s("Stop all"),content:s("All sub-applications have stopped serving, unless you restart them")}},"x-hidden":"{{ !admin }}"},create:{type:"void",title:'{{t("Add new")}}',"x-decorator":t=>v.createElement(o.SchemaComponentOptions,I(C({},t),{scope:{createOnly:!0}})),"x-component":"Action","x-component-props":{type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues(t){const n=o.useActionContext();return o.useRequest(()=>Promise.resolve({data:{name:`a_${x.uid()}`}}),I(C({},t),{refreshDeps:[n.visible]}))}},title:'{{t("Add new")}}',properties:{formSchema:T,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-use-component-props":"useCreateDatabaseConnectionAction","x-component-props":{type:"primary"}}}}}}}}}},table:{type:"array","x-uid":"input","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"name",rowSelection:{type:"checkbox"}},properties:{displayName:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{displayName:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},name:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},pinned:{type:"void",title:s("Pin to menu"),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{pinned:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},isTemplate:{type:"void",title:s("Is template"),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{isTemplate:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},status:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{status:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"TableV2.Column",properties:{actions:C({type:"void","x-component":"Space","x-component-props":{split:"|"}},D)}}}}}}}},K=()=>{const t=o.useCollectionRecordData(),n=o.useApp();return t.cname?`//${t.cname}`:n.getRouteUrl(`/apps/${t.name}/admin/`)},U=()=>{const{t}=S(),n=K(),c=o.useCollectionRecordData(),p=o.useAPIClient(),{data:i,mutate:d,refresh:u}=o.useDataBlockRequest(),h=v.useMemo(()=>p.resource("applications"),[p]),Q=()=>{h.start({filterByTk:c.name}).then(()=>{r.notification.info({key:f,message:e.jsxs("span",{children:[t("Processing..."),"    ",e.jsx(r.Spin,{indicator:e.jsx(A.LoadingOutlined,{style:{fontSize:24},spin:!0})})]}),duration:0})})},k=()=>{h.stop({filterByTk:c.name}).then(()=>{r.notification.info({key:f,message:e.jsxs("span",{children:[t("Processing..."),"    ",e.jsx(r.Spin,{indicator:e.jsx(A.LoadingOutlined,{style:{fontSize:24},spin:!0})})]}),duration:0})})};return o.useNoticeSub(z,l=>{const W=r.notification[l.level]||r.notification.info;if(l.message?W({key:f,message:l.message}):l.status!=="commanding"&&r.notification.destroy(f),!(i!=null&&i.data)||l.refresh){u();return}if(!l.app&&!l.status||!i.data.some(w=>w.name===l.app))return;const B=[...i.data];B.find(w=>w.name===l.app).status=l.status,d({data:B})}),e.jsxs(r.Space,{split:e.jsx(r.Divider,{type:"horizontal"}),children:[e.jsx("a",{href:n,target:"_blank",rel:"noreferrer",children:t("View",{ns:m})}),e.jsx("a",{onClick:()=>Q(),children:t("Start",{ns:m})}),e.jsx("a",{onClick:()=>k(),children:t("Stop",{ns:m})})]})},P=t=>{var i,d;const{admin:n=!0}=t,c=o.useCurrentUserContext(),p=(d=(i=c==null?void 0:c.data)==null?void 0:i.data)==null?void 0:d.id;return e.jsx(r.Card,{bordered:!1,children:e.jsx(o.SchemaComponent,{schema:L,scope:{admin:n,userId:p,useCreateDatabaseConnectionAction:N,useMultiAppUpdateAction:q,useStartAllAction:E,useStopAllAction:$},components:{AppVisitor:U}})})},F=()=>{const{insert:t}=o.useSchemaInitializer();S();const n=o.useSchemaInitializerItem();return e.jsx(o.SchemaInitializerItem,I(C({},n),{onClick:()=>{t({type:"void","x-decorator-props":{},"x-component":"CardItem","x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:table",properties:{app:{type:"void","x-component":"AppManager","x-component-props":{admin:!1}}}})}}))},j=t=>{const n=o.useApp(),c=t.value&&e.jsx("a",{target:"_blank",href:n.getRouteUrl(`/apps/${t.value}/admin`),rel:"noreferrer",children:t.value});return e.jsxs("div",{style:t.style,children:[t.addonBefore,t.prefix,c,t.suffix,t.addonAfter]})},G=x.connect(r.Input,x.mapReadPretty(j)),Y=o.createStyles(({token:t})=>({button:{color:t.colorTextHeaderMenu+" !important"}})),H=()=>{const{styles:t}=Y(),{data:n,run:c}=o.useRequest({resource:"applications",action:"listPinned"},{manual:!0}),{t:p}=S(),i=o.useApp(),d=[...((n==null?void 0:n.data)||[]).map(u=>{let h=i.getRouteUrl(`/apps/${u.name}/admin/`);return u.cname&&(h=`//${u.cname}`),{key:u.name,label:e.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",children:u.displayName||u.name})}}),{key:".manager",label:e.jsx(y.Link,{to:i.systemSettingsManager.getRoutePath("system-services."+m),children:p("Manage applications")})}];return e.jsx(r.Dropdown,{onOpenChange:u=>{c()},menu:{items:d},children:e.jsx(r.Button,{className:t.button,title:"Apps",icon:e.jsx(o.Icon,{type:"AppstoreOutlined"})})})},J=t=>e.jsx(o.PinnedPluginListProvider,{items:{am:{order:201,component:"MultiAppManager",pin:!0,snippet:"pm.*",belongTo:"pinnedmenu"}},children:e.jsx(o.SchemaComponentOptions,{components:{MultiAppManager:H,AppNameInput:G,MultiAppBlockInitializer:F},children:t.children})});class M extends o.Plugin{load(){return g(this,null,function*(){this.app.addComponents({AppManager:P}),this.app.use(J),this.app.systemSettingsManager.add(`system-services.${m}`,{title:s("Multi-app manager"),icon:"AppstoreOutlined",Component:P,aclSnippet:"pm.multi-app-manager.applications"}),this.app.schemaInitializerManager.get("page:addBlock").add("otherBlocks.multiApp",{name:"multiApp",title:s("Multi-app manager"),icon:e.jsx(A.AppstoreOutlined,{}),Component:F})})}}a.MultiAppManagerPlugin=M,a.default=M,a.formSchema=T,a.tableActionColumnSchema=D,Object.defineProperties(a,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(r,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@tachybase/client"),require("react/jsx-runtime"),require("antd"),require("react-router-dom"),require("react-i18next"),require("react"),require("@tachybase/schema"),require("@ant-design/icons")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","react/jsx-runtime","antd","react-router-dom","react-i18next","react","@tachybase/schema","@ant-design/icons"],t):(r=typeof globalThis!="undefined"?globalThis:r||self,t(r["@tachybase/module-multi-app"]={},r["@tachybase/client"],r.jsxRuntime,r.antd,r["react-router-dom"],r["react-i18next"],r.react,r["@tachybase/schema"],r["@ant-design/icons"]))})(this,function(r,t,o,i,k,I,g,y,m){"use strict";var ce=Object.defineProperty,le=Object.defineProperties;var de=Object.getOwnPropertyDescriptors;var O=Object.getOwnPropertySymbols;var ue=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable;var $=(r,t,o)=>t in r?ce(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o,v=(r,t)=>{for(var o in t||(t={}))ue.call(t,o)&&$(r,o,t[o]);if(O)for(var o of O(t))me.call(t,o)&&$(r,o,t[o]);return r},S=(r,t)=>le(r,de(t));var h=(r,t,o)=>new Promise((i,k)=>{var I=m=>{try{y(o.next(m))}catch(x){k(x)}},g=m=>{try{y(o.throw(m))}catch(x){k(x)}},y=m=>m.done?i(m.value):Promise.resolve(m.value).then(I,g);y((o=o.apply(r,t)).next())});const x="multi-app",N="subAppsChange",A="subAppsChange",C=()=>{const{t:e}=I.useTranslation([x,"core"]);return{t:e}},d=e=>`{{t("${e}", { ns: ["${x}", "client"] })}}`,q={type:"void","x-component":"CardItem","x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:table",properties:{app:{type:"void","x-component":"AppManager","x-component-props":{admin:!1}}}},M=()=>{const{insert:e}=t.useSchemaInitializer(),n=t.useSchemaInitializerItem(),a=g.useCallback(()=>e(q),[e]);return o.jsx(t.SchemaInitializerItem,S(v({},n),{onClick:a}))},L=e=>{const n=t.useApp(),a=e.value&&o.jsx("a",{target:"_blank",href:n.getRouteUrl(`/apps/${e.value}/admin`),rel:"noreferrer",children:e.value});return o.jsxs("div",{style:e.style,children:[e.addonBefore,e.prefix,a,e.suffix,e.addonAfter]})},E=y.connect(i.Input,y.mapReadPretty(L)),_=t.createStyles(({token:e})=>({button:{color:e.colorTextHeaderMenu+" !important"}})),K=()=>{const{styles:e}=_(),{data:n,run:a}=t.useRequest({resource:"applications",action:"listPinned"},{manual:!0}),{t:s}=C(),p=t.useApp(),u=[...((n==null?void 0:n.data)||[]).map(c=>{let f=p.getRouteUrl(`/apps/${c.name}/admin/`);return c.cname&&(f=`//${c.cname}`),{key:c.name,label:o.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",children:c.displayName||c.name})}}),{key:".manager",label:o.jsx(k.Link,{to:p.systemSettingsManager.getRoutePath("system-services."+x),children:s("Manage applications")})}];return o.jsx(i.Dropdown,{onOpenChange:c=>{a()},menu:{items:u},children:o.jsx(i.Button,{className:e.button,title:"Apps",icon:o.jsx(t.Icon,{type:"AppstoreOutlined"})})})},U=e=>o.jsx(t.PinnedPluginListProvider,{items:{am:{order:201,component:"MultiAppManager",pin:!0,snippet:"pm.*",belongTo:"pinnedmenu"}},children:o.jsx(t.SchemaComponentOptions,{components:{MultiAppManager:K,AppNameInput:E,MultiAppBlockInitializer:M},children:e.children})});class j extends t.Plugin{load(){return h(this,null,function*(){this.app.use(U)})}}const F={name:"applications",filterTargetKey:"name",targetKey:"name",fields:[{type:"uid",name:"name",primaryKey:!0,prefix:"a",interface:"input",uiSchema:{type:"string",title:d("App ID"),required:!0,"x-component":"Input","x-validator":"uid"}},{type:"string",name:"displayName",interface:"input",uiSchema:{type:"string",title:d("App display name"),required:!0,"x-component":"Input"}},{type:"string",name:"pinned",interface:"checkbox",uiSchema:{type:"boolean","x-content":d("Pin to menu"),"x-component":"Checkbox"}},{type:"string",name:"status",interface:"radioGroup",defaultValue:"pending",uiSchema:{type:"string",title:d("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"}},{type:"string",name:"isTemplate",interface:"checkbox",uiSchema:{type:"boolean","x-content":d("Is template"),"x-component":"Checkbox"}}]},w={type:"void","x-component":"div",properties:{displayName:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem","x-disabled":"{{ !createOnly }}","x-hidden":"{{ !admin }}"},"options.autoStart":{title:d("Start mode"),"x-component":"Radio.Group","x-decorator":"FormItem",default:!1,enum:[{label:d("Start on first visit"),value:!1},{label:d("Start with main application"),value:!0}],"x-hidden":"{{ !admin }}"},cnamePrefix:{title:d("Custom domain prefix"),"x-component":"Input","x-decorator":"FormItem","x-validator":`{{(value) => {
2
+ if (!value) {
3
+ return t("Please enter a valid custom domain prefix");
4
+ }
5
+ if (!/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/.test(value)) {
6
+ return t("Custom domain prefix must be 1-63 characters, lowercase letters, numbers, or hyphens (-), and cannot start or end with a hyphen (-)");
7
+ }
8
+ }}}`,"x-component-props":{addonAfter:`.${window.location.hostname}`},"x-reactions":{dependencies:["cname"],fulfill:{state:{value:'{{($deps[0] && $deps[0].replace(new RegExp("\\."+window.location.hostname+"$"), "")) || ""}}'}}}},cname:{"x-hidden":!0,"x-component":"Input","x-decorator":"FormItem","x-read-pretty":!0,"x-reactions":{dependencies:["cnamePrefix"],fulfill:{state:{value:`{{$deps[0] ? $deps[0] + ".${window.location.hostname}" : null}}`}}}},tmpl:{title:d("Template"),"x-component":"RemoteSelect","x-component-props":{fieldNames:{label:"displayName",value:"name"},service:{resource:"applications",params:{filter:{$or:[{isTemplate:!0},{createdById:"{{ userId }}"}]}}}},"x-decorator":"FormItem","x-disabled":"{{ !createOnly }}"},"options.startEnvs":{type:"string",title:d("Start environment variables"),"x-component":"Input.TextArea","x-decorator":"FormItem","x-hidden":!0},pinned:{"x-component":"CollectionField","x-decorator":"FormItem","x-hidden":"{{ !admin }}"},isTemplate:{"x-component":"CollectionField","x-decorator":"FormItem","x-hidden":"{{ !admin }}"},icon:{type:"string",title:'{{ t("Icon") }}',"x-component":"IconPicker","x-decorator":"FormItem"},color:{type:"string",title:'{{ t("Color") }}',"x-component":"ColorPicker","x-decorator":"FormItem",default:"#e5e5e5"}}},D={properties:{view:{type:"void","x-component":"AppVisitor","x-component-props":{admin:"{{ admin }}"}},update:{type:"void",title:'{{t("Edit")}}',"x-component":"Action.Link",properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ cm.useValuesFromRecord }}"},title:'{{t("Edit")}}',properties:{formSchema:w,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{t("Submit")}}',"x-action":"submit","x-component":"Action","x-use-component-props":"useMultiAppUpdateAction","x-component-props":{type:"primary"}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-hidden":"{{ !admin }}","x-use-component-props":"useDestroyActionProps","x-component-props":{confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}},G={type:"void",properties:{applicationsTable:{type:"void","x-decorator":"TableBlockProvider","x-decorator-props":{collection:F,action:"list",params:{pageSize:50,sort:["-createdAt"],appends:[],filter:{createdById:"{{ admin ? undefined : userId }}"}},rowKey:"name"},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{refresh:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-action":"destroy","x-component":"Action","x-decorator":"ACLActionProvider","x-use-component-props":"useBulkDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}},"x-hidden":"{{ !admin }}"},startAll:{type:"void",title:'{{ t("Start all") }}',"x-component":"Action","x-use-component-props":"useStartAllAction","x-component-props":{icon:"FastForwardOutlined",danger:!0,confirm:{title:d("Start all"),content:d("Starting all sub-applications may cause lag. The more applications you have, the longer the waiting time")}},"x-hidden":"{{ !admin }}"},stopAll:{type:"void",title:'{{ t("Stop all") }}',"x-component":"Action","x-use-component-props":"useStopAllAction","x-component-props":{icon:"StopOutlined",danger:!0,confirm:{title:d("Stop all"),content:d("All sub-applications have stopped serving, unless you restart them")}},"x-hidden":"{{ !admin }}"},create:{type:"void",title:'{{t("Add new")}}',"x-decorator":e=>g.createElement(t.SchemaComponentOptions,S(v({},e),{scope:{createOnly:!0}})),"x-component":"Action","x-component-props":{type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues(e){const n=t.useActionContext();return t.useRequest(()=>Promise.resolve({data:{name:`a_${y.uid()}`}}),S(v({},e),{refreshDeps:[n.visible]}))}},title:'{{t("Add new")}}',properties:{formSchema:w,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-use-component-props":"useCreateDatabaseConnectionAction","x-component-props":{type:"primary"}}}}}}}}}},table:{type:"array","x-uid":"input","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"name",rowSelection:{type:"checkbox"}},properties:{displayName:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{displayName:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},name:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},pinned:{type:"void",title:d("Pin to menu"),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{pinned:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},isTemplate:{type:"void",title:d("Is template"),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{isTemplate:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},status:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{status:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"TableV2.Column",properties:{actions:v({type:"void","x-component":"Space","x-component-props":{split:"|"}},D)}}}}}}}},Y=()=>{const e=y.useForm(),n=y.useField(),a=t.useActionContext(),s=t.useDataBlockRequest(),p=t.useDataBlockResource();return{onClick(){return h(this,null,function*(){try{yield e.submit(),n.data=n.data||{},n.data.loading=!0,yield p.create({values:e.values}),a.setVisible(!1),yield e.reset(),n.data.loading=!1,s.refresh()}catch(c){n.data&&(n.data.loading=!1)}})}}},H=e=>{const n=y.useField(),a=y.useForm(),s=t.useActionContext(),p=t.useDataBlockRequest(),u=t.useDataBlockResource(),c=t.useCollectionRecordData(),f=c==null?void 0:c.name;return{onClick(){return h(this,null,function*(){var b;yield a.submit(),n.data=n.data||{},n.data.loading=!0;try{const l=yield u.update({filterByTk:f,values:a.values});s.setVisible(!1),yield a.reset(),p.refresh(),e==null||e(f,(b=l==null?void 0:l.data)==null?void 0:b.data)}catch(l){console.error(l)}finally{n.data.loading=!1}})}}};function B({name:e,cname:n}){const a=t.useApp();return n?`//${n}`:a.getRouteUrl(`/apps/${e}/admin/`)}const W=()=>{const e=t.useDataBlockResource(),{t:n}=C();return{onClick(){return h(this,null,function*(){var p,u;const s=yield e.startAll();i.notification.info({key:A,message:o.jsxs("span",{children:[n("Processing..."),"    ",o.jsx(i.Spin,{indicator:o.jsx(m.LoadingOutlined,{style:{fontSize:24},spin:!0})})]}),duration:0}),((u=(p=s==null?void 0:s.data)==null?void 0:p.data)==null?void 0:u.all)===0&&i.notification.info({key:A,message:`${n("Start count")}: 0/0!`})})}}},J=()=>{const e=t.useDataBlockResource(),{t:n}=C();return{onClick(){return h(this,null,function*(){var p,u;const s=yield e.stopAll();if(((u=(p=s==null?void 0:s.data)==null?void 0:p.data)==null?void 0:u.all)===0){i.notification.info({key:A,message:`${n("Stop count")}: 0/0!`});return}i.notification.info({key:A,message:o.jsxs("span",{children:[n("Processing..."),"    ",o.jsx(i.Spin,{indicator:o.jsx(m.LoadingOutlined,{style:{fontSize:24},spin:!0})})]}),duration:0})})}}},Q=()=>{const e=t.useCollectionRecordData();return B({name:e.name,cname:e.cname})},X=()=>{const{t:e}=C(),n=Q(),a=t.useCollectionRecordData(),s=t.useAPIClient(),{data:p,mutate:u,refresh:c}=t.useDataBlockRequest(),f=g.useMemo(()=>s.resource("applications"),[s]),T=()=>h(this,null,function*(){try{const l=yield f.start({filterByTk:a.name});(l==null?void 0:l.status)===205?i.notification.info({key:A,message:e("App is already running")}):i.notification.info({key:A,message:o.jsxs("span",{children:[e("Processing..."),"    ",o.jsx(i.Spin,{indicator:o.jsx(m.LoadingOutlined,{style:{fontSize:24},spin:!0})})]}),duration:0})}catch(l){i.notification.error({message:e("Failed to start app")})}}),b=()=>{f.stop({filterByTk:a.name}).then(()=>{i.notification.info({key:A,message:o.jsxs("span",{children:[e("Processing..."),"    ",o.jsx(i.Spin,{indicator:o.jsx(m.LoadingOutlined,{style:{fontSize:24},spin:!0})})]}),duration:0})})};return t.useNoticeSub(N,l=>{const pe=i.notification[l.level]||i.notification.info;if(l.message?pe({key:A,message:l.message}):l.status!=="commanding"&&i.notification.destroy(A),!(p!=null&&p.data)||l.refresh){c();return}if(!l.app&&!l.status||!p.data.some(P=>P.name===l.app))return;const V=[...p.data];V.find(P=>P.name===l.app).status=l.status,u({data:V})}),o.jsxs(i.Space,{split:o.jsx(i.Divider,{type:"horizontal"}),children:[o.jsx("a",{href:n,target:"_blank",rel:"noreferrer",children:e("View",{ns:x})}),o.jsx("a",{onClick:()=>T(),children:e("Start",{ns:x})}),o.jsx("a",{onClick:()=>b(),children:e("Stop",{ns:x})})]})},z=e=>{var u,c;const{admin:n=!0}=e,a=t.useCurrentUserContext(),s=(c=(u=a==null?void 0:a.data)==null?void 0:u.data)==null?void 0:c.id,{t:p}=I.useTranslation([x,"core"],{nsMode:"fallback"});return o.jsx(i.Card,{bordered:!1,children:o.jsx(t.SchemaComponent,{schema:G,scope:{admin:n,userId:s,useCreateDatabaseConnectionAction:Y,useMultiAppUpdateAction:H,useStartAllAction:W,useStopAllAction:J,t:p},components:{AppVisitor:X}})})};class Z extends t.Plugin{load(){return h(this,null,function*(){this.app.systemSettingsManager.add(`system-services.${x}`,{title:d("Multi-app manager"),icon:"AppstoreOutlined",Component:z,aclSnippet:"pm.multi-app.applications"})})}}const R={type:"void","x-component":"CardItem","x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:table",properties:{app:{type:"void","x-component":"ViewMultiAppPane","x-component-props":{admin:!1}}}},ee=()=>{const{insert:e}=t.useSchemaInitializer(),n=t.useSchemaInitializerItem(),a=g.useCallback(()=>e(R),[e]);return o.jsx(t.SchemaInitializerItem,S(v({},n),{onClick:a}))},te=t.createStyles(({css:e,token:n})=>({appListStyle:e`
9
+ display: flex;
10
+ flex-wrap: wrap;
11
+ gap: 16px;
12
+ `})),oe=()=>{C();const{styles:e}=te(),n=t.useTableBlockContext(),a=n==null?void 0:n.service,{data:s,loading:p}=a||{};if(p)return o.jsx(i.Spin,{});const{data:u}=s||{};return o.jsx(i.Card,{style:{backgroundColor:"transparent",border:"none",boxShadow:"none"},children:o.jsx("div",{className:e.appListStyle,children:u==null?void 0:u.map(c=>o.jsx(ne,v({},c),c.name))})})},ne=e=>{const{name:n,cname:a,displayName:s,icon:p,color:u,status:c}=e,{t:f}=C(),T=B({name:n,cname:a}),b=g.useCallback(()=>{window&&c==="running"?window.open(T,"_blank"):i.message.warning(f("App is not running"))},[a,c]);return o.jsx(t.MediaCard,{layout:"vertical",title:s,icon:p,color:c==="running"?u:void 0,needHover:!1,onClick:b})},ae={type:"void",properties:{multiApp:{"x-decorator":"TableBlockProvider","x-decorator-props":{collection:F,action:"list",params:{pageSize:20,sort:["-createdAt"],appends:[],filter:{createdById:"{{ userId }}"}},rowKey:"name"},"x-component":"AppList"}}},re=()=>{var a,s;const e=t.useCurrentUserContext(),n=(s=(a=e==null?void 0:e.data)==null?void 0:a.data)==null?void 0:s.id;return o.jsx(t.SchemaComponent,{schema:ae,scope:{userId:n},components:{AppList:oe}})};class ie extends t.Plugin{load(){return h(this,null,function*(){this.app.addComponents({AppManager:z,ViewMultiAppPane:re});const n=this.app.schemaInitializerManager.get("page:addBlock");n.add("otherBlocks.multiApp",{name:"multiApp",title:d("Multi-app manager"),icon:o.jsx(m.AppstoreOutlined,{}),Component:M}),n.add("otherBlocks.showMultiApp",{name:"showMultiApp",title:d("Multi-app display"),icon:o.jsx(m.WindowsOutlined,{}),Component:ee})})}}class se extends t.Plugin{afterAdd(){return h(this,null,function*(){yield this.app.pm.add(j),yield this.app.pm.add(ie),yield this.app.pm.add(Z)})}}r.default=se,r.formSchema=w,r.tableActionColumnSchema=D,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -0,0 +1,4 @@
1
+ import { Plugin } from '@tachybase/client';
2
+ export default class PluginMultiAppManager extends Plugin {
3
+ afterAdd(): Promise<void>;
4
+ }
@@ -0,0 +1,2 @@
1
+ import { ISchema } from '@tachybase/schema';
2
+ export declare const schemaAppManager: ISchema;
@@ -0,0 +1,3 @@
1
+ export declare const useCreateDatabaseConnectionAction: () => {
2
+ onClick(): Promise<void>;
3
+ };
@@ -0,0 +1,3 @@
1
+ export declare const useMultiAppUpdateAction: (actionCallback?: (key: string, values: any) => void) => {
2
+ onClick(): Promise<void>;
3
+ };
@@ -0,0 +1,4 @@
1
+ export declare function useRouteUrl({ name, cname }: {
2
+ name: any;
3
+ cname: any;
4
+ }): string;
@@ -0,0 +1,3 @@
1
+ export declare const useStartAllAction: () => {
2
+ onClick(): Promise<void>;
3
+ };
@@ -0,0 +1,3 @@
1
+ export declare const useStopAllAction: () => {
2
+ onClick(): Promise<void>;
3
+ };
@@ -0,0 +1,5 @@
1
+ import { Plugin } from '@tachybase/client';
2
+ /** 系统配置部分 */
3
+ export declare class KitSystem extends Plugin {
4
+ load(): Promise<void>;
5
+ }
@@ -0,0 +1 @@
1
+ export declare const AppList: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ appListStyle: import("antd-style").SerializedStyles;
3
+ }>;
@@ -0,0 +1,15 @@
1
+ export declare const schemaMultiAppBlockInitializer: {
2
+ type: string;
3
+ 'x-component': string;
4
+ 'x-toolbar': string;
5
+ 'x-settings': string;
6
+ properties: {
7
+ app: {
8
+ type: string;
9
+ 'x-component': string;
10
+ 'x-component-props': {
11
+ admin: boolean;
12
+ };
13
+ };
14
+ };
15
+ };
@@ -0,0 +1 @@
1
+ export declare const ShowMultiAppBlockInitializer: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ export declare const schemaShowMultiAppBlockInitializer: {
2
+ type: string;
3
+ 'x-component': string;
4
+ 'x-toolbar': string;
5
+ 'x-settings': string;
6
+ properties: {
7
+ app: {
8
+ type: string;
9
+ 'x-component': string;
10
+ 'x-component-props': {
11
+ admin: boolean;
12
+ };
13
+ };
14
+ };
15
+ };
@@ -0,0 +1 @@
1
+ export declare const ViewMultiAppPane: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,94 @@
1
+ export declare const schemaViewMultiAppPane: {
2
+ type: string;
3
+ properties: {
4
+ multiApp: {
5
+ 'x-decorator': string;
6
+ 'x-decorator-props': {
7
+ collection: {
8
+ name: string;
9
+ filterTargetKey: string;
10
+ targetKey: string;
11
+ fields: ({
12
+ type: string;
13
+ name: string;
14
+ primaryKey: boolean;
15
+ prefix: string;
16
+ interface: string;
17
+ uiSchema: {
18
+ type: string;
19
+ title: string;
20
+ required: boolean;
21
+ 'x-component': string;
22
+ 'x-validator': string;
23
+ 'x-content'?: undefined;
24
+ enum?: undefined;
25
+ };
26
+ defaultValue?: undefined;
27
+ } | {
28
+ type: string;
29
+ name: string;
30
+ interface: string;
31
+ uiSchema: {
32
+ type: string;
33
+ title: string;
34
+ required: boolean;
35
+ 'x-component': string;
36
+ 'x-validator'?: undefined;
37
+ 'x-content'?: undefined;
38
+ enum?: undefined;
39
+ };
40
+ primaryKey?: undefined;
41
+ prefix?: undefined;
42
+ defaultValue?: undefined;
43
+ } | {
44
+ type: string;
45
+ name: string;
46
+ interface: string;
47
+ uiSchema: {
48
+ type: string;
49
+ 'x-content': string;
50
+ 'x-component': string;
51
+ title?: undefined;
52
+ required?: undefined;
53
+ 'x-validator'?: undefined;
54
+ enum?: undefined;
55
+ };
56
+ primaryKey?: undefined;
57
+ prefix?: undefined;
58
+ defaultValue?: undefined;
59
+ } | {
60
+ type: string;
61
+ name: string;
62
+ interface: string;
63
+ defaultValue: string;
64
+ uiSchema: {
65
+ type: string;
66
+ title: string;
67
+ enum: {
68
+ label: string;
69
+ value: string;
70
+ }[];
71
+ 'x-component': string;
72
+ required?: undefined;
73
+ 'x-validator'?: undefined;
74
+ 'x-content'?: undefined;
75
+ };
76
+ primaryKey?: undefined;
77
+ prefix?: undefined;
78
+ })[];
79
+ };
80
+ action: string;
81
+ params: {
82
+ pageSize: number;
83
+ sort: string[];
84
+ appends: any[];
85
+ filter: {
86
+ createdById: string;
87
+ };
88
+ };
89
+ rowKey: string;
90
+ };
91
+ 'x-component': string;
92
+ };
93
+ };
94
+ };
@@ -0,0 +1,5 @@
1
+ import { Plugin } from '@tachybase/client';
2
+ /** 用户界面部分 */
3
+ export declare class KitUsage extends Plugin {
4
+ load(): Promise<void>;
5
+ }
@@ -1,16 +1,16 @@
1
1
  module.exports = {
2
- "react": "18.3.1",
3
- "@tachybase/client": "0.23.58",
4
- "@ant-design/icons": "5.5.2",
5
- "antd": "5.22.5",
6
- "@tachybase/schema": "0.23.58",
7
- "react-router-dom": "6.28.1",
8
2
  "react-i18next": "15.2.0",
9
- "@tachybase/server": "0.23.58",
10
- "@tachybase/database": "0.23.58",
3
+ "@tachybase/client": "1.0.6",
4
+ "@tachybase/server": "1.0.6",
5
+ "@tachybase/database": "1.0.6",
11
6
  "lodash": "4.17.21",
12
7
  "mysql2": "3.11.5",
13
8
  "pg": "8.13.1",
14
- "@tachybase/actions": "0.23.58",
15
- "@tachybase/utils": "0.23.58"
9
+ "react": "18.3.1",
10
+ "@tachybase/schema": "1.0.6",
11
+ "antd": "5.22.5",
12
+ "react-router-dom": "6.28.1",
13
+ "@ant-design/icons": "5.5.2",
14
+ "@tachybase/actions": "1.0.6",
15
+ "@tachybase/utils": "1.0.6"
16
16
  };
@@ -2,15 +2,19 @@
2
2
  "All sub-applications have stopped serving, unless you reopen them": "All sub-applications have stopped serving, unless you reopen them",
3
3
  "App ID": "App ID",
4
4
  "App display name": "App display name",
5
+ "App is not running": "App is not running",
5
6
  "App status": "App status",
6
7
  "Applications": "Applications",
7
8
  "Auto start": "Auto start",
8
9
  "Custom domain": "Custom domain",
9
10
  "Custom domain prefix": "Custom domain prefix",
11
+ "Custom domain prefix must be 1-63 characters, lowercase letters, numbers, or hyphens (-), and cannot start or end with a hyphen (-)": "Custom domain prefix must be 1-63 characters, lowercase letters, numbers, or hyphens (-), and cannot start or end with a hyphen (-)",
10
12
  "Is template": "Is template",
11
13
  "Manage applications": "Manage applications",
14
+ "Multi-app display": "Multi-app display",
12
15
  "Multi-app manager": "Multi-app manager",
13
16
  "Pin to menu": "Pin to menu",
17
+ "Please enter a valid custom domain prefix": "Please enter a valid custom domain prefix",
14
18
  "Preset": "Preset",
15
19
  "Refresh": "Refresh",
16
20
  "Standalone deployment": "Standalone deployment",
@@ -4,15 +4,19 @@
4
4
  "App already started": "应用已启动",
5
5
  "App already stopped": "应用已关闭",
6
6
  "App display name": "应用名称",
7
+ "App is not running": "应用未启动, 需要先在<系统-多应用管理>里启动应用",
7
8
  "App status": "应用状态",
8
9
  "Applications": "应用",
9
10
  "Auto start": "自动启动",
10
11
  "Custom domain": "自定义域名",
11
12
  "Custom domain prefix": "自定义域名前缀",
13
+ "Custom domain prefix must be 1-63 characters, lowercase letters, numbers, or hyphens (-), and cannot start or end with a hyphen (-)": "自定义域名前缀必须为1-63位小写字母、数字或短横线(-),且不能以短横线(-)开头或结尾",
12
14
  "Is template": "是否模板",
13
15
  "Manage applications": "管理应用",
16
+ "Multi-app display": "多应用展示",
14
17
  "Multi-app manager": "多应用管理",
15
18
  "Pin to menu": "在菜单上显示",
19
+ "Please enter a valid custom domain prefix": "请输入有效的自定义域名前缀",
16
20
  "Preset": "预设",
17
21
  "Refresh": "刷新",
18
22
  "Standalone deployment": "独立部署",
@@ -1 +1 @@
1
- {"name":"mariadb","version":"2.5.6","description":"fast mariadb/mysql connector.","main":"promise.js","types":"types/index.d.ts","directories":{"lib":"lib","test":"test"},"private":false,"scripts":{"test":"npm run test:types-prettier && npm run test:prettier && npm run test:types && npm run test:lint && npm run test:base","test:base":"mocha --no-parallel --timeout 5000 \"test/**/*.js\" ","test:lint":"eslint \"{lib,test}/**/*.js\" ","test:types":"eslint \"types/*.ts\" ","test:types-prettier":"prettier --write \"types/*.ts\"","test:prettier":"prettier --write \"{tools,lib,test,benchmarks}/**/*.js\"","coverage":"npm run coverage:test && npm run coverage:report","coverage:test":"nyc mocha --no-parallel --timeout 5000 \"test/**/*.js\"","coverage:report":"nyc report --reporter=text-lcov > coverage.lcov && codecov","benchmark":"node ./benchmarks/benchmarks.js","generate":"node ./tools/generate-mariadb.js"},"repository":{"type":"git","url":"git+https://github.com/mariadb-corporation/mariadb-connector-nodejs.git"},"keywords":["mariadb","mysql","client","driver","connector"],"files":["lib","types/index.d.ts","promise.js","callback.js"],"engines":{"node":">= 10.13"},"author":"Diego Dupin <diego.dupin@mariadb.com>","license":"LGPL-2.1-or-later","dependencies":{"@types/geojson":"^7946.0.8","@types/node":"^17.0.10","denque":"^2.0.1","iconv-lite":"^0.6.3","long":"^5.2.0","moment-timezone":"^0.5.34","please-upgrade-node":"^3.2.0"},"devDependencies":{"@typescript-eslint/eslint-plugin":"^5.10.0","@typescript-eslint/parser":"^5.10.0","benchmark":"^2.1.4","chai":"^4.3.4","codecov":"^3.8.2","chalk":"^4.1.2","dom-parser":"^0.1.6","error-stack-parser":"^2.0.6","eslint":"^8.7.0","eslint-config-prettier":"^8.3.0","eslint-plugin-markdown":"^2.2.1","eslint-plugin-prettier":"^4.0.0","mocha":"^9.2.0","mocha-lcov-reporter":"^1.3.0","nyc":"^15.1.0","prettier":"^2.5.1","typescript":"^4.5.5"},"bugs":{"url":"https://jira.mariadb.org/projects/CONJS/"},"homepage":"https://github.com/mariadb-corporation/mariadb-connector-nodejs#readme","_lastModified":"2025-03-06T09:58:29.963Z"}
1
+ {"name":"mariadb","version":"2.5.6","description":"fast mariadb/mysql connector.","main":"promise.js","types":"types/index.d.ts","directories":{"lib":"lib","test":"test"},"private":false,"scripts":{"test":"npm run test:types-prettier && npm run test:prettier && npm run test:types && npm run test:lint && npm run test:base","test:base":"mocha --no-parallel --timeout 5000 \"test/**/*.js\" ","test:lint":"eslint \"{lib,test}/**/*.js\" ","test:types":"eslint \"types/*.ts\" ","test:types-prettier":"prettier --write \"types/*.ts\"","test:prettier":"prettier --write \"{tools,lib,test,benchmarks}/**/*.js\"","coverage":"npm run coverage:test && npm run coverage:report","coverage:test":"nyc mocha --no-parallel --timeout 5000 \"test/**/*.js\"","coverage:report":"nyc report --reporter=text-lcov > coverage.lcov && codecov","benchmark":"node ./benchmarks/benchmarks.js","generate":"node ./tools/generate-mariadb.js"},"repository":{"type":"git","url":"git+https://github.com/mariadb-corporation/mariadb-connector-nodejs.git"},"keywords":["mariadb","mysql","client","driver","connector"],"files":["lib","types/index.d.ts","promise.js","callback.js"],"engines":{"node":">= 10.13"},"author":"Diego Dupin <diego.dupin@mariadb.com>","license":"LGPL-2.1-or-later","dependencies":{"@types/geojson":"^7946.0.8","@types/node":"^17.0.10","denque":"^2.0.1","iconv-lite":"^0.6.3","long":"^5.2.0","moment-timezone":"^0.5.34","please-upgrade-node":"^3.2.0"},"devDependencies":{"@typescript-eslint/eslint-plugin":"^5.10.0","@typescript-eslint/parser":"^5.10.0","benchmark":"^2.1.4","chai":"^4.3.4","codecov":"^3.8.2","chalk":"^4.1.2","dom-parser":"^0.1.6","error-stack-parser":"^2.0.6","eslint":"^8.7.0","eslint-config-prettier":"^8.3.0","eslint-plugin-markdown":"^2.2.1","eslint-plugin-prettier":"^4.0.0","mocha":"^9.2.0","mocha-lcov-reporter":"^1.3.0","nyc":"^15.1.0","prettier":"^2.5.1","typescript":"^4.5.5"},"bugs":{"url":"https://jira.mariadb.org/projects/CONJS/"},"homepage":"https://github.com/mariadb-corporation/mariadb-connector-nodejs#readme","_lastModified":"2025-04-02T02:56:53.003Z"}
@@ -1 +1 @@
1
- {"name":"qs","description":"A querystring parser that supports nesting and arrays, with a depth limit","homepage":"https://github.com/ljharb/qs","version":"6.13.1","repository":{"type":"git","url":"https://github.com/ljharb/qs.git"},"funding":{"url":"https://github.com/sponsors/ljharb"},"main":"lib/index.js","sideEffects":false,"contributors":[{"name":"Jordan Harband","email":"ljharb@gmail.com","url":"http://ljharb.codes"}],"keywords":["querystring","qs","query","url","parse","stringify"],"engines":{"node":">=0.6"},"dependencies":{"side-channel":"^1.0.6"},"devDependencies":{"@browserify/envify":"^6.0.0","@browserify/uglifyify":"^6.0.0","@ljharb/eslint-config":"^21.1.1","browserify":"^16.5.2","bundle-collapser":"^1.4.0","common-shakeify":"~1.0.0","eclint":"^2.8.1","es-value-fixtures":"^1.5.0","eslint":"=8.8.0","evalmd":"^0.0.19","for-each":"^0.3.3","glob":"=10.3.7","has-bigints":"^1.0.2","has-override-mistake":"^1.0.1","has-property-descriptors":"^1.0.2","has-proto":"^1.0.3","has-symbols":"^1.0.3","iconv-lite":"^0.5.1","in-publish":"^2.0.1","jackspeak":"=2.1.1","mkdirp":"^0.5.5","mock-property":"^1.1.0","module-deps":"^6.2.3","npmignore":"^0.3.1","nyc":"^10.3.2","object-inspect":"^1.13.3","qs-iconv":"^1.0.4","safe-publish-latest":"^2.0.0","safer-buffer":"^2.1.2","tape":"^5.9.0","unassertify":"^3.0.1"},"scripts":{"prepack":"npmignore --auto --commentLines=autogenerated && npm run dist","prepublishOnly":"safe-publish-latest","prepublish":"not-in-publish || npm run prepublishOnly","pretest":"npm run --silent readme && npm run --silent lint","test":"npm run tests-only","tests-only":"nyc tape 'test/**/*.js'","posttest":"npx npm@'>=10.2' audit --production","readme":"evalmd README.md","postlint":"eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' | grep -v dist/)","lint":"eslint --ext=js,mjs .","dist":"mkdirp dist && browserify --standalone Qs -g unassertify -g @browserify/envify -g [@browserify/uglifyify --mangle.keep_fnames --compress.keep_fnames --format.indent_level=1 --compress.arrows=false --compress.passes=4 --compress.typeofs=false] -p common-shakeify -p bundle-collapser/plugin lib/index.js > dist/qs.js"},"license":"BSD-3-Clause","publishConfig":{"ignore":["!dist/*","bower.json","component.json",".github/workflows","logos","tea.yaml"]},"_lastModified":"2025-03-06T09:58:30.225Z"}
1
+ {"name":"qs","description":"A querystring parser that supports nesting and arrays, with a depth limit","homepage":"https://github.com/ljharb/qs","version":"6.13.1","repository":{"type":"git","url":"https://github.com/ljharb/qs.git"},"funding":{"url":"https://github.com/sponsors/ljharb"},"main":"lib/index.js","sideEffects":false,"contributors":[{"name":"Jordan Harband","email":"ljharb@gmail.com","url":"http://ljharb.codes"}],"keywords":["querystring","qs","query","url","parse","stringify"],"engines":{"node":">=0.6"},"dependencies":{"side-channel":"^1.0.6"},"devDependencies":{"@browserify/envify":"^6.0.0","@browserify/uglifyify":"^6.0.0","@ljharb/eslint-config":"^21.1.1","browserify":"^16.5.2","bundle-collapser":"^1.4.0","common-shakeify":"~1.0.0","eclint":"^2.8.1","es-value-fixtures":"^1.5.0","eslint":"=8.8.0","evalmd":"^0.0.19","for-each":"^0.3.3","glob":"=10.3.7","has-bigints":"^1.0.2","has-override-mistake":"^1.0.1","has-property-descriptors":"^1.0.2","has-proto":"^1.0.3","has-symbols":"^1.0.3","iconv-lite":"^0.5.1","in-publish":"^2.0.1","jackspeak":"=2.1.1","mkdirp":"^0.5.5","mock-property":"^1.1.0","module-deps":"^6.2.3","npmignore":"^0.3.1","nyc":"^10.3.2","object-inspect":"^1.13.3","qs-iconv":"^1.0.4","safe-publish-latest":"^2.0.0","safer-buffer":"^2.1.2","tape":"^5.9.0","unassertify":"^3.0.1"},"scripts":{"prepack":"npmignore --auto --commentLines=autogenerated && npm run dist","prepublishOnly":"safe-publish-latest","prepublish":"not-in-publish || npm run prepublishOnly","pretest":"npm run --silent readme && npm run --silent lint","test":"npm run tests-only","tests-only":"nyc tape 'test/**/*.js'","posttest":"npx npm@'>=10.2' audit --production","readme":"evalmd README.md","postlint":"eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' | grep -v dist/)","lint":"eslint --ext=js,mjs .","dist":"mkdirp dist && browserify --standalone Qs -g unassertify -g @browserify/envify -g [@browserify/uglifyify --mangle.keep_fnames --compress.keep_fnames --format.indent_level=1 --compress.arrows=false --compress.passes=4 --compress.typeofs=false] -p common-shakeify -p bundle-collapser/plugin lib/index.js > dist/qs.js"},"license":"BSD-3-Clause","publishConfig":{"ignore":["!dist/*","bower.json","component.json",".github/workflows","logos","tea.yaml"]},"_lastModified":"2025-04-02T02:56:53.267Z"}
@@ -36,7 +36,7 @@ async function start(ctx, next) {
36
36
  ctx.body = "ok";
37
37
  await next();
38
38
  } else {
39
- ctx.throw(400, ctx.t("App already started", { ns: import_constants.NAMESPACE }));
39
+ ctx.throw(205, ctx.t("App already started", { ns: import_constants.NAMESPACE }));
40
40
  }
41
41
  }
42
42
  async function stop(ctx, next) {
@@ -62,7 +62,13 @@ var applications_default = (0, import_database.defineCollection)({
62
62
  },
63
63
  {
64
64
  type: "string",
65
- name: "icon"
65
+ name: "icon",
66
+ interface: "icon"
67
+ },
68
+ {
69
+ type: "string",
70
+ name: "color",
71
+ interface: "color"
66
72
  },
67
73
  {
68
74
  type: "string",
@@ -222,8 +222,7 @@ class PluginMultiAppManager extends import_server.Plugin {
222
222
  import_server.AppSupervisor.getInstance().off("appStatusChanged", notifyStatusChange);
223
223
  });
224
224
  import_server.AppSupervisor.getInstance().on("appStatusChanged", notifyStatusChange);
225
- this.app.acl.allow("applications", "listPinned", "loggedIn");
226
- this.app.acl.allow("applications", "list", "loggedIn");
225
+ this.app.acl.allow("applications", ["list", "create", "update", "destroy", "start", "stop"], "loggedIn");
227
226
  this.app.acl.registerSnippet({
228
227
  name: `pm.${this.name}.applications`,
229
228
  actions: ["applications:*"]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tachybase/module-multi-app",
3
3
  "displayName": "Multi-app manager",
4
- "version": "0.23.58",
4
+ "version": "1.0.6",
5
5
  "description": "Dynamically create multiple apps without separate deployments.",
6
6
  "keywords": [
7
7
  "System management"
@@ -9,11 +9,11 @@
9
9
  "license": "Apache-2.0",
10
10
  "main": "./dist/server/index.js",
11
11
  "dependencies": {
12
+ "antd": "5.22.5",
12
13
  "qs": "^6.13.1"
13
14
  },
14
15
  "devDependencies": {
15
16
  "@ant-design/icons": "^5.5.2",
16
- "antd": "5.22.5",
17
17
  "async-mutex": "^0.3.2",
18
18
  "lodash": "4.17.21",
19
19
  "mysql2": "^3.11.5",
@@ -21,15 +21,15 @@
21
21
  "react": "~18.3.1",
22
22
  "react-i18next": "^15.2.0",
23
23
  "react-router-dom": "6.28.1",
24
- "@tachybase/schema": "0.23.58"
24
+ "@tachybase/schema": "1.0.6"
25
25
  },
26
26
  "peerDependencies": {
27
- "@tachybase/actions": "0.23.58",
28
- "@tachybase/client": "0.23.58",
29
- "@tachybase/test": "0.23.58",
30
- "@tachybase/database": "0.23.58",
31
- "@tachybase/utils": "0.23.58",
32
- "@tachybase/server": "0.23.58"
27
+ "@tachybase/actions": "1.0.6",
28
+ "@tachybase/database": "1.0.6",
29
+ "@tachybase/server": "1.0.6",
30
+ "@tachybase/test": "1.0.6",
31
+ "@tachybase/utils": "1.0.6",
32
+ "@tachybase/client": "1.0.6"
33
33
  },
34
34
  "description.zh-CN": "无需单独部署即可动态创建多个应用。",
35
35
  "displayName.zh-CN": "多应用管理器",
@@ -1 +0,0 @@
1
- export declare const Settings: () => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +0,0 @@
1
- export declare const useCreateDatabaseConnectionAction: () => {
2
- onClick(): Promise<void>;
3
- };
4
- export declare const useMultiAppUpdateAction: (actionCallback?: (key: string, values: any) => void) => {
5
- onClick(): Promise<void>;
6
- };
7
- export declare const useStartAllAction: () => {
8
- onClick(): Promise<void>;
9
- };
10
- export declare const useStopAllAction: () => {
11
- onClick(): Promise<void>;
12
- };
File without changes