@tachybase/module-multi-app 1.3.17 → 1.3.19

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,11 +1,11 @@
1
- (function(i,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("@tachybase/utils/client"),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","@tachybase/utils/client","@ant-design/icons"],t):(i=typeof globalThis!="undefined"?globalThis:i||self,t(i["@tachybase/module-multi-app"]={},i["@tachybase/client"],i.jsxRuntime,i.antd,i["react-router-dom"],i["react-i18next"],i.react,i["@tachybase/schema"],i["@tachybase/utils"],i["@ant-design/icons"]))})(this,function(i,t,n,l,I,P,b,y,f,m){"use strict";var fe=Object.defineProperty,he=Object.defineProperties;var Ae=Object.getOwnPropertyDescriptors;var L=Object.getOwnPropertySymbols;var ge=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable;var E=(i,t,n)=>t in i?fe(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,A=(i,t)=>{for(var n in t||(t={}))ge.call(t,n)&&E(i,n,t[n]);if(L)for(var n of L(t))be.call(t,n)&&E(i,n,t[n]);return i},v=(i,t)=>he(i,Ae(t));var g=(i,t,n)=>new Promise((l,I)=>{var P=f=>{try{y(n.next(f))}catch(m){I(m)}},b=f=>{try{y(n.throw(f))}catch(m){I(m)}},y=f=>f.done?l(f.value):Promise.resolve(f.value).then(P,b);y((n=n.apply(i,t)).next())});const S="multi-app",_="subAppsChange",h="subAppsChange",C=()=>{const{t:e}=P.useTranslation([S,"core"]);return{t:e}},c=e=>`{{t("${e}", { ns: ["${S}", "client"] })}}`,K={type:"void","x-component":"CardItem","x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:table",properties:{app:{type:"void","x-component":"AppManager","x-component-props":{admin:!1}}}},F=()=>{const{insert:e}=t.useSchemaInitializer(),o=t.useSchemaInitializerItem(),a=b.useCallback(()=>e(K),[e]);return n.jsx(t.SchemaInitializerItem,v(A({},o),{onClick:a}))},U=e=>{const o=t.useApp(),a=e.value&&n.jsx("a",{target:"_blank",href:o.getRouteUrl(`/apps/${e.value}/admin`),rel:"noreferrer",children:e.value});return n.jsxs("div",{style:e.style,children:[e.addonBefore,e.prefix,a,e.suffix,e.addonAfter]})},j=y.connect(l.Input,y.mapReadPretty(U)),G=t.createStyles(({token:e})=>({button:{color:e.colorTextHeaderMenu+" !important"}})),H=()=>{const{styles:e}=G(),{data:o,run:a}=t.useRequest({resource:"applications",action:"listPinned"},{manual:!0}),{t:s}=C(),r=t.useApp(),d=[...((o==null?void 0:o.data)||[]).map(p=>{let u=r.getRouteUrl(`/apps/${p.name}/admin/`);return p.cname&&(u=`//${p.cname}`),{key:p.name,label:n.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",children:p.displayName||p.name})}}),{key:".manager",label:n.jsx(I.Link,{to:r.systemSettingsManager.getRoutePath("system-services."+S),children:s("Manage applications")})}];return n.jsx(l.Dropdown,{onOpenChange:p=>{a()},menu:{items:d},children:n.jsx(l.Button,{className:e.button,title:"Apps",icon:n.jsx(t.Icon,{type:"AppstoreOutlined"})})})},Y=e=>n.jsx(t.PinnedPluginListProvider,{items:{am:{order:201,component:"MultiAppManager",pin:!0,snippet:"pm.*",belongTo:"pinnedmenu"}},children:n.jsx(t.SchemaComponentOptions,{components:{MultiAppManager:H,AppNameInput:j,MultiAppBlockInitializer:F},children:e.children})});class W extends t.Plugin{load(){return g(this,null,function*(){this.app.use(Y)})}}const M={name:"applications",filterTargetKey:"name",targetKey:"name",fields:[{type:"uid",name:"name",primaryKey:!0,prefix:"a",interface:"input",uiSchema:{type:"string",title:c("App ID"),required:!0,"x-component":"Input","x-validator":"uid"}},{type:"string",name:"displayName",interface:"input",uiSchema:{type:"string",title:c("App display name"),required:!0,"x-component":"Input"}},{type:"string",name:"pinned",interface:"checkbox",uiSchema:{type:"boolean","x-content":c("Pin to menu"),"x-component":"Checkbox"}},{type:"string",name:"status",interface:"radioGroup",defaultValue:"pending",uiSchema:{type:"string",title:c("App status"),enum:[{label:c("Initializing"),value:"initializing"},{label:c("Initialized"),value:"initialized"},{label:c("Running"),value:"running"},{label:c("Commanding"),value:"commanding"},{label:c("Stopped"),value:"stopped"},{label:c("Error"),value:"error"},{label:c("Not found"),value:"not_found"}],"x-component":"Radio.Group"}},{type:"string",name:"isTemplate",interface:"checkbox",uiSchema:{type:"boolean","x-content":c("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:c("Start mode"),"x-component":"Radio.Group","x-decorator":"FormItem",default:!1,enum:[{label:c("Start on first visit"),value:!1},{label:c("Start with main application"),value:!0}],"x-hidden":"{{ !admin }}"},cnamePrefix:{title:c("Custom domain prefix"),"x-component":"Input","x-decorator":"FormItem","x-validator":`{{(value) => {
1
+ (function(i,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("@tachybase/utils/client"),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","@tachybase/utils/client","@ant-design/icons"],t):(i=typeof globalThis!="undefined"?globalThis:i||self,t(i["@tachybase/module-multi-app"]={},i["@tachybase/client"],i.jsxRuntime,i.antd,i["react-router-dom"],i["react-i18next"],i.react,i["@tachybase/schema"],i["@tachybase/utils"],i["@ant-design/icons"]))})(this,function(i,t,n,c,I,P,b,y,f,m){"use strict";var fe=Object.defineProperty,he=Object.defineProperties;var Ae=Object.getOwnPropertyDescriptors;var L=Object.getOwnPropertySymbols;var ge=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable;var E=(i,t,n)=>t in i?fe(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,A=(i,t)=>{for(var n in t||(t={}))ge.call(t,n)&&E(i,n,t[n]);if(L)for(var n of L(t))be.call(t,n)&&E(i,n,t[n]);return i},v=(i,t)=>he(i,Ae(t));var g=(i,t,n)=>new Promise((c,I)=>{var P=f=>{try{y(n.next(f))}catch(m){I(m)}},b=f=>{try{y(n.throw(f))}catch(m){I(m)}},y=f=>f.done?c(f.value):Promise.resolve(f.value).then(P,b);y((n=n.apply(i,t)).next())});const C="multi-app",_="subAppsChange",h="subAppsChange",S=()=>{const{t:e}=P.useTranslation([C,"core"]);return{t:e}},l=e=>`{{t("${e}", { ns: ["${C}", "client"] })}}`,K={type:"void","x-component":"CardItem","x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:table",properties:{app:{type:"void","x-component":"AppManager","x-component-props":{admin:!1}}}},F=()=>{const{insert:e}=t.useSchemaInitializer(),o=t.useSchemaInitializerItem(),a=b.useCallback(()=>e(K),[e]);return n.jsx(t.SchemaInitializerItem,v(A({},o),{onClick:a}))},U=e=>{const o=t.useApp(),a=e.value&&n.jsx("a",{target:"_blank",href:o.getRouteUrl(`/apps/${e.value}/admin`),rel:"noreferrer",children:e.value});return n.jsxs("div",{style:e.style,children:[e.addonBefore,e.prefix,a,e.suffix,e.addonAfter]})},j=y.connect(c.Input,y.mapReadPretty(U)),H=t.createStyles(({token:e})=>({button:{color:e.colorTextHeaderMenu+" !important"}})),G=()=>{const{styles:e}=H(),{data:o,run:a}=t.useRequest({resource:"applications",action:"listPinned"},{manual:!0}),{t:s}=S(),r=t.useApp(),d=[...((o==null?void 0:o.data)||[]).map(p=>{let u=r.getRouteUrl(`/apps/${p.name}/admin/`);return p.cname&&(u=`//${p.cname}`),{key:p.name,label:n.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",children:p.displayName||p.name})}}),{key:".manager",label:n.jsx(I.Link,{to:r.systemSettingsManager.getRoutePath("system-services."+C),children:s("Manage applications")})}];return n.jsx(c.Dropdown,{onOpenChange:p=>{a()},menu:{items:d},children:n.jsx(c.Button,{className:e.button,title:"Apps",icon:n.jsx(t.Icon,{type:"AppstoreOutlined"})})})},Y=e=>n.jsx(t.PinnedPluginListProvider,{items:{am:{order:201,component:"MultiAppManager",pin:!0,snippet:"pm.*",belongTo:"pinnedmenu"}},children:n.jsx(t.SchemaComponentOptions,{components:{MultiAppManager:G,AppNameInput:j,MultiAppBlockInitializer:F},children:e.children})});class W extends t.Plugin{load(){return g(this,null,function*(){this.app.use(Y)})}}const M={name:"applications",filterTargetKey:"name",targetKey:"name",fields:[{type:"uid",name:"name",primaryKey:!0,prefix:"a",interface:"input",uiSchema:{type:"string",title:l("App ID"),required:!0,"x-component":"Input","x-validator":"uid"}},{type:"string",name:"displayName",interface:"input",uiSchema:{type:"string",title:l("App display name"),required:!0,"x-component":"Input"}},{type:"string",name:"pinned",interface:"checkbox",uiSchema:{type:"boolean","x-content":l("Pin to menu"),"x-component":"Checkbox"}},{type:"string",name:"status",interface:"radioGroup",defaultValue:"pending",uiSchema:{type:"string",title:l("App status"),enum:[{label:l("Initializing"),value:"initializing"},{label:l("Initialized"),value:"initialized"},{label:l("Running"),value:"running"},{label:l("Commanding"),value:"commanding"},{label:l("Stopped"),value:"stopped"},{label:l("Error"),value:"error"},{label:l("Not found"),value:"not_found"}],"x-component":"Radio.Group"}},{type:"string",name:"isTemplate",interface:"checkbox",uiSchema:{type:"boolean","x-content":l("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 }}"},cnamePrefix:{title:l("Custom domain prefix"),"x-component":"Input","x-decorator":"FormItem","x-validator":`{{(value) => {
2
2
  if (!value) {
3
3
  return null;
4
4
  }
5
5
  if (!/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/.test(value)) {
6
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
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:c("Template"),"x-component":"RemoteSelect","x-component-props":{placeholder:c("Can be empty, or selected from the template library or personal applications"),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:c("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"}}},B={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-use-component-props":"useDestroyActionProps","x-component-props":{confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}},J={type:"void",properties:{applicationsTable:{type:"void","x-decorator":"TableBlockProvider","x-decorator-props":{collection:M,action:"list",params:{pageSize:20,sort:["-createdAt"],appends:[],filter:{createdById:"{{ admin ? undefined : userId }}"}},rowKey:"name"},properties:{GlobalNotificationHandler:{type:"void","x-component":"GlobalNotificationHandler"},actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{fuzzySearch:{type:"void","x-component":"FuzzySearchInput","x-align":"left"},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:c("Start all"),content:c("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:c("Stop all"),content:c("All sub-applications have stopped serving, unless you restart them")}},"x-hidden":"{{ !admin }}"},create:{type:"void",title:'{{t("Add new")}}',"x-decorator":e=>b.createElement(t.SchemaComponentOptions,v(A({},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 o=t.useActionContext();return t.useRequest(()=>Promise.resolve({data:{name:`a_${y.uid()}`}}),v(A({},e),{refreshDeps:[o.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:c("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:c("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:A({type:"void","x-component":"Space","x-component-props":{split:"|"}},B)}}}}}}}},Q=()=>{const e=y.useForm(),o=y.useField(),a=t.useActionContext(),s=t.useDataBlockRequest(),r=t.useDataBlockResource();return{onClick(){return g(this,null,function*(){try{yield e.submit(),o.data=o.data||{},o.data.loading=!0,yield r.create({values:e.values}),a.setVisible(!1),yield e.reset(),o.data.loading=!1,s.refresh()}catch(p){o.data&&(o.data.loading=!1)}})}}},z=e=>{const{t:o}=C(),a=t.useAPIClient(),s=b.useMemo(()=>a.resource("applications"),[a]);return{handleStart:()=>g(null,null,function*(){try{l.notification.info({key:h,message:n.jsxs("span",{children:[o("Processing..."),"    ",n.jsx(l.Spin,{indicator:n.jsx(m.LoadingOutlined,{style:{fontSize:24},spin:!0})})]}),duration:0});const p=yield s.start({filterByTk:e.name});(p==null?void 0:p.status)===205&&l.notification.info({key:h,message:o("App is already running")})}catch(p){l.notification.error({key:h,message:o("Failed to start app")})}}),handleStop:()=>{s.stop({filterByTk:e.name}).then(()=>{l.notification.info({key:h,message:n.jsxs("span",{children:[o("Processing..."),"    ",n.jsx(l.Spin,{indicator:n.jsx(m.LoadingOutlined,{style:{fontSize:24},spin:!0})})]}),duration:0})})}}},V=e=>{const o=y.useField(),a=y.useForm(),s=t.useActionContext(),r=t.useDataBlockRequest(),d=t.useDataBlockResource(),p=t.useCollectionRecordData(),{record:u}=t.useRecord(),x=(p==null?void 0:p.name)||(u==null?void 0:u.name);return{onClick(){return g(this,null,function*(){var D;yield a.submit(),o.data=o.data||{},o.data.loading=!0;try{const k=yield d.update({filterByTk:x,values:a.values});s.setVisible(!1),yield a.reset(),r.refresh(),e==null||e(x,(D=k==null?void 0:k.data)==null?void 0:D.data)}catch(k){console.error(k)}finally{o.data.loading=!1}})}}};function O({name:e,cname:o}){const a=t.useApp();return o?`//${o}`:a.getRouteUrl(`/apps/${e}/admin/`)}const N=()=>{const e=t.useDataBlockResource(),{t:o}=C();return{onClick(){return g(this,null,function*(){var r,d;const s=yield e.startAll();l.notification.info({key:h,message:n.jsxs("span",{children:[o("Processing..."),"    ",n.jsx(l.Spin,{indicator:n.jsx(m.LoadingOutlined,{style:{fontSize:24},spin:!0})})]}),duration:0}),((d=(r=s==null?void 0:s.data)==null?void 0:r.data)==null?void 0:d.all)===0&&l.notification.info({key:h,message:`${o("Start count")}: 0/0!`})})}}},$=()=>{const e=t.useDataBlockResource(),{t:o}=C();return{onClick(){return g(this,null,function*(){var r,d;const s=yield e.stopAll();if(((d=(r=s==null?void 0:s.data)==null?void 0:r.data)==null?void 0:d.all)===0){l.notification.info({key:h,message:`${o("Stop count")}: 0/0!`});return}l.notification.info({key:h,message:n.jsxs("span",{children:[o("Processing..."),"    ",n.jsx(l.Spin,{indicator:n.jsx(m.LoadingOutlined,{style:{fontSize:24},spin:!0})})]}),duration:0})})}}},X=()=>{const e=t.useCollectionRecordData();return O({name:e.name,cname:e.cname})},Z=()=>{const{t:e}=C(),o=X(),a=t.useCollectionRecordData(),{handleStart:s,handleStop:r}=z(a);return n.jsxs(l.Space,{split:n.jsx(l.Divider,{type:"horizontal"}),children:[n.jsx(t.TrackingLink,{href:o,target:"_blank",rel:"noreferrer",trackingKey:"multiapp_linkView",children:e("View",{ns:S})}),a.status!=="running"&&n.jsx("a",{onClick:()=>s(),children:e("Start",{ns:S})}),a.status!=="stopped"&&n.jsx("a",{onClick:()=>r(),children:e("Stop",{ns:S})})]})},R=e=>{const{data:o,mutate:a,refresh:s}=t.useDataBlockRequest();return t.useNoticeSub(_,r=>{const d=l.notification[r.level]||l.notification.info;if(r.message?d({key:h,message:r.message}):r.status!=="commanding"&&r.status!=="initializing"&&l.notification.destroy(h),!(o!=null&&o.data)||r.refresh){s();return}if(!r.app&&!r.status||!o.data.some(x=>x.name===r.app))return;const u=[...o.data];u.find(x=>x.name===r.app).status=r.status,a(v(A({},o),{data:u}))}),null},q=e=>{var d,p;const{admin:o=!0}=e,a=t.useCurrentUserContext(),s=(p=(d=a==null?void 0:a.data)==null?void 0:d.data)==null?void 0:p.id,{t:r}=P.useTranslation([S,"core"],{nsMode:"fallback"});return n.jsx(l.Card,{bordered:!1,children:n.jsx(t.SchemaComponent,{schema:J,scope:{admin:o,userId:s,useCreateDatabaseConnectionAction:Q,useMultiAppUpdateAction:V,useStartAllAction:N,useStopAllAction:$,t:r,uid:f.uid},components:{AppVisitor:Z,GlobalNotificationHandler:R}})})};class ee extends t.Plugin{load(){return g(this,null,function*(){this.app.systemSettingsManager.add(`system-services.${S}`,{title:c("Multi-app manager"),icon:"AppstoreOutlined",Component:q,aclSnippet:"pm.multi-app.applications"})})}}const te={type:"void","x-component":"CardItem","x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:table",properties:{app:{type:"void","x-component":"ViewMultiAppPane","x-component-props":{admin:!1}}}},oe=()=>{const{insert:e}=t.useSchemaInitializer(),o=t.useSchemaInitializerItem(),a=b.useCallback(()=>e(te),[e]);return n.jsx(t.SchemaInitializerItem,v(A({},o),{onClick:a}))},ne={type:"void",properties:{update:{type:"void","x-component":"Action","x-component-props":{icon:"editoutlined"},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","x-component":"Action","x-use-component-props":"useDestroyActionProps","x-component-props":{icon:"deleteoutlined",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}},ae={type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{create:{type:"void",title:'{{t("Add new")}}',"x-decorator":e=>b.createElement(t.SchemaComponentOptions,v(A({},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 o=t.useActionContext();return t.useRequest(()=>Promise.resolve({data:{name:`a_${f.uid()}`}}),v(A({},e),{refreshDeps:[o.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"}}}}}}}}}},re=t.createStyles(({css:e,token:o})=>({appAction:e`
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:l("Template"),"x-component":"RemoteSelect","x-component-props":{placeholder:l("Can be empty, or selected from the template library or personal applications"),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:l("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"}}},B={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-use-component-props":"useDestroyActionProps","x-component-props":{confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}},J={type:"void",properties:{applicationsTable:{type:"void","x-decorator":"TableBlockProvider","x-decorator-props":{collection:M,action:"list",params:{pageSize:20,sort:["-createdAt"],appends:[],filter:{createdById:"{{ admin ? undefined : userId }}"}},rowKey:"name"},properties:{GlobalNotificationHandler:{type:"void","x-component":"GlobalNotificationHandler"},actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{fuzzySearch:{type:"void","x-component":"FuzzySearchInput","x-align":"left"},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:l("Start all"),content:l("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:l("Stop all"),content:l("All sub-applications have stopped serving, unless you restart them")}},"x-hidden":"{{ !admin }}"},create:{type:"void",title:'{{t("Add new")}}',"x-decorator":e=>b.createElement(t.SchemaComponentOptions,v(A({},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 o=t.useActionContext();return t.useRequest(()=>Promise.resolve({data:{name:`a_${y.uid()}`}}),v(A({},e),{refreshDeps:[o.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:l("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:l("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:A({type:"void","x-component":"Space","x-component-props":{split:"|"}},B)}}}}}}}},Q=()=>{const e=y.useForm(),o=y.useField(),a=t.useActionContext(),s=t.useDataBlockRequest(),r=t.useDataBlockResource();return{onClick(){return g(this,null,function*(){try{yield e.submit(),o.data=o.data||{},o.data.loading=!0,yield r.create({values:e.values}),a.setVisible(!1),yield e.reset(),o.data.loading=!1,s.refresh()}catch(p){o.data&&(o.data.loading=!1)}})}}},z=e=>{const{t:o}=S(),a=t.useAPIClient(),s=b.useMemo(()=>a.resource("applications"),[a]);return{handleStart:()=>g(null,null,function*(){try{c.notification.info({key:h,message:n.jsxs("span",{children:[o("Processing..."),"    ",n.jsx(c.Spin,{indicator:n.jsx(m.LoadingOutlined,{style:{fontSize:24},spin:!0})})]}),duration:0});const p=yield s.start({filterByTk:e.name});(p==null?void 0:p.status)===205&&c.notification.info({key:h,message:o("App is already running")})}catch(p){c.notification.error({key:h,message:o("Failed to start app")})}}),handleStop:()=>{s.stop({filterByTk:e.name}).then(()=>{c.notification.info({key:h,message:n.jsxs("span",{children:[o("Processing..."),"    ",n.jsx(c.Spin,{indicator:n.jsx(m.LoadingOutlined,{style:{fontSize:24},spin:!0})})]}),duration:0})})}}},V=e=>{const o=y.useField(),a=y.useForm(),s=t.useActionContext(),r=t.useDataBlockRequest(),d=t.useDataBlockResource(),p=t.useCollectionRecordData(),{record:u}=t.useRecord(),x=(p==null?void 0:p.name)||(u==null?void 0:u.name);return{onClick(){return g(this,null,function*(){var D;yield a.submit(),o.data=o.data||{},o.data.loading=!0;try{const k=yield d.update({filterByTk:x,values:a.values});s.setVisible(!1),yield a.reset(),r.refresh(),e==null||e(x,(D=k==null?void 0:k.data)==null?void 0:D.data)}catch(k){console.error(k)}finally{o.data.loading=!1}})}}};function O({name:e,cname:o}){const a=t.useApp();return o?`//${o}`:a.getRouteUrl(`/apps/${e}/admin/`)}const N=()=>{const e=t.useDataBlockResource(),{t:o}=S();return{onClick(){return g(this,null,function*(){var r,d;const s=yield e.startAll();c.notification.info({key:h,message:n.jsxs("span",{children:[o("Processing..."),"    ",n.jsx(c.Spin,{indicator:n.jsx(m.LoadingOutlined,{style:{fontSize:24},spin:!0})})]}),duration:0}),((d=(r=s==null?void 0:s.data)==null?void 0:r.data)==null?void 0:d.all)===0&&c.notification.info({key:h,message:`${o("Start count")}: 0/0!`})})}}},$=()=>{const e=t.useDataBlockResource(),{t:o}=S();return{onClick(){return g(this,null,function*(){var r,d;const s=yield e.stopAll();if(((d=(r=s==null?void 0:s.data)==null?void 0:r.data)==null?void 0:d.all)===0){c.notification.info({key:h,message:`${o("Stop count")}: 0/0!`});return}c.notification.info({key:h,message:n.jsxs("span",{children:[o("Processing..."),"    ",n.jsx(c.Spin,{indicator:n.jsx(m.LoadingOutlined,{style:{fontSize:24},spin:!0})})]}),duration:0})})}}},X=()=>{const e=t.useCollectionRecordData();return O({name:e.name,cname:e.cname})},Z=()=>{const{t:e}=S(),o=X(),a=t.useCollectionRecordData(),{handleStart:s,handleStop:r}=z(a);return n.jsxs(c.Space,{split:n.jsx(c.Divider,{type:"horizontal"}),children:[n.jsx(t.TrackingLink,{href:o,target:"_blank",rel:"noreferrer",trackingKey:"multiapp_linkView",children:e("View",{ns:C})}),a.status!=="running"&&n.jsx("a",{onClick:()=>s(),children:e("Start",{ns:C})}),a.status!=="stopped"&&n.jsx("a",{onClick:()=>r(),children:e("Stop",{ns:C})})]})},R=e=>{const{data:o,mutate:a,refresh:s}=t.useDataBlockRequest();return t.useNoticeSub(_,r=>{const d=c.notification[r.level]||c.notification.info;if(r.message?d({key:h,message:r.message}):r.status!=="commanding"&&r.status!=="initializing"&&c.notification.destroy(h),!(o!=null&&o.data)||r.refresh){s();return}if(!r.app&&!r.status||!o.data.some(x=>x.name===r.app))return;const u=[...o.data];u.find(x=>x.name===r.app).status=r.status,a(v(A({},o),{data:u}))}),null},q=e=>{var d,p;const{admin:o=!0}=e,a=t.useCurrentUserContext(),s=(p=(d=a==null?void 0:a.data)==null?void 0:d.data)==null?void 0:p.id,{t:r}=P.useTranslation([C,"core"],{nsMode:"fallback"});return n.jsx(c.Card,{bordered:!1,children:n.jsx(t.SchemaComponent,{schema:J,scope:{admin:o,userId:s,useCreateDatabaseConnectionAction:Q,useMultiAppUpdateAction:V,useStartAllAction:N,useStopAllAction:$,t:r,uid:f.uid},components:{AppVisitor:Z,GlobalNotificationHandler:R}})})};class ee extends t.Plugin{load(){return g(this,null,function*(){this.app.systemSettingsManager.add(`system-services.${C}`,{title:l("Multi-app manager"),icon:"AppstoreOutlined",Component:q,aclSnippet:"pm.multi-app.applications"})})}}const te={type:"void","x-component":"CardItem","x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:table",properties:{app:{type:"void","x-component":"ViewMultiAppPane","x-component-props":{admin:!1}}}},oe=()=>{const{insert:e}=t.useSchemaInitializer(),o=t.useSchemaInitializerItem(),a=b.useCallback(()=>e(te),[e]);return n.jsx(t.SchemaInitializerItem,v(A({},o),{onClick:a}))},ne={type:"void",properties:{update:{type:"void","x-component":"Action","x-component-props":{icon:"editoutlined"},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","x-component":"Action","x-use-component-props":"useDestroyActionProps","x-component-props":{icon:"deleteoutlined",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}},ae={type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{create:{type:"void",title:'{{t("Add new")}}',"x-decorator":e=>b.createElement(t.SchemaComponentOptions,v(A({},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 o=t.useActionContext();return t.useRequest(()=>Promise.resolve({data:{name:`a_${f.uid()}`}}),v(A({},e),{refreshDeps:[o.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"}}}}}}}}}},re=t.createStyles(({css:e,token:o})=>({appAction:e`
9
9
  width: 100%;
10
10
  display: flex;
11
11
  justify-content: flex-end;
@@ -47,4 +47,4 @@
47
47
  visibility: visible;
48
48
  }
49
49
  }
50
- `})),ie=()=>{C();const{styles:e}=re(),o=t.useTableBlockContext(),a=o==null?void 0:o.service,{data:s,loading:r,run:d}=a||{},[p,u]=b.useState(!1);if(r)return n.jsx(l.Spin,{});const{data:x}=s||{};return n.jsxs(l.Card,{style:{backgroundColor:"transparent",border:"none",boxShadow:"none"},children:[n.jsx("div",{className:e.appAction,children:n.jsx(t.SchemaComponent,{schema:ae})}),n.jsx("div",{className:e.appListStyle,children:x==null?void 0:x.map(T=>n.jsx(se,v(A({},T),{service:a,appStatus:p,setAppStatus:u}),T.name))})]})},se=e=>{const{name:o,cname:a,displayName:s,icon:r,color:d,status:p,service:u,appStatus:x,setAppStatus:T}=e,{t:D}=C(),k=O({name:o,cname:a}),ue=b.useCallback(()=>{window&&p==="running"?window.open(k,"_blank"):l.message.warning(D("App is not running"))},[a,p]),{handleStart:me,handleStop:xe}=z(e),ye=()=>{p==="running"?xe():me(),T(!x),u.refresh()};return n.jsx("div",{className:"media-card",children:n.jsxs(t.RecordProvider,{record:e,children:[n.jsxs("div",{className:"media-actions",children:[n.jsx(l.Button,{icon:p==="running"?n.jsx(m.StopOutlined,{}):n.jsx(m.CheckCircleOutlined,{}),onClick:ye}),n.jsx(t.SchemaComponent,{schema:ne,scope:{useMultiAppUpdateAction:V,useStartAllAction:N,useStopAllAction:$}})]}),n.jsx(t.MediaCard,{layout:"vertical",title:s,icon:r,color:p==="running"?d:void 0,needHover:!1,onClick:ue})]})})},pe={type:"void",properties:{multiApp:{"x-decorator":"TableBlockProvider","x-decorator-props":{collection:M,action:"list",params:{pageSize:20,sort:["-createdAt"],appends:[],filter:{createdById:"{{ userId }}"}},rowKey:"name"},"x-component":"AppList"}}},ce=()=>{var a,s;const e=t.useCurrentUserContext(),o=(s=(a=e==null?void 0:e.data)==null?void 0:a.data)==null?void 0:s.id;return n.jsx(t.SchemaComponent,{schema:pe,scope:{userId:o},components:{AppList:ie}})};class le extends t.Plugin{load(){return g(this,null,function*(){this.app.addComponents({AppManager:q,ViewMultiAppPane:ce});const o=this.app.schemaInitializerManager.get("page:addBlock");o.add("otherBlocks.multiApp",{name:"multiApp",title:c("Multi-app manager"),icon:n.jsx(m.AppstoreOutlined,{}),Component:F}),o.add("otherBlocks.showMultiApp",{name:"showMultiApp",title:c("Multi-app display"),icon:n.jsx(m.WindowsOutlined,{}),Component:oe})})}}class de extends t.Plugin{afterAdd(){return g(this,null,function*(){yield this.app.pm.add(W),yield this.app.pm.add(le),yield this.app.pm.add(ee)})}}i.default=de,i.formSchema=w,i.tableActionColumnSchema=B,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
50
+ `})),ie=()=>{S();const{styles:e}=re(),o=t.useTableBlockContext(),a=o==null?void 0:o.service,{data:s,loading:r,run:d}=a||{},[p,u]=b.useState(!1);if(r)return n.jsx(c.Spin,{});const{data:x}=s||{};return n.jsxs(c.Card,{style:{backgroundColor:"transparent",border:"none",boxShadow:"none"},children:[n.jsx("div",{className:e.appAction,children:n.jsx(t.SchemaComponent,{schema:ae})}),n.jsx("div",{className:e.appListStyle,children:x==null?void 0:x.map(T=>n.jsx(se,v(A({},T),{service:a,appStatus:p,setAppStatus:u}),T.name))})]})},se=e=>{const{name:o,cname:a,displayName:s,icon:r,color:d,status:p,service:u,appStatus:x,setAppStatus:T}=e,{t:D}=S(),k=O({name:o,cname:a}),ue=b.useCallback(()=>{window&&p==="running"?window.open(k,"_blank"):c.message.warning(D("App is not running"))},[a,p]),{handleStart:me,handleStop:xe}=z(e),ye=()=>{p==="running"?xe():me(),T(!x),u.refresh()};return n.jsx("div",{className:"media-card",children:n.jsxs(t.RecordProvider,{record:e,children:[n.jsxs("div",{className:"media-actions",children:[n.jsx(c.Button,{icon:p==="running"?n.jsx(m.StopOutlined,{}):n.jsx(m.CheckCircleOutlined,{}),onClick:ye}),n.jsx(t.SchemaComponent,{schema:ne,scope:{useMultiAppUpdateAction:V,useStartAllAction:N,useStopAllAction:$}})]}),n.jsx(t.MediaCard,{layout:"vertical",title:s,icon:r,color:p==="running"?d:void 0,needHover:!1,onClick:ue})]})})},pe={type:"void",properties:{multiApp:{"x-decorator":"TableBlockProvider","x-decorator-props":{collection:M,action:"list",params:{pageSize:20,sort:["-createdAt"],appends:[],filter:{createdById:"{{ userId }}"}},rowKey:"name"},"x-component":"AppList"}}},ce=()=>{var a,s;const e=t.useCurrentUserContext(),o=(s=(a=e==null?void 0:e.data)==null?void 0:a.data)==null?void 0:s.id;return n.jsx(t.SchemaComponent,{schema:pe,scope:{userId:o},components:{AppList:ie}})};class le extends t.Plugin{load(){return g(this,null,function*(){this.app.addComponents({AppManager:q,ViewMultiAppPane:ce});const o=this.app.schemaInitializerManager.get("page:addBlock");o.add("otherBlocks.multiApp",{name:"multiApp",title:l("Multi-app manager"),icon:n.jsx(m.AppstoreOutlined,{}),Component:F}),o.add("otherBlocks.showMultiApp",{name:"showMultiApp",title:l("Multi-app display"),icon:n.jsx(m.WindowsOutlined,{}),Component:oe})})}}class de extends t.Plugin{afterAdd(){return g(this,null,function*(){yield this.app.pm.add(W),yield this.app.pm.add(le),yield this.app.pm.add(ee)})}}i.default=de,i.formSchema=w,i.tableActionColumnSchema=B,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,16 +1,16 @@
1
1
  module.exports = {
2
2
  "react-i18next": "15.2.0",
3
- "@tachybase/client": "1.3.17",
4
- "@tachybase/server": "1.3.17",
5
- "@tachybase/database": "1.3.17",
3
+ "@tachybase/client": "1.3.19",
4
+ "@tachybase/server": "1.3.19",
5
+ "@tachybase/database": "1.3.19",
6
6
  "lodash": "4.17.21",
7
7
  "mysql2": "3.14.1",
8
8
  "pg": "8.13.1",
9
9
  "react": "18.3.1",
10
- "@tachybase/schema": "1.3.17",
10
+ "@tachybase/schema": "1.3.19",
11
11
  "antd": "5.22.5",
12
12
  "react-router-dom": "6.28.1",
13
- "@tachybase/utils": "1.3.17",
13
+ "@tachybase/utils": "1.3.19",
14
14
  "@ant-design/icons": "5.5.2",
15
- "@tachybase/actions": "1.3.17"
15
+ "@tachybase/actions": "1.3.19"
16
16
  };
@@ -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-07-04T03:58:08.603Z"}
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-07-17T10:55:43.164Z"}
@@ -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.14.0","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.1.0"},"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.7.0","eslint":"=8.8.0","evalmd":"^0.0.19","for-each":"^0.3.3","glob":"=10.3.7","has-bigints":"^1.1.0","has-override-mistake":"^1.0.1","has-property-descriptors":"^1.0.2","has-proto":"^1.2.0","has-symbols":"^1.1.0","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-07-04T03:58:08.917Z"}
1
+ {"name":"qs","description":"A querystring parser that supports nesting and arrays, with a depth limit","homepage":"https://github.com/ljharb/qs","version":"6.14.0","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.1.0"},"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.7.0","eslint":"=8.8.0","evalmd":"^0.0.19","for-each":"^0.3.3","glob":"=10.3.7","has-bigints":"^1.1.0","has-override-mistake":"^1.0.1","has-property-descriptors":"^1.0.2","has-proto":"^1.2.0","has-symbols":"^1.1.0","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-07-17T10:55:43.474Z"}
@@ -188,7 +188,7 @@ class PluginMultiAppManager extends import_server.Plugin {
188
188
  this.db.on(
189
189
  "applications.afterCreateWithAssociations",
190
190
  async (model, options) => {
191
- var _a;
191
+ var _a, _b;
192
192
  const { transaction } = options;
193
193
  const subApp = model.registerToSupervisor(this.app, {
194
194
  appOptionsFactory: this.appOptionsFactory
@@ -197,9 +197,9 @@ class PluginMultiAppManager extends import_server.Plugin {
197
197
  transaction,
198
198
  context: options.context
199
199
  });
200
- if (options.values.options.autoStart) {
200
+ if ((_a = options.values.options) == null ? void 0 : _a.autoStart) {
201
201
  const startPromise = subApp.runCommand("start", "--quickstart");
202
- if ((_a = options == null ? void 0 : options.context) == null ? void 0 : _a.waitSubAppInstall) {
202
+ if ((_b = options == null ? void 0 : options.context) == null ? void 0 : _b.waitSubAppInstall) {
203
203
  await startPromise;
204
204
  }
205
205
  this.app.noticeManager.notify(import_constants.NOTIFY_STATUS_EVENT_KEY, { level: "info", refresh: true });
@@ -213,10 +213,6 @@ class PluginMultiAppManager extends import_server.Plugin {
213
213
  const self = this;
214
214
  import_server.AppSupervisor.getInstance().setAppBootstrapper((0, import_app_lifecycle.LazyLoadApplication)(self));
215
215
  import_server.Gateway.getInstance().addAppSelectorMiddleware((0, import_middlewares.appSelectorMiddleware)(this.app));
216
- this.app.on("afterStart", (0, import_app_lifecycle.onAfterStart)(this.db));
217
- this.app.on("afterUpgrade", async (app, options) => {
218
- await this.subAppUpgradeHandler(app);
219
- });
220
216
  const notifyStatusChange = this.notifyStatusChange.bind(this);
221
217
  this.app.on("beforeStop", async (app) => {
222
218
  import_server.AppSupervisor.getInstance().off("appStatusChanged", notifyStatusChange);
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": "1.3.17",
4
+ "version": "1.3.19",
5
5
  "description": "Dynamically create multiple apps without separate deployments.",
6
6
  "keywords": [
7
7
  "System management"
@@ -20,15 +20,15 @@
20
20
  "react": "~18.3.1",
21
21
  "react-i18next": "^15.2.0",
22
22
  "react-router-dom": "6.28.1",
23
- "@tachybase/schema": "1.3.17"
23
+ "@tachybase/schema": "1.3.19"
24
24
  },
25
25
  "peerDependencies": {
26
- "@tachybase/actions": "1.3.17",
27
- "@tachybase/database": "1.3.17",
28
- "@tachybase/server": "1.3.17",
29
- "@tachybase/test": "1.3.17",
30
- "@tachybase/utils": "1.3.17",
31
- "@tachybase/client": "1.3.17"
26
+ "@tachybase/actions": "1.3.19",
27
+ "@tachybase/client": "1.3.19",
28
+ "@tachybase/database": "1.3.19",
29
+ "@tachybase/server": "1.3.19",
30
+ "@tachybase/test": "1.3.19",
31
+ "@tachybase/utils": "1.3.19"
32
32
  },
33
33
  "description.zh-CN": "无需单独部署即可动态创建多个应用。",
34
34
  "displayName.zh-CN": "多应用管理器",