@steedos-labs/plugin-workflow 3.0.63 → 3.0.64
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/designer/dist/amis-renderer/amis-renderer.css +1 -1
- package/designer/dist/amis-renderer/amis-renderer.js +1 -1
- package/designer/dist/assets/{index-DIAKZCeb.css → index-DvvBwwsG.css} +1 -1
- package/designer/dist/assets/{index-CugibT25.js → index-IqLl5PBH.js} +40 -40
- package/designer/dist/index.html +2 -2
- package/main/default/manager/uuflow_manager.js +53 -23
- package/main/default/objectTranslations/flows.zh-CN/flows.zh-CN.objectTranslation.yml +1 -1
- package/main/default/objects/flows/flows.object.yml +12 -3
- package/main/default/pages/page_instance_print.page.amis.json +19 -0
- package/package.json +1 -1
- package/public/amis-renderer/amis-renderer.css +1 -1
- package/public/amis-renderer/amis-renderer.js +1 -1
- package/src/instance_record_queue.js +47 -80
- package/src/rests/getPageSchema.js +1 -1
- package/src/timeout_auto_submit.js +7 -6
package/designer/dist/index.html
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
<link rel="shortcut icon" type="image/svg+xml" href="/images/logo.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>designer</title>
|
|
8
|
-
<script type="module" crossorigin src="/api/workflow/designer-v2/assets/index-
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/api/workflow/designer-v2/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/api/workflow/designer-v2/assets/index-IqLl5PBH.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="/api/workflow/designer-v2/assets/index-DvvBwwsG.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
<div id="root"></div>
|
|
@@ -3304,10 +3304,9 @@ UUFlowManager.create_instance = async function (instance_from_client, user_info)
|
|
|
3304
3304
|
};
|
|
3305
3305
|
|
|
3306
3306
|
UUFlowManager.getCurrentStepAutoSubmit = function (timeout_auto_submit, lines) {
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
return false;
|
|
3307
|
+
const timeoutLines = lines ? lines.filter(l => l.timeout_line === true) : [];
|
|
3308
|
+
const result = !!(timeout_auto_submit && timeoutLines.length > 0);
|
|
3309
|
+
return result;
|
|
3311
3310
|
};
|
|
3312
3311
|
|
|
3313
3312
|
UUFlowManager.getDueDate = async function (hours, spaceId) {
|
|
@@ -4379,6 +4378,7 @@ UUFlowManager.timeoutAutoSubmit = async function (ins_id) {
|
|
|
4379
4378
|
const query = {
|
|
4380
4379
|
state: 'pending',
|
|
4381
4380
|
current_step_auto_submit: true,
|
|
4381
|
+
timeout_auto_submit_exhausted: { $ne: true },
|
|
4382
4382
|
traces: {
|
|
4383
4383
|
$elemMatch: {
|
|
4384
4384
|
is_finished: false,
|
|
@@ -4392,15 +4392,12 @@ UUFlowManager.timeoutAutoSubmit = async function (ins_id) {
|
|
|
4392
4392
|
}
|
|
4393
4393
|
|
|
4394
4394
|
const startTime = Date.now();
|
|
4395
|
-
console.log(`[timeout_auto_submit] Starting timeout check with query:`, JSON.stringify(query));
|
|
4396
|
-
|
|
4397
4395
|
const instances = await db.instances.find(query).toArray();
|
|
4398
4396
|
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
const instanceIds = instances.map(i => i._id).join(', ');
|
|
4402
|
-
console.log(`[timeout_auto_submit] Instance IDs: [${instanceIds}]`);
|
|
4397
|
+
if (instances.length === 0) {
|
|
4398
|
+
return;
|
|
4403
4399
|
}
|
|
4400
|
+
console.log(`${new Date().toISOString()} [timeout_auto_submit] Found ${instances.length} instance(s) to process`);
|
|
4404
4401
|
|
|
4405
4402
|
for (const ins of instances) {
|
|
4406
4403
|
try {
|
|
@@ -4410,7 +4407,6 @@ UUFlowManager.timeoutAutoSubmit = async function (ins_id) {
|
|
|
4410
4407
|
|
|
4411
4408
|
// Only process if trace is not finished and due_date has passed
|
|
4412
4409
|
if (trace.is_finished || !trace.due_date || new Date(trace.due_date) > new Date()) {
|
|
4413
|
-
console.log(`[timeout_auto_submit] Skipping instance ${instance_id}: trace finished=${trace.is_finished}, due_date=${trace.due_date}, now=${new Date()}`);
|
|
4414
4410
|
continue;
|
|
4415
4411
|
}
|
|
4416
4412
|
|
|
@@ -4429,7 +4425,7 @@ UUFlowManager.timeoutAutoSubmit = async function (ins_id) {
|
|
|
4429
4425
|
if (nextStep.step_type === 'condition') {
|
|
4430
4426
|
const nextSteps = await UUFlowManager.getNextSteps(ins, flow, nextStep, "");
|
|
4431
4427
|
if (!nextSteps || nextSteps.length === 0) {
|
|
4432
|
-
console.error(
|
|
4428
|
+
console.error(`${new Date().toISOString()} [timeout_auto_submit] No next steps resolved for condition step, instance: ${instance_id}`);
|
|
4433
4429
|
continue;
|
|
4434
4430
|
}
|
|
4435
4431
|
nextStepId = nextSteps[0];
|
|
@@ -4441,7 +4437,6 @@ UUFlowManager.timeoutAutoSubmit = async function (ins_id) {
|
|
|
4441
4437
|
|
|
4442
4438
|
// Process each unfinished approve in the trace sequentially to avoid race conditions
|
|
4443
4439
|
const unfinishedApproves = trace.approves.filter(a => !a.is_finished);
|
|
4444
|
-
console.log(`[timeout_auto_submit] Instance ${instance_id}: Processing ${unfinishedApproves.length} unfinished approve(s) | flow=${flow_id} | step=${trace.step} | type=${step_type}`);
|
|
4445
4440
|
|
|
4446
4441
|
let successCount = 0;
|
|
4447
4442
|
let failureCount_approves = 0;
|
|
@@ -4451,7 +4446,6 @@ UUFlowManager.timeoutAutoSubmit = async function (ins_id) {
|
|
|
4451
4446
|
// Check failure count for this approve
|
|
4452
4447
|
const failureCount = a.timeout_auto_submit_failures || 0;
|
|
4453
4448
|
if (failureCount >= 3) {
|
|
4454
|
-
console.log(`[timeout_auto_submit] Skipping approve ${a._id} - exceeded max failures (count=${failureCount}), instance: ${instance_id}`);
|
|
4455
4449
|
skipCount++;
|
|
4456
4450
|
continue;
|
|
4457
4451
|
}
|
|
@@ -4474,12 +4468,34 @@ UUFlowManager.timeoutAutoSubmit = async function (ins_id) {
|
|
|
4474
4468
|
);
|
|
4475
4469
|
|
|
4476
4470
|
if (!current_user_info) {
|
|
4477
|
-
|
|
4471
|
+
const userNotFoundFailureCount = (a.timeout_auto_submit_failures || 0) + 1;
|
|
4472
|
+
console.error(`${new Date().toISOString()} [timeout_auto_submit] User not found: ${a.handler}, instance: ${instance_id}, approve: ${a._id}`);
|
|
4473
|
+
try {
|
|
4474
|
+
await db.instances.updateOne(
|
|
4475
|
+
{
|
|
4476
|
+
_id: instance_id,
|
|
4477
|
+
"traces._id": trace._id
|
|
4478
|
+
},
|
|
4479
|
+
{
|
|
4480
|
+
$set: {
|
|
4481
|
+
"traces.$[trace].approves.$[approve].timeout_auto_submit_failures": userNotFoundFailureCount
|
|
4482
|
+
}
|
|
4483
|
+
},
|
|
4484
|
+
{
|
|
4485
|
+
arrayFilters: [
|
|
4486
|
+
{ "trace._id": trace._id },
|
|
4487
|
+
{ "approve._id": a._id }
|
|
4488
|
+
]
|
|
4489
|
+
}
|
|
4490
|
+
);
|
|
4491
|
+
} catch (updateError) {
|
|
4492
|
+
console.error(`${new Date().toISOString()} [timeout_auto_submit] Failed to update failure count for approve ${a._id}: `, updateError.message || updateError);
|
|
4493
|
+
}
|
|
4494
|
+
failureCount_approves++;
|
|
4478
4495
|
continue;
|
|
4479
4496
|
}
|
|
4480
4497
|
|
|
4481
|
-
console.log(
|
|
4482
|
-
console.log(`[timeout_auto_submit] current_user_info: ${JSON.stringify(current_user_info)}`);
|
|
4498
|
+
console.log(`${new Date().toISOString()} [timeout_auto_submit] Processing approve ${a._id} for instance ${instance_id}`);
|
|
4483
4499
|
|
|
4484
4500
|
const updatedInstance = await UUFlowManager.workflow_engine(
|
|
4485
4501
|
approve_from_client,
|
|
@@ -4497,7 +4513,7 @@ UUFlowManager.timeoutAutoSubmit = async function (ins_id) {
|
|
|
4497
4513
|
successCount++;
|
|
4498
4514
|
} catch (approveError) {
|
|
4499
4515
|
const failureCount = (a.timeout_auto_submit_failures || 0) + 1;
|
|
4500
|
-
console.error(
|
|
4516
|
+
console.error(`${new Date().toISOString()} [timeout_auto_submit] Error processing approve ${a._id} for instance ${instance_id} (failure_count=${failureCount}): ${approveError.message || approveError}`);
|
|
4501
4517
|
|
|
4502
4518
|
// Update the failure count in the database
|
|
4503
4519
|
try {
|
|
@@ -4518,21 +4534,35 @@ UUFlowManager.timeoutAutoSubmit = async function (ins_id) {
|
|
|
4518
4534
|
]
|
|
4519
4535
|
}
|
|
4520
4536
|
);
|
|
4521
|
-
console.log(`[timeout_auto_submit] Updated failure count for approve ${a._id}: ${failureCount}`);
|
|
4522
4537
|
} catch (updateError) {
|
|
4523
|
-
console.error(
|
|
4538
|
+
console.error(`${new Date().toISOString()} [timeout_auto_submit] Failed to update failure count for approve ${a._id}: `, updateError.message || updateError);
|
|
4524
4539
|
}
|
|
4525
4540
|
failureCount_approves++;
|
|
4526
4541
|
}
|
|
4527
4542
|
}
|
|
4528
|
-
|
|
4543
|
+
if (successCount > 0 || failureCount_approves > 0) {
|
|
4544
|
+
console.log(`${new Date().toISOString()} [timeout_auto_submit] Instance ${instance_id}: success=${successCount} | failed=${failureCount_approves} | skipped=${skipCount}`);
|
|
4545
|
+
}
|
|
4546
|
+
|
|
4547
|
+
// If all approves were skipped (all exceeded max failures), mark instance as exhausted
|
|
4548
|
+
if (skipCount > 0 && skipCount === unfinishedApproves.length) {
|
|
4549
|
+
try {
|
|
4550
|
+
await db.instances.updateOne(
|
|
4551
|
+
{ _id: instance_id },
|
|
4552
|
+
{ $set: { timeout_auto_submit_exhausted: true } }
|
|
4553
|
+
);
|
|
4554
|
+
console.log(`${new Date().toISOString()} [timeout_auto_submit] Instance ${instance_id} marked as exhausted`);
|
|
4555
|
+
} catch (updateError) {
|
|
4556
|
+
console.error(`${new Date().toISOString()} [timeout_auto_submit] Failed to mark instance ${instance_id} as exhausted: `, updateError.message || updateError);
|
|
4557
|
+
}
|
|
4558
|
+
}
|
|
4529
4559
|
} catch (error) {
|
|
4530
|
-
console.error(
|
|
4560
|
+
console.error(`${new Date().toISOString()} [timeout_auto_submit] Error processing instance ${ins._id}: `, error.stack);
|
|
4531
4561
|
}
|
|
4532
4562
|
}
|
|
4533
4563
|
|
|
4534
4564
|
const duration = Date.now() - startTime;
|
|
4535
|
-
console.log(
|
|
4565
|
+
console.log(`${new Date().toISOString()} [timeout_auto_submit] Processed ${instances.length} instance(s) in ${duration}ms`);
|
|
4536
4566
|
|
|
4537
4567
|
return true;
|
|
4538
4568
|
};
|
|
@@ -748,7 +748,16 @@ actions:
|
|
|
748
748
|
designFlow:
|
|
749
749
|
label: Flow Designer
|
|
750
750
|
visible: !<tag:yaml.org,2002:js/function> |-
|
|
751
|
-
function (object_name, record_id, record_permissions) {
|
|
751
|
+
function (object_name, record_id, record_permissions, data) {
|
|
752
|
+
var record = data && data.record;
|
|
753
|
+
|
|
754
|
+
if (!record) {
|
|
755
|
+
return false;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
if(record.upgraded){
|
|
759
|
+
return false;
|
|
760
|
+
}
|
|
752
761
|
return true;
|
|
753
762
|
}
|
|
754
763
|
'on': record
|
|
@@ -774,12 +783,12 @@ actions:
|
|
|
774
783
|
return Steedos.openWindow(Steedos.absoluteUrl(iframe_url));
|
|
775
784
|
}
|
|
776
785
|
designFlowV2:
|
|
777
|
-
label:
|
|
786
|
+
label: 设计器
|
|
778
787
|
visible: !<tag:yaml.org,2002:js/function> |-
|
|
779
788
|
function (object_name, record_id, record_permissions) {
|
|
780
789
|
return true;
|
|
781
790
|
}
|
|
782
|
-
'on':
|
|
791
|
+
'on': record
|
|
783
792
|
todo: !<tag:yaml.org,2002:js/function> |-
|
|
784
793
|
function (object_name, record_id, record_permissions, data) {
|
|
785
794
|
const flow = data && data.record;
|
|
@@ -333,6 +333,7 @@
|
|
|
333
333
|
},
|
|
334
334
|
".steedos-instance-related-view-wrapper .steedos-input-table": {
|
|
335
335
|
"width": "100% !important",
|
|
336
|
+
"max-width": "none !important",
|
|
336
337
|
"display": "block !important"
|
|
337
338
|
},
|
|
338
339
|
".steedos-instance-related-view-wrapper .antd-Table-contentWrap": {
|
|
@@ -385,6 +386,24 @@
|
|
|
385
386
|
".steedos-instance-related-view-wrapper .instance-form-view td": {
|
|
386
387
|
"border-width": "1px !important"
|
|
387
388
|
},
|
|
389
|
+
".steedos-instance-related-view-wrapper .steedos-input-table .antd-Table-table": {
|
|
390
|
+
"-webkit-print-color-adjust": "exact !important",
|
|
391
|
+
"print-color-adjust": "exact !important",
|
|
392
|
+
"table-layout": "fixed !important",
|
|
393
|
+
"width": "100% !important",
|
|
394
|
+
"min-width": "0 !important"
|
|
395
|
+
},
|
|
396
|
+
".steedos-instance-related-view-wrapper .steedos-input-table .antd-Table-table th": {
|
|
397
|
+
"border-left": "1px solid #000 !important",
|
|
398
|
+
"border-bottom": "1px solid #000 !important"
|
|
399
|
+
},
|
|
400
|
+
".steedos-instance-related-view-wrapper .steedos-input-table .antd-Table-table td": {
|
|
401
|
+
"border-left": "1px solid #000 !important",
|
|
402
|
+
"border-bottom": "1px solid #000 !important"
|
|
403
|
+
},
|
|
404
|
+
".steedos-instance-related-view-wrapper .steedos-input-table .antd-Table-table th.antd-Table-operationCell, .steedos-instance-related-view-wrapper .steedos-input-table .antd-Table-table td.antd-Table-operationCell": {
|
|
405
|
+
"display": "none !important"
|
|
406
|
+
},
|
|
388
407
|
".steedos-instance-related-view-wrapper .instance-approve-history .antd-Table-table tr td": {
|
|
389
408
|
"border-bottom": "1px solid #e8e8e8 !important"
|
|
390
409
|
}
|