@nocobase/plugin-workflow 0.12.0-alpha.4 → 0.13.0-alpha.1

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.
@@ -89,6 +89,130 @@
89
89
  description ? /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: description }) : null
90
90
  ] });
91
91
  }
92
+ const EXECUTION_STATUS = {
93
+ QUEUEING: null,
94
+ STARTED: 0,
95
+ RESOLVED: 1,
96
+ FAILED: -1,
97
+ ERROR: -2,
98
+ ABORTED: -3,
99
+ CANCELED: -4,
100
+ REJECTED: -5
101
+ };
102
+ const ExecutionStatusOptions = [
103
+ {
104
+ value: EXECUTION_STATUS.QUEUEING,
105
+ label: `{{t("Queueing", { ns: "${NAMESPACE}" })}}`,
106
+ color: "blue",
107
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.HourglassOutlined, {}),
108
+ description: `{{t("Triggered but still waiting in queue to execute.", { ns: "${NAMESPACE}" })}}`
109
+ },
110
+ {
111
+ value: EXECUTION_STATUS.STARTED,
112
+ label: `{{t("On going", { ns: "${NAMESPACE}" })}}`,
113
+ color: "gold",
114
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.LoadingOutlined, {}),
115
+ description: `{{t("Started and executing, maybe waiting for an async callback (manual, delay etc.).", { ns: "${NAMESPACE}" })}}`
116
+ },
117
+ {
118
+ value: EXECUTION_STATUS.RESOLVED,
119
+ label: `{{t("Resolved", { ns: "${NAMESPACE}" })}}`,
120
+ color: "green",
121
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.CheckOutlined, {}),
122
+ description: `{{t("Successfully finished.", { ns: "${NAMESPACE}" })}}`
123
+ },
124
+ {
125
+ value: EXECUTION_STATUS.FAILED,
126
+ label: `{{t("Failed", { ns: "${NAMESPACE}" })}}`,
127
+ color: "red",
128
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.ExclamationOutlined, {}),
129
+ description: `{{t("Failed to satisfy node configurations.", { ns: "${NAMESPACE}" })}}`
130
+ },
131
+ {
132
+ value: EXECUTION_STATUS.ERROR,
133
+ label: `{{t("Error", { ns: "${NAMESPACE}" })}}`,
134
+ color: "red",
135
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.CloseOutlined, {}),
136
+ description: `{{t("Some node meets error.", { ns: "${NAMESPACE}" })}}`
137
+ },
138
+ {
139
+ value: EXECUTION_STATUS.ABORTED,
140
+ label: `{{t("Aborted", { ns: "${NAMESPACE}" })}}`,
141
+ color: "red",
142
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.MinusOutlined, { rotate: 90 }),
143
+ description: `{{t("Running of some node was aborted by program flow.", { ns: "${NAMESPACE}" })}}`
144
+ },
145
+ {
146
+ value: EXECUTION_STATUS.CANCELED,
147
+ label: `{{t("Canceled", { ns: "${NAMESPACE}" })}}`,
148
+ color: "volcano",
149
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.MinusOutlined, { rotate: 45 }),
150
+ description: `{{t("Manually canceled whole execution when waiting.", { ns: "${NAMESPACE}" })}}`
151
+ },
152
+ {
153
+ value: EXECUTION_STATUS.REJECTED,
154
+ label: `{{t("Rejected", { ns: "${NAMESPACE}" })}}`,
155
+ color: "volcano",
156
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.MinusOutlined, {}),
157
+ description: `{{t("Rejected from a manual node.", { ns: "${NAMESPACE}" })}}`
158
+ }
159
+ ];
160
+ const ExecutionStatusOptionsMap = ExecutionStatusOptions.reduce(
161
+ (map, option) => Object.assign(map, { [option.value]: option }),
162
+ {}
163
+ );
164
+ const JOB_STATUS = {
165
+ PENDING: 0,
166
+ RESOLVED: 1,
167
+ FAILED: -1,
168
+ ERROR: -2,
169
+ ABORTED: -3,
170
+ CANCELED: -4,
171
+ REJECTED: -5
172
+ };
173
+ const JobStatusOptions = [
174
+ {
175
+ value: JOB_STATUS.PENDING,
176
+ label: `{{t("Pending", { ns: "${NAMESPACE}" })}}`,
177
+ color: "gold",
178
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.ClockCircleOutlined, {})
179
+ },
180
+ {
181
+ value: JOB_STATUS.RESOLVED,
182
+ label: `{{t("Resolved", { ns: "${NAMESPACE}" })}}`,
183
+ color: "green",
184
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.CheckOutlined, {})
185
+ },
186
+ {
187
+ value: JOB_STATUS.FAILED,
188
+ label: `{{t("Failed", { ns: "${NAMESPACE}" })}}`,
189
+ color: "red",
190
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.ExclamationOutlined, {})
191
+ },
192
+ { value: JOB_STATUS.ERROR, label: `{{t("Error", { ns: "${NAMESPACE}" })}}`, color: "red", icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.CloseOutlined, {}) },
193
+ {
194
+ value: JOB_STATUS.ABORTED,
195
+ label: `{{t("Aborted", { ns: "${NAMESPACE}" })}}`,
196
+ color: "red",
197
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.MinusOutlined, { rotate: 90 })
198
+ },
199
+ {
200
+ value: JOB_STATUS.CANCELED,
201
+ label: `{{t("Canceled", { ns: "${NAMESPACE}" })}}`,
202
+ color: "volcano",
203
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.MinusOutlined, { rotate: 45 })
204
+ },
205
+ {
206
+ value: JOB_STATUS.REJECTED,
207
+ label: `{{t("Rejected", { ns: "${NAMESPACE}" })}}`,
208
+ color: "volcano",
209
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.MinusOutlined, {})
210
+ }
211
+ ];
212
+ const JobStatusOptionsMap = JobStatusOptions.reduce(
213
+ (map, option) => Object.assign(map, { [option.value]: option }),
214
+ {}
215
+ );
92
216
  const useStyles$1 = client.createStyles(({ css: css2, token }) => {
93
217
  return {
94
218
  workflowPageClass: css2`
@@ -104,12 +228,11 @@
104
228
  position: relative;
105
229
  padding: 0.5rem 1rem;
106
230
  background: ${token.colorBgContainer};
107
- border-bottom: 1px solid ${token.colorBorder};
231
+ border-bottom: 1px solid ${token.colorBorderSecondary};
108
232
 
109
233
  header {
110
234
  display: flex;
111
235
  align-items: center;
112
- min-height: 2rem;
113
236
  }
114
237
 
115
238
  aside {
@@ -143,7 +266,7 @@
143
266
  }
144
267
  }
145
268
  `,
146
- workflowVersionDropdownClass: css2`
269
+ dropdownClass: css2`
147
270
  .ant-dropdown-menu-item {
148
271
  justify-content: flex-end;
149
272
  .ant-dropdown-menu-title-content {
@@ -153,11 +276,15 @@
153
276
  text-align: right;
154
277
 
155
278
  time {
156
- width: 12em;
157
- color: ${token.colorText};
279
+ width: 14em;
158
280
  font-size: 80%;
159
281
  }
160
-
282
+ }
283
+ }
284
+ `,
285
+ workflowVersionDropdownClass: css2`
286
+ .ant-dropdown-menu-item {
287
+ .ant-dropdown-menu-title-content {
161
288
  strong {
162
289
  font-weight: normal;
163
290
  }
@@ -177,24 +304,11 @@
177
304
  }
178
305
  `,
179
306
  executionsDropdownRowClass: css2`
180
- .row {
181
- display: flex;
182
- align-items: baseline;
183
-
184
- &.current {
185
- font-weight: bold;
186
- }
187
-
307
+ .ant-dropdown-menu-item {
188
308
  .id {
189
309
  flex-grow: 1;
190
310
  text-align: right;
191
311
  }
192
-
193
- time {
194
- width: 12em;
195
- color: ${token.colorText};
196
- font-size: 80%;
197
- }
198
312
  }
199
313
  `,
200
314
  branchBlockClass: css2`
@@ -364,10 +478,6 @@
364
478
  justify-content: center;
365
479
  align-items: center;
366
480
  color: ${token.colorTextLightSolid};
367
-
368
- &[type='button'] {
369
- border: none;
370
- }
371
481
  `,
372
482
  nodeHeaderClass: css2`
373
483
  position: relative;
@@ -2228,13 +2338,22 @@
2228
2338
  uiSchema: {
2229
2339
  title: lang("Trigger data")
2230
2340
  }
2341
+ },
2342
+ {
2343
+ collectionName: "users",
2344
+ name: "user",
2345
+ type: "hasOne",
2346
+ target: "users",
2347
+ uiSchema: {
2348
+ title: lang("User submitted form")
2349
+ }
2231
2350
  }
2232
2351
  ];
2233
2352
  const result = getCollectionFieldOptions({
2234
2353
  // depth,
2235
2354
  ...options,
2236
2355
  fields: rootFields,
2237
- appends: ["data", ...((_a = config.appends) == null ? void 0 : _a.map((item) => `data.${item}`)) || []],
2356
+ appends: ["data", "user", ...((_a = config.appends) == null ? void 0 : _a.map((item) => `data.${item}`)) || []],
2238
2357
  compile,
2239
2358
  getCollectionFields
2240
2359
  });
@@ -2949,9 +3068,10 @@
2949
3068
  return opts.find((item) => !(v2 % item.value));
2950
3069
  }
2951
3070
  function getRepeatTypeValue(v2) {
3071
+ let option;
2952
3072
  switch (typeof v2) {
2953
3073
  case "number":
2954
- const option = getNumberOption$1(v2);
3074
+ option = getNumberOption$1(v2);
2955
3075
  return option ? option.value : "none";
2956
3076
  case "string":
2957
3077
  return "cron";
@@ -2968,7 +3088,8 @@
2968
3088
  onChange: (v2) => onChange(v2 * option.value),
2969
3089
  min: 1,
2970
3090
  addonBefore: t("Every"),
2971
- addonAfter: t(option.unitText)
3091
+ addonAfter: t(option.unitText),
3092
+ className: "auto-width"
2972
3093
  }
2973
3094
  );
2974
3095
  }
@@ -2997,6 +3118,7 @@
2997
3118
  gap: 0.5em;
2998
3119
 
2999
3120
  .react-js-cron {
3121
+ width: 100%;
3000
3122
  padding: 0.5em 0.5em 0 0.5em;
3001
3123
  border: 1px dashed #ccc;
3002
3124
 
@@ -3011,10 +3133,16 @@
3011
3133
  margin: 0 0.5em 0 0;
3012
3134
  }
3013
3135
  }
3136
+
3137
+ .react-js-cron-week-days {
3138
+ > span {
3139
+ min-width: 2em;
3140
+ }
3141
+ }
3014
3142
  }
3015
3143
  `,
3016
3144
  children: [
3017
- /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Select, { value: typeValue, onChange: onTypeChange, children: RepeatOptions.map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Select.Option, { value: item.value, children: t(item.text) }, item.value)) }),
3145
+ /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Select, { value: typeValue, onChange: onTypeChange, className: "auto-width", children: RepeatOptions.map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Select.Option, { value: item.value, children: t(item.text) }, item.value)) }),
3018
3146
  typeof typeValue === "number" ? /* @__PURE__ */ jsxRuntimeExports.jsx(CommonRepeatField, { value, onChange }) : null,
3019
3147
  typeValue === "cron" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
3020
3148
  J,
@@ -3223,7 +3351,8 @@
3223
3351
  "x-component-props": {
3224
3352
  className: client.css`
3225
3353
  .ant-input-number {
3226
- width: 4em;
3354
+ width: auto;
3355
+ min-width: 6em;
3227
3356
  }
3228
3357
 
3229
3358
  .ant-picker {
@@ -3692,25 +3821,22 @@
3692
3821
  }
3693
3822
  function filterTypedFields({ fields, types, appends: appends2, compile, getCollectionFields }) {
3694
3823
  return fields.filter((field) => {
3695
- const match = (types == null ? void 0 : types.length) ? types.some((type) => matchFieldType(field, type, appends2)) : true;
3824
+ if (types == null ? void 0 : types.length) {
3825
+ return types.some((type) => matchFieldType(field, type, appends2));
3826
+ }
3696
3827
  if (isAssociationField(field)) {
3697
3828
  const nextAppends = getNextAppends(field, appends2);
3698
3829
  const included = appends2.includes(field.name);
3699
- if (match) {
3700
- return included;
3701
- } else {
3702
- return (nextAppends.length || included) && filterTypedFields({
3703
- fields: getNormalizedFields(field.target, { compile, getCollectionFields }),
3704
- types,
3705
- // depth: depth - 1,
3706
- appends: nextAppends,
3707
- compile,
3708
- getCollectionFields
3709
- }).length;
3710
- }
3711
- } else {
3712
- return match;
3830
+ return (nextAppends.length || included) && filterTypedFields({
3831
+ fields: getNormalizedFields(field.target, { compile, getCollectionFields }),
3832
+ types,
3833
+ // depth: depth - 1,
3834
+ appends: nextAppends,
3835
+ compile,
3836
+ getCollectionFields
3837
+ }).length;
3713
3838
  }
3839
+ return true;
3714
3840
  });
3715
3841
  }
3716
3842
  function useWorkflowVariableOptions(options = {}) {
@@ -3901,7 +4027,7 @@
3901
4027
  ValueBlock.Result = Result$1;
3902
4028
  function matchToManyField(field, appends2) {
3903
4029
  const fieldPrefix = `${field.name}.`;
3904
- return ["hasMany", "belongsToMany"].includes(field.type) && (appends2 ? appends2.includes(field.name) || appends2.some((item) => item.startsWith(fieldPrefix)) : true);
4030
+ return ["hasOne", "belongsTo"].includes(field.type) && (appends2 ? appends2.includes(field.name) || appends2.some((item) => item.startsWith(fieldPrefix)) : true) || ["hasMany", "belongsToMany"].includes(field.type);
3905
4031
  }
3906
4032
  function useAssociatedFields() {
3907
4033
  const compile = client.useCompile();
@@ -4891,7 +5017,7 @@
4891
5017
  const scope = useWorkflowVariableOptions();
4892
5018
  const { values: config } = form;
4893
5019
  const collectionName = config == null ? void 0 : config.collection;
4894
- const collectionFields = getCollectionFields(collectionName);
5020
+ const collectionFields = getCollectionFields(collectionName).filter((field) => field.uiSchema);
4895
5021
  const fields = filter2 ? collectionFields.filter(filter2.bind(config)) : collectionFields;
4896
5022
  const unassignedFields = React.useMemo(() => fields.filter((field) => !value || !(field.name in value)), [fields, value]);
4897
5023
  const mergedDisabled = disabled || form.disabled;
@@ -5107,122 +5233,6 @@
5107
5233
  }
5108
5234
  );
5109
5235
  }
5110
- const EXECUTION_STATUS = {
5111
- QUEUEING: null,
5112
- STARTED: 0,
5113
- RESOLVED: 1,
5114
- FAILED: -1,
5115
- ERROR: -2,
5116
- ABORTED: -3,
5117
- CANCELED: -4,
5118
- REJECTED: -5
5119
- };
5120
- const ExecutionStatusOptions = [
5121
- {
5122
- value: EXECUTION_STATUS.QUEUEING,
5123
- label: `{{t("Queueing", { ns: "${NAMESPACE}" })}}`,
5124
- color: "blue",
5125
- description: `{{t("Triggered but still waiting in queue to execute.", { ns: "${NAMESPACE}" })}}`
5126
- },
5127
- {
5128
- value: EXECUTION_STATUS.STARTED,
5129
- label: `{{t("On going", { ns: "${NAMESPACE}" })}}`,
5130
- color: "gold",
5131
- description: `{{t("Started and executing, maybe waiting for an async callback (manual, delay etc.).", { ns: "${NAMESPACE}" })}}`
5132
- },
5133
- {
5134
- value: EXECUTION_STATUS.RESOLVED,
5135
- label: `{{t("Resolved", { ns: "${NAMESPACE}" })}}`,
5136
- color: "green",
5137
- description: `{{t("Successfully finished.", { ns: "${NAMESPACE}" })}}`
5138
- },
5139
- {
5140
- value: EXECUTION_STATUS.FAILED,
5141
- label: `{{t("Failed", { ns: "${NAMESPACE}" })}}`,
5142
- color: "red",
5143
- description: `{{t("Failed to satisfy node configurations.", { ns: "${NAMESPACE}" })}}`
5144
- },
5145
- {
5146
- value: EXECUTION_STATUS.ERROR,
5147
- label: `{{t("Error", { ns: "${NAMESPACE}" })}}`,
5148
- color: "red",
5149
- description: `{{t("Some node meets error.", { ns: "${NAMESPACE}" })}}`
5150
- },
5151
- {
5152
- value: EXECUTION_STATUS.ABORTED,
5153
- label: `{{t("Aborted", { ns: "${NAMESPACE}" })}}`,
5154
- color: "red",
5155
- description: `{{t("Running of some node was aborted by program flow.", { ns: "${NAMESPACE}" })}}`
5156
- },
5157
- {
5158
- value: EXECUTION_STATUS.CANCELED,
5159
- label: `{{t("Canceled", { ns: "${NAMESPACE}" })}}`,
5160
- color: "volcano",
5161
- description: `{{t("Manually canceled whole execution when waiting.", { ns: "${NAMESPACE}" })}}`
5162
- },
5163
- {
5164
- value: EXECUTION_STATUS.REJECTED,
5165
- label: `{{t("Rejected", { ns: "${NAMESPACE}" })}}`,
5166
- color: "volcano",
5167
- description: `{{t("Rejected from a manual node.", { ns: "${NAMESPACE}" })}}`
5168
- }
5169
- ];
5170
- const ExecutionStatusOptionsMap = ExecutionStatusOptions.reduce(
5171
- (map, option) => Object.assign(map, { [option.value]: option }),
5172
- {}
5173
- );
5174
- const JOB_STATUS = {
5175
- PENDING: 0,
5176
- RESOLVED: 1,
5177
- FAILED: -1,
5178
- ERROR: -2,
5179
- ABORTED: -3,
5180
- CANCELED: -4,
5181
- REJECTED: -5
5182
- };
5183
- const JobStatusOptions = [
5184
- {
5185
- value: JOB_STATUS.PENDING,
5186
- label: `{{t("Pending", { ns: "${NAMESPACE}" })}}`,
5187
- color: "gold",
5188
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.ClockCircleOutlined, {})
5189
- },
5190
- {
5191
- value: JOB_STATUS.RESOLVED,
5192
- label: `{{t("Resolved", { ns: "${NAMESPACE}" })}}`,
5193
- color: "green",
5194
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.CheckOutlined, {})
5195
- },
5196
- {
5197
- value: JOB_STATUS.FAILED,
5198
- label: `{{t("Failed", { ns: "${NAMESPACE}" })}}`,
5199
- color: "red",
5200
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.ExclamationOutlined, {})
5201
- },
5202
- { value: JOB_STATUS.ERROR, label: `{{t("Error", { ns: "${NAMESPACE}" })}}`, color: "red", icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.CloseOutlined, {}) },
5203
- {
5204
- value: JOB_STATUS.ABORTED,
5205
- label: `{{t("Aborted", { ns: "${NAMESPACE}" })}}`,
5206
- color: "red",
5207
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.MinusOutlined, { rotate: 90 })
5208
- },
5209
- {
5210
- value: JOB_STATUS.CANCELED,
5211
- label: `{{t("Canceled", { ns: "${NAMESPACE}" })}}`,
5212
- color: "volcano",
5213
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.MinusOutlined, { rotate: 45 })
5214
- },
5215
- {
5216
- value: JOB_STATUS.REJECTED,
5217
- label: `{{t("Rejected", { ns: "${NAMESPACE}" })}}`,
5218
- color: "volcano",
5219
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.MinusOutlined, {})
5220
- }
5221
- ];
5222
- const JobStatusOptionsMap = JobStatusOptions.reduce(
5223
- (map, option) => Object.assign(map, { [option.value]: option }),
5224
- {}
5225
- );
5226
5236
  const delay = {
5227
5237
  title: `{{t("Delay", { ns: "${NAMESPACE}" })}}`,
5228
5238
  type: "delay",
@@ -7338,20 +7348,39 @@
7338
7348
  var classnamesExports = classnames$1.exports;
7339
7349
  const classnames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
7340
7350
  const useStyles = client.createStyles(({ css: css2, token }) => ({
7341
- statusIconClass: css2`
7342
- padding: 0;
7343
- width: ${token.sizeLG}px;
7344
- height: ${token.sizeLG}px;
7345
- line-height: ${token.sizeLG}px;
7346
- margin-right: 0;
7347
- border-radius: 50%;
7348
- text-align: center;
7351
+ statusButtonClass: css2`
7352
+ border: none;
7353
+ .ant-tag {
7354
+ width: 100%;
7355
+ height: 100%;
7356
+ padding: 0;
7357
+ margin-right: 0;
7358
+ border-radius: 50%;
7359
+ text-align: center;
7360
+ }
7361
+ `,
7362
+ noStatusButtonClass: css2`
7363
+ border-width: 2px;
7349
7364
  `
7350
7365
  }));
7351
- function StatusIcon(props) {
7352
- const { icon, color } = JobStatusOptionsMap[props.status];
7366
+ function StatusButton(props) {
7367
+ var _a;
7353
7368
  const { styles } = useStyles();
7354
- return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Tag, { color, className: classnames(styles.statusIconClass, props.className), children: icon });
7369
+ let tag = null;
7370
+ if (typeof props.status !== "undefined" && ((_a = props.statusMap) == null ? void 0 : _a[props.status])) {
7371
+ const { icon, color } = props.statusMap[props.status];
7372
+ tag = /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Tag, { color, children: icon });
7373
+ }
7374
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
7375
+ antd.Button,
7376
+ {
7377
+ ...props,
7378
+ shape: "circle",
7379
+ size: "small",
7380
+ className: classnames(tag ? styles.statusButtonClass : styles.noStatusButtonClass, props.className),
7381
+ children: tag
7382
+ }
7383
+ );
7355
7384
  }
7356
7385
  const instructions = new client$1.Registry();
7357
7386
  instructions.register("calculation", calculation);
@@ -7382,7 +7411,7 @@
7382
7411
  return;
7383
7412
  }
7384
7413
  await form.submit();
7385
- await ((_b = (_a = api.resource("flow_nodes", data.id)).update) == null ? void 0 : _b.call(_a, {
7414
+ await ((_b = (_a = api.resource("flow_nodes")).update) == null ? void 0 : _b.call(_a, {
7386
7415
  filterByTk: data.id,
7387
7416
  values: {
7388
7417
  config: form.values
@@ -7457,7 +7486,7 @@
7457
7486
  if (!workflow) {
7458
7487
  return null;
7459
7488
  }
7460
- const resource = api.resource("workflows.nodes", workflow.id);
7489
+ const resource = api.resource("flow_nodes");
7461
7490
  async function onRemove() {
7462
7491
  async function onOk() {
7463
7492
  var _a;
@@ -7505,10 +7534,6 @@
7505
7534
  }
7506
7535
  );
7507
7536
  }
7508
- function InnerJobButton({ job, ...props }) {
7509
- const { styles } = useStyles$1();
7510
- return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Button, { ...props, shape: "circle", size: "small", className: client.cx(styles.nodeJobButtonClass, props.className), children: /* @__PURE__ */ jsxRuntimeExports.jsx(StatusIcon, { status: job.status }) });
7511
- }
7512
7537
  function JobButton() {
7513
7538
  const { execution, setViewJob } = useFlowContext();
7514
7539
  const { jobs } = useNodeContext() ?? {};
@@ -7517,19 +7542,7 @@
7517
7542
  return null;
7518
7543
  }
7519
7544
  if (!jobs.length) {
7520
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
7521
- "span",
7522
- {
7523
- className: client.cx(
7524
- styles.nodeJobButtonClass,
7525
- client.css`
7526
- border: 2px solid #d9d9d9;
7527
- border-radius: 50%;
7528
- cursor: not-allowed;
7529
- `
7530
- )
7531
- }
7532
- );
7545
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(StatusButton, { className: styles.nodeJobButtonClass, disabled: true });
7533
7546
  }
7534
7547
  function onOpenJob({ key }) {
7535
7548
  const job = jobs.find((item) => item.id == key);
@@ -7542,32 +7555,33 @@
7542
7555
  items: jobs.map((job) => {
7543
7556
  return {
7544
7557
  key: job.id,
7545
- label: /* @__PURE__ */ jsxRuntimeExports.jsxs(
7546
- "div",
7547
- {
7548
- className: client.css`
7549
- display: flex;
7550
- align-items: center;
7551
- gap: 0.5em;
7552
-
7553
- time {
7554
- color: #999;
7555
- font-size: 0.8em;
7556
- }
7557
- `,
7558
- children: [
7559
- /* @__PURE__ */ jsxRuntimeExports.jsx(StatusIcon, { status: job.status }),
7560
- /* @__PURE__ */ jsxRuntimeExports.jsx("time", { children: client$1.str2moment(job.updatedAt).format("YYYY-MM-DD HH:mm:ss") })
7561
- ]
7562
- }
7563
- )
7558
+ label: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
7559
+ /* @__PURE__ */ jsxRuntimeExports.jsx(StatusButton, { statusMap: JobStatusOptionsMap, status: job.status }),
7560
+ /* @__PURE__ */ jsxRuntimeExports.jsx("time", { children: client$1.str2moment(job.updatedAt).format("YYYY-MM-DD HH:mm:ss") })
7561
+ ] })
7564
7562
  };
7565
7563
  }),
7566
- onClick: onOpenJob
7564
+ onClick: onOpenJob,
7565
+ className: styles.dropdownClass
7567
7566
  },
7568
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(InnerJobButton, { job: jobs[jobs.length - 1] })
7567
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
7568
+ StatusButton,
7569
+ {
7570
+ statusMap: JobStatusOptionsMap,
7571
+ status: jobs[jobs.length - 1].status,
7572
+ className: styles.nodeJobButtonClass
7573
+ }
7574
+ )
7575
+ }
7576
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
7577
+ StatusButton,
7578
+ {
7579
+ statusMap: JobStatusOptionsMap,
7580
+ status: jobs[0].status,
7581
+ onClick: () => setViewJob(jobs[0]),
7582
+ className: styles.nodeJobButtonClass
7569
7583
  }
7570
- ) : /* @__PURE__ */ jsxRuntimeExports.jsx(InnerJobButton, { job: jobs[0], onClick: () => setViewJob(jobs[0]) });
7584
+ );
7571
7585
  }
7572
7586
  function NodeDefaultView(props) {
7573
7587
  const { data, children } = props;
@@ -7988,16 +8002,17 @@
7988
8002
  antd.Dropdown,
7989
8003
  {
7990
8004
  menu: {
7991
- className: styles.executionsDropdownRowClass,
7992
8005
  onClick,
8006
+ defaultSelectedKeys: [`${execution.id}`],
8007
+ className: client.cx(styles.dropdownClass, styles.executionsDropdownRowClass),
7993
8008
  items: [...executionsAfter, execution, ...executionsBefore].map((item) => {
7994
8009
  return {
7995
8010
  key: item.id,
7996
- label: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: classnames("row", { current: item.id === execution.id }), children: [
8011
+ label: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
7997
8012
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "id", children: `#${item.id}` }),
7998
8013
  /* @__PURE__ */ jsxRuntimeExports.jsx("time", { children: client$1.str2moment(item.createdAt).format("YYYY-MM-DD HH:mm:ss") })
7999
8014
  ] }),
8000
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(StatusIcon, { status: item.status })
8015
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(StatusButton, { statusMap: ExecutionStatusOptionsMap, status: item.status }) })
8001
8016
  };
8002
8017
  })
8003
8018
  },
@@ -8409,7 +8424,7 @@
8409
8424
  menu: {
8410
8425
  onClick: onSwitchVersion,
8411
8426
  defaultSelectedKeys: [`${workflow.id}`],
8412
- className: client.cx(styles.workflowVersionDropdownClass),
8427
+ className: client.cx(styles.dropdownClass, styles.workflowVersionDropdownClass),
8413
8428
  items: revisions.sort((a, b2) => b2.id - a.id).map((item, index) => ({
8414
8429
  key: `${item.id}`,
8415
8430
  icon: item.current ? /* @__PURE__ */ jsxRuntimeExports.jsx(icons.RightOutlined, {}) : null,
@@ -8671,13 +8686,14 @@
8671
8686
  type: "object",
8672
8687
  "x-component": "fieldset",
8673
8688
  properties: {
8674
- useTransaction: {
8675
- type: "boolean",
8676
- title: `{{ t("Use transaction", { ns: "${NAMESPACE}" }) }}`,
8677
- description: `{{ t("Data operation nodes in workflow will run in a same transaction until any interruption. Any failure will cause data rollback, and will also rollback the history of the execution.", { ns: "${NAMESPACE}" }) }}`,
8678
- "x-decorator": "FormItem",
8679
- "x-component": "Checkbox"
8680
- },
8689
+ // NOTE: not to expose this option for now, because hard to track errors
8690
+ // useTransaction: {
8691
+ // type: 'boolean',
8692
+ // title: `{{ t("Use transaction", { ns: "${NAMESPACE}" }) }}`,
8693
+ // description: `{{ t("Data operation nodes in workflow will run in a same transaction until any interruption. Any failure will cause data rollback, and will also rollback the history of the execution.", { ns: "${NAMESPACE}" }) }}`,
8694
+ // 'x-decorator': 'FormItem',
8695
+ // 'x-component': 'Checkbox',
8696
+ // },
8681
8697
  deleteExecutionOnStatus: {
8682
8698
  type: "array",
8683
8699
  title: `{{ t("Auto delete history when execution is on end status", { ns: "${NAMESPACE}" }) }}`,
@@ -8745,7 +8761,10 @@
8745
8761
  },
8746
8762
  title: '{{t("Add new")}}',
8747
8763
  properties: {
8748
- ...workflowFieldset,
8764
+ title: workflowFieldset.title,
8765
+ type: workflowFieldset.type,
8766
+ description: workflowFieldset.description,
8767
+ options: workflowFieldset.options,
8749
8768
  footer: {
8750
8769
  type: "void",
8751
8770
  "x-component": "Action.Drawer.Footer",
@@ -8906,7 +8925,10 @@
8906
8925
  },
8907
8926
  title: '{{ t("Edit") }}',
8908
8927
  properties: {
8909
- ...workflowFieldset,
8928
+ title: workflowFieldset.title,
8929
+ enabled: workflowFieldset.enabled,
8930
+ description: workflowFieldset.description,
8931
+ options: workflowFieldset.options,
8910
8932
  footer: {
8911
8933
  type: "void",
8912
8934
  "x-component": "Action.Drawer.Footer",