Override task ID

This commit is contained in:
naibo 2023-12-19 11:24:24 +08:00
parent d6e7b7f27f
commit bcd3265220
4 changed files with 48 additions and 6 deletions

View File

@ -362,6 +362,9 @@ exports.start = function(port = 8074) {
if (file_names.length != 0) {
eid = Math.max(...file_names) + 1;
}
if(body["EID"]!="" && body["EID"] != undefined){ //覆盖原有的执行实例
eid = parseInt(body["EID"]);
}
task["id"] = eid;
task = JSON.stringify(task);
fs.writeFile(path.join(getDir(), `execution_instances/${eid}.json`), task, (err) => {});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1000 KiB

After

Width:  |  Height:  |  Size: 4.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

After

Width:  |  Height:  |  Size: 5.7 MiB

View File

@ -31,21 +31,36 @@
.ID {
width: 10%;
}
.excel th,.excel td{
.excel th,.excel td {
text-align: center;
font-size: 13px;
padding: 10px;
max-width: 200px!important;
}
.tip {
position: fixed;
width:100%;
display: none;
z-index: 1000;
top:0;
}
</style>
</head>
<body>
<div style="position: absolute; margin-top: -10px">
<div id="tip" class="alert alert-danger alert-dismissible fade show" style="position: fixed; width:100%;display: none; z-index: 1000">
提示请先获得任务ID!</div>
<div id="tipEN" class="alert alert-danger alert-dismissible fade show" style="position: fixed; width:100%;display: none; z-index: 1000">
Hint: Please get EID first!</div>
<div id="tip" class="alert alert-danger alert-dismissible fade show tip">
提示请先获得任务ID!
</div>
<div id="tipEN" class="alert alert-danger alert-dismissible fade show tip">
Hint: Please get EID first!
</div>
<div id="tipID" class="alert alert-info alert-dismissible fade show tip">
提示任务执行ID对应配置文件已更新您可使用任务ID<span id="newID_ZH"></span>来执行加载了新配置的任务。
</div>
<div id="tipID_EN" class="alert alert-info alert-dismissible fade show tip">
Hint: The task execution ID corresponds to the configuration file has been updated, you can use the task ID <span id="newID_EN"></span> to execute the task with the new configuration.</div>
</div>
</div>
<div class="row" style="margin-top: 40px;">
@ -250,7 +265,7 @@
</label>
<div style="margin-bottom: 10px;">
<label style="margin-top: 10px;">{{"Execution ID (EID), execution files are stored in 'execution_instances' folder:~执行ID执行文件存放在execution_instances文件夹内" | lang}}</label>
<input class="form-control" v-model="ID"></input>
<input class="form-control" v-model="ID" :placeholder="LANG('如果已在此处写/生成了ID号则点击执行或获得ID按钮后任务ID将保持不变且原任务文件将会被新配置覆盖','If already have ID here, the task ID will remain unchanged and the original task file will be overwritten by the new configuration after click buttons')"></input>
<p></p>
<!-- <p>提示点击下方按钮获得任务ID然后根据此ID进行服务执行也可自己POST调用接口得到ID具体参照POST调用文档。</p> -->
<p>{{"Hint: Click the \"Get Execution ID\" button at the bottom to get the task ID, and click the \"Execute task by commandline\" button at the back to get the prompt command on how to run this task using the command line.~提示点击下方“获得任务执行ID”按钮得到任务ID点击后面的“使用命令行执行任务”按钮获得如何使用命令行运行任务的提示命令。" | lang}}</p>
@ -309,6 +324,13 @@
//TODO 翻译 写清楚readme有关浏览器版本的问题 logo更换 提示看文档来运行
},
methods: {
LANG: function (zh, en) {
if (this.lang == "zh") {
return zh;
} else {
return en;
}
},
gotoHome: function () {
let url = "";
if (getUrlParam("lang") == "zh") {
@ -406,9 +428,25 @@
});
let message = {
id: this.task.id, //这里写任务ID号如1
EID: this.ID,
params: JSON.stringify(param)
}
$.post(app.$data.backEndAddressServiceWrapper + "/invokeTask", message, function (result) {
if(app.$data.ID == result){
if (getUrlParam("lang") == "en" || getUrlParam("lang") == "") {
$("#tipID_EN").slideDown(); //提示框
$("#newID_EN").text(result);
setTimeout(function() {
$("#tipID_EN").slideUp();
}, 5000);
} else {
$("#tipID").slideDown(); //提示框
$("#newID_ZH").text(result);
setTimeout(function() {
$("#tipID").slideUp();
}, 5000);
}
}
app.$data.ID = result; //得到返回的ID
});
// }
@ -470,6 +508,7 @@
});
$.post(app.$data.backEndAddressServiceWrapper + "/invokeTask", {
id: this.task.id,
EID: this.ID,
params: JSON.stringify(param)
}, function (result) {
let message = { //显示flowchart