@nocobase/plugin-workflow 1.2.12-alpha → 1.3.0-alpha.20240710084543
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/package.json +3 -3
- package/dist/client/AddButton.d.ts +0 -16
- package/dist/client/Branch.d.ts +0 -17
- package/dist/client/CanvasContent.d.ts +0 -12
- package/dist/client/ExecutionCanvas.d.ts +0 -10
- package/dist/client/ExecutionContextProvider.d.ts +0 -15
- package/dist/client/ExecutionLink.d.ts +0 -10
- package/dist/client/ExecutionPage.d.ts +0 -10
- package/dist/client/ExecutionResourceProvider.d.ts +0 -14
- package/dist/client/FlowContext.d.ts +0 -11
- package/dist/client/WorkflowCanvas.d.ts +0 -10
- package/dist/client/WorkflowLink.d.ts +0 -10
- package/dist/client/WorkflowPage.d.ts +0 -10
- package/dist/client/WorkflowPane.d.ts +0 -10
- package/dist/client/components/AssignedFieldsFormSchemaConfig.d.ts +0 -10
- package/dist/client/components/CheckboxGroupWithTooltip.d.ts +0 -15
- package/dist/client/components/CollectionBlockInitializer.d.ts +0 -10
- package/dist/client/components/CollectionFieldset.d.ts +0 -14
- package/dist/client/components/DetailsBlockProvider.d.ts +0 -14
- package/dist/client/components/DrawerDescription.d.ts +0 -10
- package/dist/client/components/DrawerForm.d.ts +0 -13
- package/dist/client/components/ExecutionStatus.d.ts +0 -13
- package/dist/client/components/FieldsSelect.d.ts +0 -10
- package/dist/client/components/FilterDynamicComponent.d.ts +0 -14
- package/dist/client/components/OpenDrawer.d.ts +0 -14
- package/dist/client/components/RadioWithTooltip.d.ts +0 -15
- package/dist/client/components/SimpleDesigner.d.ts +0 -10
- package/dist/client/components/StatusButton.d.ts +0 -10
- package/dist/client/components/TriggerOptionRender.d.ts +0 -12
- package/dist/client/components/ValueBlock.d.ts +0 -14
- package/dist/client/components/index.d.ts +0 -16
- package/dist/client/components/renderEngineReference.d.ts +0 -10
- package/dist/client/constants.d.ts +0 -45
- package/dist/client/hooks/index.d.ts +0 -11
- package/dist/client/hooks/useGetAriaLabelOfAddButton.d.ts +0 -14
- package/dist/client/hooks/useRefreshActionProps.d.ts +0 -11
- package/dist/client/hooks/useTriggerWorkflowActionProps.d.ts +0 -20
- package/dist/client/hooks/useWorkflowExecuted.d.ts +0 -10
- package/dist/client/index.d.ts +0 -43
- package/dist/client/index.js +0 -569
- package/dist/client/locale/index.d.ts +0 -11
- package/dist/client/nodes/calculation.d.ts +0 -80
- package/dist/client/nodes/condition.d.ts +0 -108
- package/dist/client/nodes/create.d.ts +0 -110
- package/dist/client/nodes/destroy.d.ts +0 -54
- package/dist/client/nodes/end.d.ts +0 -30
- package/dist/client/nodes/index.d.ts +0 -76
- package/dist/client/nodes/query.d.ts +0 -236
- package/dist/client/nodes/update.d.ts +0 -114
- package/dist/client/schemas/collection.d.ts +0 -170
- package/dist/client/schemas/executions.d.ts +0 -282
- package/dist/client/schemas/workflows.d.ts +0 -10
- package/dist/client/settings/customizeSubmitToWorkflowActionSettings.d.ts +0 -10
- package/dist/client/style.d.ts +0 -30
- package/dist/client/triggers/collection.d.ts +0 -124
- package/dist/client/triggers/index.d.ts +0 -36
- package/dist/client/triggers/schedule/EndsByField.d.ts +0 -13
- package/dist/client/triggers/schedule/OnField.d.ts +0 -13
- package/dist/client/triggers/schedule/RepeatField.d.ts +0 -13
- package/dist/client/triggers/schedule/ScheduleConfig.d.ts +0 -10
- package/dist/client/triggers/schedule/constants.d.ts +0 -12
- package/dist/client/triggers/schedule/index.d.ts +0 -33
- package/dist/client/triggers/schedule/locale/Cron.zh-CN.d.ts +0 -42
- package/dist/client/utils.d.ts +0 -12
- package/dist/client/variable.d.ts +0 -93
- package/dist/externalVersion.js +0 -34
- package/dist/index.d.ts +0 -10
- package/dist/index.js +0 -48
- package/dist/locale/en-US.json +0 -98
- package/dist/locale/es-ES.json +0 -98
- package/dist/locale/fr-FR.json +0 -98
- package/dist/locale/ja-JP.json +0 -82
- package/dist/locale/ko_KR.json +0 -168
- package/dist/locale/pt-BR.json +0 -98
- package/dist/locale/ru-RU.json +0 -82
- package/dist/locale/tr-TR.json +0 -82
- package/dist/locale/zh-CN.json +0 -205
- package/dist/node_modules/cron-parser/.eslintrc.json +0 -15
- package/dist/node_modules/cron-parser/.travis.yml +0 -7
- package/dist/node_modules/cron-parser/LICENSE +0 -21
- package/dist/node_modules/cron-parser/component.json +0 -11
- package/dist/node_modules/cron-parser/index.d.ts +0 -1
- package/dist/node_modules/cron-parser/lib/date.js +0 -252
- package/dist/node_modules/cron-parser/lib/expression.js +0 -983
- package/dist/node_modules/cron-parser/lib/field_compactor.js +0 -70
- package/dist/node_modules/cron-parser/lib/field_stringify.js +0 -38
- package/dist/node_modules/cron-parser/lib/parser.js +0 -1
- package/dist/node_modules/cron-parser/node_modules/luxon/build/amd/luxon.js +0 -8489
- package/dist/node_modules/cron-parser/node_modules/luxon/build/cjs-browser/luxon.js +0 -8487
- package/dist/node_modules/cron-parser/node_modules/luxon/build/global/luxon.js +0 -8490
- package/dist/node_modules/cron-parser/node_modules/luxon/build/global/luxon.min.js +0 -1
- package/dist/node_modules/cron-parser/node_modules/luxon/build/node/luxon.js +0 -7522
- package/dist/node_modules/cron-parser/node_modules/luxon/package.json +0 -96
- package/dist/node_modules/cron-parser/node_modules/luxon/src/datetime.js +0 -2169
- package/dist/node_modules/cron-parser/node_modules/luxon/src/duration.js +0 -880
- package/dist/node_modules/cron-parser/node_modules/luxon/src/errors.js +0 -61
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/conversions.js +0 -157
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/diff.js +0 -80
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/digits.js +0 -76
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/english.js +0 -233
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/formats.js +0 -191
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/formatter.js +0 -386
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/invalid.js +0 -14
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/locale.js +0 -482
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/regexParser.js +0 -335
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/tokenParser.js +0 -424
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/util.js +0 -292
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/zoneUtil.js +0 -36
- package/dist/node_modules/cron-parser/node_modules/luxon/src/info.js +0 -193
- package/dist/node_modules/cron-parser/node_modules/luxon/src/interval.js +0 -602
- package/dist/node_modules/cron-parser/node_modules/luxon/src/luxon.js +0 -26
- package/dist/node_modules/cron-parser/node_modules/luxon/src/luxonFilled.js +0 -13
- package/dist/node_modules/cron-parser/node_modules/luxon/src/settings.js +0 -137
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zone.js +0 -88
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/IANAZone.js +0 -191
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/fixedOffsetZone.js +0 -94
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/invalidZone.js +0 -53
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/localZone.js +0 -63
- package/dist/node_modules/cron-parser/package.json +0 -1
- package/dist/node_modules/cron-parser/test/31_of_month.js +0 -17
- package/dist/node_modules/cron-parser/test/bug.js +0 -29
- package/dist/node_modules/cron-parser/test/crondate.js +0 -16
- package/dist/node_modules/cron-parser/test/crontab.example +0 -7
- package/dist/node_modules/cron-parser/test/empty_around_comma.js +0 -22
- package/dist/node_modules/cron-parser/test/expression.js +0 -1489
- package/dist/node_modules/cron-parser/test/field_compactor.js +0 -250
- package/dist/node_modules/cron-parser/test/field_stringify.js +0 -84
- package/dist/node_modules/cron-parser/test/fields.js +0 -32
- package/dist/node_modules/cron-parser/test/increment_on_first_iteration.js +0 -22
- package/dist/node_modules/cron-parser/test/index-ts3.test-d.ts +0 -133
- package/dist/node_modules/cron-parser/test/index.test-d.ts +0 -138
- package/dist/node_modules/cron-parser/test/leap_year.js +0 -17
- package/dist/node_modules/cron-parser/test/parser.js +0 -46
- package/dist/node_modules/cron-parser/test/parser_crondate_formats.js +0 -145
- package/dist/node_modules/cron-parser/test/parser_day_of_month.js +0 -169
- package/dist/node_modules/cron-parser/test/prev_date.js +0 -32
- package/dist/node_modules/cron-parser/test/stringify.js +0 -402
- package/dist/node_modules/cron-parser/test/timezone.js +0 -422
- package/dist/node_modules/cron-parser/types/common.d.ts +0 -131
- package/dist/node_modules/cron-parser/types/index.d.ts +0 -45
- package/dist/node_modules/cron-parser/types/ts3/index.d.ts +0 -28
- package/dist/node_modules/lru-cache/LICENSE +0 -15
- package/dist/node_modules/lru-cache/dist/cjs/index-cjs.d.ts +0 -7
- package/dist/node_modules/lru-cache/dist/cjs/index-cjs.js +0 -1
- package/dist/node_modules/lru-cache/dist/cjs/index.d.ts +0 -807
- package/dist/node_modules/lru-cache/dist/cjs/index.js +0 -1334
- package/dist/node_modules/lru-cache/dist/cjs/index.min.js +0 -2
- package/dist/node_modules/lru-cache/dist/cjs/package.json +0 -3
- package/dist/node_modules/lru-cache/dist/mjs/index.d.ts +0 -807
- package/dist/node_modules/lru-cache/dist/mjs/index.js +0 -1330
- package/dist/node_modules/lru-cache/dist/mjs/index.min.js +0 -2
- package/dist/node_modules/lru-cache/dist/mjs/package.json +0 -3
- package/dist/node_modules/lru-cache/package.json +0 -1
- package/dist/server/Plugin.d.ts +0 -84
- package/dist/server/Plugin.js +0 -503
- package/dist/server/Processor.d.ts +0 -115
- package/dist/server/Processor.js +0 -363
- package/dist/server/actions/executions.d.ts +0 -11
- package/dist/server/actions/executions.js +0 -96
- package/dist/server/actions/index.d.ts +0 -11
- package/dist/server/actions/index.js +0 -66
- package/dist/server/actions/nodes.d.ts +0 -12
- package/dist/server/actions/nodes.js +0 -217
- package/dist/server/actions/workflows.d.ts +0 -14
- package/dist/server/actions/workflows.js +0 -184
- package/dist/server/collections/executions.d.ts +0 -11
- package/dist/server/collections/executions.js +0 -66
- package/dist/server/collections/flow_nodes.d.ts +0 -11
- package/dist/server/collections/flow_nodes.js +0 -87
- package/dist/server/collections/jobs.d.ts +0 -11
- package/dist/server/collections/jobs.js +0 -66
- package/dist/server/collections/workflows.d.ts +0 -10
- package/dist/server/collections/workflows.js +0 -126
- package/dist/server/constants.d.ts +0 -29
- package/dist/server/constants.js +0 -58
- package/dist/server/functions/index.d.ts +0 -17
- package/dist/server/functions/index.js +0 -40
- package/dist/server/index.d.ts +0 -15
- package/dist/server/index.js +0 -60
- package/dist/server/instructions/CalculationInstruction.d.ts +0 -25
- package/dist/server/instructions/CalculationInstruction.js +0 -59
- package/dist/server/instructions/ConditionInstruction.d.ts +0 -36
- package/dist/server/instructions/ConditionInstruction.js +0 -167
- package/dist/server/instructions/CreateInstruction.d.ts +0 -18
- package/dist/server/instructions/CreateInstruction.js +0 -75
- package/dist/server/instructions/DestroyInstruction.d.ts +0 -18
- package/dist/server/instructions/DestroyInstruction.js +0 -59
- package/dist/server/instructions/EndInstruction.d.ts +0 -14
- package/dist/server/instructions/EndInstruction.js +0 -55
- package/dist/server/instructions/QueryInstruction.d.ts +0 -21
- package/dist/server/instructions/QueryInstruction.js +0 -82
- package/dist/server/instructions/UpdateInstruction.d.ts +0 -18
- package/dist/server/instructions/UpdateInstruction.js +0 -59
- package/dist/server/instructions/index.d.ts +0 -31
- package/dist/server/instructions/index.js +0 -42
- package/dist/server/migrations/20221129153547-calculation-variables.d.ts +0 -14
- package/dist/server/migrations/20221129153547-calculation-variables.js +0 -92
- package/dist/server/migrations/20230221032941-change-request-body-type.d.ts +0 -14
- package/dist/server/migrations/20230221032941-change-request-body-type.js +0 -102
- package/dist/server/migrations/20230221071831-calculation-expression.d.ts +0 -13
- package/dist/server/migrations/20230221071831-calculation-expression.js +0 -121
- package/dist/server/migrations/20230221121203-condition-calculation.d.ts +0 -13
- package/dist/server/migrations/20230221121203-condition-calculation.js +0 -106
- package/dist/server/migrations/20230221162902-jsonb-to-json.d.ts +0 -13
- package/dist/server/migrations/20230221162902-jsonb-to-json.js +0 -63
- package/dist/server/migrations/20230411034722-manual-multi-form.d.ts +0 -13
- package/dist/server/migrations/20230411034722-manual-multi-form.js +0 -283
- package/dist/server/migrations/20230612021134-manual-collection-block.d.ts +0 -13
- package/dist/server/migrations/20230612021134-manual-collection-block.js +0 -152
- package/dist/server/migrations/20230710115902-manual-action-values.d.ts +0 -13
- package/dist/server/migrations/20230710115902-manual-action-values.js +0 -101
- package/dist/server/migrations/20230809113132-workflow-options.d.ts +0 -13
- package/dist/server/migrations/20230809113132-workflow-options.js +0 -64
- package/dist/server/migrations/20231024172342-add-node-key.d.ts +0 -13
- package/dist/server/migrations/20231024172342-add-node-key.js +0 -90
- package/dist/server/migrations/20231122143143-split-to-plugins.d.ts +0 -13
- package/dist/server/migrations/20231122143143-split-to-plugins.js +0 -67
- package/dist/server/migrations/20240115220721-add-node-key-to-job.d.ts +0 -14
- package/dist/server/migrations/20240115220721-add-node-key-to-job.js +0 -63
- package/dist/server/migrations/20240613222612-fix-assign-field-config.d.ts +0 -13
- package/dist/server/migrations/20240613222612-fix-assign-field-config.js +0 -62
- package/dist/server/triggers/CollectionTrigger.d.ts +0 -22
- package/dist/server/triggers/CollectionTrigger.js +0 -184
- package/dist/server/triggers/ScheduleTrigger/DateFieldScheduleTrigger.d.ts +0 -39
- package/dist/server/triggers/ScheduleTrigger/DateFieldScheduleTrigger.js +0 -356
- package/dist/server/triggers/ScheduleTrigger/StaticScheduleTrigger.d.ts +0 -21
- package/dist/server/triggers/ScheduleTrigger/StaticScheduleTrigger.js +0 -152
- package/dist/server/triggers/ScheduleTrigger/index.d.ts +0 -18
- package/dist/server/triggers/ScheduleTrigger/index.js +0 -84
- package/dist/server/triggers/ScheduleTrigger/utils.d.ts +0 -13
- package/dist/server/triggers/ScheduleTrigger/utils.js +0 -44
- package/dist/server/triggers/index.d.ts +0 -21
- package/dist/server/triggers/index.js +0 -46
- package/dist/server/types/Execution.d.ts +0 -25
- package/dist/server/types/Execution.js +0 -34
- package/dist/server/types/FlowNode.d.ts +0 -24
- package/dist/server/types/FlowNode.js +0 -34
- package/dist/server/types/Job.d.ts +0 -22
- package/dist/server/types/Job.js +0 -34
- package/dist/server/types/Workflow.d.ts +0 -35
- package/dist/server/types/Workflow.js +0 -34
- package/dist/server/types/index.d.ts +0 -12
- package/dist/server/types/index.js +0 -24
- package/dist/server/utils.d.ts +0 -9
- package/dist/server/utils.js +0 -51
- package/dist/swagger/index.d.ts +0 -762
- package/dist/swagger/index.js +0 -807
package/dist/client/index.js
DELETED
|
@@ -1,569 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
(function(v,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("react/jsx-runtime"),require("@nocobase/client"),require("@nocobase/utils/client"),require("react-router-dom"),require("react"),require("antd"),require("react-i18next"),require("@ant-design/icons"),require("@formily/core"),require("@formily/reactive"),require("@formily/react"),require("lodash"),require("@formily/shared"),require("dayjs"),require("@nocobase/evaluators/client"),require("@formily/antd-v5")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@nocobase/client","@nocobase/utils/client","react-router-dom","react","antd","react-i18next","@ant-design/icons","@formily/core","@formily/reactive","@formily/react","lodash","@formily/shared","dayjs","@nocobase/evaluators/client","@formily/antd-v5"],n):(v=typeof globalThis!="undefined"?globalThis:v||self,n(v["@nocobase/plugin-workflow"]={},v.jsxRuntime,v["@nocobase/client"],v["@nocobase/utils"],v["react-router-dom"],v.react,v.antd,v["react-i18next"],v["@ant-design/icons"],v["@formily/core"],v["@formily/reactive"],v["@formily/react"],v.lodash,v["@formily/shared"],v.dayjs,v["@nocobase/evaluators"],v["@formily/antd-v5"]))})(this,function(v,n,l,J,te,b,y,Q,I,le,fo,L,ke,ho,Yt,De,jo){"use strict";var Nr=Object.defineProperty,Er=Object.defineProperties;var $r=Object.getOwnPropertyDescriptors;var mo=Object.getOwnPropertySymbols;var Gt=Object.prototype.hasOwnProperty,qt=Object.prototype.propertyIsEnumerable;var Vo=(v,n,l)=>n in v?Nr(v,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):v[n]=l,C=(v,n)=>{for(var l in n||(n={}))Gt.call(n,l)&&Vo(v,l,n[l]);if(mo)for(var l of mo(n))qt.call(n,l)&&Vo(v,l,n[l]);return v},A=(v,n)=>Er(v,$r(n));var Kt=v=>typeof v=="symbol"?v:v+"",Z=(v,n)=>{var l={};for(var J in v)Gt.call(v,J)&&n.indexOf(J)<0&&(l[J]=v[J]);if(v!=null&&mo)for(var J of mo(v))n.indexOf(J)<0&&qt.call(v,J)&&(l[J]=v[J]);return l};var w=(v,n,l)=>(Vo(v,typeof n!="symbol"?n+"":n,l),l);var U=(v,n,l)=>new Promise((J,te)=>{var b=I=>{try{Q(l.next(I))}catch(le){te(le)}},y=I=>{try{Q(l.throw(I))}catch(le){te(le)}},Q=I=>I.done?J(I.value):Promise.resolve(I.value).then(b,y);Q((l=l.apply(v,n)).next())});const _t=b.createContext(null),yo={didCatch:!1,error:null};class Zt extends b.Component{constructor(o){super(o),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=yo}static getDerivedStateFromError(o){return{didCatch:!0,error:o}}resetErrorBoundary(){const{error:o}=this.state;if(o!==null){for(var t,r,s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];(t=(r=this.props).onReset)===null||t===void 0||t.call(r,{args:a,reason:"imperative-api"}),this.setState(yo)}}componentDidCatch(o,t){var r,s;(r=(s=this.props).onError)===null||r===void 0||r.call(s,o,t)}componentDidUpdate(o,t){const{didCatch:r}=this.state,{resetKeys:s}=this.props;if(r&&t.error!==null&&Qt(o.resetKeys,s)){var a,i;(a=(i=this.props).onReset)===null||a===void 0||a.call(i,{next:s,prev:o.resetKeys,reason:"keys"}),this.setState(yo)}}render(){const{children:o,fallbackRender:t,FallbackComponent:r,fallback:s}=this.props,{didCatch:a,error:i}=this.state;let c=o;if(a){const u={error:i,resetErrorBoundary:this.resetErrorBoundary};if(b.isValidElement(s))c=s;else if(typeof t=="function")c=t(u);else if(r)c=b.createElement(r,u);else throw i}return b.createElement(_t.Provider,{value:{didCatch:a,error:i,resetErrorBoundary:this.resetErrorBoundary}},c)}}function Qt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==o.length||e.some((t,r)=>!Object.is(t,o[r]))}const Ie=b.createContext({});function G(){return b.useContext(Ie)}const p="workflow";function T(e,o={}){return l.i18n.t(e,A(C({},o),{ns:p}))}function go(){return Q.useTranslation(p)}const ne=l.createStyles(({css:e,token:o})=>({workflowPageClass:e`
|
|
11
|
-
flex-grow: 1;
|
|
12
|
-
overflow: hidden;
|
|
13
|
-
display: flex;
|
|
14
|
-
flex-direction: column;
|
|
15
|
-
|
|
16
|
-
.workflow-toolbar {
|
|
17
|
-
display: flex;
|
|
18
|
-
align-items: center;
|
|
19
|
-
justify-content: space-between;
|
|
20
|
-
position: relative;
|
|
21
|
-
padding: 0.5rem 1rem;
|
|
22
|
-
background: ${o.colorBgContainer};
|
|
23
|
-
border-bottom: 1px solid ${o.colorBorderSecondary};
|
|
24
|
-
|
|
25
|
-
header {
|
|
26
|
-
display: flex;
|
|
27
|
-
align-items: center;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
aside {
|
|
31
|
-
display: flex;
|
|
32
|
-
align-items: center;
|
|
33
|
-
gap: 0.5em;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.workflow-versions {
|
|
37
|
-
label {
|
|
38
|
-
margin-right: 0.5em;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.workflow-canvas-wrapper {
|
|
44
|
-
flex-grow: 1;
|
|
45
|
-
overflow: hidden;
|
|
46
|
-
position: relative;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.workflow-canvas-zoomer {
|
|
50
|
-
display: flex;
|
|
51
|
-
align-items: center;
|
|
52
|
-
position: absolute;
|
|
53
|
-
top: 2em;
|
|
54
|
-
right: 2em;
|
|
55
|
-
height: 10em;
|
|
56
|
-
padding: 1em 0;
|
|
57
|
-
border-radius: 0.5em;
|
|
58
|
-
background: ${o.colorBgContainer};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.workflow-canvas {
|
|
62
|
-
overflow: auto;
|
|
63
|
-
height: 100%;
|
|
64
|
-
width: 100%;
|
|
65
|
-
display: flex;
|
|
66
|
-
flex-direction: column;
|
|
67
|
-
align-items: center;
|
|
68
|
-
padding: 2em;
|
|
69
|
-
|
|
70
|
-
> .ant-alert {
|
|
71
|
-
margin-bottom: 2em;
|
|
72
|
-
font-size: 85%;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
`,dropdownClass:e`
|
|
76
|
-
.ant-dropdown-menu-item {
|
|
77
|
-
justify-content: flex-end;
|
|
78
|
-
.ant-dropdown-menu-title-content {
|
|
79
|
-
display: flex;
|
|
80
|
-
align-items: baseline;
|
|
81
|
-
justify-content: flex-end;
|
|
82
|
-
text-align: right;
|
|
83
|
-
|
|
84
|
-
time {
|
|
85
|
-
width: 14em;
|
|
86
|
-
font-size: 80%;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
`,workflowVersionDropdownClass:e`
|
|
91
|
-
max-height: 80vh;
|
|
92
|
-
overflow-y: auto;
|
|
93
|
-
|
|
94
|
-
.ant-dropdown-menu-item {
|
|
95
|
-
.ant-dropdown-menu-title-content {
|
|
96
|
-
strong {
|
|
97
|
-
font-weight: normal;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
> .enabled {
|
|
101
|
-
strong {
|
|
102
|
-
font-weight: bold;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
> .unexecuted {
|
|
107
|
-
strong {
|
|
108
|
-
font-style: italic;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
`,executionsDropdownRowClass:e`
|
|
114
|
-
.ant-dropdown-menu-item {
|
|
115
|
-
.id {
|
|
116
|
-
flex-grow: 1;
|
|
117
|
-
text-align: right;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
`,branchBlockClass:e`
|
|
121
|
-
display: flex;
|
|
122
|
-
position: relative;
|
|
123
|
-
margin: 2em auto auto auto;
|
|
124
|
-
|
|
125
|
-
:before {
|
|
126
|
-
content: '';
|
|
127
|
-
position: absolute;
|
|
128
|
-
top: 0;
|
|
129
|
-
bottom: 0;
|
|
130
|
-
left: calc(50% - 0.5px);
|
|
131
|
-
width: 1px;
|
|
132
|
-
background-color: ${o.colorBgLayout};
|
|
133
|
-
}
|
|
134
|
-
`,branchClass:e`
|
|
135
|
-
display: flex;
|
|
136
|
-
flex-direction: column;
|
|
137
|
-
align-items: center;
|
|
138
|
-
position: relative;
|
|
139
|
-
min-width: 20em;
|
|
140
|
-
padding: 0 2em;
|
|
141
|
-
|
|
142
|
-
.workflow-node-list {
|
|
143
|
-
flex-grow: 1;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
.workflow-branch-lines {
|
|
147
|
-
position: absolute;
|
|
148
|
-
top: 0;
|
|
149
|
-
bottom: 0;
|
|
150
|
-
width: 1px;
|
|
151
|
-
background-color: ${o.colorBorder};
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
:before,
|
|
155
|
-
:after {
|
|
156
|
-
content: '';
|
|
157
|
-
position: absolute;
|
|
158
|
-
height: 1px;
|
|
159
|
-
background-color: ${o.colorBorder};
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
:before {
|
|
163
|
-
top: 0;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
:after {
|
|
167
|
-
bottom: 0;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
:not(:first-child):not(:last-child) {
|
|
171
|
-
:before,
|
|
172
|
-
:after {
|
|
173
|
-
left: 0;
|
|
174
|
-
width: 100%;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
:last-child:not(:first-child) {
|
|
179
|
-
:before,
|
|
180
|
-
:after {
|
|
181
|
-
right: 50%;
|
|
182
|
-
width: 50%;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
:first-child:not(:last-child) {
|
|
187
|
-
:before,
|
|
188
|
-
:after {
|
|
189
|
-
left: 50%;
|
|
190
|
-
width: 50%;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
.end-sign {
|
|
195
|
-
position: relative;
|
|
196
|
-
display: flex;
|
|
197
|
-
flex-direction: column;
|
|
198
|
-
align-items: center;
|
|
199
|
-
justify-content: center;
|
|
200
|
-
width: 0;
|
|
201
|
-
height: 6em;
|
|
202
|
-
border-left: 1px dashed ${o.colorBgLayout};
|
|
203
|
-
|
|
204
|
-
.anticon {
|
|
205
|
-
font-size: 1.5em;
|
|
206
|
-
line-height: 100%;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
`,nodeBlockClass:e`
|
|
210
|
-
flex-grow: 1;
|
|
211
|
-
flex-shrink: 0;
|
|
212
|
-
display: flex;
|
|
213
|
-
flex-direction: column;
|
|
214
|
-
align-items: center;
|
|
215
|
-
position: relative;
|
|
216
|
-
`,nodeClass:e`
|
|
217
|
-
flex-shrink: 0;
|
|
218
|
-
display: flex;
|
|
219
|
-
flex-direction: column;
|
|
220
|
-
align-items: center;
|
|
221
|
-
`,nodeCardClass:e`
|
|
222
|
-
position: relative;
|
|
223
|
-
width: 20em;
|
|
224
|
-
background: ${o.colorBgContainer};
|
|
225
|
-
padding: 1em;
|
|
226
|
-
box-shadow: ${o.boxShadowTertiary};
|
|
227
|
-
border-radius: ${o.borderRadiusLG}px;
|
|
228
|
-
cursor: pointer;
|
|
229
|
-
transition: box-shadow 0.3s ease;
|
|
230
|
-
|
|
231
|
-
&:hover {
|
|
232
|
-
box-shadow: ${o.boxShadow};
|
|
233
|
-
|
|
234
|
-
.workflow-node-remove-button {
|
|
235
|
-
display: block;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
&.configuring {
|
|
240
|
-
box-shadow: ${o.boxShadow};
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
.workflow-node-remove-button {
|
|
244
|
-
display: none;
|
|
245
|
-
position: absolute;
|
|
246
|
-
right: 0.5em;
|
|
247
|
-
top: 0.5em;
|
|
248
|
-
color: ${o.colorText};
|
|
249
|
-
|
|
250
|
-
&[disabled] {
|
|
251
|
-
display: none;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
&:hover {
|
|
255
|
-
color: ${o.colorErrorHover};
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
.ant-input {
|
|
260
|
-
font-weight: bold;
|
|
261
|
-
|
|
262
|
-
&:not(:focus) {
|
|
263
|
-
transition:
|
|
264
|
-
background-color 0.3s ease,
|
|
265
|
-
border-color 0.3s ease;
|
|
266
|
-
border-color: ${o.colorBorderBg};
|
|
267
|
-
background-color: ${o.colorBgContainerDisabled};
|
|
268
|
-
|
|
269
|
-
&:not(:disabled):hover {
|
|
270
|
-
border-color: ${o.colorPrimaryBorderHover};
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
&:disabled:hover {
|
|
274
|
-
border-color: ${o.colorBorderBg};
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
.workflow-node-config-button {
|
|
280
|
-
padding: 0;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
&:hover {
|
|
284
|
-
box-shadow: 0 0.25em 0.5em rgba(0, 0, 0, 0.25);
|
|
285
|
-
|
|
286
|
-
.workflow-node-remove-button {
|
|
287
|
-
display: block;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
`,nodeJobButtonClass:e`
|
|
291
|
-
display: flex;
|
|
292
|
-
position: absolute;
|
|
293
|
-
top: calc(1em - 1px);
|
|
294
|
-
right: 1em;
|
|
295
|
-
justify-content: center;
|
|
296
|
-
align-items: center;
|
|
297
|
-
color: ${o.colorTextLightSolid};
|
|
298
|
-
`,nodeHeaderClass:e`
|
|
299
|
-
position: relative;
|
|
300
|
-
`,nodeMetaClass:e`
|
|
301
|
-
margin-bottom: 0.5em;
|
|
302
|
-
|
|
303
|
-
.workflow-node-id {
|
|
304
|
-
color: ${o.colorTextDescription};
|
|
305
|
-
|
|
306
|
-
&:before {
|
|
307
|
-
content: '#';
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
`,nodeTitleClass:e`
|
|
311
|
-
display: flex;
|
|
312
|
-
align-items: center;
|
|
313
|
-
font-weight: normal;
|
|
314
|
-
.workflow-node-id {
|
|
315
|
-
color: ${o.colorTextDescription};
|
|
316
|
-
}
|
|
317
|
-
`,nodeSubtreeClass:e`
|
|
318
|
-
display: flex;
|
|
319
|
-
flex-direction: column-reverse;
|
|
320
|
-
align-items: center;
|
|
321
|
-
margin: auto;
|
|
322
|
-
`,nodeJobResultClass:e`
|
|
323
|
-
padding: 1em;
|
|
324
|
-
background-color: ${o.colorBgContainer};
|
|
325
|
-
`,addButtonClass:e`
|
|
326
|
-
flex-shrink: 0;
|
|
327
|
-
padding: 2em 0;
|
|
328
|
-
|
|
329
|
-
> .ant-btn {
|
|
330
|
-
&:disabled {
|
|
331
|
-
visibility: hidden;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
`,conditionClass:e`
|
|
335
|
-
position: relative;
|
|
336
|
-
overflow: visible;
|
|
337
|
-
|
|
338
|
-
> span {
|
|
339
|
-
position: absolute;
|
|
340
|
-
top: calc(1.5em - 1px);
|
|
341
|
-
line-height: 1em;
|
|
342
|
-
color: ${o.colorTextSecondary};
|
|
343
|
-
background-color: ${o.colorBgLayout};
|
|
344
|
-
padding: 1px;
|
|
345
|
-
}
|
|
346
|
-
`,loopLineClass:e`
|
|
347
|
-
display: flex;
|
|
348
|
-
justify-content: center;
|
|
349
|
-
align-items: center;
|
|
350
|
-
position: absolute;
|
|
351
|
-
top: 50%;
|
|
352
|
-
transform: translateY(-50%);
|
|
353
|
-
width: 2em;
|
|
354
|
-
height: 6em;
|
|
355
|
-
`,terminalClass:e`
|
|
356
|
-
display: flex;
|
|
357
|
-
align-items: center;
|
|
358
|
-
justify-content: center;
|
|
359
|
-
flex-shrink: 0;
|
|
360
|
-
width: 4em;
|
|
361
|
-
height: 4em;
|
|
362
|
-
border-radius: 50%;
|
|
363
|
-
background-color: ${o.colorText};
|
|
364
|
-
color: ${o.colorBgContainer};
|
|
365
|
-
`}));function Wo(e){var k;const{upstream:o,branchIndex:t=null}=e,r=l.usePlugin(de),s=l.useCompile(),a=l.useAPIClient(),{workflow:i,refresh:c}=(k=G())!=null?k:{},u=Array.from(r.instructions.getValues()),{styles:d}=ne(),[f,h]=b.useState(!1),x=b.useMemo(()=>[{key:"control",label:`{{t("Control", { ns: "${p}" })}}`},{key:"collection",label:`{{t("Collection operations", { ns: "${p}" })}}`},{key:"manual",label:`{{t("Manual", { ns: "${p}" })}}`},{key:"extended",label:`{{t("Extended types", { ns: "${p}" })}}`}].map(O=>{const B=u.filter(S=>S.group===O.key&&(S.isAvailable?S.isAvailable({engine:r,workflow:i,upstream:o,branchIndex:t}):!0));return A(C({},O),{type:"group",children:B.map(S=>({role:"button","aria-label":S.type,key:S.type,label:S.title,type:S.options?"subMenu":null,children:S.options?S.options.map(E=>({role:"button","aria-label":E.key,key:E.key,label:E.label})):null}))})}).filter(O=>O.children.length),[t,r,u,o,i]),g=b.useCallback(B=>U(this,[B],function*({keyPath:O}){var M,N,F;const S=O.pop(),[E]=O,W=r.instructions.get(S),$=W.createDefaultConfig();if(E){const{value:D}=(N=(M=W.options)==null?void 0:M.find(H=>H.key===E))!=null?N:{};Object.assign($,typeof D=="function"?D():D)}if(i){h(!0);try{yield a.resource("workflows.nodes",i.id).create({values:{type:S,upstreamId:(F=o==null?void 0:o.id)!=null?F:null,branchIndex:t,title:s(W.title),config:$}}),c()}catch(D){console.error(D)}finally{h(!1)}}}),[a,t,r.instructions,c,o==null?void 0:o.id,i]),m=b.useMemo(()=>({onClick:g,items:s(x)}),[x,g]);return i?n.jsx("div",{className:d.addButtonClass,children:n.jsx(y.Dropdown,{trigger:["click"],menu:m,disabled:i.executed,overlayClassName:l.css`
|
|
366
|
-
.ant-dropdown-menu-root {
|
|
367
|
-
max-height: 30em;
|
|
368
|
-
overflow-y: auto;
|
|
369
|
-
}
|
|
370
|
-
`,children:n.jsx(y.Button,{"aria-label":e["aria-label"]||"add-button",shape:"circle",icon:n.jsx(I.PlusOutlined,{}),loading:f})})}):null}const bo=(e,o)=>({getAriaLabel:b.useCallback(r=>["add-button",e==null?void 0:e.type,e==null?void 0:e.title,o!=null?String(o):"",r].filter(Boolean).join("-"),[o,e==null?void 0:e.title,e==null?void 0:e.type])}),Xt=l.createStyles(({css:e,token:o})=>({container:e`
|
|
371
|
-
margin-bottom: 1.5em;
|
|
372
|
-
padding: 1em;
|
|
373
|
-
background-color: ${o.colorFillAlter};
|
|
374
|
-
|
|
375
|
-
> *:last-child {
|
|
376
|
-
margin-bottom: 0;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
dl {
|
|
380
|
-
display: flex;
|
|
381
|
-
align-items: baseline;
|
|
382
|
-
|
|
383
|
-
dt {
|
|
384
|
-
color: ${o.colorText};
|
|
385
|
-
&:after {
|
|
386
|
-
content: ':';
|
|
387
|
-
margin-right: 0.5em;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
p {
|
|
393
|
-
color: ${o.colorTextDescription};
|
|
394
|
-
}
|
|
395
|
-
`}));function Lo(e){const{label:o,title:t,description:r}=e,{styles:s}=Xt();return n.jsxs("div",{className:l.cx(s.container,e.className),children:[n.jsxs("dl",{children:[n.jsx("dt",{children:o}),n.jsx("dd",{children:n.jsx(y.Tag,{style:{background:"none"},children:t})})]}),r?n.jsx("p",{children:r}):null]})}function Rt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var zo={exports:{}};/*!
|
|
396
|
-
Copyright (c) 2018 Jed Watson.
|
|
397
|
-
Licensed under the MIT License (MIT), see
|
|
398
|
-
http://jedwatson.github.io/classnames
|
|
399
|
-
*/(function(e){(function(){var o={}.hasOwnProperty;function t(){for(var a="",i=0;i<arguments.length;i++){var c=arguments[i];c&&(a=s(a,r(c)))}return a}function r(a){if(typeof a=="string"||typeof a=="number")return a;if(typeof a!="object")return"";if(Array.isArray(a))return t.apply(null,a);if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]"))return a.toString();var i="";for(var c in a)o.call(a,c)&&a[c]&&(i=s(i,c));return i}function s(a,i){return i?a?a+" "+i:a+i:a}e.exports?(t.default=t,e.exports=t):window.classNames=t})()})(zo);var en=zo.exports;const on=Rt(en),tn=l.createStyles(({css:e,token:o})=>({statusButtonClass:e`
|
|
400
|
-
border: none;
|
|
401
|
-
.ant-tag {
|
|
402
|
-
width: 100%;
|
|
403
|
-
height: 100%;
|
|
404
|
-
padding: 0;
|
|
405
|
-
margin-right: 0;
|
|
406
|
-
border-radius: 50%;
|
|
407
|
-
text-align: center;
|
|
408
|
-
}
|
|
409
|
-
`,noStatusButtonClass:e`
|
|
410
|
-
border-width: 2px;
|
|
411
|
-
`}));function Pe(e){const i=e,{status:o,statusMap:t}=i,r=Z(i,["status","statusMap"]),{styles:s}=tn();let a=null;if(typeof o!="undefined"&&(t!=null&&t[o])){const{icon:c,color:u}=t[o];a=n.jsx(y.Tag,{color:u,children:c})}return n.jsx(y.Button,A(C({},r),{shape:"circle",size:"small",className:on(a?s.statusButtonClass:s.noStatusButtonClass,e.className),children:a}))}const pe={QUEUEING:null,STARTED:0,RESOLVED:1,FAILED:-1,ERROR:-2,ABORTED:-3,CANCELED:-4,REJECTED:-5,RETRY_NEEDED:-6},He=[{value:pe.QUEUEING,label:`{{t("Queueing", { ns: "${p}" })}}`,color:"blue",icon:n.jsx(I.HourglassOutlined,{}),description:`{{t("Triggered but still waiting in queue to execute.", { ns: "${p}" })}}`},{value:pe.STARTED,label:`{{t("On going", { ns: "${p}" })}}`,color:"gold",icon:n.jsx(I.LoadingOutlined,{}),description:`{{t("Started and executing, maybe waiting for an async callback (manual, delay etc.).", { ns: "${p}" })}}`},{value:pe.RESOLVED,label:`{{t("Resolved", { ns: "${p}" })}}`,color:"green",icon:n.jsx(I.CheckOutlined,{}),description:`{{t("Successfully finished.", { ns: "${p}" })}}`},{value:pe.FAILED,label:`{{t("Failed", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.ExclamationOutlined,{}),description:`{{t("Failed to satisfy node configurations.", { ns: "${p}" })}}`},{value:pe.ERROR,label:`{{t("Error", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.CloseOutlined,{}),description:`{{t("Some node meets error.", { ns: "${p}" })}}`},{value:pe.ABORTED,label:`{{t("Aborted", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.MinusOutlined,{rotate:90}),description:`{{t("Running of some node was aborted by program flow.", { ns: "${p}" })}}`},{value:pe.CANCELED,label:`{{t("Canceled", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.MinusOutlined,{rotate:45}),description:`{{t("Manually canceled whole execution when waiting.", { ns: "${p}" })}}`},{value:pe.REJECTED,label:`{{t("Rejected", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.MinusOutlined,{}),description:`{{t("Rejected from a manual node.", { ns: "${p}" })}}`},{value:pe.RETRY_NEEDED,label:`{{t("Retry needed", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.RedoOutlined,{}),description:`{{t("General failed but should do another try.", { ns: "${p}" })}}`}],Ge=He.reduce((e,o)=>Object.assign(e,{[o.value]:o}),{}),ie={PENDING:0,RESOLVED:1,FAILED:-1,ERROR:-2,ABORTED:-3,CANCELED:-4,REJECTED:-5,RETRY_NEEDED:-6},vo=[{value:ie.PENDING,label:`{{t("Pending", { ns: "${p}" })}}`,color:"gold",icon:n.jsx(I.ClockCircleOutlined,{})},{value:ie.RESOLVED,label:`{{t("Resolved", { ns: "${p}" })}}`,color:"green",icon:n.jsx(I.CheckOutlined,{})},{value:ie.FAILED,label:`{{t("Failed", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.ExclamationOutlined,{})},{value:ie.ERROR,label:`{{t("Error", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.CloseOutlined,{})},{value:ie.ABORTED,label:`{{t("Aborted", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.MinusOutlined,{rotate:90})},{value:ie.CANCELED,label:`{{t("Canceled", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.MinusOutlined,{rotate:45})},{value:ie.REJECTED,label:`{{t("Rejected", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.MinusOutlined,{})},{value:ie.RETRY_NEEDED,label:`{{t("Retry needed", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.RedoOutlined,{})}],qe=vo.reduce((e,o)=>Object.assign(e,{[o.value]:o}),{});class ge{constructor(){w(this,"title");w(this,"type");w(this,"group");w(this,"description");w(this,"options");w(this,"fieldset");w(this,"view");w(this,"scope");w(this,"components");w(this,"end")}createDefaultConfig(){return{}}}function nn(){const e=L.useForm(),o=l.useAPIClient(),t=l.useActionContext(),{refresh:r}=l.useResourceActionContext(),s=ve(),{workflow:a}=G();return{run(){return U(this,null,function*(){var c,u;if(a.executed){y.message.error(T("Node in executed workflow cannot be modified"));return}yield e.submit(),yield(u=(c=o.resource("flow_nodes")).update)==null?void 0:u.call(c,{filterByTk:s.id,values:{config:e.values}}),e.setInitialValues(fo.toJS(e.values)),t.setFormValueChanged(!1),t.setVisible(!1),r()})}}}const xo=b.createContext({});function ve(){return b.useContext(xo)}function Me(e=[]){const o=ve();return e.some(t=>ke.get(o.config,t)!=null)}function Jo(e,o){const t=[];if(!e)return[];for(let r=e.upstream;r;r=r.upstream)(typeof o!="function"||o(r))&&t.push(r);return t}function Uo(e){const o=[];if(!e)return[];for(let t=e;t;t=t.upstream)t.upstream&&t.branchIndex!=null&&o.push(t.upstream);return o}function Ho({data:e}){var i;const{styles:o}=ne(),{getAriaLabel:t}=bo(e),r=l.usePlugin(de),{Component:s=ko,end:a}=(i=r.instructions.get(e.type))!=null?i:{};return n.jsx(xo.Provider,{value:e,children:n.jsxs("div",{className:l.cx(o.nodeBlockClass),children:[n.jsx(s,{data:e}),!a||typeof a=="function"&&!a(e)?n.jsx(Wo,{"aria-label":t(),upstream:e}):n.jsx("div",{className:"end-sign",children:n.jsx(I.CloseOutlined,{})})]})})}function wo(){var d;const{t:e}=Q.useTranslation(),o=l.useAPIClient(),{workflow:t,nodes:r,refresh:s}=(d=G())!=null?d:{},a=ve(),{modal:i}=y.App.useApp();if(!t)return null;const c=o.resource("flow_nodes");function u(){return U(this,null,function*(){function f(){return U(this,null,function*(){var m;yield(m=c.destroy)==null?void 0:m.call(c,{filterByTk:a.id}),s()})}const h=r.filter(m=>m===a?!1:J.parse(m.config).parameters.filter(({key:B})=>B.startsWith(`$jobsMapByNodeKey.${a.key}.`)||B===`$jobsMapByNodeKey.${a.key}`).length);if(h.length){i.error({title:T("Can not delete"),content:T("The result of this node has been referenced by other nodes ({{nodes}}), please remove the usage before deleting.",{nodes:h.map(m=>`#${m.id}`).join(", ")})});return}const g=!r.find(m=>m.upstream===a&&m.branchIndex!=null)?e("Are you sure you want to delete it?"):T("This node contains branches, deleting will also be preformed to them, are you sure?");i.confirm({title:e("Delete"),content:g,onOk:f})})}return t.executed?null:n.jsx(y.Button,{type:"text",shape:"circle",icon:n.jsx(I.DeleteOutlined,{}),onClick:u,className:"workflow-node-remove-button"})}function Co(){var a;const{execution:e,setViewJob:o}=G(),{jobs:t}=(a=ve())!=null?a:{},{styles:r}=ne();if(!e)return null;if(!t.length)return n.jsx(Pe,{className:r.nodeJobButtonClass,disabled:!0});function s({key:i}){const c=t.find(u=>u.id==i);o(c)}return t.length>1?n.jsx(y.Dropdown,{menu:{items:t.map(i=>({key:i.id,label:n.jsxs(n.Fragment,{children:[n.jsx(Pe,{statusMap:qe,status:i.status}),n.jsx("time",{children:J.str2moment(i.updatedAt).format("YYYY-MM-DD HH:mm:ss")})]})})),onClick:s,className:r.dropdownClass},children:n.jsx(Pe,{statusMap:qe,status:t[t.length-1].status,className:r.nodeJobButtonClass})}):n.jsx(Pe,{statusMap:qe,status:t[0].status,onClick:()=>o(t[0]),className:r.nodeJobButtonClass})}function rn(){return{form:L.useForm()}}function ko(e){var M;const{data:o,children:t}=e,r=l.useCompile(),s=l.useAPIClient(),{workflow:a,refresh:i}=(M=G())!=null?M:{},{styles:c}=ne(),d=l.usePlugin(de).instructions.get(o.type),f=a.executed?'{{t("View")}}':'{{t("Configure")}}',[h,x]=b.useState(o.title),[g,m]=b.useState(!1),[k,O]=b.useState(!1),B=b.useMemo(()=>{const N=ke.cloneDeep(o.config);return le.createForm({initialValues:N,disabled:a.executed})},[o,a]),S=b.useCallback(N=>{m(N),N||B.reset()},[B]),E=b.useCallback(function(N){return U(this,null,function*(){var D,H;const F=N||r(d==null?void 0:d.title);x(F),F!==o.title&&(yield(H=(D=s.resource("flow_nodes")).update)==null?void 0:H.call(D,{filterByTk:o.id,values:{title:F}}),i())})},[o,d]),W=b.useCallback(function(N){if(N.target===N.currentTarget){m(!0);return}const F=new Set(["workflow-node-meta","workflow-node-config-button","ant-input-disabled"]);for(let D=N.target;D&&D!==N.currentTarget&&D!==document.documentElement;D=D.parentNode)if(Array.from(D.classList).some(H=>F.has(H))){m(!0),N.stopPropagation();return}},[]);if(!d)return n.jsx("div",{className:l.cx(c.nodeClass,`workflow-node-type-${o.type}`),children:n.jsx(y.Tooltip,{title:T("Node with unknown type will cause error. Please delete it or check plugin which provide this type."),children:n.jsxs("div",{role:"button","aria-label":`_untyped-${h}`,className:l.cx(c.nodeCardClass,"invalid"),onClick:W,children:[n.jsxs("div",{className:l.cx(c.nodeMetaClass,"workflow-node-meta"),children:[n.jsx(y.Tag,{color:"error",children:T("Unknown node")}),n.jsx("span",{className:"workflow-node-id",children:o.id})]}),n.jsx(y.Input.TextArea,{value:h,disabled:!0,autoSize:!0}),n.jsx(wo,{}),n.jsx(Co,{})]})})});const $=r(d.title);return n.jsxs("div",{className:l.cx(c.nodeClass,`workflow-node-type-${o.type}`),children:[n.jsxs("div",{role:"button","aria-label":`${$}-${h}`,className:l.cx(c.nodeCardClass,{configuring:g}),onClick:W,children:[n.jsxs("div",{className:l.cx(c.nodeMetaClass,"workflow-node-meta"),children:[n.jsx(y.Tag,{children:$}),n.jsx("span",{className:"workflow-node-id",children:o.id})]}),n.jsx(y.Input.TextArea,{disabled:a.executed,value:h,onChange:N=>x(N.target.value),onBlur:N=>E(N.target.value),autoSize:!0}),n.jsx(wo,{}),n.jsx(Co,{}),n.jsx(l.ActionContextProvider,{value:{visible:g,setVisible:S,formValueChanged:k,setFormValueChanged:O},children:n.jsx(l.FormProvider,{form:B,children:n.jsx(l.SchemaComponent,{distributed:!1,scope:A(C({},d.scope),{useFormProviderProps:rn,useUpdateAction:nn}),components:d.components,schema:{type:"void",properties:A(C({},d.view?{view:d.view}:{}),{button:{type:"void","x-content":f,"x-component":y.Button,"x-component-props":{type:"link",className:"workflow-node-config-button"}},[o.id]:{type:"void",title:n.jsxs("div",{className:l.css`
|
|
412
|
-
display: flex;
|
|
413
|
-
justify-content: space-between;
|
|
414
|
-
|
|
415
|
-
strong {
|
|
416
|
-
font-weight: bold;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
.ant-tag {
|
|
420
|
-
margin-inline-end: 0;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
code {
|
|
424
|
-
font-weight: normal;
|
|
425
|
-
}
|
|
426
|
-
`,children:[n.jsx("strong",{children:o.title}),n.jsx(y.Tooltip,{title:T("Variable key of node"),children:n.jsx(y.Tag,{children:n.jsx("code",{children:o.key})})})]}),"x-decorator":"FormV2","x-use-decorator-props":"useFormProviderProps","x-component":"Action.Drawer",properties:A(C({},d.description?{description:{type:"void","x-component":Lo,"x-component-props":{label:T("Node type"),title:d.title,description:d.description}}}:{}),{fieldset:{type:"void","x-component":"fieldset","x-component-props":{className:l.css`
|
|
427
|
-
.ant-input,
|
|
428
|
-
.ant-select,
|
|
429
|
-
.ant-cascader-picker,
|
|
430
|
-
.ant-picker,
|
|
431
|
-
.ant-input-number,
|
|
432
|
-
.ant-input-affix-wrapper {
|
|
433
|
-
&.auto-width {
|
|
434
|
-
width: auto;
|
|
435
|
-
min-width: 6em;
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
`},properties:d.fieldset},actions:a.executed?null:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useUpdateAction }}"}}}}})}})}})})})]}),t]})}function Ke({from:e=null,entry:o=null,branchIndex:t=null,controller:r=null,className:s,end:a}){const{styles:i}=ne(),{getAriaLabel:c}=bo(e,t),u=[];for(let d=o;d;d=d.downstream)u.push(d);return n.jsxs("div",{className:l.cx("workflow-branch",i.branchClass,s),children:[n.jsx("div",{className:"workflow-branch-lines"}),r,n.jsx(Wo,{"aria-label":c(),upstream:e,branchIndex:t}),n.jsx("div",{className:"workflow-node-list",children:u.map(d=>n.jsx(Ho,{data:d},d.id))}),a?n.jsx("div",{className:"end-sign",children:n.jsx(I.CloseOutlined,{})}):null]})}function sn(){var a;const e=L.useForm(),o=l.useAPIClient(),{workflow:t}=(a=G())!=null?a:{},r=l.useActionContext(),{refresh:s}=l.useResourceActionContext();return{run(){return U(this,null,function*(){if(t.executed){y.message.error(T("Trigger in executed workflow cannot be modified"));return}yield e.submit(),yield o.resource("workflows").update({filterByTk:t.id,values:{config:e.values}}),r.setFormValueChanged(!1),r.setVisible(!1),s()})}}}class So{constructor(){w(this,"sync");w(this,"title");w(this,"description");w(this,"fieldset");w(this,"view");w(this,"scope");w(this,"components");w(this,"initializers");w(this,"isActionTriggerable")}}function ln(){const e=l.useCompile(),{workflow:o,execution:t}=G(),{styles:r}=ne(),s=Ao();return t?n.jsx(l.SchemaComponent,{schema:{type:"void",name:"execution","x-component":"Action","x-component-props":{title:n.jsx(I.InfoOutlined,{}),shape:"circle",size:"small",className:r.nodeJobButtonClass,type:"primary"},properties:{[t.id]:{type:"void","x-decorator":"Form","x-decorator-props":{initialValue:t},"x-component":"Action.Modal",title:n.jsxs("div",{className:l.cx(r.nodeTitleClass),children:[n.jsx(y.Tag,{children:e(s.title)}),n.jsx("strong",{children:o.title}),n.jsxs("span",{className:"workflow-node-id",children:["#",t.id]})]}),properties:{createdAt:{type:"string",title:`{{t("Triggered at", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0},context:{type:"object",title:`{{t("Trigger variables", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Input.JSON","x-component-props":{className:l.css`
|
|
439
|
-
padding: 1em;
|
|
440
|
-
background-color: #eee;
|
|
441
|
-
`},"x-read-pretty":!0}}}}}}):null}function an(){return{form:L.useForm()}}const cn=()=>{const e=l.useAPIClient(),{workflow:o,refresh:t}=G(),[r,s]=b.useState(""),[a,i]=b.useState(!1),[c,u]=b.useState(!1),{styles:d}=ne(),f=l.useCompile(),h=Ao();b.useEffect(()=>{var $,M;o&&s((M=($=o.triggerTitle)!=null?$:o.title)!=null?M:f(h==null?void 0:h.title))},[o,h]);const x=b.useMemo(()=>{const $=ke.cloneDeep(o.config);return le.createForm({initialValues:$,disabled:o.executed})},[o]),g=b.useCallback($=>{i($),$||x.reset()},[x]),m=b.useCallback(function($){return U(this,null,function*(){const M=$||f(h==null?void 0:h.title);s(M),M!==o.triggerTitle&&(yield e.resource("workflows").update({filterByTk:o.id,values:{triggerTitle:M}}),t())})},[o,h]),k=b.useCallback(function($){var N;if($.target===$.currentTarget){i(!0);return}const M=new Set(["workflow-node-meta","workflow-node-config-button","ant-input-disabled"]);for(let F=$.target;F&&F!==$.currentTarget;F=F.parentNode)if(Array.from((N=F.classList)!=null?N:[]).some(D=>M.has(D))){i(!0),$.stopPropagation();return}},[]),O=o.executed?'{{t("View")}}':'{{t("Configure")}}',B=T("Trigger");if(!h)return n.jsx(y.Tooltip,{title:T("Workflow with unknown type will cause error. Please delete it or check plugin which provide this type."),children:n.jsxs("div",{role:"button","aria-label":`${B}-${r}`,className:l.cx(d.nodeCardClass,"invalid"),onClick:k,children:[n.jsx("div",{className:l.cx(d.nodeMetaClass,"workflow-node-meta"),children:n.jsx(y.Tag,{color:"error",children:T("Unknown trigger")})}),n.jsx("div",{className:"workflow-node-title",children:n.jsx(y.Input.TextArea,{value:r,disabled:!0,autoSize:!0})})]})});const{fieldset:S,scope:E,components:W}=h;return n.jsxs("div",{role:"button","aria-label":`${B}-${r}`,className:l.cx(d.nodeCardClass),onClick:k,children:[n.jsx("div",{className:l.cx(d.nodeMetaClass,"workflow-node-meta"),children:n.jsxs(y.Tag,{color:"gold",children:[n.jsx(I.ThunderboltOutlined,{}),n.jsx("span",{className:"type",children:f(h.title)})]})}),n.jsx("div",{className:"workflow-node-title",children:n.jsx(y.Input.TextArea,{value:r,onChange:$=>s($.target.value),onBlur:$=>m($.target.value),autoSize:!0,disabled:o.executed})}),n.jsx(ln,{}),n.jsx(l.ActionContextProvider,{value:{visible:a,setVisible:g,formValueChanged:c,setFormValueChanged:u},children:n.jsx(l.FormProvider,{form:x,children:n.jsx(l.SchemaComponent,{scope:A(C({},E),{useFormProviderProps:an}),components:W,schema:{name:`workflow-trigger-${o.id}`,type:"void",properties:{config:{type:"void","x-content":O,"x-component":y.Button,"x-component-props":{type:"link",className:"workflow-node-config-button"}},drawer:{type:"void",title:B,"x-component":"Action.Drawer","x-decorator":"FormV2","x-use-decorator-props":"useFormProviderProps",properties:A(C({},h.description?{description:{type:"void","x-component":Lo,"x-component-props":{label:T("Trigger type"),title:h.title,description:h.description}}}:{}),{fieldset:{type:"void","x-component":"fieldset","x-component-props":{className:l.css`
|
|
442
|
-
.ant-select.auto-width {
|
|
443
|
-
width: auto;
|
|
444
|
-
min-width: 6em;
|
|
445
|
-
}
|
|
446
|
-
`},properties:S},actions:C({},o.executed?{}:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:sn}}}})})}}}})})})]})};function Ao(){const e=l.usePlugin(de),{workflow:o}=G();return e.triggers.get(o.type)}function Go({entry:e}){const{styles:o}=ne(),{workflow:t}=G(),[r,s]=b.useState(100);return n.jsxs("div",{className:"workflow-canvas-wrapper",children:[n.jsx(Zt,{FallbackComponent:l.ErrorFallback,onError:console.error,children:n.jsx("div",{className:"workflow-canvas",style:{zoom:r/100},children:n.jsx("div",{className:l.cx(o.branchBlockClass,l.css`
|
|
447
|
-
margin-top: 0 !important;
|
|
448
|
-
`),children:n.jsxs("div",{className:o.branchClass,children:[t!=null&&t.executed?n.jsx(y.Alert,{type:"warning",message:T("Executed workflow cannot be modified. Could be copied to a new version to modify."),showIcon:!0,className:l.css`
|
|
449
|
-
margin-bottom: 1em;
|
|
450
|
-
`}):null,n.jsx(cn,{}),n.jsx("div",{className:l.cx(o.branchBlockClass,l.css`
|
|
451
|
-
margin-top: 0 !important;
|
|
452
|
-
`),children:n.jsx(Ke,{entry:e})}),n.jsx("div",{className:o.terminalClass,children:T("End")})]})})})}),n.jsx("div",{className:"workflow-canvas-zoomer",children:n.jsx(y.Slider,{vertical:!0,reverse:!0,defaultValue:100,step:10,min:10,value:r,onChange:s})})]})}function Fo(e){const o=new Map;e.forEach(t=>o.set(t.id,t));for(const t of o.values())t.upstreamId&&(t.upstream=o.get(t.upstreamId)),t.downstreamId&&(t.downstream=o.get(t.downstreamId))}function Oo(e,o){o(e),e.properties&&Object.keys(e.properties).forEach(t=>{Oo(e.properties[t],o)})}function xe(e){return`/admin/workflow/workflows/${e}`}function Ye(e){return`/admin/workflow/executions/${e}`}function dn(e,o=[]){const t=new Map;e.forEach(r=>{r.jobs=[],t.set(r.id,r)}),o.forEach(r=>{const s=t.get(r.nodeId);s.jobs.push(r),r.node={id:s.id,key:s.key,title:s.title,type:s.type}}),e.forEach(r=>{r.jobs=r.jobs.sort((s,a)=>s.id-a.id)})}function un(){const{instructions:e}=l.usePlugin(de),o=l.useCompile(),{viewJob:t,setViewJob:r}=G(),{styles:s}=ne(),{node:a={}}=t!=null?t:{},i=e.get(a.type);return n.jsx(l.ActionContextProvider,{value:{visible:!!t,setVisible:r},children:n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[`${t==null?void 0:t.id}-${t==null?void 0:t.updatedAt}-modal`]:{type:"void","x-decorator":"Form","x-decorator-props":{initialValue:t},"x-component":"Action.Modal",title:n.jsxs("div",{className:s.nodeTitleClass,children:[n.jsx(y.Tag,{children:o(i==null?void 0:i.title)}),n.jsx("strong",{children:a.title}),n.jsxs("span",{className:"workflow-node-id",children:["#",a.id]})]}),properties:{status:{type:"number",title:`{{t("Status", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Select",enum:vo,"x-read-pretty":!0},updatedAt:{type:"string",title:`{{t("Executed at", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0},result:{type:"object",title:`{{t("Node result", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Input.JSON","x-component-props":{className:s.nodeJobResultClass},"x-read-pretty":!0}}}}}})})}function pn(e){const{execution:o}=G(),t=l.useAPIClient(),r=te.useNavigate(),{styles:s}=ne(),[a,i]=b.useState([]),[c,u]=b.useState([]);b.useEffect(()=>{o&&t.resource("executions").list({filter:{key:o.key,id:{$lt:o.id}},sort:"-createdAt",pageSize:10,fields:["id","status","createdAt"]}).then(({data:f})=>{i(f.data)}).catch(()=>{})},[o]),b.useEffect(()=>{o&&t.resource("executions").list({filter:{key:o.key,id:{$gt:o.id}},sort:"createdAt",pageSize:10,fields:["id","status","createdAt"]}).then(({data:f})=>{u(f.data.reverse())}).catch(()=>{})},[o]);const d=b.useCallback(({key:f})=>{f!=o.id&&r(Ye(f))},[o]);return o?n.jsx(y.Dropdown,{menu:{onClick:d,defaultSelectedKeys:[`${o.id}`],className:l.cx(s.dropdownClass,s.executionsDropdownRowClass),items:[...c,o,...a].map(f=>({key:f.id,label:n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"id",children:`#${f.id}`}),n.jsx("time",{children:J.str2moment(f.createdAt).format("YYYY-MM-DD HH:mm:ss")})]}),icon:n.jsx("span",{children:n.jsx(Pe,{statusMap:Ge,status:f.status})})}))},children:n.jsxs(y.Space,{children:[n.jsx("strong",{children:`#${o.id}`}),n.jsx(I.DownOutlined,{})]})}):null}function mn(){var S;const{t:e}=Q.useTranslation(),o=l.useCompile(),{data:t,loading:r,refresh:s}=l.useResourceActionContext(),{setTitle:a}=l.useDocumentTitle(),[i,c]=b.useState(null),u=l.useApp(),d=l.useAPIClient();b.useEffect(()=>{var N;const{workflow:M}=(N=t==null?void 0:t.data)!=null?N:{};a==null||a(`${M!=null&&M.title?`${M.title} - `:""}${T("Execution history")}`)},[t==null?void 0:t.data]);const f=b.useCallback(()=>{y.Modal.confirm({title:T("Cancel the execution"),icon:n.jsx(I.ExclamationCircleFilled,{}),content:T("Are you sure you want to cancel the execution?"),onOk:()=>{d.resource("executions").cancel({filterByTk:t==null?void 0:t.data.id}).then(()=>{y.message.success(e("Operation succeeded")),s()}).catch(M=>{console.error(M.data.error)})}})},[t==null?void 0:t.data]);if(!(t!=null&&t.data))return r?n.jsx(y.Spin,{}):n.jsx(y.Result,{status:"404",title:"Not found"});const E=(S=t==null?void 0:t.data)!=null?S:{},{jobs:h=[],workflow:W={}}=E,$=W,{nodes:x=[],revisions:g=[]}=$,m=Z($,["nodes","revisions"]),k=Z(E,["jobs","workflow"]);Fo(x),dn(x,h);const O=x.find(M=>!M.upstream),B=Ge[k.status];return n.jsxs(Ie.Provider,{value:{workflow:m.type?m:null,nodes:x,execution:k,viewJob:i,setViewJob:c},children:[n.jsxs("div",{className:"workflow-toolbar",children:[n.jsx("header",{children:n.jsx(y.Breadcrumb,{items:[{title:n.jsx(te.Link,{to:u.pluginSettingsManager.getRoutePath("workflow"),children:T("Workflow")})},{title:n.jsx(y.Tooltip,{title:`Key: ${m.key}`,children:n.jsx(te.Link,{to:xe(m.id),children:m.title})})},{title:n.jsx(pn,{})}]})}),n.jsxs("aside",{children:[n.jsx(y.Tag,{color:B.color,children:o(B.label)}),k.status?null:n.jsx(y.Tooltip,{title:T("Cancel the execution"),children:n.jsx(y.Button,{type:"link",danger:!0,onClick:f,shape:"circle",size:"small",icon:n.jsx(I.StopOutlined,{})})}),n.jsx("time",{children:J.str2moment(k.updatedAt).format("YYYY-MM-DD HH:mm:ss")})]})]}),n.jsx(Go,{entry:O}),n.jsx(un,{})]})}const qo=()=>{const e=te.useParams(),{styles:o}=ne();return n.jsx("div",{className:l.cx(o.workflowPageClass),children:n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[`execution_${e.id}`]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"executions",fields:[]},resourceName:"executions",request:{resource:"executions",action:"get",params:{filter:e,appends:["jobs","workflow","workflow.nodes"]}}},"x-component":"ExecutionCanvas"}}},components:{ExecutionCanvas:mn}})})},Ko=()=>{const{t:e}=Q.useTranslation(),{id:o}=l.useRecord(),{setVisible:t}=l.useActionContext();return n.jsx(te.Link,{to:Ye(o),onClick:()=>t(!1),children:e("View")})},fn={name:"execution-executions",fields:[{interface:"id",type:"bigInt",name:"id",uiSchema:{type:"number",title:'{{t("ID")}}',"x-component":"Input","x-component-props":{},"x-read-pretty":!0}},{interface:"createdAt",type:"datetime",name:"createdAt",uiSchema:{type:"datetime",title:`{{t("Triggered at", { ns: "${p}" })}}`,"x-component":"DatePicker","x-component-props":{},"x-read-pretty":!0}},{interface:"m2o",type:"belongsTo",name:"workflowId",uiSchema:{type:"number",title:`{{t("Version", { ns: "${p}" })}}`,"x-component"({value:e}){const{setVisible:o}=l.useActionContext();return n.jsx(te.Link,{to:xe(e),onClick:()=>o(!1),children:`#${e}`})}}},{type:"number",name:"status",interface:"select",uiSchema:{title:`{{t("Status", { ns: "${p}" })}}`,type:"string","x-component":"Select","x-decorator":"FormItem",enum:He}}]},Yo={type:"void",name:"executionHistoryDrawer",title:`{{t("Execution history", { ns: "${p}" })}}`,"x-component":"Action.Drawer",properties:{content:{type:"void","x-decorator":"ExecutionResourceProvider","x-decorator-props":{collection:fn,resourceName:"executions",request:{resource:"executions",action:"list",params:{appends:["workflow.id","workflow.title"],pageSize:20,sort:["-createdAt"],filter:{}}}},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{refresher:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},clear:{type:"void",title:'{{t("Clear")}}',"x-component":"Action","x-component-props":{useAction(){const{t:e}=Q.useTranslation(),{refresh:o,defaultRequest:t}=l.useResourceActionContext(),{resource:r}=l.useResourceContext(),{setVisible:s}=l.useActionContext();return{run(){return U(this,null,function*(){var i;yield r.destroy({filter:(i=t.params)==null?void 0:i.filter}),y.message.success(e("Operation succeeded")),o(),s(!1)})}}},confirm:{title:`{{t("Clear all executions", { ns: "${p}" })}}`,content:`{{t("Clear executions will not reset executed count, and started executions will not be deleted, are you sure you want to delete them all?", { ns: "${p}" })}}`}}}}},table:{type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{id:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{id:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},createdAt:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{createdAt:{type:"datetime","x-component":"CollectionField","x-component-props":{showTime:!0},"x-read-pretty":!0}}},workflowId:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{workflowId:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},status:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:`{{t("Status", { ns: "${p}" })}}`,properties:{status:{type:"number","x-decorator":"ExecutionStatusColumn","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{link:{type:"void","x-component":"ExecutionLink"}}}}}}}}}}};function _o(e){var a;const t=l.useCompile()(e.label),r=b.useCallback(i=>{i.preventDefault(),i.stopPropagation()},[]),{color:s}=(a=Ge[e.value])!=null?a:{};return n.jsx(y.Tag,{color:s,onMouseDown:r,closable:e.closable,onClose:e.onClose,children:t})}function hn(e){const o=l.useCompile();return n.jsxs(n.Fragment,{children:[n.jsx(_o,C({},e)),e.description?n.jsx("span",{children:o(e.description)}):null]})}function yn(o){var e=Z(o,[]);const t=e.multiple?"multiple":null;return n.jsx(y.Select,A(C({role:"button","data-testid":`select-${t||"single"}`},e),{mode:t,optionLabelProp:"label",tagRender:_o,children:He.filter(r=>!!r.value&&r.value!==pe.ABORTED).map(r=>n.jsx(y.Select.Option,A(C({},r),{children:n.jsx(hn,C({},r))}),r.value))}))}function Zo(e){const{t:o}=Q.useTranslation(),{refresh:t}=l.useResourceActionContext(),{resource:r}=l.useResourceContext(),s=l.useRecord(),a=b.useCallback(()=>{y.Modal.confirm({title:T("Cancel the execution"),icon:n.jsx(I.ExclamationCircleFilled,{}),content:T("Are you sure you want to cancel the execution?"),onOk:()=>{r.cancel({filterByTk:s.id}).then(()=>{y.message.success(o("Operation succeeded")),t()}).catch(i=>{console.error(i.data.error)})}})},[s]);return n.jsxs("div",{className:l.css`
|
|
453
|
-
display: flex;
|
|
454
|
-
`,children:[e.children,s.status?null:n.jsx(y.Tooltip,{title:T("Cancel the execution"),children:n.jsx(y.Button,{type:"link",danger:!0,onClick:a,shape:"circle",size:"small",icon:n.jsx(I.StopOutlined,{})})})]})}function Qo(){const e=l.useResourceActionContext();return{onClick(){return U(this,null,function*(){var t;(t=e==null?void 0:e.refresh)==null||t.call(e)})}}}function gn(r){var s=r,{request:e,filter:o={}}=s,t=Z(s,["request","filter"]);var c;const{workflow:a}=G(),i=A(C({},t),{request:A(C({},e),{params:A(C({},e==null?void 0:e.params),{filter:A(C({},(c=e==null?void 0:e.params)==null?void 0:c.filter),{key:a.key})})})});return n.jsx(l.ResourceActionProvider,C({},i))}function bn(){var M;const e=te.useNavigate(),{t:o}=Q.useTranslation(),t=l.useApp(),{data:r,refresh:s,loading:a}=l.useResourceActionContext(),{resource:i}=l.useResourceContext(),{setTitle:c}=l.useDocumentTitle(),[u,d]=b.useState(!1),{styles:f}=ne(),{modal:h}=y.App.useApp();if(b.useEffect(()=>{var D;const{title:F}=(D=r==null?void 0:r.data)!=null?D:{};c==null||c(`${T("Workflow")}${F?`: ${F}`:""}`)},[r==null?void 0:r.data]),!(r!=null&&r.data))return a?n.jsx(y.Spin,{}):n.jsx(y.Result,{status:"404",title:"Not found",extra:n.jsx(y.Button,{onClick:()=>e(-1),children:T("Go back")})});const N=(M=r==null?void 0:r.data)!=null?M:{},{nodes:x=[],revisions:g=[]}=N,m=Z(N,["nodes","revisions"]);Fo(x);const k=x.find(F=>!F.upstream);function O({key:F}){F!=m.id&&e(xe(F))}function B(F){return U(this,null,function*(){yield i.update({filterByTk:m.id,values:{enabled:F}}),s()})}function S(){return U(this,null,function*(){const{data:{data:F}}=yield i.revision({filterByTk:m.id,filter:{key:m.key}});y.message.success(o("Operation succeeded")),e(`/admin/workflow/workflows/${F.id}`)})}function E(){return U(this,null,function*(){const F=m.current?T("Delete a main version will cause all other revisions to be deleted too."):"";h.confirm({title:o("Are you sure you want to delete it?"),content:F,onOk(){return U(this,null,function*(){var H;yield i.destroy({filterByTk:m.id}),y.message.success(o("Operation succeeded")),e(m.current?t.pluginSettingsManager.getRoutePath("workflow"):xe((H=g.find(K=>K.current))==null?void 0:H.id))})}})})}function W(D){return U(this,arguments,function*({key:F}){switch(F){case"history":d(!0);return;case"revision":return S();case"delete":return E()}})}const $=m.executed&&!g.find(F=>!F.executed&&new Date(F.createdAt)>new Date(m.createdAt));return n.jsxs(Ie.Provider,{value:{workflow:m,nodes:x,refresh:s},children:[n.jsxs("div",{className:"workflow-toolbar",children:[n.jsx("header",{children:n.jsx(y.Breadcrumb,{items:[{title:n.jsx(te.Link,{to:t.pluginSettingsManager.getRoutePath("workflow"),children:T("Workflow")})},{title:n.jsx(y.Tooltip,{title:`Key: ${m.key}`,children:n.jsx("strong",{children:m.title})})}]})}),n.jsxs("aside",{children:[m.sync?n.jsx(y.Tag,{color:"orange",children:T("Synchronously")}):n.jsx(y.Tag,{color:"cyan",children:T("Asynchronously")}),n.jsx(y.Dropdown,{className:"workflow-versions",trigger:["click"],menu:{onClick:O,defaultSelectedKeys:[`${m.id}`],className:l.cx(f.dropdownClass,f.workflowVersionDropdownClass),items:g.sort((F,D)=>D.id-F.id).map((F,D)=>({role:"button","aria-label":`version-${D}`,key:`${F.id}`,icon:F.current?n.jsx(I.RightOutlined,{}):null,className:l.cx({executed:F.executed,unexecuted:!F.executed,enabled:F.enabled}),label:n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:`#${F.id}`}),n.jsx("time",{children:J.str2moment(F.createdAt).format("YYYY-MM-DD HH:mm:ss")})]})}))},children:n.jsxs(y.Button,{type:"text","aria-label":"version",children:[n.jsx("label",{children:T("Version")}),n.jsx("span",{children:m!=null&&m.id?`#${m.id}`:null}),n.jsx(I.DownOutlined,{})]})}),n.jsx(y.Switch,{checked:m.enabled,onChange:B,checkedChildren:T("On"),unCheckedChildren:T("Off")}),n.jsx(y.Dropdown,{menu:{items:[{key:"key",label:`Key: ${m.key}`,disabled:!0},{type:"divider"},{role:"button","aria-label":"history",key:"history",label:T("Execution history"),disabled:!m.allExecuted},{role:"button","aria-label":"revision",key:"revision",label:T("Copy to new version"),disabled:!$},{type:"divider"},{role:"button","aria-label":"delete",danger:!0,key:"delete",label:o("Delete")}],onClick:W},children:n.jsx(y.Button,{"aria-label":"more",type:"text",icon:n.jsx(I.EllipsisOutlined,{})})}),n.jsx(l.ActionContextProvider,{value:{visible:u,setVisible:d},children:n.jsx(l.SchemaComponent,{schema:Yo,components:{ExecutionResourceProvider:gn,ExecutionLink:Ko,ExecutionStatusColumn:Zo},scope:{useRefreshActionProps:Qo}})})]})]}),n.jsx(Go,{entry:k})]})}const Xo=()=>{const e=te.useParams(),{styles:o}=ne();return n.jsx("div",{className:l.cx(o.workflowPageClass),children:n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[`provider_${e.id}`]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"workflows",fields:[]},resourceName:"workflows",request:{resource:"workflows",action:"get",params:{filter:{id:e.id},appends:["nodes","revisions.id","revisions.createdAt","revisions.current","revisions.executed","revisions.enabled"]}}},"x-component":"WorkflowCanvas"}}},components:{WorkflowCanvas:bn}})})},vn=r=>{var s=r,{request:e,filter:o={}}=s,t=Z(s,["request","filter"]);var c;const a=l.useRecord(),i=A(C({},t),{request:A(C({},e),{params:A(C({},e==null?void 0:e.params),{filter:A(C({},(c=e==null?void 0:e.params)==null?void 0:c.filter),{key:a.key})})})});return n.jsx(l.ResourceActionProvider,C({},i))},xn=()=>{const{t:e}=Q.useTranslation(),{id:o}=l.useRecord(),{setVisible:t}=l.useActionContext(),{getAriaLabel:r}=l.useGetAriaLabelOfAction("Configure");return n.jsx(te.Link,{"aria-label":r(),to:xe(o),onClick:()=>t(!1),children:e("Configure")})};function wn(r){var s=r,{component:e="div",children:o}=s,t=Z(s,["component","children"]);const[a,i]=b.useState(!1),c=L.useFieldSchema();return n.jsxs(l.ActionContextProvider,{value:{visible:a,setVisible:i,fieldSchema:c},children:[b.createElement(e,A(C({},t),{onClick(){i(!0)}}),o),n.jsx(l.SchemaComponent,{schema:c,onlyRenderProperties:!0})]})}function Cn({data:e}){const{label:o,color:t,options:r}=e,s=l.useCompile();return n.jsxs(y.Space,{direction:"vertical",children:[n.jsx(y.Tag,{color:t,children:s(o)}),n.jsx(y.Typography.Text,{type:"secondary",style:{whiteSpace:"normal"},children:s(r.description)})]})}const Ro={name:"workflows",fields:[{type:"string",name:"title",interface:"input",uiSchema:{title:'{{t("Name")}}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"type",interface:"select",uiSchema:{title:`{{t("Trigger type", { ns: "${p}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Select","x-component-props":{options:"{{getTriggersOptions()}}",optionRender:Cn,popupMatchSelectWidth:!0,listHeight:300},required:!0}},{type:"boolean",name:"sync",interface:"select",uiSchema:{title:`{{t("Mode", { ns: "${p}" })}}`,type:"boolean","x-decorator":"FormItem","x-component":"Select",enum:[{label:`{{ t("Asynchronously", { ns: "${p}" }) }}`,value:!1,color:"cyan"},{label:`{{ t("Synchronously", { ns: "${p}" }) }}`,value:!0,color:"orange"}],required:!0}},{type:"string",name:"description",interface:"textarea",uiSchema:{title:'{{t("Description")}}',type:"string","x-component":"Input.TextArea"}},{type:"boolean",name:"enabled",interface:"radioGroup",uiSchema:{title:`{{t("Status", { ns: "${p}" })}}`,type:"string",enum:[{label:`{{t("On", { ns: "${p}" })}}`,value:!0,color:"#52c41a"},{label:`{{t("Off", { ns: "${p}" })}}`,value:!1}],"x-component":"Radio.Group","x-decorator":"FormItem",default:!1}},{type:"number",name:"allExecuted",interface:"integer",uiSchema:{title:`{{t("Executed", { ns: "${p}" })}}`,type:"number","x-component":"InputNumber","x-decorator":"FormItem"}},{type:"object",name:"options"}]},fe={title:{"x-component":"CollectionField","x-decorator":"FormItem"},type:{"x-component":"CollectionField","x-decorator":"FormItem"},sync:{type:"boolean",title:`{{ t("Execute mode", { ns: "${p}" }) }}`,description:`{{ t("Execute workflow asynchronously or synchronously based on trigger type, and could not be changed after created.", { ns: "${p}" }) }}`,"x-decorator":"FormItem","x-component":"SyncOptionSelect","x-component-props":{options:[{label:`{{ t("Asynchronously", { ns: "${p}" }) }}`,value:!1,tooltip:`{{ t("Will be executed in the background as a queued task.", { ns: "${p}" }) }}`},{label:`{{ t("Synchronously", { ns: "${p}" }) }}`,value:!0,tooltip:`{{ t("For user actions that require immediate feedback. Can not use asynchronous nodes in such mode, and it is not recommended to perform time-consuming operations under synchronous mode.", { ns: "${p}" }) }}`}]}},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"fieldset",properties:{deleteExecutionOnStatus:{type:"array",title:`{{ t("Auto delete history when execution is on end status", { ns: "${p}" }) }}`,"x-decorator":"FormItem","x-component":"ExecutionStatusSelect","x-component-props":{multiple:!0}}}}},kn={type:"void",properties:{provider:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:Ro,resourceName:"workflows",request:{resource:"workflows",action:"list",params:{filter:{current:!0},sort:["-createdAt"],except:["config"]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:Ro},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"cm.useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},refresher:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},sync:{type:"void",title:`{{t("Sync", { ns: "${p}" })}}`,"x-decorator":"Tooltip","x-decorator-props":{title:`{{ t("Sync enabled status of all workflows from database", { ns: "${p}" }) }}`},"x-component":"Action","x-component-props":{icon:"SyncOutlined",useAction(){const{t:e}=Q.useTranslation(),{resource:o}=l.useResourceContext(),t=l.useResourceActionContext();return{run(){return U(this,null,function*(){yield o.sync(),yield t==null?void 0:t.refresh(),y.message.success(e("Operation succeeded"))})}}}},"x-reactions":["{{useWorkflowSyncAction}}"]},delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"Action","x-component-props":{type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{current:!0}},title:'{{t("Add new")}}',properties:{title:fe.title,type:fe.type,sync:fe.sync,description:fe.description,options:fe.options,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}"}}}}}}}}}},table:{type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{title:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},type:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},sync:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{sync:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{enabled:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0,default:!1}}},allExecuted:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{allExecuted:{type:"number","x-decorator":"OpenDrawer","x-decorator-props":{component:function(o){const t=l.useRecord();return b.createElement("a",C({"aria-label":`executed-${t.title}`},o))}},"x-component":"CollectionField","x-read-pretty":!0,properties:{drawer:Yo}}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{configure:{type:"void","x-component":"WorkflowLink"},update:{type:"void",title:'{{ t("Edit") }}',"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ cm.useValuesFromRecord }}"},title:'{{ t("Edit") }}',properties:{title:fe.title,enabled:fe.enabled,sync:fe.sync,description:fe.description,options:fe.options,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}}}}},revision:{type:"void",title:`{{t("Duplicate", { ns: "${p}" })}}`,"x-component":"Action.Link","x-component-props":{openSize:"small"},properties:{modal:{type:"void",title:`{{t("Duplicate to new workflow", { ns: "${p}" })}}`,"x-decorator":"FormV2","x-component":"Action.Modal",properties:{title:{type:"string",title:'{{t("Title")}}',"x-decorator":"FormItem","x-component":"Input"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction(){const{t:e}=Q.useTranslation(),{refresh:o}=l.useResourceActionContext(),{resource:t,targetKey:r}=l.useResourceContext(),{setVisible:s}=l.useActionContext(),{[r]:a}=l.useRecord(),{values:i}=L.useForm();return{run(){return U(this,null,function*(){yield t.revision({filterByTk:a,values:i}),y.message.success(e("Operation succeeded")),o(),s(!1)})}}}}},cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{ cm.useDestroyActionAndRefreshCM }}"}}}}}}}}}}}};function Sn(e){const o=L.useField(),t=l.useRecord(),r=l.usePlugin(de);return L.useFormEffects(s=>{le.onFieldChange("type",a=>{let i=t.id||!a.value;if(a.value){const c=r.triggers.get(a.value);c.sync!=null?(i=!0,o.setValue(c.sync)):o.setInitialValue(!1)}o.setPattern(i?"disabled":"editable")})}),b.useEffect(()=>{if(t.id){o.setPattern("disabled");const s=r.triggers.get(t.type);s.sync!=null?o.setValue(s.sync):o.setInitialValue(!1)}},[t.id,o,r.triggers]),n.jsx(Te,C({},e))}function An(e){const o=l.useApp();e.visible=!!(l.usePlugin("multi-app-share-collection")||o.name!=="main")}function Fn(){const e=b.useContext(l.SchemaComponentContext),{getTriggersOptions:o}=l.usePlugin(de);return n.jsx(y.Card,{bordered:!1,children:n.jsx(l.SchemaComponentContext.Provider,{value:A(C({},e),{designable:!1}),children:n.jsx(l.SchemaComponent,{schema:kn,components:{WorkflowLink:xn,ExecutionResourceProvider:vn,ExecutionLink:Ko,OpenDrawer:wn,ExecutionStatusSelect:yn,SyncOptionSelect:Sn,ExecutionStatusColumn:Zo,Tooltip:y.Tooltip},scope:{getTriggersOptions:o,useWorkflowSyncAction:An,useRefreshActionProps:Qo}})})})}function On(r){var s=r,{collection:e,dataPath:o}=s,t=Z(s,["collection","dataPath"]);const{insert:a}=l.useSchemaInitializer(),{getTemplateSchemaByMode:i}=l.useSchemaTemplateManager(),{getCollection:c}=l.useCollectionManager_deprecated(),u=l.useRecordCollectionDataSourceItems("FormItem");let d;if(typeof e=="string"){const[h,x]=l.parseCollectionName(e);d=c(x,h)}else d=e;function f(x){return U(this,arguments,function*({item:h}){const g=h.template?yield i(h):null,m={type:"void",name:ho.uid(),title:d.title,"x-decorator":"DetailsBlockProvider","x-decorator-props":{collection:e,dataPath:o},"x-component":"CardItem","x-component-props":{title:t.title},"x-designer":"SimpleDesigner",properties:{grid:{type:"void","x-component":"FormV2","x-use-component-props":"useDetailsBlockProps","x-read-pretty":!0,properties:{grid:g||{type:"void","x-component":"Grid","x-initializer":"details:configureFields",properties:{}}}}}};Oo(m,k=>{k["x-uid"]&&delete k["x-uid"]}),a(m)})}return n.jsx(l.SchemaInitializerItem,A(C({},t),{onClick:f,items:u}))}function Be(e){var a;const o=l.useSchemaInitializerItem(),t=(a=e==null?void 0:e.collection)!=null?a:o.collection;let r,s;if(typeof t=="string"){const i=l.parseCollectionName(t);r=i[0],s=i[1]}else s=t;return n.jsx(l.CollectionProvider_deprecated,{dataSource:r,collection:s,children:n.jsx(On,C(C({},o),e))})}function Tn(){return!0}const To=L.observer(e=>{const d=e,{filter:o=Tn}=d,t=Z(d,["filter"]),r=l.useCompile(),{getCollectionFields:s}=l.useCollectionManager_deprecated(),{values:a}=L.useForm(),[i,c]=l.parseCollectionName(a==null?void 0:a.collection),u=s(c,i);return n.jsx(y.Select,A(C({popupMatchSelectWidth:!1},t),{options:u.filter(o).map(f=>{var h;return{label:r((h=f.uiSchema)==null?void 0:h.title),value:f.name}})}))},{displayName:"FieldsSelect"}),ae={type:"string",title:'{{t("Collection")}}',required:!0,"x-reactions":[],"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader"},et={type:"object",title:'{{t("Fields values")}}',description:`{{t("Unassigned fields will be set to default values, and those without default values will be set to null.", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-decorator-props":{labelAlign:"left",className:l.css`
|
|
455
|
-
flex-direction: column;
|
|
456
|
-
`},"x-component":"CollectionFieldset"},_e={type:"object",title:'{{t("Filter")}}',"x-decorator":"FormItem","x-component":"Filter","x-use-component-props":()=>{const{values:e}=L.useForm(),[o,t]=l.parseCollectionName(e==null?void 0:e.collection);return{options:l.useCollectionFilterOptions(t,o),className:l.css`
|
|
457
|
-
position: relative;
|
|
458
|
-
width: 100%;
|
|
459
|
-
`}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"}},Nn={type:"array",title:'{{t("Sort")}}',"x-decorator":"FormItem","x-component":"ArrayItems",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:"{{useSortableFields()}}",required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260}}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:'{{t("ASC")}}',value:"asc"},{label:'{{t("DESC")}}',value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{t("Add sort field")}}',"x-component":"ArrayItems.Addition"}}},En={type:"void",title:'{{t("Pagination")}}',"x-decorator":"SchemaComponentContext.Provider","x-decorator-props":{value:{designable:!1}},"x-component":"Grid",properties:{row:{type:"void","x-component":"Grid.Row",properties:{page:{type:"void","x-component":"Grid.Col",properties:{page:{type:"number",title:'{{t("Page number")}}',"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:["number","null"]},default:1}}},pageSize:{type:"void","x-component":"Grid.Col",properties:{pageSize:{type:"number",title:'{{t("Page size")}}',"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{min:1,max:100},default:20}}}}}}},Ve={type:"array",title:`{{t("Preload associations", { ns: "${p}" })}}`,description:`{{t("Please select the associated fields that need to be accessed in subsequent nodes. With more than two levels of to-many associations may cause performance issue, please use with caution.", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"AppendsTreeSelect","x-component-props":{title:"Preload associations",multiple:!0,useCollection(){const{values:e}=L.useForm();return e==null?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},Se={label:"label",value:"value",children:"children"},ot={label:`{{t("Node result", { ns: "${p}" })}}`,value:"$jobsMapByNodeKey",useOptions(e){const{instructions:o}=l.usePlugin(de),t=ve(),r=Jo(t),s=[];return r.forEach(a=>{var u;const i=o.get(a.type),c=(u=i.useVariables)==null?void 0:u.call(i,a,e);c&&s.push(c)}),s}},tt={label:`{{t("Trigger variables", { ns: "${p}" })}}`,value:"$context",useOptions(e){var s,a;const{triggers:o}=l.usePlugin(de),{workflow:t}=G(),r=o.get(t.type);return(a=(s=r==null?void 0:r.useVariables)==null?void 0:s.call(r,t.config,e))!=null?a:null}},nt={label:`{{t("Scope variables", { ns: "${p}" })}}`,value:"$scopes",useOptions(e){const{fieldNames:o=Se,current:t}=e,{instructions:r}=l.usePlugin(de),s=ve(),a=t!=null?t:s,i=Uo(a),c=[];return i.forEach(u=>{var h,x;const d=r.get(u.type),f=(h=d.useScopeVariables)==null?void 0:h.call(d,u,e);f&&c.push({key:u.key,[o.value]:u.key,[o.label]:(x=u.title)!=null?x:`#${u.id}`,[o.children]:f})}),c}},rt={label:`{{t("System variables", { ns: "${p}" })}}`,value:"$system",useOptions({types:e,fieldNames:o=Se}){return[...!e||e.includes("date")?[{key:"now",[o.label]:T("System time"),[o.value]:"now"}]:[]]}},Ze={boolean:new Set(["checkbox"]),number:new Set(["integer","number","percent"]),string:new Set(["input","password","email","phone","select","radioGroup","text","markdown","richText","expression","time"]),date:new Set(["date","createdAt","updatedAt"])};function st(e,o){var t,r,s,a,i,c;return typeof o=="string"?(t=Ze[o])==null?void 0:t.has(e.interface):typeof o=="object"&&o.type==="reference"?No(e)?((r=o.options)==null?void 0:r.entity)&&(e.collectionName===((s=o.options)==null?void 0:s.collection)||((a=o.options)==null?void 0:a.collection)==="*"):e.isForeignKey?e.collectionName===((i=o.options)==null?void 0:i.collection)&&e.name==="id"||e.target===((c=o.options)==null?void 0:c.collection):!1:typeof o=="function"?o(e):!1}function No(e){return["belongsTo","hasOne","hasMany","belongsToMany"].includes(e.type)}function Eo(e,o){if(o==null)return null;const t=`${e.name}.`;return o.filter(r=>r.startsWith(t)).map(r=>r.replace(t,""))}function $o({fields:e,types:o,appends:t,depth:r=1,compile:s,getCollectionFields:a}){return e.filter(i=>{const c=o!=null&&o.length?o.some(u=>st(i,u)):!0;if(No(i)){if(t===null)return r?c||$o({fields:Do(i.target,{compile:s,getCollectionFields:a}),types:o,depth:r-1,appends:t,compile:s,getCollectionFields:a}):!1;const u=Eo(i,t),d=t.includes(i.name);return c?d:((u==null?void 0:u.length)||d)&&$o({fields:Do(i.target,{compile:s,getCollectionFields:a}),types:o,appends:u,compile:s,getCollectionFields:a}).length}else return c})}function Qe(e,o){var a,i;const t=l.useCompile(),r=(i=(a=e.useOptions)==null?void 0:a.call(e,o))==null?void 0:i.filter(Boolean),{fieldNames:s}=o;return{[s.label]:t(e.label),[s.value]:e.value,key:e[s.value],[s.children]:r,disabled:!r||!r.length}}function me(e={}){var s;const o=Object.assign({},Se,(s=e.fieldNames)!=null?s:{}),t=Object.assign(e,{fieldNames:o});return[Qe(nt,t),Qe(ot,t),Qe(tt,t),Qe(rt,t)]}function Do(e,{compile:o,getCollectionFields:t}){var d,f,h,x;const[r,s]=l.parseCollectionName(e),a=t(s,r),i=[],c=[];a.forEach(g=>{if(g.isForeignKey)i.push(g);else{const m=a.find(k=>k.name===g.foreignKey);m&&i.push(m),c.push(g)}});const u=ke.uniqBy(i,"name");for(let g=c.length-1;g>=0;g--){const m=c[g];if(m.type==="belongsTo"){const k=u.find(O=>O.name===m.foreignKey);k?c.splice(g,0,A(C(C({},m),k),{uiSchema:A(C({},m.uiSchema),{title:(d=k.uiSchema)!=null&&d.title?o((f=k.uiSchema)==null?void 0:f.title):k.name})})):c.splice(g,0,A(C({},m),{name:m.foreignKey,type:"bigInt",isForeignKey:!0,interface:m.interface,uiSchema:A(C({},m.uiSchema),{title:(h=m.uiSchema)!=null&&h.title?`${o((x=m.uiSchema)==null?void 0:x.title)} ID`:m.name})}))}else m.type==="context"&&m.collectionName==="users"&&c.splice(g,1)}return ke.uniqBy(c,"name").filter(g=>g.interface&&!g.hidden)}function $n(e){const o=Eo(e.field,e.appends),t=Ae(C({collection:`${e.field.dataSourceKey&&e.field.dataSourceKey!=="main"?`${e.field.dataSourceKey}:`:""}${e.field.target}`,types:e.types,appends:o,depth:e.depth-1},this));e.loadChildren=null,t.length?e.children=t:(e.isLeaf=!0,!e.types||e.types.some(s=>st(e.field,s))||(e.disabled=!0))}function Ae(e){const{fields:o,collection:t,types:r,appends:s=[],depth:a=1,compile:i,getCollectionFields:c,fieldNames:u=Se}=e,d=o!=null?o:Do(t,{compile:i,getCollectionFields:c}),f=$n.bind({compile:i,getCollectionFields:c,fieldNames:u});return $o({fields:d,types:r,depth:a,appends:s,compile:i,getCollectionFields:c}).map(x=>{var O;const g=i(((O=x.uiSchema)==null?void 0:O.title)||x.name),m=Eo(x,s),k=!No(x)||m&&!m.length&&!s.includes(x.name)||!1;return{[u.label]:g,key:x.name,[u.value]:x.name,isLeaf:k,loadChildren:k?null:f,field:x,depth:a,appends:s,types:r}})}function je(e){const o=l.useApp(),{collectionManager:t}=o.dataSourceManager.getDataSource(e);return b.useCallback(r=>t.getCollectionFields(r),[t])}function lt(t){var r=t,{variableOptions:e}=r,o=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.Input,C({scope:s},o))}function Io(t){var r=t,{variableOptions:e}=r,o=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.TextArea,C({scope:s},o))}function Dn(t){var r=t,{variableOptions:e}=r,o=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.RawTextArea,C({scope:s},o))}function In(t){var r=t,{variableOptions:e}=r,o=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.JSON,C({scope:s},o))}function Pn(){const e=l.useAPIClient(),o=L.useForm(),{field:t,__parent:r}=l.useBlockRequestContext(),{setVisible:s}=l.useActionContext(),a=te.useNavigate(),i=L.useFieldSchema(),c=L.useField(),u=l.useCompile(),{modal:d}=y.App.useApp(),f=l.useCollectValuesToSubmit(),h=c.componentProps.filterKeys||[];return{onClick(){return U(this,null,function*(){var B,S,E;const{onSuccess:g,skipValidator:m,triggerWorkflows:k}=(B=i==null?void 0:i["x-action-settings"])!=null?B:{};m||(yield o.submit());const O=yield f();c.data=t.data||{},c.data.loading=!0;try{const W=yield e.resource("workflows").trigger({values:O,filterKeys:h,triggerWorkflows:k!=null&&k.length?k.map($=>[$.workflowKey,$.context].filter(Boolean).join("!")).join(","):void 0});if(c.data.loading=!1,c.data.data=W,(E=(S=r==null?void 0:r.service)==null?void 0:S.refresh)==null||E.call(S),s==null||s(!1),!(g!=null&&g.successMessage))return;g!=null&&g.manualClose?d.success({title:u(g==null?void 0:g.successMessage),onOk:()=>U(this,null,function*(){yield o.reset(),g!=null&&g.redirecting&&(g!=null&&g.redirectTo)&&(J.isURL(g.redirectTo)?window.location.href=g.redirectTo:a(g.redirectTo))})}):y.message.success(u(g==null?void 0:g.successMessage))}catch(W){c.data.loading=!1}})}}}function Mn(){var g;const e=l.useCompile(),o=l.useAPIClient(),t=l.useRecord(),r=L.useField(),s=L.useFieldSchema(),{field:a,__parent:i}=l.useBlockRequestContext(),{setVisible:c,setSubmitted:u}=l.useActionContext(),{modal:d}=y.App.useApp(),f=te.useNavigate(),{onSuccess:h,triggerWorkflows:x}=(g=s==null?void 0:s["x-action-settings"])!=null?g:{};return{onClick(k,O){return U(this,null,function*(){r.data=a.data||{},r.data.loading=!0;try{if(yield o.resource("workflows").trigger({values:t,triggerWorkflows:x!=null&&x.length?x.map(B=>[B.workflowKey,B.context].filter(Boolean).join("!")).join(","):void 0}),O&&O(),c==null||c(!1),u==null||u(!0),!(h!=null&&h.successMessage))return;if(h!=null&&h.manualClose){let B;d.success({title:e(h==null?void 0:h.successMessage),onOk(){return U(this,null,function*(){h!=null&&h.redirecting&&(h!=null&&h.redirectTo)&&(J.isURL(h.redirectTo)?window.location.href=h.redirectTo:f(h.redirectTo))})}})}else y.message.success(e(h==null?void 0:h.successMessage))}catch(B){console.error(B)}finally{r.data.loading=!1}})}}}function Bn(){const{workflow:e}=G();return!!(e!=null&&e.executed)}function it(){const{workflow:e}=G();return!!(e!=null&&e.allExecuted)}const Fe={CREATED:1,UPDATED:2,SAVED:3,DELETED:4},Vn=[{label:`{{t("After record added", { ns: "${p}" })}}`,value:Fe.CREATED},{label:`{{t("After record updated", { ns: "${p}" })}}`,value:Fe.UPDATED},{label:`{{t("After record added or updated", { ns: "${p}" })}}`,value:Fe.SAVED},{label:`{{t("After record deleted", { ns: "${p}" })}}`,value:Fe.DELETED}];function jn(e,o){var u;const[t,r]=l.parseCollectionName(e.collection),s=l.useCompile(),a=je(t),i=[{collectionName:r,name:"data",type:"hasOne",target:r,uiSchema:{title:T("Trigger data")}}];return Ae(A(C({appends:["data",...((u=e.appends)==null?void 0:u.map(d=>`data.${d}`))||[]]},o),{fields:i,compile:s,getCollectionFields:a}))}class Wn extends So{constructor(){super(...arguments);w(this,"title",`{{t("Collection event", { ns: "${p}" })}}`);w(this,"description",`{{t('Triggered when data changes in the collection, such as after adding, updating, or deleting a record. Unlike "Post-action event", Collection event listens for data changes rather than HTTP requests. Unless you understand the exact meaning, it is recommended to use "Post-action event".', { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":"{{ useWorkflowAnyExecuted() }}","x-component-props":{dataSourceFilter(t){return t.options.key==="main"||t.options.isDBInstance}},"x-reactions":[...ae["x-reactions"],{target:"changed",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}},{target:"condition",effects:["onFieldValueChange"],fulfill:{state:{value:null}}},{target:"appends",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}}]}),mode:{type:"number",title:`{{t("Trigger on", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Select","x-component-props":{popupMatchSelectWidth:!1,placeholder:`{{t("Trigger on", { ns: "${p}" })}}`,className:"auto-width"},enum:Vn,required:!0,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},changed:{type:"array",title:`{{t("Changed fields", { ns: "${p}" })}}`,description:`{{t("Triggered only if one of the selected fields changes. If unselected, it means that it will be triggered when any field changes. When record is added or deleted, any field is considered to have been changed.", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"FieldsSelect","x-component-props":{mode:"multiple",placeholder:'{{t("Select field")}}',filter(t){return!t.hidden&&(t.uiSchema?!t.uiSchema["x-read-pretty"]:!0)&&!["linkTo","hasOne","hasMany","belongsToMany"].includes(t.type)}},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:`{{!!$deps[0] && ($deps[1] & ${Fe.UPDATED})}}`}}}]},condition:A(C({},_e),{title:`{{t("Only triggers when match conditions", { ns: "${p}" })}}`,"x-component-props":{},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}),appends:A(C({},Ve),{"x-reactions":[...Ve["x-reactions"],{dependencies:["mode"],fulfill:{state:{visible:`{{!($deps[0] & ${Fe.DELETED})}}`}}}]})});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource,useWorkflowAnyExecuted:it});w(this,"components",{FieldsSelect:To});w(this,"useVariables",jn)}useInitializers(t){return t.collection?{name:"triggerData",type:"item",key:"triggerData",title:`{{t("Trigger data", { ns: "${p}" })}}`,Component:Be,collection:t.collection,dataPath:"$context.data"}:null}}const we={STATIC:0,DATE_FIELD:1};function Ln(e){return!e.hidden&&(e.uiSchema?e.type==="date":!1)}function at({value:e,onChange:o}){const t=e!=null?e:{},{t:r}=Q.useTranslation(),[s,a]=b.useState(t.offset?t.offset/Math.abs(t.offset):0);return n.jsxs("fieldset",{className:l.css`
|
|
460
|
-
display: flex;
|
|
461
|
-
gap: 0.5em;
|
|
462
|
-
`,children:[n.jsx(To,{value:t.field,onChange:i=>o(A(C({},t),{field:i})),filter:Ln,placeholder:r("Select field"),className:"auto-width"}),t.field?n.jsx(y.Select,{value:s,onChange:i=>{a(i),o(A(C({},t),{offset:Math.abs(t.offset)*i}))},options:[{value:0,label:T("Exactly at")},{value:-1,label:r("Before")},{value:1,label:r("After")}],className:"auto-width"}):null,s?n.jsxs(n.Fragment,{children:[n.jsx(y.InputNumber,{value:Math.abs(t.offset),onChange:i=>o(A(C({},t),{offset:(i!=null?i:0)*s}))}),n.jsx(y.Select,{value:t.unit||864e5,onChange:i=>o(A(C({},t),{unit:i})),options:[{value:864e5,label:T("Days")},{value:36e5,label:T("Hours")},{value:6e4,label:T("Minutes")},{value:1e3,label:T("Seconds")}],className:"auto-width"})]}):null]})}function zn({value:e,onChange:o}){const{t}=go(),r=e!=null?typeof e=="object"&&!(e instanceof Date)?"field":"date":null;return n.jsxs("fieldset",{className:l.css`
|
|
463
|
-
display: flex;
|
|
464
|
-
gap: 0.5em;
|
|
465
|
-
`,children:[n.jsxs(y.Select,{value:r,onChange:s=>{o(s?s==="field"?{}:new Date:null)},className:"auto-width",children:[n.jsx(y.Select.Option,{value:null,children:t("No end")}),n.jsx(y.Select.Option,{value:"field",children:t("By field")}),n.jsx(y.Select.Option,{value:"date",children:t("By custom date")})]}),r==="field"?n.jsx(at,{value:e,onChange:o}):null,r==="date"?n.jsx(y.DatePicker,{showTime:!0,value:Yt(e),onChange:s=>{o(s?s.toDate():null)}}):null]})}var re=function(){return re=Object.assign||function(e){for(var o,t=1,r=arguments.length;t<r;t++)for(var s in o=arguments[t])Object.prototype.hasOwnProperty.call(o,s)&&(e[s]=o[s]);return e},re.apply(this,arguments)};function ct(e,o){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)o.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(t[r[s]]=e[r[s]])}return t}function Xe(e,o,t){if(t||arguments.length===2)for(var r,s=0,a=o.length;s<a;s++)!r&&s in o||(r||(r=Array.prototype.slice.call(o,0,s)),r[s]=o[s]);return e.concat(r||Array.prototype.slice.call(o))}var Jn=[{name:"@yearly",value:"0 0 1 1 *"},{name:"@annually",value:"0 0 1 1 *"},{name:"@monthly",value:"0 0 1 * *"},{name:"@weekly",value:"0 0 * * 0"},{name:"@daily",value:"0 0 * * *"},{name:"@midnight",value:"0 0 * * *"},{name:"@hourly",value:"0 * * * *"}],Ce=[{type:"minutes",min:0,max:59,total:60},{type:"hours",min:0,max:23,total:24},{type:"month-days",min:1,max:31,total:31},{type:"months",min:1,max:12,total:12,alt:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]},{type:"week-days",min:0,max:6,total:7,alt:["SUN","MON","TUE","WED","THU","FRI","SAT"]}],V={everyText:"every",emptyMonths:"every month",emptyMonthDays:"every day of the month",emptyMonthDaysShort:"day of the month",emptyWeekDays:"every day of the week",emptyWeekDaysShort:"day of the week",emptyHours:"every hour",emptyMinutes:"every minute",emptyMinutesForHourPeriod:"every",yearOption:"year",monthOption:"month",weekOption:"week",dayOption:"day",hourOption:"hour",minuteOption:"minute",rebootOption:"reboot",prefixPeriod:"Every",prefixMonths:"in",prefixMonthDays:"on",prefixWeekDays:"on",prefixWeekDaysForMonthAndYearPeriod:"and",prefixHours:"at",prefixMinutes:":",prefixMinutesForHourPeriod:"at",suffixMinutesForHourPeriod:"minute(s)",errorInvalidCron:"Invalid cron expression",clearButtonText:"Clear",weekDays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],altWeekDays:["SUN","MON","TUE","WED","THU","FRI","SAT"],altMonths:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]};function dt(e,o){for(var t=[],r=e;r<=o;r++)t.push(r);return t}function Re(e){return e.sort(function(o,t){return o-t}),e}function ut(e){var o=[];return e.forEach(function(t){o.indexOf(t)<0&&o.push(t)}),o}function ce(e){return Object.entries(e).filter(function(o){var t=o[0],r=o[1];return t&&r}).map(function(o){return o[0]}).join(" ")}function pt(e,o){e&&e({type:"invalid_cron",description:o.errorInvalidCron||V.errorInvalidCron})}function eo(e){var o=parseInt(e,10),t=Number(e);return o===t?t:NaN}function mt(e,o,t,r,s,a,i,c,u,d,f,h,x,g){t&&t(void 0),o(!1);var m=!1;if(!e){if(r==="always"||a&&r==="for-default-value")return;m=!0}if(!m){if(c&&(c===!0||c.includes(e))){if(e==="@reboot")return void g("reboot");var k=Jn.find(function(S){return S.name===e});k&&(e=k.value)}try{var O=function(S){if(typeof S!="string")throw new Error("Invalid cron string");var E=S.replace(/\s+/g," ").trim().split(" ");if(E.length===5)return E.map(function(W,$){return function(M,N){if(M==="*"||M==="*/1")return[];var F=Re(ut(gt(function(H,K,ue){if(ue){H=H.toUpperCase();for(var P=0;P<ue.length;P++)H=H.replace(ue[P],"".concat(P+K))}return H}(M,N.min,N.alt).split(",").map(function(H){var K,ue=H.split("/");if(ue.length>2)throw new Error('Invalid value "'.concat(M,' for "').concat(N.type,'"'));var P=ue[0],j=ue[1];K=P==="*"?dt(N.min,N.max):function(q,Y,R){var ee=q.split("-");if(ee.length===1){var Le=eo(ee[0]);if(isNaN(Le))throw new Error('Invalid value "'.concat(Y,'" for ').concat(R.type));return[Le]}if(ee.length===2){var he=eo(ee[0]),Ee=eo(ee[1]);if(isNaN(he)||isNaN(Ee))throw new Error('Invalid value "'.concat(Y,'" for ').concat(R.type));if(Ee<he)throw new Error('Max range is less than min range in "'.concat(q,'" for ').concat(R.type));return dt(he,Ee)}throw new Error('Invalid value "'.concat(q,'" for ').concat(R.type))}(P,M,N);var z=function(q,Y){if(q!==void 0){var R=eo(q);if(isNaN(R)||R<1)throw new Error('Invalid interval step value "'.concat(q,'" for ').concat(Y.type));return R}}(j,N),se=function(q,Y){if(Y){var R=q[0];q=q.filter(function(ee){return ee%Y==R%Y||ee===R})}return q}(K,z);return se}).flat(),N))),D=bt(F,N);if(D!==void 0)throw new Error('Value "'.concat(D,'" out of range for ').concat(N.type));return F.length===N.total?[]:F}(W,Ce[$])});throw new Error("Invalid cron string format")}(e),B=function(S){return S[3].length>0?"year":S[2].length>0?"month":S[4].length>0?"week":S[1].length>0?"day":S[0].length>0?"hour":"minute"}(O);g(B),u(O[0]),d(O[1]),f(O[2]),h(O[3]),x(O[4])}catch(S){m=!0}}m&&(s.current=e,o(!0),pt(t,i))}function ft(e,o,t,r,s,a,i){if(e==="reboot")return"@reboot";var c=function(u,d){return u.map(function(f,h){var x=Ce[h];return ht(yt(f,x),x,d)})}([e!=="minute"&&a?a:[],e!=="minute"&&e!=="hour"&&s?s:[],e!=="year"&&e!=="month"||!t?[]:t,e==="year"&&o?o:[],e!=="year"&&e!=="month"&&e!=="week"||!r?[]:r],i);return c.join(" ")}function ht(e,o,t,r,s){var a="";if(function(c,u){return c.length===u.max-u.min+1}(e,o)||e.length===0)a="*";else{var i=function(c){if(c.length>2){var u=c[1]-c[0];if(u>1)return u}}(e);a=i&&function(c,u){for(var d=1;d<c.length;d++){var f=c[d-1];if(c[d]-f!==u)return!1}return!0}(e,i)?function(c,u,d){var f=vt(c),h=xt(c),x=c.length===(h-f)/d+1;return!!(f===u.min&&h+d>u.max&&x)}(e,o,i)?"*/".concat(i):"".concat(Oe(vt(e),o,t,r,s),"-").concat(Oe(xt(e),o,t,r,s),"/").concat(i):function(c){var u=[],d=null;return c.forEach(function(f,h,x){f!==x[h+1]-1?d!==null?(u.push([d,f]),d=null):u.push(f):d===null&&(d=f)}),u}(e).map(function(c){return Array.isArray(c)?"".concat(Oe(c[0],o,t,r,s),"-").concat(Oe(c[1],o,t,r,s)):Oe(c,o,t,r,s)}).join(",")}return a}function Oe(e,o,t,r,s){var a=e.toString(),i=o.type,c=o.alt,u=o.min,d=r&&(r===!0||r.includes(i)),f=s==="24-hour-clock"&&(i==="hours"||i==="minutes");if(t&&i==="week-days"||t&&i==="months"?a=c[e-u]:e<10&&(d||f)&&(a=a.padStart(2,"0")),i==="hours"&&s==="12-hour-clock"){var h=e>=12?"PM":"AM",x=e%12||12;x<10&&d&&(x=x.toString().padStart(2,"0")),a="".concat(x).concat(h)}return a}function yt(e,o){var t=Re(ut(gt(e,o)));if(t.length===0)return t;var r=bt(t,o);if(r!==void 0)throw new Error('Value "'.concat(r,'" out of range for ').concat(o.type));return t}function gt(e,o){return o.type==="week-days"&&(e=e.map(function(t){return t===7?0:t})),e}function bt(e,o){var t=e[0],r=e[e.length-1];return t<o.min?t:r>o.max?r:void 0}function vt(e){return e[0]}function xt(e){return e[e.length-1]}function We(e){var o=e.value,t=e.grid,r=t===void 0||t,s=e.optionsList,a=e.setValue,i=e.locale,c=e.className,u=e.humanizeLabels,d=e.disabled,f=e.readOnly,h=e.leadingZero,x=e.clockFormat,g=e.period,m=e.unit,k=e.periodicityOnDoubleClick,O=e.mode,B=ct(e,["value","grid","optionsList","setValue","locale","className","humanizeLabels","disabled","readOnly","leadingZero","clockFormat","period","unit","periodicityOnDoubleClick","mode"]),S=b.useMemo(function(){if(o&&Array.isArray(o))return o.map(function(P){return P.toString()})},[o]),E=b.useMemo(function(){return s?s.map(function(P,j){return{value:(m.min===0?j:j+1).toString(),label:P}}):Xe([],Array(m.total),!0).map(function(P,j){var z=m.min===0?j:j+1;return{value:z.toString(),label:Oe(z,m,u,h,x)}})},[s,h,u,x]),W=JSON.stringify(i),$=b.useCallback(function(P){var j=P.value;if(!o||o[0]!==Number(j))return n.jsx(n.Fragment,{});var z=ht(yt(o,m),m,u,h,x),se=z.match(/^\*\/([0-9]+),?/)||[];return n.jsx("div",{children:se[1]?"".concat(i.everyText||V.everyText," ").concat(se[1]):z})},[o,W,u,h,x]),M=b.useCallback(function(P){var j=Array.isArray(P)?Re(P):[P],z=j;o&&(z=O==="single"?[]:Xe([],o,!0),j.forEach(function(se){var q=Number(se);z=o.some(function(Y){return Y===q})?z.filter(function(Y){return Y!==q}):Re(Xe(Xe([],z,!0),[q],!1))})),z.length===m.total?a([]):a(z)},[a,o]),N=b.useCallback(function(P){if(P!==0&&P!==1){for(var j=m.total+m.min,z=[],se=m.min;se<j;se++)se%P==0&&z.push(se);var q=o&&z&&o.length===z.length&&o.every(function(R,ee){return R===z[ee]}),Y=z.length===E.length;a(Y||q?[]:z)}else a([])},[o,E,a]),F=b.useRef([]),D=b.useCallback(function(P){if(!f){var j=F.current;j.push({time:new Date().getTime(),value:Number(P)});var z=window.setTimeout(function(){k&&j.length>1&&j[j.length-1].time-j[j.length-2].time<300?j[j.length-1].value===j[j.length-2].value?N(Number(P)):M([j[j.length-2].value,j[j.length-1].value]):M(Number(P)),F.current=[]},300);return function(){window.clearTimeout(z)}}},[F,M,N,f,k]),H=b.useCallback(function(){f||a([])},[a,f]),K=b.useMemo(function(){var P;return ce(((P={"react-js-cron-select":!0,"react-js-cron-custom-select":!0})["".concat(c,"-select")]=!!c,P))},[c]),ue=b.useMemo(function(){var P;return ce(((P={"react-js-cron-select-dropdown":!0})["react-js-cron-select-dropdown-".concat(m.type)]=!0,P["react-js-cron-custom-select-dropdown"]=!0,P["react-js-cron-custom-select-dropdown-".concat(m.type)]=!0,P["react-js-cron-custom-select-dropdown-minutes-large"]=m.type==="minutes"&&g!=="hour"&&g!=="day",P["react-js-cron-custom-select-dropdown-minutes-medium"]=m.type==="minutes"&&(g==="day"||g==="hour"),P["react-js-cron-custom-select-dropdown-hours-twelve-hour-clock"]=m.type==="hours"&&x==="12-hour-clock",P["react-js-cron-custom-select-dropdown-grid"]=!!r,P["".concat(c,"-select-dropdown")]=!!c,P["".concat(c,"-select-dropdown-").concat(m.type)]=!!c,P))},[c,r,x,g]);return n.jsx(y.Select,re({mode:O!=="single"||k?"multiple":void 0,allowClear:!f,virtual:!1,open:!f&&void 0,value:S,onClear:H,tagRender:$,className:K,popupClassName:ue,options:E,showSearch:!1,showArrow:!f,menuItemSelectedIcon:null,dropdownMatchSelectWidth:!1,onSelect:D,onDeselect:D,disabled:d,dropdownAlign:m.type!=="minutes"&&m.type!=="hours"||g==="day"||g==="hour"?void 0:{points:["tr","br"]},"data-testid":"custom-select-".concat(m.type)},B))}function Un(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.leadingZero,u=e.clockFormat,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=b.useMemo(function(){var g;return ce(((g={"react-js-cron-field":!0,"react-js-cron-hours":!0})["".concat(s,"-field")]=!!s,g["".concat(s,"-hours")]=!!s,g))},[s]);return n.jsxs("div",re({className:x},{children:[r.prefixHours!==""&&n.jsx("span",{children:r.prefixHours||V.prefixHours}),n.jsx(We,{placeholder:r.emptyHours||V.emptyHours,value:o,unit:Ce[1],setValue:t,locale:r,className:s,disabled:a,readOnly:i,leadingZero:c,clockFormat:u,period:d,periodicityOnDoubleClick:f,mode:h})]}))}function Hn(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.leadingZero,u=e.clockFormat,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=b.useMemo(function(){var g;return ce(((g={"react-js-cron-field":!0,"react-js-cron-minutes":!0})["".concat(s,"-field")]=!!s,g["".concat(s,"-minutes")]=!!s,g))},[s]);return n.jsxs("div",re({className:x},{children:[d==="hour"?r.prefixMinutesForHourPeriod!==""&&n.jsx("span",{children:r.prefixMinutesForHourPeriod||V.prefixMinutesForHourPeriod}):r.prefixMinutes!==""&&n.jsx("span",{children:r.prefixMinutes||V.prefixMinutes}),n.jsx(We,{placeholder:d==="hour"?r.emptyMinutesForHourPeriod||V.emptyMinutesForHourPeriod:r.emptyMinutes||V.emptyMinutes,value:o,unit:Ce[0],setValue:t,locale:r,className:s,disabled:a,readOnly:i,leadingZero:c,clockFormat:u,period:d,periodicityOnDoubleClick:f,mode:h}),d==="hour"&&r.suffixMinutesForHourPeriod!==""&&n.jsx("span",{children:r.suffixMinutesForHourPeriod||V.suffixMinutesForHourPeriod})]}))}function Gn(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.weekDays,i=e.disabled,c=e.readOnly,u=e.leadingZero,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=!a||a.length===0,g=b.useMemo(function(){var O;return ce(((O={"react-js-cron-field":!0,"react-js-cron-month-days":!0,"react-js-cron-month-days-placeholder":!x})["".concat(s,"-field")]=!!s,O["".concat(s,"-month-days")]=!!s,O))},[s,x]),m=JSON.stringify(r),k=b.useMemo(function(){return x?r.emptyMonthDays||V.emptyMonthDays:r.emptyMonthDaysShort||V.emptyMonthDaysShort},[x,m]);return!c||o&&o.length>0||(!o||o.length===0)&&(!a||a.length===0)?n.jsxs("div",re({className:g},{children:[r.prefixMonthDays!==""&&n.jsx("span",{children:r.prefixMonthDays||V.prefixMonthDays}),n.jsx(We,{placeholder:k,value:o,setValue:t,unit:Ce[2],locale:r,className:s,disabled:i,readOnly:c,leadingZero:u,period:d,periodicityOnDoubleClick:f,mode:h})]})):null}function qn(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.humanizeLabels,i=e.disabled,c=e.readOnly,u=e.period,d=e.periodicityOnDoubleClick,f=e.mode,h=r.months||V.months,x=b.useMemo(function(){var g;return ce(((g={"react-js-cron-field":!0,"react-js-cron-months":!0})["".concat(s,"-field")]=!!s,g["".concat(s,"-months")]=!!s,g))},[s]);return n.jsxs("div",re({className:x},{children:[r.prefixMonths!==""&&n.jsx("span",{children:r.prefixMonths||V.prefixMonths}),n.jsx(We,{placeholder:r.emptyMonths||V.emptyMonths,optionsList:h,grid:!1,value:o,unit:re(re({},Ce[3]),{alt:r.altMonths||V.altMonths}),setValue:t,locale:r,className:s,humanizeLabels:a,disabled:i,readOnly:c,period:u,periodicityOnDoubleClick:d,mode:f})]}))}function Kn(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.shortcuts,u=e.allowedPeriods,d=[];u.includes("year")&&d.push({value:"year",label:r.yearOption||V.yearOption}),u.includes("month")&&d.push({value:"month",label:r.monthOption||V.monthOption}),u.includes("week")&&d.push({value:"week",label:r.weekOption||V.weekOption}),u.includes("day")&&d.push({value:"day",label:r.dayOption||V.dayOption}),u.includes("hour")&&d.push({value:"hour",label:r.hourOption||V.hourOption}),u.includes("minute")&&d.push({value:"minute",label:r.minuteOption||V.minuteOption}),u.includes("reboot")&&c&&(c===!0||c.includes("@reboot"))&&d.push({value:"reboot",label:r.rebootOption||V.rebootOption});var f=b.useCallback(function(m){i||t(m)},[t,i]),h=b.useMemo(function(){var m;return ce(((m={"react-js-cron-field":!0,"react-js-cron-period":!0})["".concat(s,"-field")]=!!s,m["".concat(s,"-period")]=!!s,m))},[s]),x=b.useMemo(function(){var m;return ce(((m={"react-js-cron-select":!0,"react-js-cron-select-no-prefix":r.prefixPeriod===""})["".concat(s,"-select")]=!!s,m))},[s,r.prefixPeriod]),g=b.useMemo(function(){var m;return ce(((m={"react-js-cron-select-dropdown":!0,"react-js-cron-select-dropdown-period":!0})["".concat(s,"-select-dropdown")]=!!s,m["".concat(s,"-select-dropdown-period")]=!!s,m))},[s]);return n.jsxs("div",re({className:h},{children:[r.prefixPeriod!==""&&n.jsx("span",{children:r.prefixPeriod||V.prefixPeriod}),n.jsx(y.Select,{defaultValue:o,value:o,onChange:f,options:d,className:x,popupClassName:g,disabled:a,showArrow:!i,open:!i&&void 0,"data-testid":"select-period"},JSON.stringify(r))]}))}function Yn(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.humanizeLabels,i=e.monthDays,c=e.disabled,u=e.readOnly,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=r.weekDays||V.weekDays,g=d==="week"||!i||i.length===0,m=b.useMemo(function(){var E;return ce(((E={"react-js-cron-field":!0,"react-js-cron-week-days":!0,"react-js-cron-week-days-placeholder":!g})["".concat(s,"-field")]=!!s,E["".concat(s,"-week-days")]=!!s,E))},[s,g]),k=JSON.stringify(r),O=b.useMemo(function(){return g?r.emptyWeekDays||V.emptyWeekDays:r.emptyWeekDaysShort||V.emptyWeekDaysShort},[g,k]),B=d==="week"||!u||o&&o.length>0||(!o||o.length===0)&&(!i||i.length===0),S=!u||i&&i.length>0||(!i||i.length===0)&&(!o||o.length===0);return B?n.jsxs("div",re({className:m},{children:[r.prefixWeekDays!==""&&(d==="week"||!S)&&n.jsx("span",{children:r.prefixWeekDays||V.prefixWeekDays}),r.prefixWeekDaysForMonthAndYearPeriod!==""&&d!=="week"&&S&&n.jsx("span",{children:r.prefixWeekDaysForMonthAndYearPeriod||V.prefixWeekDaysForMonthAndYearPeriod}),n.jsx(We,{placeholder:O,optionsList:x,grid:!1,value:o,unit:re(re({},Ce[4]),{alt:r.altWeekDays||V.altWeekDays}),setValue:t,locale:r,className:s,humanizeLabels:a,disabled:c,readOnly:u,period:d,periodicityOnDoubleClick:f,mode:h})]})):null}function _n(e){var o=e.clearButton,t=o===void 0||o,r=e.clearButtonProps,s=r===void 0?{}:r,a=e.clearButtonAction,i=a===void 0?"fill-with-every":a,c=e.locale,u=c===void 0?V:c,d=e.value,f=d===void 0?"":d,h=e.setValue,x=e.displayError,g=x===void 0||x,m=e.onError,k=e.className,O=e.defaultPeriod,B=O===void 0?"day":O,S=e.allowEmpty,E=S===void 0?"for-default-value":S,W=e.humanizeLabels,$=W===void 0||W,M=e.humanizeValue,N=M!==void 0&&M,F=e.disabled,D=F!==void 0&&F,H=e.readOnly,K=H!==void 0&&H,ue=e.leadingZero,P=ue!==void 0&&ue,j=e.shortcuts,z=j===void 0?["@yearly","@annually","@monthly","@weekly","@daily","@midnight","@hourly"]:j,se=e.clockFormat,q=e.periodicityOnDoubleClick,Y=q===void 0||q,R=e.mode,ee=R===void 0?"multiple":R,Le=e.allowedDropdowns,he=Le===void 0?["period","months","month-days","week-days","hours","minutes"]:Le,Ee=e.allowedPeriods,Ar=Ee===void 0?["year","month","week","day","hour","minute","reboot"]:Ee,$e=b.useRef(f),Po=b.useRef(B),$t=b.useState(),be=$t[0],to=$t[1],Dt=b.useState(),ze=Dt[0],no=Dt[1],It=b.useState(),ro=It[0],so=It[1],Pt=b.useState(),Je=Pt[0],lo=Pt[1],Mt=b.useState(),io=Mt[0],ao=Mt[1],Bt=b.useState(),co=Bt[0],uo=Bt[1],Vt=b.useState(!1),Mo=Vt[0],Ue=Vt[1],jt=b.useState(!1),po=jt[0],Wt=jt[1],Fr=function(_){var ye=b.useRef(_);return b.useEffect(function(){ye.current=_},[_]),ye.current}(po),Lt=JSON.stringify(u);b.useEffect(function(){mt(f,Ue,m,E,$e,!0,u,z,uo,ao,no,so,lo,to)},[]),b.useEffect(function(){f!==$e.current&&mt(f,Ue,m,E,$e,!1,u,z,uo,ao,no,so,lo,to)},[f,$e,Lt,E,z]),b.useEffect(function(){if(!(be||co||ro||ze||Je||io)||po||Fr)po&&Wt(!1);else{var _=be||Po.current,ye=ft(_,ro,ze,Je,io,co,N);h(ye,{selectedPeriod:_}),$e.current=ye,m&&m(void 0),Ue(!1)}},[be,ze,ro,Je,io,co,N,po]);var zt=b.useCallback(function(){no(void 0),so(void 0),lo(void 0),ao(void 0),uo(void 0);var _="",ye=be!=="reboot"&&be?be:Po.current;ye!==be&&to(ye),i==="fill-with-every"&&(_=ft(ye,void 0,void 0,void 0,void 0,void 0)),h(_,{selectedPeriod:ye}),$e.current=_,Wt(!0),E==="never"&&i==="empty"?(Ue(!0),pt(m,u)):(m&&m(void 0),Ue(!1))},[be,h,m,i]),Or=b.useMemo(function(){var _;return ce(((_={"react-js-cron":!0,"react-js-cron-error":Mo&&g,"react-js-cron-disabled":D,"react-js-cron-read-only":K})["".concat(k)]=!!k,_["".concat(k,"-error")]=Mo&&g&&!!k,_["".concat(k,"-disabled")]=D&&!!k,_["".concat(k,"-read-only")]=K&&!!k,_))},[k,Mo,g,D,K]),Bo=s.className,Jt=ct(s,["className"]),Ut=b.useMemo(function(){var _;return ce(((_={"react-js-cron-clear-button":!0})["".concat(k,"-clear-button")]=!!k,_["".concat(Bo)]=!!Bo,_))},[k,Bo]),Tr=JSON.stringify(Jt),Ht=b.useMemo(function(){return t&&!K?n.jsx(y.Button,re({className:Ut,danger:!0,type:"primary",disabled:D},Jt,{onClick:zt},{children:u.clearButtonText||V.clearButtonText})):null},[t,K,Lt,Ut,D,Tr,zt]),oe=be||Po.current;return n.jsxs("div",re({className:Or},{children:[he.includes("period")&&n.jsx(Kn,{value:oe,setValue:to,locale:u,className:k,disabled:D,readOnly:K,shortcuts:z,allowedPeriods:Ar}),oe==="reboot"?Ht:n.jsxs(n.Fragment,{children:[oe==="year"&&he.includes("months")&&n.jsx(qn,{value:ro,setValue:so,locale:u,className:k,humanizeLabels:$,disabled:D,readOnly:K,period:oe,periodicityOnDoubleClick:Y,mode:ee}),(oe==="year"||oe==="month")&&he.includes("month-days")&&n.jsx(Gn,{value:ze,setValue:no,locale:u,className:k,weekDays:Je,disabled:D,readOnly:K,leadingZero:P,period:oe,periodicityOnDoubleClick:Y,mode:ee}),(oe==="year"||oe==="month"||oe==="week")&&he.includes("week-days")&&n.jsx(Yn,{value:Je,setValue:lo,locale:u,className:k,humanizeLabels:$,monthDays:ze,disabled:D,readOnly:K,period:oe,periodicityOnDoubleClick:Y,mode:ee}),n.jsxs("div",{children:[oe!=="minute"&&oe!=="hour"&&he.includes("hours")&&n.jsx(Un,{value:io,setValue:ao,locale:u,className:k,disabled:D,readOnly:K,leadingZero:P,clockFormat:se,period:oe,periodicityOnDoubleClick:Y,mode:ee}),oe!=="minute"&&he.includes("minutes")&&n.jsx(Hn,{value:co,setValue:uo,locale:u,period:oe,className:k,disabled:D,readOnly:K,leadingZero:P,clockFormat:se,periodicityOnDoubleClick:Y,mode:ee}),Ht]})]})]}))}const wt=[{value:"none",text:"No repeat"},{value:6e4,text:"By minute",unitText:"Minutes"},{value:36e5,text:"By hour",unitText:"Hours"},{value:864e5,text:"By day",unitText:"Days"},{value:6048e5,text:"By week",unitText:"Weeks"},{value:"cron",text:"Advanced"}];function Ct(e){return wt.filter(t=>typeof t.value=="number").reverse().find(t=>!(e%t.value))}function Zn(e){let o;switch(typeof e){case"number":return o=Ct(e),o?o.value:"none";case"string":return"cron"}return"none"}function Qn({value:e,onChange:o}){const{t}=go(),r=Ct(e);return n.jsx(y.InputNumber,{value:e/r.value,onChange:s=>o(s*r.value),min:1,addonBefore:t("Every"),addonAfter:t(r.unitText),className:"auto-width"})}function Xn({value:e=null,onChange:o}){const{t}=go(),r=Zn(e),s=b.useCallback(a=>{if(a==="none"){o(null);return}if(a==="cron"){o("0 * * * * *");return}o(a)},[o]);return n.jsxs("fieldset",{className:l.css`
|
|
466
|
-
display: flex;
|
|
467
|
-
flex-direction: ${r==="cron"?"column":"row"};
|
|
468
|
-
align-items: flex-start;
|
|
469
|
-
gap: 0.5em;
|
|
470
|
-
|
|
471
|
-
.react-js-cron {
|
|
472
|
-
width: 100%;
|
|
473
|
-
padding: 0.5em 0.5em 0 0.5em;
|
|
474
|
-
border: 1px dashed #ccc;
|
|
475
|
-
|
|
476
|
-
.react-js-cron-field {
|
|
477
|
-
margin-bottom: 0.5em;
|
|
478
|
-
|
|
479
|
-
> span {
|
|
480
|
-
margin: 0 0.5em 0 0;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
> .react-js-cron-select {
|
|
484
|
-
margin: 0 0.5em 0 0;
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
.react-js-cron-week-days {
|
|
489
|
-
> span {
|
|
490
|
-
min-width: 2em;
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
`,children:[n.jsx(y.Select,{value:r,onChange:s,className:"auto-width",children:wt.map(a=>n.jsx(y.Select.Option,{value:a.value,children:t(a.text)},a.value))}),typeof r=="number"?n.jsx(Qn,{value:e,onChange:o}):null,r==="cron"?n.jsx(_n,{value:e.trim().split(/\s+/).slice(1).join(" "),setValue:a=>o(`0 ${a}`),clearButton:!1,locale:window.cronLocale}):null]})}const Rn={[we.STATIC]:{startsOn:{type:"datetime",title:`{{t("Starts on", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},required:!0},repeat:{type:"string",title:`{{t("Repeat mode", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RepeatField","x-reactions":[{target:"endsOn",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"limit",fulfill:{state:{visible:"{{!!$self.value}}"}}}]},endsOn:{type:"datetime",title:`{{t("Ends on", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0}},limit:{type:"number",title:`{{t("Repeat limit", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{placeholder:`{{t("No limit", { ns: "${p}" })}}`,min:0}}},[we.DATE_FIELD]:{collection:A(C({},ae),{"x-component-props":{dataSourceFilter(e){return e.options.key==="main"||e.options.isDBInstance}},"x-reactions":[...ae["x-reactions"],{target:"startsOn",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}]}),startsOn:{type:"object",title:`{{t("Starts on", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"OnField","x-reactions":[{target:"repeat",fulfill:{state:{visible:"{{!!$self.value}}"}}}],required:!0},repeat:{type:"string",title:`{{t("Repeat mode", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RepeatField","x-reactions":[{target:"endsOn",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"limit",fulfill:{state:{visible:"{{!!$self.value}}"}}}]},endsOn:{type:"object",title:`{{t("Ends on", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"EndsByField"},limit:{type:"number",title:`{{t("Repeat limit", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{placeholder:`{{t("No limit", { ns: "${p}" })}}`,min:0}},appends:A(C({},Ve),{"x-reactions":[{dependencies:["mode","collection"],fulfill:{state:{visible:`{{$deps[0] === ${we.DATE_FIELD} && $deps[1]}}`}}}]})}},er=[{value:we.STATIC,label:`{{t("Based on certain date", { ns: "${p}" })}}`},{value:we.DATE_FIELD,label:`{{t("Based on date field of collection", { ns: "${p}" })}}`}],or=()=>{const{values:e={},clearFormGraph:o}=L.useForm(),[t,r]=b.useState(e.mode);return L.useFormEffects(()=>{le.onFieldValueChange("mode",s=>{r(s.value),o("collection"),o("startsOn"),o("repeat"),o("endsOn"),o("limit")})}),n.jsxs(n.Fragment,{children:[n.jsx(l.SchemaComponent,{schema:{type:"number",title:`{{t("Trigger mode", { ns: "${p}" })}}`,name:"mode","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{options:er},required:!0,default:we.STATIC}}),n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[`mode-${t}`]:{type:"void","x-component":"fieldset","x-component-props":{className:l.css`
|
|
495
|
-
.ant-input-number {
|
|
496
|
-
width: auto;
|
|
497
|
-
min-width: 6em;
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
.ant-picker {
|
|
501
|
-
width: auto;
|
|
502
|
-
}
|
|
503
|
-
`},properties:Rn[t]}}},components:{OnField:at,RepeatField:Xn,EndsByField:zn}})]})};function tr(e,o){var c;const[t,r]=l.parseCollectionName(e.collection),s=l.useCompile(),a=je(t),i=[];if((!(o!=null&&o.types)||o.types.includes("date"))&&i.push({key:"date",value:"date",label:T("Trigger time")}),e.mode===we.DATE_FIELD){const[u]=Ae(A(C({appends:["data",...((c=e.appends)==null?void 0:c.map(d=>`data.${d}`))||[]]},o),{fields:[{collectionName:e.collection,name:"data",type:"hasOne",target:e.collection,uiSchema:{title:T("Trigger data")}}],compile:s,getCollectionFields:a}));u&&i.push(u)}return i}class nr extends So{constructor(){super(...arguments);w(this,"sync",!1);w(this,"title",`{{t("Schedule event", { ns: "${p}" })}}`);w(this,"description",`{{t("Triggered according to preset time conditions. Suitable for one-time or periodic tasks, such as sending notifications and cleaning data on a schedule.", { ns: "${p}" })}}`);w(this,"fieldset",{config:{type:"void","x-component":"ScheduleConfig","x-component-props":{}}});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource});w(this,"components",{ScheduleConfig:or});w(this,"useVariables",tr)}useInitializers(t){return t.collection?{name:"triggerData",type:"item",title:`{{t("Trigger data", { ns: "${p}" })}}`,Component:Be,collection:t.collection,dataPath:"$context.data"}:null}}function Te(e){const a=e,{options:o=[],direction:t}=a,r=Z(a,["options","direction"]),s=l.useCompile();return n.jsx(y.Radio.Group,A(C({},r),{children:n.jsx(y.Space,{direction:t,children:o.map(i=>n.jsxs(y.Radio,{value:i.value,children:[n.jsx("span",{className:l.css`
|
|
504
|
-
& + .anticon {
|
|
505
|
-
margin-left: 0.25em;
|
|
506
|
-
}
|
|
507
|
-
`,children:s(i.label)}),i.tooltip&&n.jsx(y.Tooltip,{title:s(i.tooltip),children:n.jsx(I.QuestionCircleOutlined,{style:{color:"#666"}})})]},i.value))})}))}function kt(){const e=L.useFieldSchema(),o=l.useCompile();return n.jsxs(l.GeneralSchemaDesigner,{title:o(e.title),children:[n.jsx(l.SchemaSettingsBlockTitleItem,{}),n.jsx(l.SchemaSettingsDivider,{}),n.jsx(l.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})]})}const Ne=()=>null;function rr(){const a=l.useSchemaInitializerItem(),{node:o,resultTitle:t}=a,r=Z(a,["node","resultTitle"]),{insert:s}=l.useSchemaInitializer();return n.jsx(l.SchemaInitializerItem,A(C({},r),{onClick:()=>{var i;s({type:"void",name:o.id,title:o.title,"x-component":"CardItem","x-component-props":{title:(i=o.title)!=null?i:`#${o.id}`},"x-designer":"ValueBlock.Designer",properties:{result:{type:"void",title:t,"x-component":"ValueBlock.Result","x-component-props":{dataSource:`{{$jobsMapByNodeKey.${o.key}}}`}}}})}}))}function sr({dataSource:e}){var s;const o=L.useFieldSchema(),{execution:t}=G();if(!t)return o.title;const r=J.parse(e)({$jobsMapByNodeKey:((s=t.jobs)!=null?s:[]).reduce((a,i)=>Object.assign(a,{[i.nodeKey]:i.result}),{})});return n.jsx("pre",{className:l.css`
|
|
508
|
-
margin: 0;
|
|
509
|
-
`,children:JSON.stringify(r,null,2)})}Ne.Initializer=rr,Ne.Result=sr,Ne.Designer=kt;const St=e=>{const o=De.evaluators.get(e);return o&&o.link?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:l.css`
|
|
510
|
-
&:after {
|
|
511
|
-
content: ':';
|
|
512
|
-
}
|
|
513
|
-
& + a {
|
|
514
|
-
margin-left: 0.25em;
|
|
515
|
-
}
|
|
516
|
-
`,children:l.i18n.t("Syntax references")}),n.jsx("a",{href:o.link,target:"_blank",rel:"noreferrer",children:o.label})]}):null};class lr extends ge{constructor(){super(...arguments);w(this,"title",`{{t("Calculation", { ns: "${p}" })}}`);w(this,"type","calculation");w(this,"group","control");w(this,"description",`{{t("Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression.", { ns: "${p}" })}}`);w(this,"fieldset",{engine:{type:"string",title:`{{t("Calculation engine", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:De.getOptions()},required:!0,default:"math.js"},expression:{type:"string",title:`{{t("Calculation expression", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{changeOnSelect:!0},"x-validator"(t,r,{form:s}){const{values:a}=s,{evaluate:i}=De.evaluators.get(a.engine),c=t.trim().replace(/{{([^{}]+)}}/g," 1 ");try{return i(c),""}catch(u){return T("Expression syntax error")}},"x-reactions":[{dependencies:["engine"],fulfill:{schema:{description:"{{renderEngineReference($deps[0])}}"}}}],required:!0}});w(this,"scope",{renderEngineReference:St});w(this,"components",{WorkflowVariableTextArea:Io,RadioWithTooltip:Te,ValueBlock:Ne})}useVariables({key:t,title:r},{types:s,fieldNames:a=Se}){return s&&!s.some(i=>i in Ze||Object.values(Ze).some(c=>c.has(i)))?null:{value:t,label:r}}useInitializers(t){var r,s;return{name:(r=t.title)!=null?r:`#${t.id}`,type:"item",title:(s=t.title)!=null?s:`#${t.id}`,Component:Ne.Initializer,node:t,resultTitle:T("Calculation result")}}}const X=new J.Registry;X.register("equal",{name:"=",type:"boolean",group:"boolean"}),X.register("notEqual",{name:"≠",type:"boolean",group:"boolean"}),X.register("gt",{name:">",type:"boolean",group:"boolean"}),X.register("gte",{name:"≥",type:"boolean",group:"boolean"}),X.register("lt",{name:"<",type:"boolean",group:"boolean"}),X.register("lte",{name:"≤",type:"boolean",group:"boolean"}),X.register("add",{name:"+",type:"number",group:"number"}),X.register("minus",{name:"-",type:"number",group:"number"}),X.register("multiple",{name:"*",type:"number",group:"number"}),X.register("divide",{name:"/",type:"number",group:"number"}),X.register("mod",{name:"%",type:"number",group:"number"}),X.register("includes",{name:'{{t("contains")}}',type:"boolean",group:"string"}),X.register("notIncludes",{name:'{{t("does not contain")}}',type:"boolean",group:"string"}),X.register("startsWith",{name:'{{t("starts with")}}',type:"boolean",group:"string"}),X.register("notStartsWith",{name:'{{t("not starts with")}}',type:"boolean",group:"string"}),X.register("endsWith",{name:'{{t("ends with")}}',type:"boolean",group:"string"}),X.register("notEndsWith",{name:'{{t("not ends with")}}',type:"boolean",group:"string"}),X.register("concat",{name:`{{t("concat", { ns: "${p}" })}}`,type:"string",group:"string"});const ir=[{value:"boolean",title:'{{t("Comparision")}}'},{value:"number",title:`{{t("Arithmetic calculation", { ns: "${p}" })}}`},{value:"string",title:`{{t("String operation", { ns: "${p}" })}}`},{value:"date",title:`{{t("Date", { ns: "${p}" })}}`}];function At(e){return Array.from(X.getEntities()).filter(([o,t])=>t.group===e)}function ar({calculator:e,operands:o=[],onChange:t}){const r=l.useCompile(),s=me(),a=me(),i=b.useCallback(d=>t({calculator:e,operands:[d,o[1]]}),[e,t,o]),c=b.useCallback(d=>t({calculator:e,operands:[o[0],d]}),[e,t,o]),u=b.useCallback(d=>t({operands:o,calculator:d}),[t,o]);return n.jsxs("fieldset",{className:l.css`
|
|
517
|
-
display: flex;
|
|
518
|
-
gap: 0.5em;
|
|
519
|
-
align-items: center;
|
|
520
|
-
flex-wrap: wrap;
|
|
521
|
-
`,children:[n.jsx(l.Variable.Input,{changeOnSelect:!0,value:o[0],onChange:i,scope:s,useTypedConstant:!0}),n.jsx(y.Select,{role:"button","aria-label":"select-operator-calc",value:e,onChange:u,placeholder:T("Operator"),popupMatchSelectWidth:!1,className:"auto-width",children:ir.filter(d=>!!At(d.value).length).map(d=>n.jsx(y.Select.OptGroup,{label:r(d.title),children:At(d.value).map(([f,{name:h}])=>n.jsx(y.Select.Option,{value:f,children:r(h)},f))},d.value))}),n.jsx(l.Variable.Input,{changeOnSelect:!0,value:o[1],onChange:c,scope:a,useTypedConstant:!0})]})}function cr({value:e,onChange:o,onRemove:t}){if(!e)return null;const{calculator:r,operands:s=[]}=e;return n.jsxs("div",{className:l.css`
|
|
522
|
-
display: flex;
|
|
523
|
-
position: relative;
|
|
524
|
-
margin: 0.5em 0;
|
|
525
|
-
`,children:[e.group?n.jsx(Ft,{value:e.group,onChange:a=>o(A(C({},e),{group:a}))}):n.jsx(ar,{operands:s,calculator:r,onChange:o}),n.jsx(y.Button,{"aria-label":"icon-close",onClick:t,type:"link",icon:n.jsx(I.CloseCircleOutlined,{})})]})}function Ft({value:e,onChange:o}){const{t}=Q.useTranslation(),{type:r="and",calculations:s=[]}=e;function a(){o(A(C({},e),{calculations:[...s,{not:!1,calculator:"equal"}]}))}function i(){o(A(C({},e),{calculations:[...s,{not:!1,group:{type:"and",calculations:[]}}]}))}function c(d){s.splice(d,1),o(A(C({},e),{calculations:[...s]}))}function u(d,f){s.splice(d,1,f),o(A(C({},e),{calculations:[...s]}))}return n.jsxs("div",{className:l.cx("node-type-condition-group",l.css`
|
|
526
|
-
position: relative;
|
|
527
|
-
width: 100%;
|
|
528
|
-
.node-type-condition-group {
|
|
529
|
-
padding: 0.5em 1em;
|
|
530
|
-
border: 1px dashed #ddd;
|
|
531
|
-
}
|
|
532
|
-
+ button {
|
|
533
|
-
position: absolute;
|
|
534
|
-
right: 0;
|
|
535
|
-
}
|
|
536
|
-
`),children:[n.jsx("div",{className:l.css`
|
|
537
|
-
display: flex;
|
|
538
|
-
align-items: center;
|
|
539
|
-
gap: 0.5em;
|
|
540
|
-
.ant-select {
|
|
541
|
-
width: auto;
|
|
542
|
-
min-width: 6em;
|
|
543
|
-
}
|
|
544
|
-
`,children:n.jsxs(Q.Trans,{children:["Meet ",n.jsxs(y.Select,{role:"button","data-testid":"filter-select-all-or-any",value:r,onChange:d=>o(A(C({},e),{type:d})),children:[n.jsx(y.Select.Option,{value:"and",children:"All"}),n.jsx(y.Select.Option,{value:"or",children:"Any"})]})," conditions in the group"]})}),n.jsx("div",{className:"calculation-items",children:s.map((d,f)=>n.jsx(cr,{value:d,onChange:u.bind(this,f),onRemove:()=>c(f)},`${d.calculator}_${f}`))}),n.jsxs("div",{className:l.css`
|
|
545
|
-
button {
|
|
546
|
-
padding: 0;
|
|
547
|
-
&:not(:last-child) {
|
|
548
|
-
margin-right: 1em;
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
`,children:[n.jsx(y.Button,{type:"link",onClick:a,children:t("Add condition")}),n.jsx(y.Button,{type:"link",onClick:i,children:t("Add condition group")})]})]})}function dr({value:e,onChange:o}){const t=e&&Object.keys(e).length?e:{group:{type:"and",calculations:[]}};return n.jsx(Ft,{value:t.group,onChange:r=>o(A(C({},t),{group:r}))})}class ur extends ge{constructor(){super(...arguments);w(this,"title",`{{t("Condition", { ns: "${p}" })}}`);w(this,"type","condition");w(this,"group","control");w(this,"description",`{{t('Based on boolean result of the calculation to determine whether to "continue" or "exit" the process, or continue on different branches of "yes" and "no".', { ns: "${p}" })}}`);w(this,"fieldset",{rejectOnFalse:{type:"boolean",title:`{{t("Mode", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{disabled:!0},enum:[{value:!0,label:`{{t('Continue when "Yes"', { ns: "${p}" })}}`},{value:!1,label:`{{t('Branch into "Yes" and "No"', { ns: "${p}" })}}`}]},engine:{type:"string",title:`{{t("Calculation engine", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[["basic",{label:`{{t("Basic", { ns: "${p}" })}}`}],...Array.from(De.evaluators.getEntities()).filter(([t])=>["math.js","formula.js"].includes(t))].reduce((t,[r,s])=>t.concat(C({value:r},s)),[])},required:!0,default:"basic"},calculation:{type:"string",title:`{{t("Condition", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"CalculationConfig","x-reactions":{dependencies:["engine"],fulfill:{state:{visible:'{{$deps[0] === "basic"}}'}}},required:!0},expression:{type:"string",title:`{{t("Condition expression", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{changeOnSelect:!0},"x-validator"(t,r,{form:s}){const{values:a}=s,{evaluate:i}=De.evaluators.get(a.engine),c=t.trim().replace(/{{([^{}]+)}}/g," 1 ");try{return i(c),""}catch(u){return T("Expression syntax error")}},"x-reactions":{dependencies:["engine"],fulfill:{state:{visible:'{{$deps[0] !== "basic"}}'},schema:{description:"{{renderEngineReference($deps[0])}}"}}},required:!0}});w(this,"options",[{label:`{{t('Continue when "Yes"', { ns: "${p}" })}}`,key:"rejectOnFalse",value:{rejectOnFalse:!0}},{label:`{{t('Branch into "Yes" and "No"', { ns: "${p}" })}}`,key:"branch",value:{rejectOnFalse:!1}}]);w(this,"scope",{renderEngineReference:St,useWorkflowVariableOptions:me});w(this,"components",{CalculationConfig:dr,WorkflowVariableTextArea:Io,RadioWithTooltip:Te})}Component({data:t}){const{t:r}=Q.useTranslation(),{nodes:s}=G(),{styles:a}=ne(),{id:i,config:{rejectOnFalse:c}}=t,u=s.find(f=>f.upstreamId===i&&f.branchIndex===1),d=s.find(f=>f.upstreamId===i&&f.branchIndex===0);return n.jsx(ko,{data:t,children:c?null:n.jsxs("div",{className:a.nodeSubtreeClass,children:[n.jsxs("div",{className:a.branchBlockClass,children:[n.jsx(Ke,{from:t,entry:d,branchIndex:0}),n.jsx(Ke,{from:t,entry:u,branchIndex:1})]}),n.jsxs("div",{className:a.conditionClass,children:[n.jsx("span",{style:{right:"4em"},children:r("No")}),n.jsx("span",{style:{left:"4em"},children:r("Yes")})]})]})})}}class pr extends ge{constructor(){super(...arguments);w(this,"title",`{{t("End process", { ns: "${p}" })}}`);w(this,"type","end");w(this,"group","control");w(this,"description",`{{t("End the process immediately, with set status.", { ns: "${p}" })}}`);w(this,"fieldset",{endStatus:{type:"number",title:`{{t("End status", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:`{{t("Succeeded", { ns: "${p}" })}}`,value:ie.RESOLVED},{label:`{{t("Failed", { ns: "${p}" })}}`,value:ie.FAILED}],required:!0,default:ie.RESOLVED}});w(this,"end",!0)}}function oo({value:e,onChange:o,renderSchemaComponent:t}){const r=me();return n.jsx(l.Variable.Input,{value:e,onChange:o,scope:r,children:t()})}function mr(e){const{execution:o,nodes:t}=G(),r=b.useMemo(()=>t.reduce((i,c)=>Object.assign(i,{[c.id]:c.key}),{}),[t]),s=b.useMemo(()=>{var i;return{$context:o==null?void 0:o.context,$jobsMapByNodeKey:((i=o==null?void 0:o.jobs)!=null?i:[]).reduce((c,u)=>Object.assign(c,{[r[u.nodeId]]:u.result}),{})}},[o==null?void 0:o.context,o==null?void 0:o.jobs,r]);return b.useMemo(()=>ke.get(s,e),[s,e])}function fr({collection:e,dataPath:o,children:t}){const r=L.useField(),s=b.useRef(null),{getAssociationAppends:a}=l.useAssociationNames(),{appends:i,updateAssociationValues:c}=a(),u=mr(o);let d,f;if(typeof e=="string"){const B=l.parseCollectionName(e);d=B[0],f=B[1]}else f=e;const h=b.useMemo(()=>le.createForm({values:u,readPretty:!0}),[u]),x={appends:i},g={loading:!1,data:{data:u}},k=l.useAPIClient().resource(f),O=l.useBlockRequestContext();return n.jsx(l.CollectionProvider_deprecated,{dataSource:d,collection:f,children:n.jsx(l.RecordProvider,{record:u,parent:null,children:n.jsx(l.BlockRequestContext_deprecated.Provider,{value:{block:"form",field:r,service:g,resource:k,__parent:O},children:n.jsx(l.FormBlockContext.Provider,{value:{params:x,form:h,field:r,service:g,updateAssociationValues:c,formBlockRef:s},children:t})})})})}function hr(e){const a=e,{options:o=[],direction:t}=a,r=Z(a,["options","direction"]),s=l.useCompile();return n.jsx(y.Checkbox.Group,A(C({},r),{children:n.jsx(y.Space,{direction:t,children:o.map(i=>n.jsxs(y.Checkbox,{value:i.value,children:[n.jsx("span",{className:l.css`
|
|
552
|
-
& + .anticon {
|
|
553
|
-
margin-left: 0.25em;
|
|
554
|
-
}
|
|
555
|
-
`,children:s(i.label)}),i.tooltip&&n.jsx(y.Tooltip,{title:s(i.tooltip),children:n.jsx(I.QuestionCircleOutlined,{style:{color:"#666"}})})]},i.value))})}))}function yr({key:e,title:o,config:t},r){var d,f;const[s,a]=l.parseCollectionName(t.collection),i=l.useCompile(),c=je(s),[u]=Ae(A(C({appends:[e,...((f=(d=t.params)==null?void 0:d.appends)==null?void 0:f.map(h=>`${e}.${h}`))||[]]},r),{fields:[{collectionName:a,name:e,type:"hasOne",target:a,uiSchema:{title:o}}],compile:i,getCollectionFields:c}));return u}class gr extends ge{constructor(){super(...arguments);w(this,"title",`{{t("Query record", { ns: "${p}" })}}`);w(this,"type","query");w(this,"group","collection");w(this,"description",`{{t("Query records from a collection. You can use variables from upstream nodes as query conditions.", { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...ae["x-reactions"],{target:"params",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}]}),multiple:{type:"boolean",title:`{{t("Result type", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[{label:`{{t("Single record", { ns: "${p}" })}}`,value:!1,tooltip:`{{t("The result will be an object of the first matching record only, or null if no matched record.", { ns: "${p}" })}}`},{label:`{{t("Multiple records", { ns: "${p}" })}}`,value:!0,tooltip:`{{t("The result will be an array containing matched records, or an empty one if no matching records. This can be used to be processed in a loop node.", { ns: "${p}" })}}`}]},required:!0,default:!1},params:{type:"object","x-component":"fieldset",properties:{filter:_e,sort:Nn,pagination:En,appends:Ve},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{$deps[0] != null}}"}}}]},failOnEmpty:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":`{{t("Exit when query result is null", { ns: "${p}" })}}`}});w(this,"scope",{useNodeSavedConfig:Me,useCollectionDataSource:l.useCollectionDataSource,useSortableFields(){const t=l.useCompile(),{values:r}=L.useForm(),[s,a]=l.parseCollectionName(r.collection),i=l.useApp(),{collectionManager:c}=i.dataSourceManager.getDataSource(s);return c.getCollectionFields(a).filter(d=>{if(!d.interface)return!1;const f=i.dataSourceManager.collectionFieldInterfaceManager.getFieldInterface(d.interface);return!!(f!=null&&f.sortable)}).map(d=>{var f,h;return{value:d.name,label:(f=d==null?void 0:d.uiSchema)!=null&&f.title?t((h=d==null?void 0:d.uiSchema)==null?void 0:h.title):d.name}})}});w(this,"components",{ArrayItems:jo.ArrayItems,FilterDynamicComponent:oo,SchemaComponentContext:l.SchemaComponentContext,WorkflowVariableInput:lt,RadioWithTooltip:Te});w(this,"useVariables",yr)}useInitializers(t){var r,s;return!t.config.collection||t.config.multiple?null:{name:(r=t.title)!=null?r:`#${t.id}`,type:"item",title:(s=t.title)!=null?s:`#${t.id}`,Component:Be,collection:t.config.collection,dataPath:`$jobsMapByNodeKey.${t.key}`}}}function br(e){const{getCollectionFields:o}=l.useCollectionManager_deprecated(),{path:t}=L.useField(),r=t.segments[t.segments.length-1],{values:s}=L.useForm(),[a,i]=l.parseCollectionName(s==null?void 0:s.collection),c=o(i,a),{type:u}=c.find(h=>h.name===r),d=Array.isArray(e.value)?e.value.join(","):e.value,f=b.useCallback(h=>{const x=h.target.value.trim(),g=["belongsTo","hasOne"].includes(u)?x||null:x.split(",").map(m=>m.trim()).filter(m=>m!=="");e.onChange(g)},[e.onChange,u]);return n.jsx(y.Input,A(C({},e),{value:d,onChange:f}))}const Ot=L.observer(({value:e,disabled:o,onChange:t,filter:r})=>{const{token:s}=l.useToken(),{t:a}=Q.useTranslation(),i=l.useCompile(),c=L.useForm(),{getCollectionFields:u}=l.useCollectionManager_deprecated(),d=me(),{values:f}=c,[h,x]=l.parseCollectionName(f==null?void 0:f.collection),g=u(x,h).filter(S=>S.uiSchema),m=r?g.filter(r.bind(f)):g,k=b.useMemo(()=>m.filter(S=>!e||!(S.name in e)),[m,e]),O=o||c.disabled,B=b.useMemo(()=>({onClick:({key:S})=>{t(A(C({},e),{[S]:null}))},style:{maxHeight:300,overflowY:"auto"},items:k.map(S=>{var E,W;return{key:S.name,label:i((W=(E=S.uiSchema)==null?void 0:E.title)!=null?W:S.name)}})}),[t,k,e]);return n.jsx("fieldset",{className:l.css`
|
|
556
|
-
margin-top: 0.5em;
|
|
557
|
-
|
|
558
|
-
> .ant-formily-item {
|
|
559
|
-
flex-direction: column;
|
|
560
|
-
|
|
561
|
-
> .ant-formily-item-label {
|
|
562
|
-
line-height: 32px;
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
`,children:m.length?n.jsxs(l.CollectionProvider_deprecated,{name:x,dataSource:h,children:[m.filter(S=>e&&S.name in e).map(S=>{var W,$;const E=["belongsTo","hasOne","hasMany","belongsToMany"].includes(S.type)?br:l.CollectionField;return n.jsxs(y.Form.Item,{label:i(($=(W=S.uiSchema)==null?void 0:W.title)!=null?$:S.name),labelAlign:"left",className:l.css`
|
|
566
|
-
.ant-form-item-control-input-content {
|
|
567
|
-
display: flex;
|
|
568
|
-
}
|
|
569
|
-
`,children:[n.jsx(l.Variable.Input,{scope:d,value:e[S.name],changeOnSelect:!0,onChange:M=>{t(A(C({},e),{[S.name]:M}))},children:n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[S.name]:{"x-component":E,"x-validator"(){return""}}}}})}),O?null:n.jsx(y.Button,{"aria-label":"icon-close",type:"link",icon:n.jsx(I.CloseCircleOutlined,{}),onClick:()=>{var F;const D=e,{[F=S.name]:M}=D,N=Z(D,[Kt(F)]);t(N)}})]},S.name)}),k.length?n.jsx(y.Dropdown,{menu:B,children:n.jsx(y.Button,{icon:n.jsx(I.PlusOutlined,{}),children:a("Add field")})}):null]}):n.jsx("p",{style:{color:s.colorText},children:T("Please select collection first")})})},{displayName:"CollectionFieldSet"});function Tt(e,o){o(e),e!=null&&e.properties&&Object.values(e.properties).forEach(t=>{Tt(t,o)})}function Nt(){return{name:ho.uid(),type:"void","x-component":"Grid","x-initializer":"assignFieldValuesForm:configureFields"}}function Et(e){const{workflow:o}=G(),{setFormValueChanged:t}=l.useActionContext();l.useAPIClient();const r=me(),s=L.useForm(),{values:a,setValuesIn:i}=s,c=fo.toJS(a.params),[u,d]=l.parseCollectionName(a.collection),f=l.useSchemaOptionsContext(),[h,x]=b.useState(e.value&&Object.keys(e.value).length?e.value:Nt()),g=b.useMemo(()=>le.createForm({initialValues:c.values,disabled:o.executed,effects(){le.onFormValuesChange(k=>{i("params.values",fo.toJS(k.values)),t(!0)})}}),[o.executed]);L.useFormEffects(()=>{le.onFieldValueChange("collection",k=>U(this,null,function*(){g.clearFormGraph("*");const O=Nt();i("params.values",{}),x(O)}))});const m=b.useCallback(k=>{const[O]=Object.values(k.toJSON().properties);e.onChange(O);const B=new Set;Tt(O,E=>{var W;if(E["x-component"]==="AssignedField"&&(W=E["x-collection-field"])!=null&&W.startsWith(`${d}.`)){const[,$]=E["x-collection-field"].split(".");B.add($)}});const S={};Array.from(B).forEach(E=>{E in g.values&&(S[E]=g.values[E])}),i("params.values",S)},[d,e.onChange]);return n.jsx(y.Card,{children:n.jsx(l.CollectionManagerProvider,{dataSource:u,children:n.jsx(l.CollectionProvider,{name:d,children:n.jsx(l.FormProvider,{form:g,children:n.jsx(jo.FormLayout,{layout:"vertical",children:n.jsx(l.VariableScopeProvider,{scope:r,children:n.jsx(l.SchemaComponentProvider,{form:g,designable:!s.disabled,children:n.jsx(l.SchemaComponentOptions,A(C({},f),{children:n.jsx(l.SchemaComponent,{schema:h,onChange:m})}))})})})})})})})}function vr({key:e,title:o,config:t},r){var d,f;const[s,a]=l.parseCollectionName(t.collection),i=l.useCompile(),c=je(s),[u]=Ae(A(C({appends:[e,...((f=(d=t.params)==null?void 0:d.appends)==null?void 0:f.map(h=>`${e}.${h}`))||[]]},r),{fields:[{collectionName:a,name:e,type:"hasOne",target:a,uiSchema:{title:o}}],compile:i,getCollectionFields:c}));return u}class xr extends ge{constructor(){super(...arguments);w(this,"title",`{{t("Create record", { ns: "${p}" })}}`);w(this,"type","create");w(this,"group","collection");w(this,"description",`{{t("Add new record to a collection. You can use variables from upstream nodes to assign values to fields.", { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...ae["x-reactions"],{target:"params",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),usingAssignFormSchema:{type:"boolean"},assignFormSchema:{type:"object",title:'{{t("Fields values")}}',"x-decorator":"FormItem","x-component":"AssignedFieldsFormSchemaConfig","x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && $deps[1]) ? "visible" : "hidden"}}'}}}]},params:{type:"object",properties:{values:A(C({},et),{"x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && !$deps[1]) ? "visible" : "hidden"}}'}}}]}),appends:Ve}}});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource,useNodeSavedConfig:Me});w(this,"components",{CollectionFieldset:Ot,AssignedFieldsFormSchemaConfig:Et});w(this,"useVariables",vr)}createDefaultConfig(){return{usingAssignFormSchema:!0,assignFormSchema:{}}}useInitializers(t){var r,s;return t.config.collection?{name:(r=t.title)!=null?r:`#${t.id}`,type:"item",title:(s=t.title)!=null?s:`#${t.id}`,Component:Be,collection:t.config.collection,dataPath:`$jobsMapByNodeKey.${t.key}`}:null}}class wr extends ge{constructor(){super(...arguments);w(this,"title",`{{t("Update record", { ns: "${p}" })}}`);w(this,"type","update");w(this,"group","collection");w(this,"description",`{{t("Update records of a collection. You can use variables from upstream nodes as query conditions and field values.", { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...ae["x-reactions"],{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params.filter",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}},{target:"params.values",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),params:{type:"object",properties:{individualHooks:{type:"boolean",title:`{{t("Update mode", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[{label:`{{t("Update in a batch", { ns: "${p}" })}}`,value:!1,tooltip:`{{t("Update all eligible data at one time, which has better performance when the amount of data is large. But the updated data will not trigger other workflows, and will not record audit logs.", { ns: "${p}" })}}`},{label:`{{t("Update one by one", { ns: "${p}" })}}`,value:!0,tooltip:`{{t("The updated data can trigger other workflows, and the audit log will also be recorded. But it is usually only applicable to several or dozens of pieces of data, otherwise there will be performance problems.", { ns: "${p}" })}}`}]},default:!1},filter:A(C({},_e),{title:`{{t("Only update records matching conditions", { ns: "${p}" })}}`,"x-validator"(t){return J.isValidFilter(t)?"":T("Please add at least one condition")}}),values:A(C({},et),{"x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && !$deps[1]) ? "visible" : "hidden"}}'}}}]})}},usingAssignFormSchema:{type:"boolean"},assignFormSchema:{type:"object",title:'{{t("Fields values")}}',"x-decorator":"FormItem","x-component":"AssignedFieldsFormSchemaConfig","x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && $deps[1]) ? "visible" : "hidden"}}'}}}]}});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource,useNodeSavedConfig:Me});w(this,"components",{FilterDynamicComponent:oo,CollectionFieldset:Ot,AssignedFieldsFormSchemaConfig:Et,RadioWithTooltip:Te})}createDefaultConfig(){return{usingAssignFormSchema:!0,assignFormSchema:{}}}}class Cr extends ge{constructor(){super(...arguments);w(this,"title",'{{t("Delete record")}}');w(this,"type","destroy");w(this,"group","collection");w(this,"description",`{{t("Delete records of a collection. Could use variables in workflow context as filter. All records match the filter will be deleted.", { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...ae["x-reactions"],{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),params:{type:"object",properties:{filter:A(C({},_e),{"x-validator"(t){return J.isValidFilter(t)?"":T("Please add at least one condition")}})}}});w(this,"scope",{useNodeSavedConfig:Me,useCollectionDataSource:l.useCollectionDataSource});w(this,"components",{FilterDynamicComponent:oo})}}const kr=new l.SchemaSettings({name:"actionSettings:submitToWorkflow",items:[{name:"editButton",Component:l.ButtonEditor,useComponentProps(){const{buttonEditorProps:e}=l.useSchemaToolbar();return e}},{name:"secondConfirmation",Component:l.SecondConFirm},{name:"assignFieldValues",Component:l.AssignedFieldValues},{name:"skipRequiredValidation",Component:l.SkipValidation},{name:"afterSuccessfulSubmission",Component:l.AfterSuccess,useVisible(){var o;const e=L.useFieldSchema();return ho.isValid((o=e==null?void 0:e["x-action-settings"])==null?void 0:o.onSuccess)}},{name:"bindWorkflow",Component:l.WorkflowConfig},{name:"delete",sort:100,Component:l.RemoveButton,useComponentProps(){const{removeButtonProps:e}=l.useSchemaToolbar();return e}}]});function Sr({children:e,workflow:o,execution:t,nodes:r}){const s=l.usePlugin(de),a=s.triggers.get(o.type).components,i=r.reduce((c,{type:u})=>Object.assign(c,s.instructions.get(u).components),{});return n.jsx(Ie.Provider,{value:{workflow:o,nodes:r,execution:t},children:n.jsx(l.SchemaComponentOptions,{components:C(C({},a),i),children:e})})}class de extends l.Plugin{constructor(){super(...arguments);w(this,"triggers",new J.Registry);w(this,"instructions",new J.Registry);w(this,"getTriggersOptions",()=>Array.from(this.triggers.getEntities()).map(a=>{var[t,i]=a,c=i,{title:r}=c,s=Z(c,["title"]);return{value:t,label:r,color:"gold",options:s}}))}isWorkflowSync(t){var r,s;return(s=(r=this.triggers.get(t.type))==null?void 0:r.sync)!=null?s:t.sync}registerTrigger(t,r){if(typeof r=="function")this.triggers.register(t,new r);else if(r)this.triggers.register(t,r);else throw new TypeError("invalid trigger type to register")}registerInstruction(t,r){if(typeof r=="function")this.instructions.register(t,new r);else if(r instanceof ge)this.instructions.register(t,r);else throw new TypeError("invalid instruction type to register")}load(){return U(this,null,function*(){this.app.router.add("admin.workflow.workflows.id",{path:xe(":id"),element:n.jsx(Xo,{})}),this.app.router.add("admin.workflow.executions.id",{path:Ye(":id"),element:n.jsx(qo,{})}),this.app.addComponents({WorkflowPage:Xo,ExecutionPage:qo}),this.app.pluginSettingsManager.add(p,{icon:"PartitionOutlined",title:`{{t("Workflow", { ns: "${p}" })}}`,Component:Fn,aclSnippet:"pm.workflow.workflows"}),this.app.schemaSettingsManager.add(kr),this.registerTrigger("collection",Wn),this.registerTrigger("schedule",nr),this.registerInstruction("calculation",lr),this.registerInstruction("condition",ur),this.registerInstruction("end",pr),this.registerInstruction("query",gr),this.registerInstruction("create",xr),this.registerInstruction("update",wr),this.registerInstruction("destroy",Cr)})}}v.BaseTypeSets=Ze,v.Branch=Ke,v.CheckboxGroupWithTooltip=hr,v.CollectionBlockInitializer=Be,v.DetailsBlockProvider=fr,v.EXECUTION_STATUS=pe,v.ExecutionContextProvider=Sr,v.ExecutionStatusOptions=He,v.ExecutionStatusOptionsMap=Ge,v.FieldsSelect=To,v.FilterDynamicComponent=oo,v.FlowContext=Ie,v.Instruction=ge,v.JOB_STATUS=ie,v.JobButton=Co,v.JobStatusOptions=vo,v.JobStatusOptionsMap=qe,v.Node=Ho,v.NodeContext=xo,v.NodeDefaultView=ko,v.RadioWithTooltip=Te,v.RemoveButton=wo,v.SimpleDesigner=kt,v.Trigger=So,v.ValueBlock=Ne,v.WorkflowVariableInput=lt,v.WorkflowVariableJSON=In,v.WorkflowVariableRawTextArea=Dn,v.WorkflowVariableTextArea=Io,v.default=de,v.defaultFieldNames=Se,v.getCollectionFieldOptions=Ae,v.getWorkflowDetailPath=xe,v.getWorkflowExecutionsPath=Ye,v.linkNodes=Fo,v.nodesOptions=ot,v.scopeOptions=nt,v.systemOptions=rt,v.traverseSchema=Oo,v.triggerOptions=tt,v.useAvailableUpstreams=Jo,v.useFlowContext=G,v.useGetAriaLabelOfAddButton=bo,v.useGetCollectionFields=je,v.useNodeContext=ve,v.useNodeSavedConfig=Me,v.useRecordTriggerWorkflowsActionProps=Mn,v.useStyles=ne,v.useTrigger=Ao,v.useTriggerWorkflowsActionProps=Pn,v.useUpstreamScopes=Uo,v.useWorkflowAnyExecuted=it,v.useWorkflowExecuted=Bn,v.useWorkflowVariableOptions=me,Object.defineProperties(v,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|