@steedos-labs/plugin-workflow 3.0.62 → 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 +100 -16
- 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 +60 -67
- package/src/rests/getPageSchema.js +1 -1
- package/src/timeout_auto_submit.js +10 -5
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,
|
|
@@ -4391,8 +4391,14 @@ UUFlowManager.timeoutAutoSubmit = async function (ins_id) {
|
|
|
4391
4391
|
query._id = ins_id;
|
|
4392
4392
|
}
|
|
4393
4393
|
|
|
4394
|
+
const startTime = Date.now();
|
|
4394
4395
|
const instances = await db.instances.find(query).toArray();
|
|
4395
4396
|
|
|
4397
|
+
if (instances.length === 0) {
|
|
4398
|
+
return;
|
|
4399
|
+
}
|
|
4400
|
+
console.log(`${new Date().toISOString()} [timeout_auto_submit] Found ${instances.length} instance(s) to process`);
|
|
4401
|
+
|
|
4396
4402
|
for (const ins of instances) {
|
|
4397
4403
|
try {
|
|
4398
4404
|
const flow_id = ins.flow;
|
|
@@ -4419,7 +4425,7 @@ UUFlowManager.timeoutAutoSubmit = async function (ins_id) {
|
|
|
4419
4425
|
if (nextStep.step_type === 'condition') {
|
|
4420
4426
|
const nextSteps = await UUFlowManager.getNextSteps(ins, flow, nextStep, "");
|
|
4421
4427
|
if (!nextSteps || nextSteps.length === 0) {
|
|
4422
|
-
console.error(
|
|
4428
|
+
console.error(`${new Date().toISOString()} [timeout_auto_submit] No next steps resolved for condition step, instance: ${instance_id}`);
|
|
4423
4429
|
continue;
|
|
4424
4430
|
}
|
|
4425
4431
|
nextStepId = nextSteps[0];
|
|
@@ -4431,8 +4437,19 @@ UUFlowManager.timeoutAutoSubmit = async function (ins_id) {
|
|
|
4431
4437
|
|
|
4432
4438
|
// Process each unfinished approve in the trace sequentially to avoid race conditions
|
|
4433
4439
|
const unfinishedApproves = trace.approves.filter(a => !a.is_finished);
|
|
4440
|
+
|
|
4441
|
+
let successCount = 0;
|
|
4442
|
+
let failureCount_approves = 0;
|
|
4443
|
+
let skipCount = 0;
|
|
4434
4444
|
for (const a of unfinishedApproves) {
|
|
4435
4445
|
try {
|
|
4446
|
+
// Check failure count for this approve
|
|
4447
|
+
const failureCount = a.timeout_auto_submit_failures || 0;
|
|
4448
|
+
if (failureCount >= 3) {
|
|
4449
|
+
skipCount++;
|
|
4450
|
+
continue;
|
|
4451
|
+
}
|
|
4452
|
+
|
|
4436
4453
|
// Create a separate approve_from_client for each approve to avoid shared mutation
|
|
4437
4454
|
const approve_from_client = {
|
|
4438
4455
|
_id: a._id,
|
|
@@ -4451,35 +4468,102 @@ UUFlowManager.timeoutAutoSubmit = async function (ins_id) {
|
|
|
4451
4468
|
);
|
|
4452
4469
|
|
|
4453
4470
|
if (!current_user_info) {
|
|
4454
|
-
|
|
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++;
|
|
4455
4495
|
continue;
|
|
4456
4496
|
}
|
|
4457
4497
|
|
|
4458
|
-
console.log(
|
|
4459
|
-
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}`);
|
|
4460
4499
|
|
|
4461
4500
|
const updatedInstance = await UUFlowManager.workflow_engine(
|
|
4462
|
-
approve_from_client,
|
|
4463
|
-
current_user_info,
|
|
4464
|
-
current_user_info._id,
|
|
4501
|
+
approve_from_client,
|
|
4502
|
+
current_user_info,
|
|
4503
|
+
current_user_info._id,
|
|
4465
4504
|
true
|
|
4466
4505
|
);
|
|
4467
4506
|
|
|
4468
4507
|
await pushManager.send_instance_notification(
|
|
4469
|
-
"auto_submit_pending_inbox",
|
|
4470
|
-
updatedInstance,
|
|
4471
|
-
"",
|
|
4508
|
+
"auto_submit_pending_inbox",
|
|
4509
|
+
updatedInstance,
|
|
4510
|
+
"",
|
|
4472
4511
|
current_user_info
|
|
4473
4512
|
);
|
|
4513
|
+
successCount++;
|
|
4474
4514
|
} catch (approveError) {
|
|
4475
|
-
|
|
4515
|
+
const failureCount = (a.timeout_auto_submit_failures || 0) + 1;
|
|
4516
|
+
console.error(`${new Date().toISOString()} [timeout_auto_submit] Error processing approve ${a._id} for instance ${instance_id} (failure_count=${failureCount}): ${approveError.message || approveError}`);
|
|
4517
|
+
|
|
4518
|
+
// Update the failure count in the database
|
|
4519
|
+
try {
|
|
4520
|
+
await db.instances.updateOne(
|
|
4521
|
+
{
|
|
4522
|
+
_id: instance_id,
|
|
4523
|
+
"traces._id": trace._id
|
|
4524
|
+
},
|
|
4525
|
+
{
|
|
4526
|
+
$set: {
|
|
4527
|
+
"traces.$[trace].approves.$[approve].timeout_auto_submit_failures": failureCount
|
|
4528
|
+
}
|
|
4529
|
+
},
|
|
4530
|
+
{
|
|
4531
|
+
arrayFilters: [
|
|
4532
|
+
{ "trace._id": trace._id },
|
|
4533
|
+
{ "approve._id": a._id }
|
|
4534
|
+
]
|
|
4535
|
+
}
|
|
4536
|
+
);
|
|
4537
|
+
} catch (updateError) {
|
|
4538
|
+
console.error(`${new Date().toISOString()} [timeout_auto_submit] Failed to update failure count for approve ${a._id}: `, updateError.message || updateError);
|
|
4539
|
+
}
|
|
4540
|
+
failureCount_approves++;
|
|
4541
|
+
}
|
|
4542
|
+
}
|
|
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);
|
|
4476
4557
|
}
|
|
4477
4558
|
}
|
|
4478
4559
|
} catch (error) {
|
|
4479
|
-
console.error(
|
|
4560
|
+
console.error(`${new Date().toISOString()} [timeout_auto_submit] Error processing instance ${ins._id}: `, error.stack);
|
|
4480
4561
|
}
|
|
4481
4562
|
}
|
|
4482
4563
|
|
|
4564
|
+
const duration = Date.now() - startTime;
|
|
4565
|
+
console.log(`${new Date().toISOString()} [timeout_auto_submit] Processed ${instances.length} instance(s) in ${duration}ms`);
|
|
4566
|
+
|
|
4483
4567
|
return true;
|
|
4484
4568
|
};
|
|
4485
4569
|
|
|
@@ -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
|
}
|