@tachybase/module-multi-app 1.2.6 → 1.2.8

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.
@@ -5,7 +5,7 @@
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(this,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==="running"&&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: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(this,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`
9
9
  width: 100%;
10
10
  display: flex;
11
11
  justify-content: flex-end;
@@ -1,16 +1,16 @@
1
1
  module.exports = {
2
2
  "react-i18next": "15.2.0",
3
- "@tachybase/client": "1.2.6",
4
- "@tachybase/server": "1.2.6",
5
- "@tachybase/database": "1.2.6",
3
+ "@tachybase/client": "1.2.8",
4
+ "@tachybase/server": "1.2.8",
5
+ "@tachybase/database": "1.2.8",
6
6
  "lodash": "4.17.21",
7
7
  "mysql2": "3.11.5",
8
8
  "pg": "8.13.1",
9
9
  "react": "18.3.1",
10
- "@tachybase/schema": "1.2.6",
10
+ "@tachybase/schema": "1.2.8",
11
11
  "antd": "5.22.5",
12
12
  "react-router-dom": "6.28.1",
13
- "@tachybase/utils": "1.2.6",
13
+ "@tachybase/utils": "1.2.8",
14
14
  "@ant-design/icons": "5.5.2",
15
- "@tachybase/actions": "1.2.6"
15
+ "@tachybase/actions": "1.2.8"
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-06-18T04:32:29.253Z"}
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-06-18T17:12:24.574Z"}
@@ -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-06-18T04:32:29.578Z"}
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-06-18T17:12:24.885Z"}
@@ -30,14 +30,6 @@ function injectAppListMiddleware() {
30
30
  for (const application of applications) {
31
31
  const appStatus = import_server.AppSupervisor.getInstance().getAppStatus(application.name, "stopped");
32
32
  application.status = appStatus;
33
- if (application.tmpl) {
34
- const matchedApp = applications.find((app) => app.name === application.tmpl);
35
- if (matchedApp) {
36
- application.tmpl = `${matchedApp.displayName}(${application.tmpl})`;
37
- } else {
38
- application.tmpl = `Not Exists(${application.tmpl})`;
39
- }
40
- }
41
33
  }
42
34
  }
43
35
  };
@@ -0,0 +1,6 @@
1
+ import { Migration } from '@tachybase/server';
2
+ export default class extends Migration {
3
+ on: string;
4
+ appVersion: string;
5
+ up(): Promise<void>;
6
+ }
@@ -0,0 +1,69 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var fix_tmpl_exports = {};
19
+ __export(fix_tmpl_exports, {
20
+ default: () => fix_tmpl_default
21
+ });
22
+ module.exports = __toCommonJS(fix_tmpl_exports);
23
+ var import_server = require("@tachybase/server");
24
+ function extractInnermost(expression) {
25
+ let trimmed = expression.trim();
26
+ const regex = /^NOT\s+EXISTS\s*\(\s*(.+)\s*\)$/i;
27
+ while (regex.test(trimmed)) {
28
+ trimmed = trimmed.match(regex)[1];
29
+ }
30
+ return trimmed;
31
+ }
32
+ class fix_tmpl_default extends import_server.Migration {
33
+ constructor() {
34
+ super(...arguments);
35
+ this.on = "afterLoad";
36
+ // 'beforeLoad' or 'afterLoad'
37
+ this.appVersion = "<1.2.7";
38
+ }
39
+ async up() {
40
+ const repo = this.db.getRepository("applications");
41
+ const list = await repo.find({
42
+ filter: {
43
+ tmpl: {
44
+ $includes: "Not Exists"
45
+ }
46
+ },
47
+ raw: true
48
+ });
49
+ if (!list.length) {
50
+ this.app.logger.info("multi app fix tmpl 0 rows");
51
+ return;
52
+ }
53
+ let count = 0;
54
+ for (const item of list) {
55
+ const originName = extractInnermost(item.tmpl);
56
+ if (originName === item.tmpl) {
57
+ continue;
58
+ }
59
+ await repo.update({
60
+ filterByTk: item.name,
61
+ values: {
62
+ tmpl: originName
63
+ }
64
+ });
65
+ count++;
66
+ }
67
+ this.app.logger.info(`multi app fix tmpl ${count} rows`);
68
+ }
69
+ }
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.2.6",
4
+ "version": "1.2.8",
5
5
  "description": "Dynamically create multiple apps without separate deployments.",
6
6
  "keywords": [
7
7
  "System management"
@@ -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": "1.2.6"
24
+ "@tachybase/schema": "1.2.8"
25
25
  },
26
26
  "peerDependencies": {
27
- "@tachybase/actions": "1.2.6",
28
- "@tachybase/database": "1.2.6",
29
- "@tachybase/server": "1.2.6",
30
- "@tachybase/client": "1.2.6",
31
- "@tachybase/utils": "1.2.6",
32
- "@tachybase/test": "1.2.6"
27
+ "@tachybase/actions": "1.2.8",
28
+ "@tachybase/client": "1.2.8",
29
+ "@tachybase/database": "1.2.8",
30
+ "@tachybase/server": "1.2.8",
31
+ "@tachybase/test": "1.2.8",
32
+ "@tachybase/utils": "1.2.8"
33
33
  },
34
34
  "description.zh-CN": "无需单独部署即可动态创建多个应用。",
35
35
  "displayName.zh-CN": "多应用管理器",