@kb-labs/workflow-entry 2.98.0 → 2.100.0
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.
- package/dist/widgets/117.js +1 -1
- package/dist/widgets/165.js +1 -1
- package/dist/widgets/370.js +1 -1
- package/dist/widgets/46.js +1 -1
- package/dist/widgets/50.js +1 -1
- package/dist/widgets/546.js +1 -1
- package/dist/widgets/62.js +1 -1
- package/dist/widgets/669.js +1 -1
- package/dist/widgets/697.js +2 -0
- package/dist/widgets/697.js.map +1 -0
- package/dist/widgets/716.js +1 -1
- package/dist/widgets/733.js +2 -2
- package/dist/widgets/775.js +1 -1
- package/dist/widgets/__federation_expose_Crons.js +1 -1
- package/dist/widgets/__federation_expose_Dashboard.js +1 -1
- package/dist/widgets/__federation_expose_DefinitionDetail.js +1 -1
- package/dist/widgets/__federation_expose_Definitions.js +1 -1
- package/dist/widgets/__federation_expose_Jobs.js +1 -1
- package/dist/widgets/__federation_expose_RunDetail.js +1 -1
- package/dist/widgets/__federation_expose_Runs.js +1 -1
- package/dist/widgets/mf-manifest.json +17 -17
- package/dist/widgets/mf-stats.json +29 -28
- package/dist/widgets/remoteEntry.js +3 -3
- package/dist/widgets/remoteEntry.js.map +1 -1
- package/package.json +7 -7
- package/dist/widgets/78.js +0 -2
- package/dist/widgets/78.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[772],{6026(e,t){var n=Symbol.for("react.transitional.element");function a(e,t,a){var r=null;if(void 0!==a&&(r=""+a),void 0!==t.key&&(r=""+t.key),"key"in t)for(var s in a={},t)"key"!==s&&(a[s]=t[s]);else a=t;return{$$typeof:n,type:e,key:r,ref:void 0!==(t=a.ref)?t:null,props:a}}t.Fragment=Symbol.for("react.fragment"),t.jsx=a,t.jsxs=a},4552(e,t,n){e.exports=n(6026)},1597(e,t,n){n.r(t);var a=n(4552);n(
|
|
1
|
+
"use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[772],{6026(e,t){var n=Symbol.for("react.transitional.element");function a(e,t,a){var r=null;if(void 0!==a&&(r=""+a),void 0!==t.key&&(r=""+t.key),"key"in t)for(var s in a={},t)"key"!==s&&(a[s]=t[s]);else a=t;return{$$typeof:n,type:e,key:r,ref:void 0!==(t=a.ref)?t:null,props:a}}t.Fragment=Symbol.for("react.fragment"),t.jsx=a,t.jsxs=a},4552(e,t,n){e.exports=n(6026)},1597(e,t,n){n.r(t);var a=n(4552);n(7079);var r=n(9776),s=n(7936);function l(){var e,t,n,l=(0,s.useData)("/exec/api/v1/crons"),i=l.data,o=l.isLoading,c=function(e){return e?new Date(e).toLocaleString():"-"},d=[{title:"Cron ID",dataIndex:"id",key:"id",render:function(e){return(0,a.jsx)(r.UITypographyText,{className:"typo-body",strong:!0,children:e})}},{title:"Schedule",dataIndex:"schedule",key:"schedule",render:function(e){return(0,a.jsxs)(r.UISpace,{className:"gap-tight",children:[(0,a.jsx)(r.UIIcon,{name:"ClockCircleOutlined",className:"text-secondary"}),(0,a.jsx)(r.UITypographyText,{className:"typo-caption",code:!0,children:e})]})}},{title:"Job Type",dataIndex:"jobType",key:"jobType",render:function(e){return(0,a.jsx)(r.UITypographyText,{className:"typo-body",children:e})}},{title:"Timezone",dataIndex:"timezone",key:"timezone",render:function(e){return(0,a.jsx)(r.UITypographyText,{className:"typo-caption",children:e||"UTC"})}},{title:"Status",dataIndex:"enabled",key:"enabled",render:function(e){return(0,a.jsx)(r.UIBadge,{variant:e?"success":"default",children:e?"Enabled":"Disabled"})}},{title:"Last Run",dataIndex:"lastRun",key:"lastRun",render:function(e){return(0,a.jsxs)(r.UISpace,{className:"gap-tight",children:[(0,a.jsx)(r.UIIcon,{name:"CalendarOutlined",className:"text-secondary"}),(0,a.jsx)(r.UITypographyText,{className:"typo-caption",children:c(e)})]})}},{title:"Next Run",dataIndex:"nextRun",key:"nextRun",render:function(e){return e?(0,a.jsxs)(r.UISpace,{className:"gap-tight",children:[(0,a.jsx)(r.UIIcon,{name:"CalendarOutlined",className:"text-info"}),(0,a.jsx)(r.UITypographyText,{className:"typo-caption",children:c(e)})]}):(0,a.jsx)(r.UITypographyText,{className:"typo-caption text-tertiary",children:"-"})}},{title:"Plugin",dataIndex:"pluginId",key:"pluginId",render:function(e){return e?(0,a.jsx)(r.UITag,{color:"blue",children:e}):(0,a.jsx)(r.UITypographyText,{className:"typo-caption text-tertiary",children:"-"})}}],y=(null==i||null==(e=i.crons)?void 0:e.filter(function(e){return e.enabled}).length)||0,p=(null==i||null==(t=i.crons)?void 0:t.filter(function(e){return!e.enabled}).length)||0;return(0,a.jsxs)(r.UIPage,{width:"full",children:[(0,a.jsx)(r.UIPageHeader,{title:"Cron Jobs",description:"Scheduled recurring tasks",breadcrumbs:[{title:"Home",href:"/"},{title:"Workflows",href:"/workflows"},{title:"Crons"}]}),(0,a.jsx)(r.UICard,{style:{marginBottom:"var(--spacing-section)"},children:(0,a.jsxs)(r.UISpace,{className:"gap-section",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.UITypographyText,{className:"typo-label text-secondary",children:"Total Cron Jobs"}),(0,a.jsx)("div",{children:(0,a.jsx)(r.UITypographyText,{className:"typo-section-title",children:(null==i||null==(n=i.crons)?void 0:n.length)||0})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.UITypographyText,{className:"typo-label text-secondary",children:"Enabled"}),(0,a.jsx)("div",{children:(0,a.jsx)(r.UITypographyText,{className:"typo-section-title text-success",children:y})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.UITypographyText,{className:"typo-label text-secondary",children:"Disabled"}),(0,a.jsx)("div",{children:(0,a.jsx)(r.UITypographyText,{className:"typo-section-title",children:p})})]})]})}),(0,a.jsx)(r.UICard,{children:(0,a.jsx)(r.UITable,{dataSource:(null==i?void 0:i.crons)||[],columns:d,loading:o,rowKey:"id",pagination:{pageSize:20}})})]})}n.d(t,{default:()=>l})}}]);
|
|
2
2
|
//# sourceMappingURL=__federation_expose_Crons.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[685],{6026(e,t){var r=Symbol.for("react.transitional.element");function n(e,t,n){var o=null;if(void 0!==n&&(o=""+n),void 0!==t.key&&(o=""+t.key),"key"in t)for(var a in n={},t)"key"!==a&&(n[a]=t[a]);else n=t;return{$$typeof:r,type:e,key:o,ref:void 0!==(t=n.ref)?t:null,props:n}}t.Fragment=Symbol.for("react.fragment"),t.jsx=n,t.jsxs=n},4552(e,t,r){e.exports=r(6026)},6631(e,t,r){var n=r(4552),o=r(1913),a=r(1198);function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(a.push(r.value),!t||a.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw n}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return l(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e){var t,r=e.name,o=e.schema,l=e.value,i=e.onChange,s=(0,n.jsxs)(a.UISpace,{className:"gap-tight",style:{marginBottom:4},children:[(0,n.jsxs)(a.UITypographyText,{className:"typo-label",children:[r,o.required&&(0,n.jsx)("span",{style:{color:"var(--color-error)",marginLeft:2},children:"*"})]}),o.description&&(0,n.jsxs)(a.UITypographyText,{className:"typo-caption text-tertiary",children:["— ",o.description]})]});return"boolean"===o.type?(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)("div",{children:(0,n.jsx)(a.UISwitch,{checked:void 0!==l?!!l:null!=(t=o.default)&&t,onChange:i})})]}):"number"===o.type?(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)(a.UIInputNumber,{style:{width:"100%"},value:l,placeholder:void 0!==o.default?String(o.default):void 0,onChange:i})]}):(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)(a.UIInput,{value:l,placeholder:void 0!==o.default?String(o.default):void 0,onChange:function(e){return i(e)}})]})}function u(e){var t,r,l=e.open,u=e.onClose,p=e.onRun,d=e.loading,y="workflows"in e&&Array.isArray(e.workflows),f=y?e.workflows:[],h=s(o.useState(void 0),2),m=h[0],x=h[1],g=s(o.useState("{}"),2),v=g[0],j=g[1],I=s(o.useState(null),2),b=I[0],w=I[1],U=s(o.useState({}),2),T=U[0],k=U[1],S=y?null!=(t=f.find(function(e){return e.id===m}))?t:null:null!=(r=e.workflow)?r:null,N=null==S?void 0:S.inputs,O=!!N&&Object.keys(N).length>0;o.useEffect(function(){if(l)if(j("{}"),w(null),y||x(void 0),N){var e={},t=!0,r=!1,n=void 0;try{for(var o,a=Object.entries(N)[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var i=s(o.value,2),c=i[0],u=i[1];void 0!==u.default&&(e[c]=u.default)}}catch(e){r=!0,n=e}finally{try{t||null==a.return||a.return()}finally{if(r)throw n}}k(e)}else k({})},[l,null==S?void 0:S.id,N,y]),o.useEffect(function(){if(y&&m)if(j("{}"),w(null),N){var e={},t=!0,r=!1,n=void 0;try{for(var o,a=Object.entries(N)[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var l=s(o.value,2),i=l[0],c=l[1];void 0!==c.default&&(e[i]=c.default)}}catch(e){r=!0,n=e}finally{try{t||null==a.return||a.return()}finally{if(r)throw n}}k(e)}else k({})},[m,N,y]);var C=(0,n.jsxs)(a.UISpace,{style:{justifyContent:"flex-end"},children:[(0,n.jsx)(a.UIButton,{onClick:u,disabled:d,children:"Cancel"}),(0,n.jsx)(a.UIButton,{variant:"primary",icon:(0,n.jsx)(a.UIIcon,{name:"PlayCircleOutlined"}),loading:d,disabled:!S||!O&&!!b,onClick:function(){if(S)if(O)p(S.id,T);else{var e=v.trim();if(!e||"{}"===e)return void p(S.id,{});try{var t=JSON.parse(e);p(S.id,t)}catch(e){w("Invalid JSON")}}},children:"Run"})]}),A=S?"Run Workflow: ".concat(S.name):"Run Workflow";return(0,n.jsxs)(a.UIModal,{open:l,title:(0,n.jsxs)(a.UISpace,{className:"gap-item",children:[(0,n.jsx)(a.UIIcon,{name:"ThunderboltOutlined"}),(0,n.jsx)("span",{children:A})]}),onCancel:u,footer:C,maskClosable:!d,children:[y&&(0,n.jsxs)("div",{style:{marginTop:16},children:[(0,n.jsx)(a.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Select Workflow"}),(0,n.jsx)(a.UISelect,{style:{width:"100%"},placeholder:"Choose a workflow...",value:m,onChange:function(e){return x(e)},showSearch:!0,options:f.map(function(e){return{label:e.name,value:e.id,description:e.description}})})]}),S&&O&&(0,n.jsx)("div",{style:{marginTop:16},children:Object.entries(N).map(function(e){var t=s(e,2),r=t[0],o=t[1];return(0,n.jsx)(c,{name:r,schema:o,value:T[r],onChange:function(e){return k(function(t){var n,o;return n=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){i(e,t,r[t])})}return e}({},t),o=null!=(o=i({},r,e))?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(o)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))}),n})}},r)})}),S&&!O&&(0,n.jsxs)("div",{style:{marginTop:16},children:[(0,n.jsx)(a.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Input payload (JSON)"}),(0,n.jsx)(a.UIInputTextArea,{value:v,onChange:function(e){var t=e.target.value;if(j(t),!t.trim()||"{}"===t.trim())return void w(null);try{JSON.parse(t),w(null)}catch(e){w("Invalid JSON")}},rows:6,placeholder:"{}",style:{fontFamily:"var(--font-mono, monospace)",fontSize:13},status:b?"error":void 0}),b&&(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-error",style:{display:"block",marginTop:4},children:b}),(0,n.jsxs)(a.UITypographyText,{className:"typo-caption text-tertiary",style:{display:"block",marginTop:8},children:["Leave empty or ",(0,n.jsx)("code",{children:"{}"})," to run without parameters"]})]})]})}r.d(t,{y:()=>u})},5484(e,t,r){r.r(t),r.d(t,{default:()=>g});var n=r(4552),o=r(1913),a=r(3596),l=r(1198),i=r(6188);function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function c(e,t,r,n,o,a,l){try{var i=e[a](l),s=i.value}catch(e){r(e);return}i.done?t(s):Promise.resolve(s).then(n,o)}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(a.push(r.value),!t||a.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw n}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e){var t=e.runId,r=e.onSuccess,o=u((0,l.useUIMessage)(),2),a=o[0],s=o[1],p=(0,i.useMutateData)("/exec/api/v1/runs/".concat(t,"/cancel"));return(0,n.jsxs)(n.Fragment,{children:[s,(0,n.jsx)(l.UIButton,{variant:"text",size:"small",danger:!0,icon:(0,n.jsx)(l.UIIcon,{name:"StopOutlined"}),loading:p.isLoading,onClick:function(e){var n;return(n=function(){var n;return function(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:s(0)}),i(l,"throw",{value:s(1)}),i(l,"return",{value:s(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function s(i){return function(s){var c=[i,s];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(o){switch(o.label){case 0:e.preventDefault(),e.stopPropagation(),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,p.mutateAsync()];case 2:return o.sent(),a.success("Run ".concat(t.slice(0,8)," cancelled")),r(),[3,4];case 3:return n=o.sent(),a.error("Failed to cancel: ".concat(n.message)),[3,4];case 4:return[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var a=n.apply(e,t);function l(e){c(a,r,o,l,i,"next",e)}function i(e){c(a,r,o,l,i,"throw",e)}l(void 0)})})()},children:"Cancel"})]})}function d(){var e=u((0,l.useUIMessage)(),2),t=(e[0],e[1]),r=(0,i.useData)("/exec/api/v1/stats",{pollingMs:3e3}),o=r.data,s=r.isLoading,c=r.refetch,d=(null==o?void 0:o.activeExecutions)||[],y=d.length>0,f=d.some(function(e){return"waiting_approval"===e.status}),h=function(e){if(!e)return"-";var t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");var r=Math.floor(t/60);if(r<60)return"".concat(r,"m ").concat(t%60,"s");var n=Math.floor(r/60);return"".concat(n,"h ").concat(r%60,"m")};return(0,n.jsxs)(n.Fragment,{children:[t,f&&(0,n.jsx)(l.UIAlert,{variant:"warning",message:"Waiting for your approval",description:"One or more workflow steps require your decision.",showIcon:!0,style:{marginBottom:"var(--spacing-card)"}}),(0,n.jsx)(l.UICard,{title:(0,n.jsxs)(l.UISpace,{className:"gap-item",children:[(0,n.jsxs)(l.UITypographyText,{className:"typo-card-title",children:["Active Runs (",d.length,")"]}),(0,n.jsx)(l.UIButton,{variant:"text",size:"small",icon:(0,n.jsx)(l.UIIcon,{name:"ReloadOutlined",spin:s}),onClick:function(){return c()}})]}),style:{marginBottom:"var(--spacing-section)"},children:y?(0,n.jsx)(l.UIList,{dataSource:d,renderItem:function(e){return(0,n.jsxs)(l.UIListItem,{actions:[(0,n.jsx)(p,{runId:e.id,onSuccess:function(){return c()}},"cancel")],children:[(0,n.jsx)(l.UIListItemMeta,{title:(0,n.jsx)(a.Link,{to:"/p/workflows/runs/".concat(e.id),style:{color:"inherit",textDecoration:"none"},children:(0,n.jsxs)(l.UISpace,{children:[(0,n.jsx)(l.UITypographyText,{className:"typo-body",style:{color:"var(--color-link)"},children:e.workflowName||e.type}),void 0!==e.progress&&(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-secondary",children:[e.progress,"%"]})]})}),description:(0,n.jsxs)(l.UISpace,{direction:"vertical",className:"gap-tight",style:{width:"100%"},children:[e.progressMessage&&(0,n.jsx)(l.UITypographyText,{className:"typo-description",children:e.progressMessage}),(0,n.jsxs)(l.UISpace,{className:"gap-item",children:[(0,n.jsx)(l.UIIcon,{name:"ClockCircleOutlined",className:"text-secondary"}),(0,n.jsx)(l.UITypographyText,{className:"typo-caption text-secondary",children:h(e.durationMs)}),(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-tertiary",children:["ID: ",e.id.slice(0,8)]})]})]})}),void 0!==e.progress&&(0,n.jsx)(l.UIProgress,{percent:e.progress,size:"small",status:"active",style:{width:120}})]})}}):(0,n.jsx)(l.UITypographyText,{className:"typo-description text-secondary",children:"No active runs"})})]})}var y=r(6631);function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(a.push(r.value),!t||a.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw n}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return f(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var m={completed:(0,n.jsx)(l.UIIcon,{name:"CheckCircleOutlined",className:"text-success"}),failed:(0,n.jsx)(l.UIIcon,{name:"CloseCircleOutlined",className:"text-error"}),cancelled:(0,n.jsx)(l.UIIcon,{name:"StopOutlined",className:"text-warning"})},x={completed:"success",failed:"error",cancelled:"warning"};function g(){var e,t=(0,a.useNavigate)(),r=h((0,l.useUIMessage)(),2),s=r[0],c=r[1],u=h(o.useState(!1),2),p=u[0],f=u[1],g=(0,i.useData)("/exec/api/v1/stats",{pollingMs:3e3}).data,v=(0,i.useData)("/exec/api/v1/workflows",{params:{limit:100}}).data,j=(0,i.useMutateData)(function(e){return"/exec/api/v1/workflows/".concat(encodeURIComponent(e.workflowId),"/runs")},{mapBody:function(e){return e.input}}),I=(null==g?void 0:g.recentActivity)||[],b=[{title:"Time",dataIndex:"finishedAt",key:"finishedAt",width:100,render:function(e){return(0,n.jsx)(l.UITypographyText,{className:"typo-caption",style:{whiteSpace:"nowrap"},children:function(e){var t=new Date(e),r=Math.floor((new Date().getTime()-t.getTime())/6e4);if(r<1)return"Just now";if(r<60)return"".concat(r,"m ago");var n=Math.floor(r/60);if(n<24)return"".concat(n,"h ago");var o=Math.floor(n/24);return"".concat(o,"d ago")}(e)})}},{title:"Workflow / Job",dataIndex:"workflowName",key:"workflowName",width:280,render:function(e,t){return(0,n.jsxs)("div",{style:{overflow:"hidden"},children:[(0,n.jsx)(l.UITypographyText,{className:"typo-body",ellipsis:{tooltip:e||t.type},style:{display:"block"},children:e||t.type}),(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-tertiary",code:!0,ellipsis:{tooltip:t.id},style:{display:"block"},children:[t.id.slice(0,16),"..."]})]})}},{title:"Status",dataIndex:"status",key:"status",width:140,render:function(e){return(0,n.jsx)(l.UITag,{icon:m[e],color:x[e],children:e.toUpperCase()})}},{title:"Duration",dataIndex:"durationMs",key:"durationMs",width:100,render:function(e){return(0,n.jsx)(l.UITypographyText,{className:"typo-caption",children:function(e){if(!e)return"-";var t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");var r=Math.floor(t/60);if(r<60)return"".concat(r,"m ").concat(t%60,"s");var n=Math.floor(r/60);return"".concat(n,"h ").concat(r%60,"m")}(e)})}},{title:"Error",dataIndex:"error",key:"error",render:function(e){return e?(0,n.jsx)(l.UITypographyText,{className:"typo-caption text-error",ellipsis:{tooltip:e},style:{display:"block"},children:e}):(0,n.jsx)(l.UITypographyText,{className:"typo-caption text-tertiary",children:"-"})}}];return(0,n.jsxs)(l.UIPage,{width:"full",children:[c,(0,n.jsx)(l.UIPageHeader,{title:"Workflows",description:"Monitor workflows, jobs, and scheduled tasks",breadcrumbs:[{title:"Home",href:"/"},{title:"Workflows"}],actions:(0,n.jsx)(l.UIButton,{variant:"primary",icon:(0,n.jsx)(l.UIIcon,{name:"PlayCircleOutlined"}),onClick:function(){f(!0)},children:"Run Workflow"})}),(0,n.jsx)(d,{}),(0,n.jsx)(l.UICard,{style:{marginBottom:"var(--spacing-section)"},children:(0,n.jsxs)(l.UIRow,{gutter:16,children:[(0,n.jsx)(l.UICol,{span:6,children:(0,n.jsxs)(l.UISpace,{direction:"vertical",className:"gap-tight",children:[(0,n.jsx)(l.UITypographyText,{className:"typo-label text-secondary",children:"Total Workflows"}),(0,n.jsx)(l.UITypographyText,{className:"typo-section-title",children:(null==g?void 0:g.workflows.total)||0}),(0,n.jsxs)(l.UISpace,{className:"gap-tight",children:[(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-success",children:[(null==g?void 0:g.workflows.active)||0," active"]}),(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-secondary",children:[(null==g?void 0:g.workflows.inactive)||0," inactive"]})]})]})}),(0,n.jsx)(l.UICol,{span:6,children:(0,n.jsxs)(l.UISpace,{direction:"vertical",className:"gap-tight",children:[(0,n.jsx)(l.UITypographyText,{className:"typo-label text-secondary",children:"Jobs Running"}),(0,n.jsx)(l.UITypographyText,{className:"typo-section-title text-info",children:(null==g?void 0:g.jobs.running)||0}),(0,n.jsx)(l.UISpace,{className:"gap-tight",children:(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-secondary",children:[(null==g?void 0:g.jobs.pending)||0," pending"]})})]})}),(0,n.jsx)(l.UICol,{span:6,children:(0,n.jsxs)(l.UISpace,{direction:"vertical",className:"gap-tight",children:[(0,n.jsx)(l.UITypographyText,{className:"typo-label text-secondary",children:"Jobs Completed"}),(0,n.jsx)(l.UITypographyText,{className:"typo-section-title text-success",children:(null==g?void 0:g.jobs.completed)||0}),(0,n.jsx)(l.UISpace,{className:"gap-tight",children:(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-error",children:[(null==g?void 0:g.jobs.failed)||0," failed"]})})]})}),(0,n.jsx)(l.UICol,{span:6,children:(0,n.jsxs)(l.UISpace,{direction:"vertical",className:"gap-tight",children:[(0,n.jsx)(l.UITypographyText,{className:"typo-label text-secondary",children:"Cron Jobs"}),(0,n.jsx)(l.UITypographyText,{className:"typo-section-title",children:(null==g?void 0:g.crons.total)||0}),(0,n.jsxs)(l.UISpace,{className:"gap-tight",children:[(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-success",children:[(null==g?void 0:g.crons.enabled)||0," enabled"]}),(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-secondary",children:[(null==g?void 0:g.crons.disabled)||0," disabled"]})]})]})})]})}),(0,n.jsx)(l.UICard,{title:(0,n.jsx)(l.UITypographyText,{className:"typo-card-title",children:"Recent Activity"}),style:{marginBottom:"var(--spacing-section)"},children:(0,n.jsx)(l.UITable,{dataSource:I,columns:b,rowKey:"id",scroll:{x:760},pagination:{pageSize:20},onRow:function(e){return{style:{cursor:"pointer"},onClick:function(){return t("/p/workflows/runs/".concat(e.id))}}}})}),(0,n.jsx)(y.y,{open:p,workflows:null!=(e=null==v?void 0:v.workflows)?e:[],loading:j.isLoading,onClose:function(){return f(!1)},onRun:function(e,r){j.mutate({workflowId:e,input:r},{onSuccess:function(e){f(!1),t("/p/workflows/runs/".concat(e.runId))},onError:function(t){s.error('Failed to start workflow "'.concat(e,'": ').concat(t.message))}})}})]})}}}]);
|
|
1
|
+
"use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[685],{6026(e,t){var r=Symbol.for("react.transitional.element");function n(e,t,n){var o=null;if(void 0!==n&&(o=""+n),void 0!==t.key&&(o=""+t.key),"key"in t)for(var a in n={},t)"key"!==a&&(n[a]=t[a]);else n=t;return{$$typeof:r,type:e,key:o,ref:void 0!==(t=n.ref)?t:null,props:n}}t.Fragment=Symbol.for("react.fragment"),t.jsx=n,t.jsxs=n},4552(e,t,r){e.exports=r(6026)},6631(e,t,r){var n=r(4552),o=r(7079),a=r(9776);function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(a.push(r.value),!t||a.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw n}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return l(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e){var t,r=e.name,o=e.schema,l=e.value,i=e.onChange,s=(0,n.jsxs)(a.UISpace,{className:"gap-tight",style:{marginBottom:4},children:[(0,n.jsxs)(a.UITypographyText,{className:"typo-label",children:[r,o.required&&(0,n.jsx)("span",{style:{color:"var(--color-error)",marginLeft:2},children:"*"})]}),o.description&&(0,n.jsxs)(a.UITypographyText,{className:"typo-caption text-tertiary",children:["— ",o.description]})]});return"boolean"===o.type?(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)("div",{children:(0,n.jsx)(a.UISwitch,{checked:void 0!==l?!!l:null!=(t=o.default)&&t,onChange:i})})]}):"number"===o.type?(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)(a.UIInputNumber,{style:{width:"100%"},value:l,placeholder:void 0!==o.default?String(o.default):void 0,onChange:i})]}):(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)(a.UIInput,{value:l,placeholder:void 0!==o.default?String(o.default):void 0,onChange:function(e){return i(e)}})]})}function u(e){var t,r,l=e.open,u=e.onClose,p=e.onRun,d=e.loading,y="workflows"in e&&Array.isArray(e.workflows),f=y?e.workflows:[],h=s(o.useState(void 0),2),m=h[0],x=h[1],g=s(o.useState("{}"),2),v=g[0],j=g[1],I=s(o.useState(null),2),b=I[0],w=I[1],U=s(o.useState({}),2),T=U[0],k=U[1],S=y?null!=(t=f.find(function(e){return e.id===m}))?t:null:null!=(r=e.workflow)?r:null,N=null==S?void 0:S.inputs,O=!!N&&Object.keys(N).length>0;o.useEffect(function(){if(l)if(j("{}"),w(null),y||x(void 0),N){var e={},t=!0,r=!1,n=void 0;try{for(var o,a=Object.entries(N)[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var i=s(o.value,2),c=i[0],u=i[1];void 0!==u.default&&(e[c]=u.default)}}catch(e){r=!0,n=e}finally{try{t||null==a.return||a.return()}finally{if(r)throw n}}k(e)}else k({})},[l,null==S?void 0:S.id,N,y]),o.useEffect(function(){if(y&&m)if(j("{}"),w(null),N){var e={},t=!0,r=!1,n=void 0;try{for(var o,a=Object.entries(N)[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var l=s(o.value,2),i=l[0],c=l[1];void 0!==c.default&&(e[i]=c.default)}}catch(e){r=!0,n=e}finally{try{t||null==a.return||a.return()}finally{if(r)throw n}}k(e)}else k({})},[m,N,y]);var C=(0,n.jsxs)(a.UISpace,{style:{justifyContent:"flex-end"},children:[(0,n.jsx)(a.UIButton,{onClick:u,disabled:d,children:"Cancel"}),(0,n.jsx)(a.UIButton,{variant:"primary",icon:(0,n.jsx)(a.UIIcon,{name:"PlayCircleOutlined"}),loading:d,disabled:!S||!O&&!!b,onClick:function(){if(S)if(O)p(S.id,T);else{var e=v.trim();if(!e||"{}"===e)return void p(S.id,{});try{var t=JSON.parse(e);p(S.id,t)}catch(e){w("Invalid JSON")}}},children:"Run"})]}),A=S?"Run Workflow: ".concat(S.name):"Run Workflow";return(0,n.jsxs)(a.UIModal,{open:l,title:(0,n.jsxs)(a.UISpace,{className:"gap-item",children:[(0,n.jsx)(a.UIIcon,{name:"ThunderboltOutlined"}),(0,n.jsx)("span",{children:A})]}),onCancel:u,footer:C,maskClosable:!d,children:[y&&(0,n.jsxs)("div",{style:{marginTop:16},children:[(0,n.jsx)(a.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Select Workflow"}),(0,n.jsx)(a.UISelect,{style:{width:"100%"},placeholder:"Choose a workflow...",value:m,onChange:function(e){return x(e)},showSearch:!0,options:f.map(function(e){return{label:e.name,value:e.id,description:e.description}})})]}),S&&O&&(0,n.jsx)("div",{style:{marginTop:16},children:Object.entries(N).map(function(e){var t=s(e,2),r=t[0],o=t[1];return(0,n.jsx)(c,{name:r,schema:o,value:T[r],onChange:function(e){return k(function(t){var n,o;return n=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){i(e,t,r[t])})}return e}({},t),o=null!=(o=i({},r,e))?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(o)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))}),n})}},r)})}),S&&!O&&(0,n.jsxs)("div",{style:{marginTop:16},children:[(0,n.jsx)(a.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Input payload (JSON)"}),(0,n.jsx)(a.UIInputTextArea,{value:v,onChange:function(e){var t=e.target.value;if(j(t),!t.trim()||"{}"===t.trim())return void w(null);try{JSON.parse(t),w(null)}catch(e){w("Invalid JSON")}},rows:6,placeholder:"{}",style:{fontFamily:"var(--font-mono, monospace)",fontSize:13},status:b?"error":void 0}),b&&(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-error",style:{display:"block",marginTop:4},children:b}),(0,n.jsxs)(a.UITypographyText,{className:"typo-caption text-tertiary",style:{display:"block",marginTop:8},children:["Leave empty or ",(0,n.jsx)("code",{children:"{}"})," to run without parameters"]})]})]})}r.d(t,{y:()=>u})},5484(e,t,r){r.r(t),r.d(t,{default:()=>g});var n=r(4552),o=r(7079),a=r(5450),l=r(9776),i=r(7936);function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function c(e,t,r,n,o,a,l){try{var i=e[a](l),s=i.value}catch(e){r(e);return}i.done?t(s):Promise.resolve(s).then(n,o)}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(a.push(r.value),!t||a.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw n}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e){var t=e.runId,r=e.onSuccess,o=u((0,l.useUIMessage)(),2),a=o[0],s=o[1],p=(0,i.useMutateData)("/exec/api/v1/runs/".concat(t,"/cancel"));return(0,n.jsxs)(n.Fragment,{children:[s,(0,n.jsx)(l.UIButton,{variant:"text",size:"small",danger:!0,icon:(0,n.jsx)(l.UIIcon,{name:"StopOutlined"}),loading:p.isLoading,onClick:function(e){var n;return(n=function(){var n;return function(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:s(0)}),i(l,"throw",{value:s(1)}),i(l,"return",{value:s(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function s(i){return function(s){var c=[i,s];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(o){switch(o.label){case 0:e.preventDefault(),e.stopPropagation(),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,p.mutateAsync()];case 2:return o.sent(),a.success("Run ".concat(t.slice(0,8)," cancelled")),r(),[3,4];case 3:return n=o.sent(),a.error("Failed to cancel: ".concat(n.message)),[3,4];case 4:return[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var a=n.apply(e,t);function l(e){c(a,r,o,l,i,"next",e)}function i(e){c(a,r,o,l,i,"throw",e)}l(void 0)})})()},children:"Cancel"})]})}function d(){var e=u((0,l.useUIMessage)(),2),t=(e[0],e[1]),r=(0,i.useData)("/exec/api/v1/stats",{pollingMs:3e3}),o=r.data,s=r.isLoading,c=r.refetch,d=(null==o?void 0:o.activeExecutions)||[],y=d.length>0,f=d.some(function(e){return"waiting_approval"===e.status}),h=function(e){if(!e)return"-";var t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");var r=Math.floor(t/60);if(r<60)return"".concat(r,"m ").concat(t%60,"s");var n=Math.floor(r/60);return"".concat(n,"h ").concat(r%60,"m")};return(0,n.jsxs)(n.Fragment,{children:[t,f&&(0,n.jsx)(l.UIAlert,{variant:"warning",message:"Waiting for your approval",description:"One or more workflow steps require your decision.",showIcon:!0,style:{marginBottom:"var(--spacing-card)"}}),(0,n.jsx)(l.UICard,{title:(0,n.jsxs)(l.UISpace,{className:"gap-item",children:[(0,n.jsxs)(l.UITypographyText,{className:"typo-card-title",children:["Active Runs (",d.length,")"]}),(0,n.jsx)(l.UIButton,{variant:"text",size:"small",icon:(0,n.jsx)(l.UIIcon,{name:"ReloadOutlined",spin:s}),onClick:function(){return c()}})]}),style:{marginBottom:"var(--spacing-section)"},children:y?(0,n.jsx)(l.UIList,{dataSource:d,renderItem:function(e){return(0,n.jsxs)(l.UIListItem,{actions:[(0,n.jsx)(p,{runId:e.id,onSuccess:function(){return c()}},"cancel")],children:[(0,n.jsx)(l.UIListItemMeta,{title:(0,n.jsx)(a.Link,{to:"/p/workflows/runs/".concat(e.id),style:{color:"inherit",textDecoration:"none"},children:(0,n.jsxs)(l.UISpace,{children:[(0,n.jsx)(l.UITypographyText,{className:"typo-body",style:{color:"var(--color-link)"},children:e.workflowName||e.type}),void 0!==e.progress&&(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-secondary",children:[e.progress,"%"]})]})}),description:(0,n.jsxs)(l.UISpace,{direction:"vertical",className:"gap-tight",style:{width:"100%"},children:[e.progressMessage&&(0,n.jsx)(l.UITypographyText,{className:"typo-description",children:e.progressMessage}),(0,n.jsxs)(l.UISpace,{className:"gap-item",children:[(0,n.jsx)(l.UIIcon,{name:"ClockCircleOutlined",className:"text-secondary"}),(0,n.jsx)(l.UITypographyText,{className:"typo-caption text-secondary",children:h(e.durationMs)}),(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-tertiary",children:["ID: ",e.id.slice(0,8)]})]})]})}),void 0!==e.progress&&(0,n.jsx)(l.UIProgress,{percent:e.progress,size:"small",status:"active",style:{width:120}})]})}}):(0,n.jsx)(l.UITypographyText,{className:"typo-description text-secondary",children:"No active runs"})})]})}var y=r(6631);function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(a.push(r.value),!t||a.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw n}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return f(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var m={completed:(0,n.jsx)(l.UIIcon,{name:"CheckCircleOutlined",className:"text-success"}),failed:(0,n.jsx)(l.UIIcon,{name:"CloseCircleOutlined",className:"text-error"}),cancelled:(0,n.jsx)(l.UIIcon,{name:"StopOutlined",className:"text-warning"})},x={completed:"success",failed:"error",cancelled:"warning"};function g(){var e,t=(0,a.useNavigate)(),r=h((0,l.useUIMessage)(),2),s=r[0],c=r[1],u=h(o.useState(!1),2),p=u[0],f=u[1],g=(0,i.useData)("/exec/api/v1/stats",{pollingMs:3e3}).data,v=(0,i.useData)("/exec/api/v1/workflows",{params:{limit:100}}).data,j=(0,i.useMutateData)(function(e){return"/exec/api/v1/workflows/".concat(encodeURIComponent(e.workflowId),"/runs")},{mapBody:function(e){return e.input}}),I=(null==g?void 0:g.recentActivity)||[],b=[{title:"Time",dataIndex:"finishedAt",key:"finishedAt",width:100,render:function(e){return(0,n.jsx)(l.UITypographyText,{className:"typo-caption",style:{whiteSpace:"nowrap"},children:function(e){var t=new Date(e),r=Math.floor((new Date().getTime()-t.getTime())/6e4);if(r<1)return"Just now";if(r<60)return"".concat(r,"m ago");var n=Math.floor(r/60);if(n<24)return"".concat(n,"h ago");var o=Math.floor(n/24);return"".concat(o,"d ago")}(e)})}},{title:"Workflow / Job",dataIndex:"workflowName",key:"workflowName",width:280,render:function(e,t){return(0,n.jsxs)("div",{style:{overflow:"hidden"},children:[(0,n.jsx)(l.UITypographyText,{className:"typo-body",ellipsis:{tooltip:e||t.type},style:{display:"block"},children:e||t.type}),(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-tertiary",code:!0,ellipsis:{tooltip:t.id},style:{display:"block"},children:[t.id.slice(0,16),"..."]})]})}},{title:"Status",dataIndex:"status",key:"status",width:140,render:function(e){return(0,n.jsx)(l.UITag,{icon:m[e],color:x[e],children:e.toUpperCase()})}},{title:"Duration",dataIndex:"durationMs",key:"durationMs",width:100,render:function(e){return(0,n.jsx)(l.UITypographyText,{className:"typo-caption",children:function(e){if(!e)return"-";var t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");var r=Math.floor(t/60);if(r<60)return"".concat(r,"m ").concat(t%60,"s");var n=Math.floor(r/60);return"".concat(n,"h ").concat(r%60,"m")}(e)})}},{title:"Error",dataIndex:"error",key:"error",render:function(e){return e?(0,n.jsx)(l.UITypographyText,{className:"typo-caption text-error",ellipsis:{tooltip:e},style:{display:"block"},children:e}):(0,n.jsx)(l.UITypographyText,{className:"typo-caption text-tertiary",children:"-"})}}];return(0,n.jsxs)(l.UIPage,{width:"full",children:[c,(0,n.jsx)(l.UIPageHeader,{title:"Workflows",description:"Monitor workflows, jobs, and scheduled tasks",breadcrumbs:[{title:"Home",href:"/"},{title:"Workflows"}],actions:(0,n.jsx)(l.UIButton,{variant:"primary",icon:(0,n.jsx)(l.UIIcon,{name:"PlayCircleOutlined"}),onClick:function(){f(!0)},children:"Run Workflow"})}),(0,n.jsx)(d,{}),(0,n.jsx)(l.UICard,{style:{marginBottom:"var(--spacing-section)"},children:(0,n.jsxs)(l.UIRow,{gutter:16,children:[(0,n.jsx)(l.UICol,{span:6,children:(0,n.jsxs)(l.UISpace,{direction:"vertical",className:"gap-tight",children:[(0,n.jsx)(l.UITypographyText,{className:"typo-label text-secondary",children:"Total Workflows"}),(0,n.jsx)(l.UITypographyText,{className:"typo-section-title",children:(null==g?void 0:g.workflows.total)||0}),(0,n.jsxs)(l.UISpace,{className:"gap-tight",children:[(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-success",children:[(null==g?void 0:g.workflows.active)||0," active"]}),(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-secondary",children:[(null==g?void 0:g.workflows.inactive)||0," inactive"]})]})]})}),(0,n.jsx)(l.UICol,{span:6,children:(0,n.jsxs)(l.UISpace,{direction:"vertical",className:"gap-tight",children:[(0,n.jsx)(l.UITypographyText,{className:"typo-label text-secondary",children:"Jobs Running"}),(0,n.jsx)(l.UITypographyText,{className:"typo-section-title text-info",children:(null==g?void 0:g.jobs.running)||0}),(0,n.jsx)(l.UISpace,{className:"gap-tight",children:(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-secondary",children:[(null==g?void 0:g.jobs.pending)||0," pending"]})})]})}),(0,n.jsx)(l.UICol,{span:6,children:(0,n.jsxs)(l.UISpace,{direction:"vertical",className:"gap-tight",children:[(0,n.jsx)(l.UITypographyText,{className:"typo-label text-secondary",children:"Jobs Completed"}),(0,n.jsx)(l.UITypographyText,{className:"typo-section-title text-success",children:(null==g?void 0:g.jobs.completed)||0}),(0,n.jsx)(l.UISpace,{className:"gap-tight",children:(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-error",children:[(null==g?void 0:g.jobs.failed)||0," failed"]})})]})}),(0,n.jsx)(l.UICol,{span:6,children:(0,n.jsxs)(l.UISpace,{direction:"vertical",className:"gap-tight",children:[(0,n.jsx)(l.UITypographyText,{className:"typo-label text-secondary",children:"Cron Jobs"}),(0,n.jsx)(l.UITypographyText,{className:"typo-section-title",children:(null==g?void 0:g.crons.total)||0}),(0,n.jsxs)(l.UISpace,{className:"gap-tight",children:[(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-success",children:[(null==g?void 0:g.crons.enabled)||0," enabled"]}),(0,n.jsxs)(l.UITypographyText,{className:"typo-caption text-secondary",children:[(null==g?void 0:g.crons.disabled)||0," disabled"]})]})]})})]})}),(0,n.jsx)(l.UICard,{title:(0,n.jsx)(l.UITypographyText,{className:"typo-card-title",children:"Recent Activity"}),style:{marginBottom:"var(--spacing-section)"},children:(0,n.jsx)(l.UITable,{dataSource:I,columns:b,rowKey:"id",scroll:{x:760},pagination:{pageSize:20},onRow:function(e){return{style:{cursor:"pointer"},onClick:function(){return t("/p/workflows/runs/".concat(e.id))}}}})}),(0,n.jsx)(y.y,{open:p,workflows:null!=(e=null==v?void 0:v.workflows)?e:[],loading:j.isLoading,onClose:function(){return f(!1)},onRun:function(e,r){j.mutate({workflowId:e,input:r},{onSuccess:function(e){f(!1),t("/p/workflows/runs/".concat(e.runId))},onError:function(t){s.error('Failed to start workflow "'.concat(e,'": ').concat(t.message))}})}})]})}}}]);
|
|
2
2
|
//# sourceMappingURL=__federation_expose_Dashboard.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[777],{6026(e,t){var n=Symbol.for("react.transitional.element");function r(e,t,r){var o=null;if(void 0!==r&&(o=""+r),void 0!==t.key&&(o=""+t.key),"key"in t)for(var a in r={},t)"key"!==a&&(r[a]=t[a]);else r=t;return{$$typeof:n,type:e,key:o,ref:void 0!==(t=r.ref)?t:null,props:r}}t.Fragment=Symbol.for("react.fragment"),t.jsx=r,t.jsxs=r},4552(e,t,n){e.exports=n(6026)},6631(e,t,n){var r=n(4552),o=n(1913),a=n(1198);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e){var t,n=e.name,o=e.schema,i=e.value,l=e.onChange,s=(0,r.jsxs)(a.UISpace,{className:"gap-tight",style:{marginBottom:4},children:[(0,r.jsxs)(a.UITypographyText,{className:"typo-label",children:[n,o.required&&(0,r.jsx)("span",{style:{color:"var(--color-error)",marginLeft:2},children:"*"})]}),o.description&&(0,r.jsxs)(a.UITypographyText,{className:"typo-caption text-tertiary",children:["— ",o.description]})]});return"boolean"===o.type?(0,r.jsxs)("div",{style:{marginBottom:16},children:[s,(0,r.jsx)("div",{children:(0,r.jsx)(a.UISwitch,{checked:void 0!==i?!!i:null!=(t=o.default)&&t,onChange:l})})]}):"number"===o.type?(0,r.jsxs)("div",{style:{marginBottom:16},children:[s,(0,r.jsx)(a.UIInputNumber,{style:{width:"100%"},value:i,placeholder:void 0!==o.default?String(o.default):void 0,onChange:l})]}):(0,r.jsxs)("div",{style:{marginBottom:16},children:[s,(0,r.jsx)(a.UIInput,{value:i,placeholder:void 0!==o.default?String(o.default):void 0,onChange:function(e){return l(e)}})]})}function u(e){var t,n,i=e.open,u=e.onClose,d=e.onRun,p=e.loading,f="workflows"in e&&Array.isArray(e.workflows),y=f?e.workflows:[],h=s(o.useState(void 0),2),g=h[0],m=h[1],v=s(o.useState("{}"),2),x=v[0],j=v[1],w=s(o.useState(null),2),I=w[0],b=w[1],k=s(o.useState({}),2),U=k[0],S=k[1],T=f?null!=(t=y.find(function(e){return e.id===g}))?t:null:null!=(n=e.workflow)?n:null,O=null==T?void 0:T.inputs,C=!!O&&Object.keys(O).length>0;o.useEffect(function(){if(i)if(j("{}"),b(null),f||m(void 0),O){var e={},t=!0,n=!1,r=void 0;try{for(var o,a=Object.entries(O)[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var l=s(o.value,2),c=l[0],u=l[1];void 0!==u.default&&(e[c]=u.default)}}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}S(e)}else S({})},[i,null==T?void 0:T.id,O,f]),o.useEffect(function(){if(f&&g)if(j("{}"),b(null),O){var e={},t=!0,n=!1,r=void 0;try{for(var o,a=Object.entries(O)[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var i=s(o.value,2),l=i[0],c=i[1];void 0!==c.default&&(e[l]=c.default)}}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}S(e)}else S({})},[g,O,f]);var N=(0,r.jsxs)(a.UISpace,{style:{justifyContent:"flex-end"},children:[(0,r.jsx)(a.UIButton,{onClick:u,disabled:p,children:"Cancel"}),(0,r.jsx)(a.UIButton,{variant:"primary",icon:(0,r.jsx)(a.UIIcon,{name:"PlayCircleOutlined"}),loading:p,disabled:!T||!C&&!!I,onClick:function(){if(T)if(C)d(T.id,U);else{var e=x.trim();if(!e||"{}"===e)return void d(T.id,{});try{var t=JSON.parse(e);d(T.id,t)}catch(e){b("Invalid JSON")}}},children:"Run"})]}),P=T?"Run Workflow: ".concat(T.name):"Run Workflow";return(0,r.jsxs)(a.UIModal,{open:i,title:(0,r.jsxs)(a.UISpace,{className:"gap-item",children:[(0,r.jsx)(a.UIIcon,{name:"ThunderboltOutlined"}),(0,r.jsx)("span",{children:P})]}),onCancel:u,footer:N,maskClosable:!p,children:[f&&(0,r.jsxs)("div",{style:{marginTop:16},children:[(0,r.jsx)(a.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Select Workflow"}),(0,r.jsx)(a.UISelect,{style:{width:"100%"},placeholder:"Choose a workflow...",value:g,onChange:function(e){return m(e)},showSearch:!0,options:y.map(function(e){return{label:e.name,value:e.id,description:e.description}})})]}),T&&C&&(0,r.jsx)("div",{style:{marginTop:16},children:Object.entries(O).map(function(e){var t=s(e,2),n=t[0],o=t[1];return(0,r.jsx)(c,{name:n,schema:o,value:U[n],onChange:function(e){return S(function(t){var r,o;return r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){l(e,t,n[t])})}return e}({},t),o=null!=(o=l({},n,e))?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}),r})}},n)})}),T&&!C&&(0,r.jsxs)("div",{style:{marginTop:16},children:[(0,r.jsx)(a.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Input payload (JSON)"}),(0,r.jsx)(a.UIInputTextArea,{value:x,onChange:function(e){var t=e.target.value;if(j(t),!t.trim()||"{}"===t.trim())return void b(null);try{JSON.parse(t),b(null)}catch(e){b("Invalid JSON")}},rows:6,placeholder:"{}",style:{fontFamily:"var(--font-mono, monospace)",fontSize:13},status:I?"error":void 0}),I&&(0,r.jsx)(a.UITypographyText,{className:"typo-caption text-error",style:{display:"block",marginTop:4},children:I}),(0,r.jsxs)(a.UITypographyText,{className:"typo-caption text-tertiary",style:{display:"block",marginTop:8},children:["Leave empty or ",(0,r.jsx)("code",{children:"{}"})," to run without parameters"]})]})]})}n.d(t,{y:()=>u})},3887(e,t,n){n.r(t);var r=n(4552),o=n(1913),a=n(3596),i=n(1198),l=n(6188),s=n(6631);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var d={queued:"default",running:"processing",success:"success",failed:"error",cancelled:"warning",skipped:"default",waiting_approval:"gold"};function p(e){var t=e.runId,n=e.onSuccess,o=(0,l.useMutateData)("/exec/api/v1/runs/".concat(t,"/cancel"));return(0,r.jsx)(i.UIButton,{variant:"link",size:"small",danger:!0,icon:(0,r.jsx)(i.UIIcon,{name:"StopOutlined"}),loading:o.isLoading,onClick:function(e){e.stopPropagation(),o.mutateAsync().then(n).catch(function(){})},children:"Cancel"})}function f(){var e,t,n=(0,a.useParams)().workflowId,c=(0,a.useNavigate)(),f=u((0,i.useUIMessage)(),2),y=f[0],h=f[1],g=n?decodeURIComponent(n):"",m=u(o.useState(!1),2),v=m[0],x=m[1],j=(0,l.useData)(g?"/exec/api/v1/workflows/".concat(encodeURIComponent(g)):"/exec/api/v1/workflows/__none__",{enabled:!!g}),w=j.data,I=j.isLoading,b=(0,l.useData)(g?"/exec/api/v1/workflows/".concat(encodeURIComponent(g),"/runs"):"/exec/api/v1/workflows/__none__/runs",{enabled:!!g,pollingMs:5e3,params:{limit:50}}),k=b.data,U=b.isLoading,S=b.refetch,T=(0,l.useMutateData)("/exec/api/v1/workflows/".concat(encodeURIComponent(g),"/runs")),O=[{title:"Run ID",dataIndex:"id",key:"id",width:200,render:function(e){return(0,r.jsxs)(i.UITypographyText,{className:"typo-caption",code:!0,ellipsis:{tooltip:e},style:{cursor:"pointer",color:"var(--color-link)"},onClick:function(t){t.stopPropagation(),c("/p/workflows/runs/".concat(e))},children:[e.slice(0,16),"..."]})}},{title:"Status",dataIndex:"status",key:"status",width:140,render:function(e){var t;return(0,r.jsx)(i.UITag,{color:null!=(t=d[e])?t:"default",children:e.toUpperCase()})}},{title:"Triggered By",dataIndex:"trigger",key:"user",width:160,render:function(e){var t;return(0,r.jsx)(i.UITypographyText,{className:"typo-caption text-secondary",children:null!=(t=null==e?void 0:e.user)?t:"-"})}},{title:"Started At",dataIndex:"startedAt",key:"startedAt",width:180,render:function(e){return(0,r.jsx)(i.UITypographyText,{className:"typo-caption",children:e?new Date(e).toLocaleString():"-"})}},{title:"Duration",dataIndex:"durationMs",key:"durationMs",width:100,render:function(e){return(0,r.jsx)(i.UITypographyText,{className:"typo-caption",children:function(e){if(!e)return"-";var t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");var n=Math.floor(t/60);if(n<60)return"".concat(n,"m ").concat(t%60,"s");var r=Math.floor(n/60);return"".concat(r,"h ").concat(n%60,"m")}(e)})}},{title:"Actions",key:"actions",width:100,fixed:"right",render:function(e,t){return"running"!==t.status&&"pending"!==t.status?null:(0,r.jsx)(p,{runId:t.id,onSuccess:function(){S()}})}}];return I?(0,r.jsx)(i.UIPage,{children:(0,r.jsx)("div",{style:{textAlign:"center",padding:"80px 0"},children:(0,r.jsx)(i.UISpin,{size:"large"})})}):w?(0,r.jsxs)(i.UIPage,{children:[h,(0,r.jsx)(i.UIPageHeader,{title:w.name,description:w.description,breadcrumbs:[{title:"Home",href:"/"},{title:"Workflows",href:"/workflows"},{title:"Definitions",href:"/p/workflows/definitions"},{title:w.name}],actions:(0,r.jsx)(i.UIButton,{variant:"primary",icon:(0,r.jsx)(i.UIIcon,{name:"PlayCircleOutlined"}),onClick:function(){return x(!0)},children:"Run"})}),(0,r.jsx)(i.UICard,{style:{marginBottom:"var(--spacing-section)"},children:(0,r.jsx)(i.UIDescriptions,{column:3,items:[{key:"id",label:"ID",children:(0,r.jsx)(i.UITypographyText,{code:!0,className:"typo-caption",children:w.id})},{key:"source",label:"Source",children:(0,r.jsx)(i.UITag,{color:"manifest"===w.source?"blue":"green",children:"manifest"===w.source?"Plugin":"Standalone"})},{key:"status",label:"Status",children:w.status?(0,r.jsx)(i.UITag,{color:"active"===w.status?"success":"default",children:w.status.toUpperCase()}):"-"},{key:"plugin",label:"Plugin",children:(0,r.jsx)(i.UITypographyText,{className:"typo-caption",children:null!=(e=w.pluginId)?e:"-"})},{key:"tags",label:"Tags",span:2,children:w.tags&&w.tags.length>0?(0,r.jsx)(i.UISpace,{className:"gap-tight",children:w.tags.map(function(e){return(0,r.jsx)(i.UITag,{children:e},e)})}):"-"}]})}),(0,r.jsx)(i.UICard,{title:(0,r.jsx)(i.UITypographyText,{className:"typo-card-title",children:"Recent Runs"}),children:(0,r.jsx)(i.UITable,{dataSource:null!=(t=null==k?void 0:k.runs)?t:[],columns:O,loading:U,rowKey:"id",scroll:{x:900},pagination:{pageSize:20},onRow:function(e){return{style:{cursor:"pointer"},onClick:function(){return c("/p/workflows/runs/".concat(e.id))}}}})}),(0,r.jsx)(s.y,{open:v,workflow:w,loading:T.isLoading,onClose:function(){return x(!1)},onRun:function(e,t){T.mutate(t,{onSuccess:function(e){x(!1),c("/p/workflows/runs/".concat(e.runId))},onError:function(e){y.error('Failed to start workflow "'.concat(g,'": ').concat(e.message))}})}})]}):(0,r.jsx)(i.UIPage,{children:(0,r.jsx)(i.UIEmptyState,{description:'Workflow "'.concat(g,'" not found'),action:(0,r.jsx)(i.UIButton,{onClick:function(){return c("/p/workflows/definitions")},children:"Back to Definitions"})})})}n.d(t,{default:()=>f})}}]);
|
|
1
|
+
"use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[777],{6026(e,t){var n=Symbol.for("react.transitional.element");function r(e,t,r){var o=null;if(void 0!==r&&(o=""+r),void 0!==t.key&&(o=""+t.key),"key"in t)for(var a in r={},t)"key"!==a&&(r[a]=t[a]);else r=t;return{$$typeof:n,type:e,key:o,ref:void 0!==(t=r.ref)?t:null,props:r}}t.Fragment=Symbol.for("react.fragment"),t.jsx=r,t.jsxs=r},4552(e,t,n){e.exports=n(6026)},6631(e,t,n){var r=n(4552),o=n(7079),a=n(9776);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e){var t,n=e.name,o=e.schema,i=e.value,l=e.onChange,s=(0,r.jsxs)(a.UISpace,{className:"gap-tight",style:{marginBottom:4},children:[(0,r.jsxs)(a.UITypographyText,{className:"typo-label",children:[n,o.required&&(0,r.jsx)("span",{style:{color:"var(--color-error)",marginLeft:2},children:"*"})]}),o.description&&(0,r.jsxs)(a.UITypographyText,{className:"typo-caption text-tertiary",children:["— ",o.description]})]});return"boolean"===o.type?(0,r.jsxs)("div",{style:{marginBottom:16},children:[s,(0,r.jsx)("div",{children:(0,r.jsx)(a.UISwitch,{checked:void 0!==i?!!i:null!=(t=o.default)&&t,onChange:l})})]}):"number"===o.type?(0,r.jsxs)("div",{style:{marginBottom:16},children:[s,(0,r.jsx)(a.UIInputNumber,{style:{width:"100%"},value:i,placeholder:void 0!==o.default?String(o.default):void 0,onChange:l})]}):(0,r.jsxs)("div",{style:{marginBottom:16},children:[s,(0,r.jsx)(a.UIInput,{value:i,placeholder:void 0!==o.default?String(o.default):void 0,onChange:function(e){return l(e)}})]})}function u(e){var t,n,i=e.open,u=e.onClose,d=e.onRun,p=e.loading,f="workflows"in e&&Array.isArray(e.workflows),y=f?e.workflows:[],h=s(o.useState(void 0),2),g=h[0],m=h[1],v=s(o.useState("{}"),2),x=v[0],j=v[1],w=s(o.useState(null),2),I=w[0],b=w[1],k=s(o.useState({}),2),U=k[0],S=k[1],T=f?null!=(t=y.find(function(e){return e.id===g}))?t:null:null!=(n=e.workflow)?n:null,O=null==T?void 0:T.inputs,C=!!O&&Object.keys(O).length>0;o.useEffect(function(){if(i)if(j("{}"),b(null),f||m(void 0),O){var e={},t=!0,n=!1,r=void 0;try{for(var o,a=Object.entries(O)[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var l=s(o.value,2),c=l[0],u=l[1];void 0!==u.default&&(e[c]=u.default)}}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}S(e)}else S({})},[i,null==T?void 0:T.id,O,f]),o.useEffect(function(){if(f&&g)if(j("{}"),b(null),O){var e={},t=!0,n=!1,r=void 0;try{for(var o,a=Object.entries(O)[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var i=s(o.value,2),l=i[0],c=i[1];void 0!==c.default&&(e[l]=c.default)}}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}S(e)}else S({})},[g,O,f]);var N=(0,r.jsxs)(a.UISpace,{style:{justifyContent:"flex-end"},children:[(0,r.jsx)(a.UIButton,{onClick:u,disabled:p,children:"Cancel"}),(0,r.jsx)(a.UIButton,{variant:"primary",icon:(0,r.jsx)(a.UIIcon,{name:"PlayCircleOutlined"}),loading:p,disabled:!T||!C&&!!I,onClick:function(){if(T)if(C)d(T.id,U);else{var e=x.trim();if(!e||"{}"===e)return void d(T.id,{});try{var t=JSON.parse(e);d(T.id,t)}catch(e){b("Invalid JSON")}}},children:"Run"})]}),P=T?"Run Workflow: ".concat(T.name):"Run Workflow";return(0,r.jsxs)(a.UIModal,{open:i,title:(0,r.jsxs)(a.UISpace,{className:"gap-item",children:[(0,r.jsx)(a.UIIcon,{name:"ThunderboltOutlined"}),(0,r.jsx)("span",{children:P})]}),onCancel:u,footer:N,maskClosable:!p,children:[f&&(0,r.jsxs)("div",{style:{marginTop:16},children:[(0,r.jsx)(a.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Select Workflow"}),(0,r.jsx)(a.UISelect,{style:{width:"100%"},placeholder:"Choose a workflow...",value:g,onChange:function(e){return m(e)},showSearch:!0,options:y.map(function(e){return{label:e.name,value:e.id,description:e.description}})})]}),T&&C&&(0,r.jsx)("div",{style:{marginTop:16},children:Object.entries(O).map(function(e){var t=s(e,2),n=t[0],o=t[1];return(0,r.jsx)(c,{name:n,schema:o,value:U[n],onChange:function(e){return S(function(t){var r,o;return r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){l(e,t,n[t])})}return e}({},t),o=null!=(o=l({},n,e))?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}),r})}},n)})}),T&&!C&&(0,r.jsxs)("div",{style:{marginTop:16},children:[(0,r.jsx)(a.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Input payload (JSON)"}),(0,r.jsx)(a.UIInputTextArea,{value:x,onChange:function(e){var t=e.target.value;if(j(t),!t.trim()||"{}"===t.trim())return void b(null);try{JSON.parse(t),b(null)}catch(e){b("Invalid JSON")}},rows:6,placeholder:"{}",style:{fontFamily:"var(--font-mono, monospace)",fontSize:13},status:I?"error":void 0}),I&&(0,r.jsx)(a.UITypographyText,{className:"typo-caption text-error",style:{display:"block",marginTop:4},children:I}),(0,r.jsxs)(a.UITypographyText,{className:"typo-caption text-tertiary",style:{display:"block",marginTop:8},children:["Leave empty or ",(0,r.jsx)("code",{children:"{}"})," to run without parameters"]})]})]})}n.d(t,{y:()=>u})},3887(e,t,n){n.r(t);var r=n(4552),o=n(7079),a=n(5450),i=n(9776),l=n(7936),s=n(6631);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var d={queued:"default",running:"processing",success:"success",failed:"error",cancelled:"warning",skipped:"default",waiting_approval:"gold"};function p(e){var t=e.runId,n=e.onSuccess,o=(0,l.useMutateData)("/exec/api/v1/runs/".concat(t,"/cancel"));return(0,r.jsx)(i.UIButton,{variant:"link",size:"small",danger:!0,icon:(0,r.jsx)(i.UIIcon,{name:"StopOutlined"}),loading:o.isLoading,onClick:function(e){e.stopPropagation(),o.mutateAsync().then(n).catch(function(){})},children:"Cancel"})}function f(){var e,t,n=(0,a.useParams)().workflowId,c=(0,a.useNavigate)(),f=u((0,i.useUIMessage)(),2),y=f[0],h=f[1],g=n?decodeURIComponent(n):"",m=u(o.useState(!1),2),v=m[0],x=m[1],j=(0,l.useData)(g?"/exec/api/v1/workflows/".concat(encodeURIComponent(g)):"/exec/api/v1/workflows/__none__",{enabled:!!g}),w=j.data,I=j.isLoading,b=(0,l.useData)(g?"/exec/api/v1/workflows/".concat(encodeURIComponent(g),"/runs"):"/exec/api/v1/workflows/__none__/runs",{enabled:!!g,pollingMs:5e3,params:{limit:50}}),k=b.data,U=b.isLoading,S=b.refetch,T=(0,l.useMutateData)("/exec/api/v1/workflows/".concat(encodeURIComponent(g),"/runs")),O=[{title:"Run ID",dataIndex:"id",key:"id",width:200,render:function(e){return(0,r.jsxs)(i.UITypographyText,{className:"typo-caption",code:!0,ellipsis:{tooltip:e},style:{cursor:"pointer",color:"var(--color-link)"},onClick:function(t){t.stopPropagation(),c("/p/workflows/runs/".concat(e))},children:[e.slice(0,16),"..."]})}},{title:"Status",dataIndex:"status",key:"status",width:140,render:function(e){var t;return(0,r.jsx)(i.UITag,{color:null!=(t=d[e])?t:"default",children:e.toUpperCase()})}},{title:"Triggered By",dataIndex:"trigger",key:"user",width:160,render:function(e){var t;return(0,r.jsx)(i.UITypographyText,{className:"typo-caption text-secondary",children:null!=(t=null==e?void 0:e.user)?t:"-"})}},{title:"Started At",dataIndex:"startedAt",key:"startedAt",width:180,render:function(e){return(0,r.jsx)(i.UITypographyText,{className:"typo-caption",children:e?new Date(e).toLocaleString():"-"})}},{title:"Duration",dataIndex:"durationMs",key:"durationMs",width:100,render:function(e){return(0,r.jsx)(i.UITypographyText,{className:"typo-caption",children:function(e){if(!e)return"-";var t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");var n=Math.floor(t/60);if(n<60)return"".concat(n,"m ").concat(t%60,"s");var r=Math.floor(n/60);return"".concat(r,"h ").concat(n%60,"m")}(e)})}},{title:"Actions",key:"actions",width:100,fixed:"right",render:function(e,t){return"running"!==t.status&&"pending"!==t.status?null:(0,r.jsx)(p,{runId:t.id,onSuccess:function(){S()}})}}];return I?(0,r.jsx)(i.UIPage,{children:(0,r.jsx)("div",{style:{textAlign:"center",padding:"80px 0"},children:(0,r.jsx)(i.UISpin,{size:"large"})})}):w?(0,r.jsxs)(i.UIPage,{children:[h,(0,r.jsx)(i.UIPageHeader,{title:w.name,description:w.description,breadcrumbs:[{title:"Home",href:"/"},{title:"Workflows",href:"/workflows"},{title:"Definitions",href:"/p/workflows/definitions"},{title:w.name}],actions:(0,r.jsx)(i.UIButton,{variant:"primary",icon:(0,r.jsx)(i.UIIcon,{name:"PlayCircleOutlined"}),onClick:function(){return x(!0)},children:"Run"})}),(0,r.jsx)(i.UICard,{style:{marginBottom:"var(--spacing-section)"},children:(0,r.jsx)(i.UIDescriptions,{column:3,items:[{key:"id",label:"ID",children:(0,r.jsx)(i.UITypographyText,{code:!0,className:"typo-caption",children:w.id})},{key:"source",label:"Source",children:(0,r.jsx)(i.UITag,{color:"manifest"===w.source?"blue":"green",children:"manifest"===w.source?"Plugin":"Standalone"})},{key:"status",label:"Status",children:w.status?(0,r.jsx)(i.UITag,{color:"active"===w.status?"success":"default",children:w.status.toUpperCase()}):"-"},{key:"plugin",label:"Plugin",children:(0,r.jsx)(i.UITypographyText,{className:"typo-caption",children:null!=(e=w.pluginId)?e:"-"})},{key:"tags",label:"Tags",span:2,children:w.tags&&w.tags.length>0?(0,r.jsx)(i.UISpace,{className:"gap-tight",children:w.tags.map(function(e){return(0,r.jsx)(i.UITag,{children:e},e)})}):"-"}]})}),(0,r.jsx)(i.UICard,{title:(0,r.jsx)(i.UITypographyText,{className:"typo-card-title",children:"Recent Runs"}),children:(0,r.jsx)(i.UITable,{dataSource:null!=(t=null==k?void 0:k.runs)?t:[],columns:O,loading:U,rowKey:"id",scroll:{x:900},pagination:{pageSize:20},onRow:function(e){return{style:{cursor:"pointer"},onClick:function(){return c("/p/workflows/runs/".concat(e.id))}}}})}),(0,r.jsx)(s.y,{open:v,workflow:w,loading:T.isLoading,onClose:function(){return x(!1)},onRun:function(e,t){T.mutate(t,{onSuccess:function(e){x(!1),c("/p/workflows/runs/".concat(e.runId))},onError:function(e){y.error('Failed to start workflow "'.concat(g,'": ').concat(e.message))}})}})]}):(0,r.jsx)(i.UIPage,{children:(0,r.jsx)(i.UIEmptyState,{description:'Workflow "'.concat(g,'" not found'),action:(0,r.jsx)(i.UIButton,{onClick:function(){return c("/p/workflows/definitions")},children:"Back to Definitions"})})})}n.d(t,{default:()=>f})}}]);
|
|
2
2
|
//# sourceMappingURL=__federation_expose_DefinitionDetail.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[55],{6026(e,t){var r=Symbol.for("react.transitional.element");function n(e,t,n){var o=null;if(void 0!==n&&(o=""+n),void 0!==t.key&&(o=""+t.key),"key"in t)for(var i in n={},t)"key"!==i&&(n[i]=t[i]);else n=t;return{$$typeof:r,type:e,key:o,ref:void 0!==(t=n.ref)?t:null,props:n}}t.Fragment=Symbol.for("react.fragment"),t.jsx=n,t.jsxs=n},4552(e,t,r){e.exports=r(6026)},6631(e,t,r){var n=r(4552),o=r(1913),i=r(1198);function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){l=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e){var t,r=e.name,o=e.schema,a=e.value,l=e.onChange,s=(0,n.jsxs)(i.UISpace,{className:"gap-tight",style:{marginBottom:4},children:[(0,n.jsxs)(i.UITypographyText,{className:"typo-label",children:[r,o.required&&(0,n.jsx)("span",{style:{color:"var(--color-error)",marginLeft:2},children:"*"})]}),o.description&&(0,n.jsxs)(i.UITypographyText,{className:"typo-caption text-tertiary",children:["— ",o.description]})]});return"boolean"===o.type?(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)("div",{children:(0,n.jsx)(i.UISwitch,{checked:void 0!==a?!!a:null!=(t=o.default)&&t,onChange:l})})]}):"number"===o.type?(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)(i.UIInputNumber,{style:{width:"100%"},value:a,placeholder:void 0!==o.default?String(o.default):void 0,onChange:l})]}):(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)(i.UIInput,{value:a,placeholder:void 0!==o.default?String(o.default):void 0,onChange:function(e){return l(e)}})]})}function u(e){var t,r,a=e.open,u=e.onClose,d=e.onRun,p=e.loading,f="workflows"in e&&Array.isArray(e.workflows),y=f?e.workflows:[],h=s(o.useState(void 0),2),m=h[0],v=h[1],g=s(o.useState("{}"),2),x=g[0],w=g[1],j=s(o.useState(null),2),b=j[0],I=j[1],k=s(o.useState({}),2),S=k[0],U=k[1],T=f?null!=(t=y.find(function(e){return e.id===m}))?t:null:null!=(r=e.workflow)?r:null,O=null==T?void 0:T.inputs,C=!!O&&Object.keys(O).length>0;o.useEffect(function(){if(a)if(w("{}"),I(null),f||v(void 0),O){var e={},t=!0,r=!1,n=void 0;try{for(var o,i=Object.entries(O)[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var l=s(o.value,2),c=l[0],u=l[1];void 0!==u.default&&(e[c]=u.default)}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}U(e)}else U({})},[a,null==T?void 0:T.id,O,f]),o.useEffect(function(){if(f&&m)if(w("{}"),I(null),O){var e={},t=!0,r=!1,n=void 0;try{for(var o,i=Object.entries(O)[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var a=s(o.value,2),l=a[0],c=a[1];void 0!==c.default&&(e[l]=c.default)}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}U(e)}else U({})},[m,O,f]);var N=(0,n.jsxs)(i.UISpace,{style:{justifyContent:"flex-end"},children:[(0,n.jsx)(i.UIButton,{onClick:u,disabled:p,children:"Cancel"}),(0,n.jsx)(i.UIButton,{variant:"primary",icon:(0,n.jsx)(i.UIIcon,{name:"PlayCircleOutlined"}),loading:p,disabled:!T||!C&&!!b,onClick:function(){if(T)if(C)d(T.id,S);else{var e=x.trim();if(!e||"{}"===e)return void d(T.id,{});try{var t=JSON.parse(e);d(T.id,t)}catch(e){I("Invalid JSON")}}},children:"Run"})]}),A=T?"Run Workflow: ".concat(T.name):"Run Workflow";return(0,n.jsxs)(i.UIModal,{open:a,title:(0,n.jsxs)(i.UISpace,{className:"gap-item",children:[(0,n.jsx)(i.UIIcon,{name:"ThunderboltOutlined"}),(0,n.jsx)("span",{children:A})]}),onCancel:u,footer:N,maskClosable:!p,children:[f&&(0,n.jsxs)("div",{style:{marginTop:16},children:[(0,n.jsx)(i.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Select Workflow"}),(0,n.jsx)(i.UISelect,{style:{width:"100%"},placeholder:"Choose a workflow...",value:m,onChange:function(e){return v(e)},showSearch:!0,options:y.map(function(e){return{label:e.name,value:e.id,description:e.description}})})]}),T&&C&&(0,n.jsx)("div",{style:{marginTop:16},children:Object.entries(O).map(function(e){var t=s(e,2),r=t[0],o=t[1];return(0,n.jsx)(c,{name:r,schema:o,value:S[r],onChange:function(e){return U(function(t){var n,o;return n=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){l(e,t,r[t])})}return e}({},t),o=null!=(o=l({},r,e))?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(o)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))}),n})}},r)})}),T&&!C&&(0,n.jsxs)("div",{style:{marginTop:16},children:[(0,n.jsx)(i.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Input payload (JSON)"}),(0,n.jsx)(i.UIInputTextArea,{value:x,onChange:function(e){var t=e.target.value;if(w(t),!t.trim()||"{}"===t.trim())return void I(null);try{JSON.parse(t),I(null)}catch(e){I("Invalid JSON")}},rows:6,placeholder:"{}",style:{fontFamily:"var(--font-mono, monospace)",fontSize:13},status:b?"error":void 0}),b&&(0,n.jsx)(i.UITypographyText,{className:"typo-caption text-error",style:{display:"block",marginTop:4},children:b}),(0,n.jsxs)(i.UITypographyText,{className:"typo-caption text-tertiary",style:{display:"block",marginTop:8},children:["Leave empty or ",(0,n.jsx)("code",{children:"{}"})," to run without parameters"]})]})]})}r.d(t,{y:()=>u})},8792(e,t,r){r.r(t);var n=r(4552),o=r(1913),i=r(3596),a=r(1198),l=r(6188),s=r(6631);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){l=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return c(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(){var e=(0,i.useNavigate)(),t=u((0,a.useUIMessage)(),2),r=t[0],c=t[1],d=u(o.useState(null),2),p=d[0],f=d[1],y=(0,l.useData)("/exec/api/v1/workflows",{params:{limit:100}}),h=y.data,m=y.isLoading,v=(0,l.useMutateData)(function(e){return"/exec/api/v1/workflows/".concat(encodeURIComponent(e.workflowId),"/runs")},{mapBody:function(e){return{inputs:e.input}}}),g=[{title:"Workflow",dataIndex:"name",key:"name",width:280,render:function(e,t){return(0,n.jsxs)("div",{style:{width:"100%",overflow:"hidden"},children:[(0,n.jsx)(a.UITypographyText,{className:"typo-body",strong:!0,style:{display:"block"},children:e}),t.description&&(0,n.jsx)(a.UITypographyText,{className:"typo-description text-secondary",ellipsis:{tooltip:t.description},style:{display:"block"},children:t.description})]})}},{title:"ID",dataIndex:"id",key:"id",width:220,render:function(e){return(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-tertiary",code:!0,ellipsis:{tooltip:e},children:e})}},{title:"Source",dataIndex:"source",key:"source",width:120,render:function(e){return(0,n.jsx)(a.UITag,{color:"manifest"===e?"blue":"green",children:"manifest"===e?"Plugin":"Standalone"})}},{title:"Plugin",dataIndex:"pluginId",key:"pluginId",width:200,render:function(e){return e?(0,n.jsx)(a.UITypographyText,{className:"typo-caption",children:e}):(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-tertiary",children:"-"})}},{title:"Version",dataIndex:"version",key:"version",width:100,render:function(e,t){if(!e)return(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-tertiary",children:"-"});var r=(null==t?void 0:t.updatedAt)?"Updated ".concat(new Date(t.updatedAt).toLocaleString()):void 0;return(0,n.jsxs)(a.UITypographyText,{className:"typo-caption",code:!0,title:r,children:["v",e]})}},{title:"Status",dataIndex:"status",key:"status",width:100,render:function(e){return e?(0,n.jsx)(a.UITag,{color:"active"===e?"success":"default",children:e.toUpperCase()}):(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-tertiary",children:"-"})}},{title:"Actions",key:"actions",width:160,fixed:"right",render:function(t,r){return(0,n.jsxs)(a.UISpace,{className:"gap-tight",children:[(0,n.jsx)(a.UIButton,{variant:"link",size:"small",icon:(0,n.jsx)(a.UIIcon,{name:"EyeOutlined"}),onClick:function(t){t.stopPropagation(),e("/p/workflows/definitions/".concat(encodeURIComponent(r.id)))},children:"View"}),(0,n.jsx)(a.UIButton,{variant:"link",size:"small",icon:(0,n.jsx)(a.UIIcon,{name:"PlayCircleOutlined"}),onClick:function(e){e.stopPropagation(),f(r)},children:"Run"})]})}}];return(0,n.jsxs)(a.UIPage,{width:"full",children:[c,(0,n.jsx)(a.UIPageHeader,{title:"Workflow Definitions",description:"All registered workflow definitions",breadcrumbs:[{title:"Home",href:"/"},{title:"Workflows",href:"/workflows"},{title:"Definitions"}]}),(0,n.jsx)(a.UICard,{children:(0,n.jsx)(a.UITable,{dataSource:(null==h?void 0:h.workflows)||[],columns:g,loading:m,rowKey:"id",scroll:{x:1210},pagination:{pageSize:20},onRow:function(t){return{style:{cursor:"pointer"},onClick:function(){return e("/p/workflows/definitions/".concat(encodeURIComponent(t.id)))}}}})}),(0,n.jsx)(s.y,{open:!!p,workflow:p,loading:v.isLoading,onClose:function(){return f(null)},onRun:function(t,n){v.mutate({workflowId:t,input:n},{onSuccess:function(t){f(null),e("/p/workflows/runs/".concat(t.runId))},onError:function(e){r.error('Failed to start workflow "'.concat(t,'": ').concat(e.message))}})}})]})}r.d(t,{default:()=>d})}}]);
|
|
1
|
+
"use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[55],{6026(e,t){var r=Symbol.for("react.transitional.element");function n(e,t,n){var o=null;if(void 0!==n&&(o=""+n),void 0!==t.key&&(o=""+t.key),"key"in t)for(var i in n={},t)"key"!==i&&(n[i]=t[i]);else n=t;return{$$typeof:r,type:e,key:o,ref:void 0!==(t=n.ref)?t:null,props:n}}t.Fragment=Symbol.for("react.fragment"),t.jsx=n,t.jsxs=n},4552(e,t,r){e.exports=r(6026)},6631(e,t,r){var n=r(4552),o=r(7079),i=r(9776);function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){l=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e){var t,r=e.name,o=e.schema,a=e.value,l=e.onChange,s=(0,n.jsxs)(i.UISpace,{className:"gap-tight",style:{marginBottom:4},children:[(0,n.jsxs)(i.UITypographyText,{className:"typo-label",children:[r,o.required&&(0,n.jsx)("span",{style:{color:"var(--color-error)",marginLeft:2},children:"*"})]}),o.description&&(0,n.jsxs)(i.UITypographyText,{className:"typo-caption text-tertiary",children:["— ",o.description]})]});return"boolean"===o.type?(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)("div",{children:(0,n.jsx)(i.UISwitch,{checked:void 0!==a?!!a:null!=(t=o.default)&&t,onChange:l})})]}):"number"===o.type?(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)(i.UIInputNumber,{style:{width:"100%"},value:a,placeholder:void 0!==o.default?String(o.default):void 0,onChange:l})]}):(0,n.jsxs)("div",{style:{marginBottom:16},children:[s,(0,n.jsx)(i.UIInput,{value:a,placeholder:void 0!==o.default?String(o.default):void 0,onChange:function(e){return l(e)}})]})}function u(e){var t,r,a=e.open,u=e.onClose,d=e.onRun,p=e.loading,f="workflows"in e&&Array.isArray(e.workflows),y=f?e.workflows:[],h=s(o.useState(void 0),2),m=h[0],v=h[1],g=s(o.useState("{}"),2),x=g[0],w=g[1],j=s(o.useState(null),2),b=j[0],I=j[1],k=s(o.useState({}),2),S=k[0],U=k[1],T=f?null!=(t=y.find(function(e){return e.id===m}))?t:null:null!=(r=e.workflow)?r:null,O=null==T?void 0:T.inputs,C=!!O&&Object.keys(O).length>0;o.useEffect(function(){if(a)if(w("{}"),I(null),f||v(void 0),O){var e={},t=!0,r=!1,n=void 0;try{for(var o,i=Object.entries(O)[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var l=s(o.value,2),c=l[0],u=l[1];void 0!==u.default&&(e[c]=u.default)}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}U(e)}else U({})},[a,null==T?void 0:T.id,O,f]),o.useEffect(function(){if(f&&m)if(w("{}"),I(null),O){var e={},t=!0,r=!1,n=void 0;try{for(var o,i=Object.entries(O)[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var a=s(o.value,2),l=a[0],c=a[1];void 0!==c.default&&(e[l]=c.default)}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}U(e)}else U({})},[m,O,f]);var N=(0,n.jsxs)(i.UISpace,{style:{justifyContent:"flex-end"},children:[(0,n.jsx)(i.UIButton,{onClick:u,disabled:p,children:"Cancel"}),(0,n.jsx)(i.UIButton,{variant:"primary",icon:(0,n.jsx)(i.UIIcon,{name:"PlayCircleOutlined"}),loading:p,disabled:!T||!C&&!!b,onClick:function(){if(T)if(C)d(T.id,S);else{var e=x.trim();if(!e||"{}"===e)return void d(T.id,{});try{var t=JSON.parse(e);d(T.id,t)}catch(e){I("Invalid JSON")}}},children:"Run"})]}),A=T?"Run Workflow: ".concat(T.name):"Run Workflow";return(0,n.jsxs)(i.UIModal,{open:a,title:(0,n.jsxs)(i.UISpace,{className:"gap-item",children:[(0,n.jsx)(i.UIIcon,{name:"ThunderboltOutlined"}),(0,n.jsx)("span",{children:A})]}),onCancel:u,footer:N,maskClosable:!p,children:[f&&(0,n.jsxs)("div",{style:{marginTop:16},children:[(0,n.jsx)(i.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Select Workflow"}),(0,n.jsx)(i.UISelect,{style:{width:"100%"},placeholder:"Choose a workflow...",value:m,onChange:function(e){return v(e)},showSearch:!0,options:y.map(function(e){return{label:e.name,value:e.id,description:e.description}})})]}),T&&C&&(0,n.jsx)("div",{style:{marginTop:16},children:Object.entries(O).map(function(e){var t=s(e,2),r=t[0],o=t[1];return(0,n.jsx)(c,{name:r,schema:o,value:S[r],onChange:function(e){return U(function(t){var n,o;return n=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){l(e,t,r[t])})}return e}({},t),o=null!=(o=l({},r,e))?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(o)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))}),n})}},r)})}),T&&!C&&(0,n.jsxs)("div",{style:{marginTop:16},children:[(0,n.jsx)(i.UITypographyText,{className:"typo-label",style:{display:"block",marginBottom:8},children:"Input payload (JSON)"}),(0,n.jsx)(i.UIInputTextArea,{value:x,onChange:function(e){var t=e.target.value;if(w(t),!t.trim()||"{}"===t.trim())return void I(null);try{JSON.parse(t),I(null)}catch(e){I("Invalid JSON")}},rows:6,placeholder:"{}",style:{fontFamily:"var(--font-mono, monospace)",fontSize:13},status:b?"error":void 0}),b&&(0,n.jsx)(i.UITypographyText,{className:"typo-caption text-error",style:{display:"block",marginTop:4},children:b}),(0,n.jsxs)(i.UITypographyText,{className:"typo-caption text-tertiary",style:{display:"block",marginTop:8},children:["Leave empty or ",(0,n.jsx)("code",{children:"{}"})," to run without parameters"]})]})]})}r.d(t,{y:()=>u})},8792(e,t,r){r.r(t);var n=r(4552),o=r(7079),i=r(5450),a=r(9776),l=r(7936),s=r(6631);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){l=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return c(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(){var e=(0,i.useNavigate)(),t=u((0,a.useUIMessage)(),2),r=t[0],c=t[1],d=u(o.useState(null),2),p=d[0],f=d[1],y=(0,l.useData)("/exec/api/v1/workflows",{params:{limit:100}}),h=y.data,m=y.isLoading,v=(0,l.useMutateData)(function(e){return"/exec/api/v1/workflows/".concat(encodeURIComponent(e.workflowId),"/runs")},{mapBody:function(e){return{inputs:e.input}}}),g=[{title:"Workflow",dataIndex:"name",key:"name",width:280,render:function(e,t){return(0,n.jsxs)("div",{style:{width:"100%",overflow:"hidden"},children:[(0,n.jsx)(a.UITypographyText,{className:"typo-body",strong:!0,style:{display:"block"},children:e}),t.description&&(0,n.jsx)(a.UITypographyText,{className:"typo-description text-secondary",ellipsis:{tooltip:t.description},style:{display:"block"},children:t.description})]})}},{title:"ID",dataIndex:"id",key:"id",width:220,render:function(e){return(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-tertiary",code:!0,ellipsis:{tooltip:e},children:e})}},{title:"Source",dataIndex:"source",key:"source",width:120,render:function(e){return(0,n.jsx)(a.UITag,{color:"manifest"===e?"blue":"green",children:"manifest"===e?"Plugin":"Standalone"})}},{title:"Plugin",dataIndex:"pluginId",key:"pluginId",width:200,render:function(e){return e?(0,n.jsx)(a.UITypographyText,{className:"typo-caption",children:e}):(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-tertiary",children:"-"})}},{title:"Version",dataIndex:"version",key:"version",width:100,render:function(e,t){if(!e)return(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-tertiary",children:"-"});var r=(null==t?void 0:t.updatedAt)?"Updated ".concat(new Date(t.updatedAt).toLocaleString()):void 0;return(0,n.jsxs)(a.UITypographyText,{className:"typo-caption",code:!0,title:r,children:["v",e]})}},{title:"Status",dataIndex:"status",key:"status",width:100,render:function(e){return e?(0,n.jsx)(a.UITag,{color:"active"===e?"success":"default",children:e.toUpperCase()}):(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-tertiary",children:"-"})}},{title:"Actions",key:"actions",width:160,fixed:"right",render:function(t,r){return(0,n.jsxs)(a.UISpace,{className:"gap-tight",children:[(0,n.jsx)(a.UIButton,{variant:"link",size:"small",icon:(0,n.jsx)(a.UIIcon,{name:"EyeOutlined"}),onClick:function(t){t.stopPropagation(),e("/p/workflows/definitions/".concat(encodeURIComponent(r.id)))},children:"View"}),(0,n.jsx)(a.UIButton,{variant:"link",size:"small",icon:(0,n.jsx)(a.UIIcon,{name:"PlayCircleOutlined"}),onClick:function(e){e.stopPropagation(),f(r)},children:"Run"})]})}}];return(0,n.jsxs)(a.UIPage,{width:"full",children:[c,(0,n.jsx)(a.UIPageHeader,{title:"Workflow Definitions",description:"All registered workflow definitions",breadcrumbs:[{title:"Home",href:"/"},{title:"Workflows",href:"/workflows"},{title:"Definitions"}]}),(0,n.jsx)(a.UICard,{children:(0,n.jsx)(a.UITable,{dataSource:(null==h?void 0:h.workflows)||[],columns:g,loading:m,rowKey:"id",scroll:{x:1210},pagination:{pageSize:20},onRow:function(t){return{style:{cursor:"pointer"},onClick:function(){return e("/p/workflows/definitions/".concat(encodeURIComponent(t.id)))}}}})}),(0,n.jsx)(s.y,{open:!!p,workflow:p,loading:v.isLoading,onClose:function(){return f(null)},onRun:function(t,n){v.mutate({workflowId:t,input:n},{onSuccess:function(t){f(null),e("/p/workflows/runs/".concat(t.runId))},onError:function(e){r.error('Failed to start workflow "'.concat(t,'": ').concat(e.message))}})}})]})}r.d(t,{default:()=>d})}}]);
|
|
2
2
|
//# sourceMappingURL=__federation_expose_Definitions.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[97],{6026(e,t){var r=Symbol.for("react.transitional.element");function n(e,t,n){var a=null;if(void 0!==n&&(a=""+n),void 0!==t.key&&(a=""+t.key),"key"in t)for(var o in n={},t)"key"!==o&&(n[o]=t[o]);else n=t;return{$$typeof:r,type:e,key:a,ref:void 0!==(t=n.ref)?t:null,props:n}}t.Fragment=Symbol.for("react.fragment"),t.jsx=n,t.jsxs=n},4552(e,t,r){e.exports=r(6026)},9012(e,t,r){r.r(t);var n=r(4552),a=r(
|
|
1
|
+
"use strict";(self.rspackChunk_kb_labs_workflow_entry=self.rspackChunk_kb_labs_workflow_entry||[]).push([[97],{6026(e,t){var r=Symbol.for("react.transitional.element");function n(e,t,n){var a=null;if(void 0!==n&&(a=""+n),void 0!==t.key&&(a=""+t.key),"key"in t)for(var o in n={},t)"key"!==o&&(n[o]=t[o]);else n=t;return{$$typeof:r,type:e,key:a,ref:void 0!==(t=n.ref)?t:null,props:n}}t.Fragment=Symbol.for("react.fragment"),t.jsx=n,t.jsxs=n},4552(e,t,r){e.exports=r(6026)},9012(e,t,r){r.r(t);var n=r(4552),a=r(7079),o=r(9776),l=r(7936);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function c(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}var p={pending:"default",running:"processing",completed:"success",failed:"error",cancelled:"warning"};function u(){var e,t=function(e){if(Array.isArray(e))return e}(e=a.useState({limit:50}))||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(t=n.next()).done)&&(a.push(t.value),2!==a.length);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e)||function(e){if(e){if("string"==typeof e)return i(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return i(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),r=t[0],u=t[1],y=(0,l.useData)("/exec/api/v1/jobs",{params:r}),d=y.data,f=y.isLoading,h=function(e,t){if(!e)return"-";var r=new Date(e).getTime(),n=Math.floor(((t?new Date(t).getTime():Date.now())-r)/1e3);if(n<60)return"".concat(n,"s");var a=Math.floor(n/60);if(a<60)return"".concat(a,"m ").concat(n%60,"s");var o=Math.floor(a/60);return"".concat(o,"h ").concat(a%60,"m")},g=[{title:"Job ID",dataIndex:"id",key:"id",width:180,render:function(e){return(0,n.jsxs)(o.UITypographyText,{className:"typo-caption",code:!0,ellipsis:{tooltip:e},style:{whiteSpace:"nowrap"},children:[e.slice(0,16),"..."]})}},{title:"Type",dataIndex:"type",key:"type",width:260,render:function(e){return(0,n.jsx)(o.UITypographyText,{className:"typo-body",ellipsis:{tooltip:e},style:{display:"block"},children:e})}},{title:"Status",dataIndex:"status",key:"status",width:130,render:function(e,t){return(0,n.jsxs)(o.UISpace,{direction:"vertical",className:"gap-tight",children:[(0,n.jsx)(o.UITag,{color:p[e]||"default",children:e.toUpperCase()}),void 0!==t.progress&&"running"===e&&(0,n.jsxs)(o.UITypographyText,{className:"typo-caption text-secondary",children:[t.progress,"%",t.progressMessage&&" \xb7 ".concat(t.progressMessage)]})]})}},{title:"Created",dataIndex:"createdAt",key:"createdAt",width:220,render:function(e){return(0,n.jsx)(o.UITypographyText,{className:"typo-caption",style:{whiteSpace:"nowrap"},children:e?new Date(e).toLocaleString():"-"})}},{title:"Duration",key:"duration",width:100,render:function(e,t){return(0,n.jsx)(o.UITypographyText,{className:"typo-caption",children:h(t.startedAt,t.finishedAt)})}},{title:"Attempts",key:"attempts",width:90,render:function(e,t){return(0,n.jsxs)(o.UITypographyText,{className:"typo-caption",children:[t.attempt||0," / ",t.maxRetries||3]})}},{title:"Error",dataIndex:"error",key:"error",width:260,render:function(e){return e?(0,n.jsx)(o.UITypographyText,{className:"typo-caption text-error",ellipsis:{tooltip:e},style:{display:"block"},children:e}):(0,n.jsx)(o.UITypographyText,{className:"typo-caption text-tertiary",children:"-"})}}];return(0,n.jsxs)(o.UIPage,{width:"full",children:[(0,n.jsx)(o.UIPageHeader,{title:"Background Jobs",description:"Monitor background job execution and status",breadcrumbs:[{title:"Home",href:"/"},{title:"Workflows",href:"/workflows"},{title:"Jobs"}]}),(0,n.jsx)(o.UICard,{style:{marginBottom:"var(--spacing-section)"},children:(0,n.jsxs)(o.UIRow,{gutter:16,children:[(0,n.jsxs)(o.UICol,{span:8,children:[(0,n.jsx)(o.UITypographyText,{className:"typo-label",children:"Filter by Status"}),(0,n.jsx)(o.UISelect,{style:{width:"100%",marginTop:8},placeholder:"All statuses",allowClear:!0,value:r.status,onChange:function(e){return u(c(s({},r),{status:e}))},options:[{label:"Pending",value:"pending"},{label:"Running",value:"running"},{label:"Completed",value:"completed"},{label:"Failed",value:"failed"},{label:"Cancelled",value:"cancelled"}]})]}),(0,n.jsxs)(o.UICol,{span:8,children:[(0,n.jsx)(o.UITypographyText,{className:"typo-label",children:"Filter by Type"}),(0,n.jsx)(o.UISelect,{style:{width:"100%",marginTop:8},placeholder:"All types",allowClear:!0,showSearch:!0,value:r.type,onChange:function(e){return u(c(s({},r),{type:e}))},options:[]})]}),(0,n.jsxs)(o.UICol,{span:8,children:[(0,n.jsx)(o.UITypographyText,{className:"typo-label",children:"Limit"}),(0,n.jsx)(o.UISelect,{style:{width:"100%",marginTop:8},value:r.limit||50,onChange:function(e){return u(c(s({},r),{limit:e}))},options:[{label:"25",value:25},{label:"50",value:50},{label:"100",value:100},{label:"200",value:200}]})]})]})}),(0,n.jsx)(o.UICard,{children:(0,n.jsx)(o.UITable,{dataSource:(null==d?void 0:d.jobs)||[],columns:g,loading:f,rowKey:"id",scroll:{x:1240},pagination:{pageSize:20}})})]})}r.d(t,{default:()=>u})}}]);
|
|
2
2
|
//# sourceMappingURL=__federation_expose_Jobs.js.map
|