verteilen-core 1.2.6 → 1.2.7
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/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/index.ts +1 -6
- package/package.json +1 -1
- package/src/index.ts +6 -0
- package/tsconfig.json +3 -1
- package/dist/jest.config.d.ts +0 -2
- package/dist/jest.config.js +0 -8
- package/dist/src/client/job_parameter.js +0 -36
- package/dist/src/client/parameter.js +0 -36
- package/dist/src/util/server/console_handle.js +0 -248
- package/dist/src/util/server/log_handle.js +0 -230
- /package/dist/{src/client → client}/analysis.d.ts +0 -0
- /package/dist/{src/client → client}/analysis.js +0 -0
- /package/dist/{src/client → client}/client.d.ts +0 -0
- /package/dist/{src/client → client}/client.js +0 -0
- /package/dist/{src/client → client}/cluster.d.ts +0 -0
- /package/dist/{src/client → client}/cluster.js +0 -0
- /package/dist/{src/client → client}/database.d.ts +0 -0
- /package/dist/{src/client → client}/database.js +0 -0
- /package/dist/{src/client → client}/execute.d.ts +0 -0
- /package/dist/{src/client → client}/execute.js +0 -0
- /package/dist/{src/client → client}/http.d.ts +0 -0
- /package/dist/{src/client → client}/http.js +0 -0
- /package/dist/{src/client → client}/javascript.d.ts +0 -0
- /package/dist/{src/client → client}/javascript.js +0 -0
- /package/dist/{src/client → client}/job_database.d.ts +0 -0
- /package/dist/{src/client → client}/job_database.js +0 -0
- /package/dist/{src/client → client}/job_execute.d.ts +0 -0
- /package/dist/{src/client → client}/job_execute.js +0 -0
- /package/dist/{src/client → client}/os.d.ts +0 -0
- /package/dist/{src/client → client}/os.js +0 -0
- /package/dist/{src/client → client}/resource.d.ts +0 -0
- /package/dist/{src/client → client}/resource.js +0 -0
- /package/dist/{src/client → client}/shell.d.ts +0 -0
- /package/dist/{src/client → client}/shell.js +0 -0
- /package/dist/{src/computed.d.ts → computed.d.ts} +0 -0
- /package/dist/{src/computed.js → computed.js} +0 -0
- /package/dist/{src/interface → interface}/base.d.ts +0 -0
- /package/dist/{src/interface → interface}/base.js +0 -0
- /package/dist/{src/interface → interface}/bus.d.ts +0 -0
- /package/dist/{src/interface → interface}/bus.js +0 -0
- /package/dist/{src/interface → interface}/enum.d.ts +0 -0
- /package/dist/{src/interface → interface}/enum.js +0 -0
- /package/dist/{src/interface → interface}/execute.d.ts +0 -0
- /package/dist/{src/interface → interface}/execute.js +0 -0
- /package/dist/{src/interface → interface}/record.d.ts +0 -0
- /package/dist/{src/interface → interface}/record.js +0 -0
- /package/dist/{src/interface → interface}/server.d.ts +0 -0
- /package/dist/{src/interface → interface}/server.js +0 -0
- /package/dist/{src/interface → interface}/struct.d.ts +0 -0
- /package/dist/{src/interface → interface}/struct.js +0 -0
- /package/dist/{src/interface → interface}/table.d.ts +0 -0
- /package/dist/{src/interface → interface}/table.js +0 -0
- /package/dist/{src/interface → interface}/ui.d.ts +0 -0
- /package/dist/{src/interface → interface}/ui.js +0 -0
- /package/dist/{src/interface.d.ts → interface.d.ts} +0 -0
- /package/dist/{src/interface.js → interface.js} +0 -0
- /package/dist/{src/lan → lan}/en.json +0 -0
- /package/dist/{src/lan → lan}/zh_TW.json +0 -0
- /package/dist/{src/plugins → plugins}/i18n.d.ts +0 -0
- /package/dist/{src/plugins → plugins}/i18n.js +0 -0
- /package/dist/{src/script → script}/console_manager.d.ts +0 -0
- /package/dist/{src/script → script}/console_manager.js +0 -0
- /package/dist/{src/script → script}/console_server_manager.d.ts +0 -0
- /package/dist/{src/script → script}/console_server_manager.js +0 -0
- /package/dist/{src/script → script}/execute/base.d.ts +0 -0
- /package/dist/{src/script → script}/execute/base.js +0 -0
- /package/dist/{src/script → script}/execute/feedback.d.ts +0 -0
- /package/dist/{src/script → script}/execute/feedback.js +0 -0
- /package/dist/{src/script → script}/execute/interface.d.ts +0 -0
- /package/dist/{src/script → script}/execute/interface.js +0 -0
- /package/dist/{src/script → script}/execute/region_job.d.ts +0 -0
- /package/dist/{src/script → script}/execute/region_job.js +0 -0
- /package/dist/{src/script → script}/execute/region_project.d.ts +0 -0
- /package/dist/{src/script → script}/execute/region_project.js +0 -0
- /package/dist/{src/script → script}/execute/region_subtask.d.ts +0 -0
- /package/dist/{src/script → script}/execute/region_subtask.js +0 -0
- /package/dist/{src/script → script}/execute/region_task.d.ts +0 -0
- /package/dist/{src/script → script}/execute/region_task.js +0 -0
- /package/dist/{src/script → script}/execute/runner.d.ts +0 -0
- /package/dist/{src/script → script}/execute/runner.js +0 -0
- /package/dist/{src/script → script}/execute/util_parser.d.ts +0 -0
- /package/dist/{src/script → script}/execute/util_parser.js +0 -0
- /package/dist/{src/script → script}/execute_manager.d.ts +0 -0
- /package/dist/{src/script → script}/execute_manager.js +0 -0
- /package/dist/{src/script → script}/socket_manager.d.ts +0 -0
- /package/dist/{src/script → script}/socket_manager.js +0 -0
- /package/dist/{src/script → script}/webhook_manager.d.ts +0 -0
- /package/dist/{src/script → script}/webhook_manager.js +0 -0
- /package/dist/{src/script → script}/webhook_server_manager.d.ts +0 -0
- /package/dist/{src/script → script}/webhook_server_manager.js +0 -0
- /package/dist/{src/server → server}/detail.d.ts +0 -0
- /package/dist/{src/server → server}/detail.js +0 -0
- /package/dist/{src/server → server}/io.d.ts +0 -0
- /package/dist/{src/server → server}/io.js +0 -0
- /package/dist/{src/server → server}/plugin.d.ts +0 -0
- /package/dist/{src/server → server}/plugin.js +0 -0
- /package/dist/{src/server → server}/server.d.ts +0 -0
- /package/dist/{src/server → server}/server.js +0 -0
- /package/dist/{src/server.d.ts → server.d.ts} +0 -0
- /package/dist/{src/server.js → server.js} +0 -0
- /package/dist/{src/util → util}/console_handle.d.ts +0 -0
- /package/dist/{src/util → util}/console_handle.js +0 -0
- /package/dist/{src/util → util}/log_handle.d.ts +0 -0
- /package/dist/{src/util → util}/log_handle.js +0 -0
- /package/{dist/test → test}/TEST.d.ts +0 -0
- /package/{dist/test → test}/TEST.js +0 -0
- /package/{dist/test → test}/client/execute.test.d.ts +0 -0
- /package/{dist/test → test}/client/execute.test.js +0 -0
- /package/{dist/test → test}/client/javascript.test.d.ts +0 -0
- /package/{dist/test → test}/client/javascript.test.js +0 -0
- /package/{dist/test → test}/client/server.test.d.ts +0 -0
- /package/{dist/test → test}/client/server.test.js +0 -0
- /package/{dist/test → test}/client/task.test.d.ts +0 -0
- /package/{dist/test → test}/client/task.test.js +0 -0
- /package/{dist/test → test}/script/parser.test.d.ts +0 -0
- /package/{dist/test → test}/script/parser.test.js +0 -0
- /package/{dist/test → test}/script/socket.test.d.ts +0 -0
- /package/{dist/test → test}/script/socket.test.js +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
1
|
+
export * from './computed';
|
|
2
|
+
export * from './interface';
|
|
3
|
+
export * from './server';
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./computed"), exports);
|
|
18
|
+
__exportStar(require("./interface"), exports);
|
|
19
|
+
__exportStar(require("./server"), exports);
|
package/index.ts
CHANGED
package/package.json
CHANGED
package/src/index.ts
ADDED
package/tsconfig.json
CHANGED
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
"skipLibCheck": false,
|
|
11
11
|
"forceConsistentCasingInFileNames": true,
|
|
12
12
|
"outDir": "dist",
|
|
13
|
+
"rootDir": "src",
|
|
13
14
|
"allowJs": true,
|
|
14
15
|
"removeComments": true,
|
|
15
16
|
"noImplicitAny": false
|
|
16
|
-
}
|
|
17
|
+
},
|
|
18
|
+
"exclude": ["coverage", "test", "index.ts", "jest.config.js", "dist"]
|
|
17
19
|
}
|
package/dist/jest.config.d.ts
DELETED
package/dist/jest.config.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ClientJobParameter = void 0;
|
|
4
|
-
class ClientJobParameter {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.feedbacknumber = (data) => {
|
|
7
|
-
this.feedback("feedbacknumber", data);
|
|
8
|
-
};
|
|
9
|
-
this.feedbackboolean = (data) => {
|
|
10
|
-
this.feedback("feedbackboolean", data);
|
|
11
|
-
};
|
|
12
|
-
this.feedbackstring = (data) => {
|
|
13
|
-
this.feedback("feedbackstring", data);
|
|
14
|
-
};
|
|
15
|
-
this.feedbackobject = (data) => {
|
|
16
|
-
this.feedback("feedbackobject", data);
|
|
17
|
-
};
|
|
18
|
-
this.feedbacklist = (data) => {
|
|
19
|
-
this.feedback("feedbacklist", data);
|
|
20
|
-
};
|
|
21
|
-
this.feedbackselect = (data) => {
|
|
22
|
-
this.feedback("feedbackselect", data);
|
|
23
|
-
};
|
|
24
|
-
this.feedback = (title, data) => {
|
|
25
|
-
const p = {
|
|
26
|
-
name: title,
|
|
27
|
-
data: {
|
|
28
|
-
key: data.key,
|
|
29
|
-
value: data.value
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
console.log(JSON.stringify(p));
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.ClientJobParameter = ClientJobParameter;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ClientParameter = void 0;
|
|
4
|
-
class ClientParameter {
|
|
5
|
-
constructor(_source) {
|
|
6
|
-
this.feedbacknumber = (data) => {
|
|
7
|
-
this.feedback("feedback_number", data);
|
|
8
|
-
};
|
|
9
|
-
this.feedbackboolean = (data) => {
|
|
10
|
-
this.feedback("feedback_boolean", data);
|
|
11
|
-
};
|
|
12
|
-
this.feedbackstring = (data) => {
|
|
13
|
-
this.feedback("feedback_string", data);
|
|
14
|
-
};
|
|
15
|
-
this.feedbackobject = (data) => {
|
|
16
|
-
this.feedback("feedback_object", data);
|
|
17
|
-
};
|
|
18
|
-
this.feedbacklist = (data) => {
|
|
19
|
-
this.feedback("feedback_list", data);
|
|
20
|
-
};
|
|
21
|
-
this.feedbackselect = (data) => {
|
|
22
|
-
this.feedback("feedback_select", data);
|
|
23
|
-
};
|
|
24
|
-
this.feedback = (title, data) => {
|
|
25
|
-
if (this.source == undefined)
|
|
26
|
-
return;
|
|
27
|
-
const p = {
|
|
28
|
-
name: title,
|
|
29
|
-
data: data
|
|
30
|
-
};
|
|
31
|
-
this.source.send(JSON.stringify(p, null, 2));
|
|
32
|
-
};
|
|
33
|
-
this.source = _source;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.ClientParameter = ClientParameter;
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Util_Server_Console_Proxy = exports.Util_Server_Console = void 0;
|
|
4
|
-
const interface_1 = require("../../interface");
|
|
5
|
-
class Util_Server_Console {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.receivedPack = (model, record) => {
|
|
8
|
-
var _a, _b;
|
|
9
|
-
const pass = model.manager.Register();
|
|
10
|
-
if (pass == -1) {
|
|
11
|
-
model.record.running = false;
|
|
12
|
-
model.record.stop = true;
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
model.record.projects = record.projects;
|
|
16
|
-
model.record.nodes = record.nodes;
|
|
17
|
-
model.record.project_state = model.record.projects.map(x => {
|
|
18
|
-
return {
|
|
19
|
-
uuid: x.uuid,
|
|
20
|
-
state: interface_1.ExecuteState.NONE
|
|
21
|
-
};
|
|
22
|
-
});
|
|
23
|
-
model.record.project_index = pass;
|
|
24
|
-
model.record.project = record.projects[pass].uuid;
|
|
25
|
-
model.record.task_index = 0;
|
|
26
|
-
model.record.task_state = model.record.projects[0].task.map(x => {
|
|
27
|
-
return {
|
|
28
|
-
uuid: x.uuid,
|
|
29
|
-
state: interface_1.ExecuteState.NONE
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
model.record.task_state[0].state = interface_1.ExecuteState.RUNNING;
|
|
33
|
-
model.record.task_detail = [];
|
|
34
|
-
const task = (_a = model.record.projects[model.record.project_index]) === null || _a === void 0 ? void 0 : _a.task[model.record.task_index];
|
|
35
|
-
const count = task.cronjob ? ((_b = task === null || task === void 0 ? void 0 : task.jobs.length) !== null && _b !== void 0 ? _b : 0) : 1;
|
|
36
|
-
for (let i = 0; i < count; i++) {
|
|
37
|
-
model.record.task_detail.push({
|
|
38
|
-
index: i,
|
|
39
|
-
node: "",
|
|
40
|
-
message: [],
|
|
41
|
-
state: interface_1.ExecuteState.NONE
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
model.manager.Update();
|
|
45
|
-
return true;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.Util_Server_Console = Util_Server_Console;
|
|
50
|
-
class Util_Server_Console_Proxy {
|
|
51
|
-
constructor(_model) {
|
|
52
|
-
this.execute_project_start = (d) => {
|
|
53
|
-
var _a, _b;
|
|
54
|
-
const index = d[1];
|
|
55
|
-
if (index == -1)
|
|
56
|
-
return;
|
|
57
|
-
this.model.record.project = d[0].uuid;
|
|
58
|
-
this.model.record.project_index = index;
|
|
59
|
-
this.model.record.project_state[index].state = interface_1.ExecuteState.RUNNING;
|
|
60
|
-
this.model.record.task_state = this.model.record.projects[index].task.map(x => {
|
|
61
|
-
return {
|
|
62
|
-
uuid: x.uuid,
|
|
63
|
-
state: interface_1.ExecuteState.NONE
|
|
64
|
-
};
|
|
65
|
-
});
|
|
66
|
-
this.model.record.task_detail = [];
|
|
67
|
-
const task = (_a = this.model.record.projects[this.model.record.project_index]) === null || _a === void 0 ? void 0 : _a.task[this.model.record.task_index];
|
|
68
|
-
const count = task.cronjob ? ((_b = task === null || task === void 0 ? void 0 : task.jobs.length) !== null && _b !== void 0 ? _b : 0) : 1;
|
|
69
|
-
for (let i = 0; i < count; i++) {
|
|
70
|
-
this.model.record.task_detail.push({
|
|
71
|
-
index: i,
|
|
72
|
-
node: "",
|
|
73
|
-
message: [],
|
|
74
|
-
state: interface_1.ExecuteState.NONE
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
console.log("project start: ", this.model.record.projects.length, index);
|
|
78
|
-
};
|
|
79
|
-
this.execute_project_finish = (d) => {
|
|
80
|
-
if (this.model.record.process_type >= 1) {
|
|
81
|
-
this.model.record.running = false;
|
|
82
|
-
this.model.record.stop = true;
|
|
83
|
-
}
|
|
84
|
-
const index = d[1];
|
|
85
|
-
const size = this.model.record.projects.length;
|
|
86
|
-
if (index == -1)
|
|
87
|
-
return;
|
|
88
|
-
this.model.record.project = "";
|
|
89
|
-
this.model.record.project_state[index].state = interface_1.ExecuteState.FINISH;
|
|
90
|
-
this.model.record.para = undefined;
|
|
91
|
-
console.log("project finish: ", this.model.record.projects.length, index);
|
|
92
|
-
if (index == size - 1) {
|
|
93
|
-
this.model.record.command.push(['clean']);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
this.execute_task_start = (d) => {
|
|
97
|
-
if (this.model.record.project_index == -1)
|
|
98
|
-
return;
|
|
99
|
-
const index = this.model.record.projects[this.model.record.project_index].task.findIndex(x => x.uuid == d[0].uuid);
|
|
100
|
-
if (index == -1)
|
|
101
|
-
return;
|
|
102
|
-
this.model.record.useCron = d[0].cronjob;
|
|
103
|
-
this.model.record.task = d[0].uuid;
|
|
104
|
-
this.model.record.task_index = index;
|
|
105
|
-
this.model.record.task_state[index].state = interface_1.ExecuteState.RUNNING;
|
|
106
|
-
for (let i = 0; i < index; i++)
|
|
107
|
-
this.model.record.task_state[i].state = interface_1.ExecuteState.FINISH;
|
|
108
|
-
for (let i = index + 1; i < this.model.record.task_state.length; i++)
|
|
109
|
-
this.model.record.task_state[i].state = interface_1.ExecuteState.NONE;
|
|
110
|
-
this.model.record.task_detail = [];
|
|
111
|
-
const p = this.model.record.projects[this.model.record.project_index];
|
|
112
|
-
const t = p.task[this.model.record.task_index];
|
|
113
|
-
const count = this.model.manager.get_task_state_count(t);
|
|
114
|
-
for (let i = 0; i < count; i++) {
|
|
115
|
-
this.model.record.task_detail.push({
|
|
116
|
-
index: i,
|
|
117
|
-
node: "",
|
|
118
|
-
message: [],
|
|
119
|
-
state: interface_1.ExecuteState.NONE
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
this.execute_task_finish = (d) => {
|
|
124
|
-
if (this.model.record.process_type == 2) {
|
|
125
|
-
this.model.record.running = false;
|
|
126
|
-
this.model.record.stop = true;
|
|
127
|
-
}
|
|
128
|
-
if (this.model.record.project_index == -1)
|
|
129
|
-
return;
|
|
130
|
-
const index = this.model.record.projects[this.model.record.project_index].task.findIndex(x => x.uuid == d.uuid);
|
|
131
|
-
if (index == -1)
|
|
132
|
-
return;
|
|
133
|
-
this.model.record.useCron = false;
|
|
134
|
-
this.model.record.task = "";
|
|
135
|
-
this.model.record.task_state[index].state = interface_1.ExecuteState.FINISH;
|
|
136
|
-
if (index + 1 < this.model.record.task_state.length - 1) {
|
|
137
|
-
this.model.record.task_state[index + 1].state = interface_1.ExecuteState.RUNNING;
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
this.execute_subtask_start = (d) => {
|
|
141
|
-
var _a;
|
|
142
|
-
try {
|
|
143
|
-
this.model.record.task_detail[d[1]].node = (_a = d[2]) !== null && _a !== void 0 ? _a : '';
|
|
144
|
-
this.model.record.task_detail[d[1]].state = interface_1.ExecuteState.RUNNING;
|
|
145
|
-
}
|
|
146
|
-
catch (error) {
|
|
147
|
-
console.error(`execute_subtask_start`, error.message);
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
this.execute_subtask_update = (d) => {
|
|
151
|
-
if (this.model.record.task_detail.length > d[1]) {
|
|
152
|
-
this.model.record.task_detail[d[1]].node = d[2];
|
|
153
|
-
this.model.record.task_detail[d[1]].state = d[3];
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
console.error(`subtask_start ${d[1]} is out of range: ${this.model.record.task_detail.length}`);
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
this.execute_subtask_end = (d) => {
|
|
160
|
-
try {
|
|
161
|
-
this.model.record.task_detail[d[1]].state = interface_1.ExecuteState.FINISH;
|
|
162
|
-
}
|
|
163
|
-
catch (error) {
|
|
164
|
-
console.error(`execute_subtask_end`, error.message);
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
this.execute_job_start = (d) => {
|
|
168
|
-
if (this.model.record.project_index == -1)
|
|
169
|
-
return;
|
|
170
|
-
if (!this.model.record.useCron) {
|
|
171
|
-
this.model.record.task_detail[0].node = d[2];
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
this.execute_job_finish = (d) => {
|
|
175
|
-
if (d[3] == 1) {
|
|
176
|
-
const task = this.model.record.projects[this.model.record.project_index].task[this.model.record.task_index];
|
|
177
|
-
const index = task.jobs.findIndex(x => x.uuid == d[0].uuid);
|
|
178
|
-
if (index != -1 && task.jobs[index].category == interface_1.JobCategory.Condition) {
|
|
179
|
-
const cr = task.jobs[index].number_args[0];
|
|
180
|
-
if (cr == interface_1.ConditionResult.None)
|
|
181
|
-
return;
|
|
182
|
-
this.model.record.command.push(['stop']);
|
|
183
|
-
let timer;
|
|
184
|
-
timer = setInterval(() => {
|
|
185
|
-
if (this.model.record.running == false) {
|
|
186
|
-
clearInterval(timer);
|
|
187
|
-
const state = (cr == interface_1.ConditionResult.ThrowTask || cr == interface_1.ConditionResult.ThrowProject) ? interface_1.ExecuteState.ERROR : interface_1.ExecuteState.SKIP;
|
|
188
|
-
const target = this.model.record.task_detail[d[1]];
|
|
189
|
-
if (target != undefined) {
|
|
190
|
-
target.state = state;
|
|
191
|
-
}
|
|
192
|
-
if (cr == interface_1.ConditionResult.Pause)
|
|
193
|
-
return;
|
|
194
|
-
if (cr == interface_1.ConditionResult.SkipProject || cr == interface_1.ConditionResult.ThrowProject) {
|
|
195
|
-
this.model.record.command.push(['skip', 0, state]);
|
|
196
|
-
if (this.model.record.project.length > 0) {
|
|
197
|
-
if (this.model.record.process_type == 0) {
|
|
198
|
-
this.model.record.command.push(['execute', this.model.record.process_type]);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
else if (cr == interface_1.ConditionResult.SkipTask || cr == interface_1.ConditionResult.ThrowTask) {
|
|
203
|
-
this.model.record.command.push(['skip', 1, state]);
|
|
204
|
-
if (this.model.record.project.length > 0) {
|
|
205
|
-
if (this.model.record.process_type == 0) {
|
|
206
|
-
this.model.record.command.push(['execute', this.model.record.process_type]);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}, 1000);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
this.feedback_message = (d) => {
|
|
216
|
-
if (d.index == undefined || d.index == -1)
|
|
217
|
-
return;
|
|
218
|
-
const container = this.model.record.task_detail[d.index];
|
|
219
|
-
if (container != undefined) {
|
|
220
|
-
container.message.push(d.message);
|
|
221
|
-
if (container.message.length > interface_1.MESSAGE_LIMIT) {
|
|
222
|
-
container.message.shift();
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
this.update_runtime_parameter = (d) => {
|
|
227
|
-
this.model.record.para = d;
|
|
228
|
-
};
|
|
229
|
-
this.model = _model;
|
|
230
|
-
}
|
|
231
|
-
get execute_proxy() {
|
|
232
|
-
const d = {
|
|
233
|
-
executeProjectStart: (data) => { this.execute_project_start(data); },
|
|
234
|
-
executeProjectFinish: (data) => { this.execute_project_finish(data); },
|
|
235
|
-
executeTaskStart: (data) => { this.execute_task_start(data); },
|
|
236
|
-
executeTaskFinish: (data) => { this.execute_task_finish(data); },
|
|
237
|
-
executeSubtaskStart: (data) => { this.execute_subtask_start(data); },
|
|
238
|
-
executeSubtaskUpdate: (data) => { this.execute_subtask_update(data); },
|
|
239
|
-
executeSubtaskFinish: (data) => { this.execute_subtask_end(data); },
|
|
240
|
-
executeJobStart: (data) => { this.execute_job_start(data); },
|
|
241
|
-
executeJobFinish: (data) => { this.execute_job_finish(data); },
|
|
242
|
-
feedbackMessage: (data) => { this.feedback_message(data); },
|
|
243
|
-
updateParameter: (data) => { this.update_runtime_parameter(data); }
|
|
244
|
-
};
|
|
245
|
-
return d;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
exports.Util_Server_Console_Proxy = Util_Server_Console_Proxy;
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.Util_Server_Log_Proxy = void 0;
|
|
46
|
-
const uuid_1 = require("uuid");
|
|
47
|
-
const interface_1 = require("../../interface");
|
|
48
|
-
const fs = __importStar(require("fs"));
|
|
49
|
-
class Util_Server_Log_Proxy {
|
|
50
|
-
get target_log() {
|
|
51
|
-
return this.logs.logs.find(x => x.uuid == this.uuid);
|
|
52
|
-
}
|
|
53
|
-
constructor(_model, _log, _preference) {
|
|
54
|
-
this.task_index = 0;
|
|
55
|
-
this.uuid = '';
|
|
56
|
-
this.execute_project_start = (d) => __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
const target = this.model.record.projects[this.model.record.project_index];
|
|
58
|
-
const title = yield this.getnewname(target.title);
|
|
59
|
-
this.uuid = (0, uuid_1.v6)();
|
|
60
|
-
const newlog = {
|
|
61
|
-
uuid: this.uuid,
|
|
62
|
-
filename: title,
|
|
63
|
-
dirty: true,
|
|
64
|
-
output: this.preference.log,
|
|
65
|
-
project: target,
|
|
66
|
-
state: interface_1.ExecuteState.RUNNING,
|
|
67
|
-
start_timer: Date.now(),
|
|
68
|
-
parameter: d[0].parameter,
|
|
69
|
-
end_timer: 0,
|
|
70
|
-
logs: target.task.map(x => {
|
|
71
|
-
return {
|
|
72
|
-
start_timer: 0,
|
|
73
|
-
end_timer: 0,
|
|
74
|
-
task_state: {
|
|
75
|
-
uuid: x.uuid,
|
|
76
|
-
state: interface_1.ExecuteState.NONE
|
|
77
|
-
},
|
|
78
|
-
task_detail: []
|
|
79
|
-
};
|
|
80
|
-
})
|
|
81
|
-
};
|
|
82
|
-
this.logs.logs = [newlog].concat(this.logs.logs);
|
|
83
|
-
});
|
|
84
|
-
this.execute_project_finish = (d) => {
|
|
85
|
-
if (this.target_log == undefined)
|
|
86
|
-
return;
|
|
87
|
-
this.target_log.state = interface_1.ExecuteState.FINISH;
|
|
88
|
-
this.target_log.end_timer = Date.now();
|
|
89
|
-
this.target_log.dirty = true;
|
|
90
|
-
};
|
|
91
|
-
this.execute_task_start = (d) => {
|
|
92
|
-
if (this.target_log == undefined)
|
|
93
|
-
return;
|
|
94
|
-
const index = this.target_log.project.task.findIndex(x => x.uuid == d[0].uuid);
|
|
95
|
-
if (index == -1)
|
|
96
|
-
return;
|
|
97
|
-
this.task_index = index;
|
|
98
|
-
this.target_log.logs[this.task_index].task_detail = [];
|
|
99
|
-
const p = this.model.record.projects[this.model.record.project_index];
|
|
100
|
-
const t = p.task[this.task_index];
|
|
101
|
-
const count = this.model.manager.get_task_state_count(t);
|
|
102
|
-
for (let i = 0; i < count; i++) {
|
|
103
|
-
this.target_log.logs[this.task_index].task_detail.push({
|
|
104
|
-
index: i,
|
|
105
|
-
node: "",
|
|
106
|
-
message: [],
|
|
107
|
-
state: interface_1.ExecuteState.NONE
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
if (this.target_log.logs.length > this.task_index) {
|
|
111
|
-
this.target_log.logs[this.task_index].task_state.state = interface_1.ExecuteState.RUNNING;
|
|
112
|
-
this.target_log.logs[this.task_index].start_timer = Date.now();
|
|
113
|
-
this.target_log.dirty = true;
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
this.execute_task_finish = (d) => {
|
|
117
|
-
if (this.target_log == undefined)
|
|
118
|
-
return;
|
|
119
|
-
if (this.target_log.logs.length > this.task_index) {
|
|
120
|
-
this.target_log.logs[this.task_index].task_state.state = interface_1.ExecuteState.FINISH;
|
|
121
|
-
this.target_log.logs[this.task_index].end_timer = Date.now();
|
|
122
|
-
this.target_log.dirty = true;
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
this.execute_subtask_start = (d) => {
|
|
126
|
-
if (this.target_log == undefined)
|
|
127
|
-
return;
|
|
128
|
-
if (this.target_log.logs[this.task_index].task_detail.length > d[1]) {
|
|
129
|
-
this.target_log.logs[this.task_index].task_detail[d[1]].state = interface_1.ExecuteState.RUNNING;
|
|
130
|
-
this.target_log.dirty = true;
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
this.execute_subtask_update = (d) => {
|
|
134
|
-
if (this.target_log == undefined)
|
|
135
|
-
return;
|
|
136
|
-
if (this.target_log.logs[this.task_index].task_detail.length > d[1]) {
|
|
137
|
-
this.target_log.logs[this.task_index].task_detail[d[1]].state = d[3];
|
|
138
|
-
this.target_log.dirty = true;
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
this.execute_subtask_end = (d) => {
|
|
142
|
-
if (this.target_log == undefined)
|
|
143
|
-
return;
|
|
144
|
-
if (this.target_log.logs[this.task_index].task_detail.length > d[1]) {
|
|
145
|
-
this.target_log.logs[this.task_index].task_detail[d[1]].state = interface_1.ExecuteState.FINISH;
|
|
146
|
-
this.target_log.dirty = true;
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
this.execute_job_start = (d) => {
|
|
150
|
-
};
|
|
151
|
-
this.execute_job_finish = (d) => {
|
|
152
|
-
if (this.target_log == undefined)
|
|
153
|
-
return;
|
|
154
|
-
if (d[3] == 1) {
|
|
155
|
-
const currentLog = this.target_log;
|
|
156
|
-
const task = currentLog.project.task[this.task_index];
|
|
157
|
-
const index = task.jobs.findIndex(x => x.uuid == d[0].uuid);
|
|
158
|
-
if (index != -1 && task.jobs[index].category == interface_1.JobCategory.Condition) {
|
|
159
|
-
const cr = task.jobs[index].number_args[0];
|
|
160
|
-
if (cr == interface_1.ConditionResult.None)
|
|
161
|
-
return;
|
|
162
|
-
const state = (cr == interface_1.ConditionResult.ThrowTask || cr == interface_1.ConditionResult.ThrowProject) ? interface_1.ExecuteState.ERROR : interface_1.ExecuteState.SKIP;
|
|
163
|
-
const target = this.model.record.task_detail[d[1]];
|
|
164
|
-
if (target != undefined) {
|
|
165
|
-
target.state = state;
|
|
166
|
-
}
|
|
167
|
-
currentLog.logs[this.task_index].task_state.state = state;
|
|
168
|
-
if (cr == interface_1.ConditionResult.Pause)
|
|
169
|
-
return;
|
|
170
|
-
if (cr == interface_1.ConditionResult.SkipProject || cr == interface_1.ConditionResult.ThrowProject) {
|
|
171
|
-
currentLog.state = state;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
this.feedback_message = (d) => {
|
|
177
|
-
if (this.target_log == undefined)
|
|
178
|
-
return;
|
|
179
|
-
if (d.index == undefined || d.index == -1)
|
|
180
|
-
return;
|
|
181
|
-
if (this.target_log == undefined)
|
|
182
|
-
return;
|
|
183
|
-
if (this.target_log.logs[this.task_index].task_detail.length > d.index) {
|
|
184
|
-
this.target_log.logs[this.task_index].task_detail[d.index].message.push(d.message);
|
|
185
|
-
this.target_log.dirty = true;
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
console.warn("Try access message by index but failed: ", d);
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
this.update_runtime_parameter = (d) => {
|
|
192
|
-
if (this.target_log != undefined) {
|
|
193
|
-
this.target_log.parameter = d;
|
|
194
|
-
this.target_log.dirty = true;
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
this.getnewname = (name) => __awaiter(this, void 0, void 0, function* () {
|
|
198
|
-
const root = "data/log";
|
|
199
|
-
let count = 0;
|
|
200
|
-
let filename = name;
|
|
201
|
-
let p = `${root}/${filename}`;
|
|
202
|
-
while (fs.existsSync(p + ".json")) {
|
|
203
|
-
count = count + 1;
|
|
204
|
-
filename = `${name} ${count}`;
|
|
205
|
-
p = `${root}/${filename}`;
|
|
206
|
-
}
|
|
207
|
-
return filename;
|
|
208
|
-
});
|
|
209
|
-
this.model = _model;
|
|
210
|
-
this.logs = _log;
|
|
211
|
-
this.preference = _preference;
|
|
212
|
-
}
|
|
213
|
-
get execute_proxy() {
|
|
214
|
-
const d = {
|
|
215
|
-
executeProjectStart: (data) => { this.execute_project_start(data); },
|
|
216
|
-
executeProjectFinish: (data) => { this.execute_project_finish(data); },
|
|
217
|
-
executeTaskStart: (data) => { this.execute_task_start(data); },
|
|
218
|
-
executeTaskFinish: (data) => { this.execute_task_finish(data); },
|
|
219
|
-
executeSubtaskStart: (data) => { this.execute_subtask_start(data); },
|
|
220
|
-
executeSubtaskUpdate: (data) => { this.execute_subtask_update(data); },
|
|
221
|
-
executeSubtaskFinish: (data) => { this.execute_subtask_end(data); },
|
|
222
|
-
executeJobStart: (data) => { this.execute_job_start(data); },
|
|
223
|
-
executeJobFinish: (data) => { this.execute_job_finish(data); },
|
|
224
|
-
feedbackMessage: (data) => { this.feedback_message(data); },
|
|
225
|
-
updateParameter: (data) => { this.update_runtime_parameter(data); }
|
|
226
|
-
};
|
|
227
|
-
return d;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
exports.Util_Server_Log_Proxy = Util_Server_Log_Proxy;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|