verteilen-core 1.3.18 → 1.3.20

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/lan/en.json CHANGED
@@ -133,6 +133,8 @@
133
133
  "delete-template": "Delete Template",
134
134
  "delete-plugin-confirm": "Are you sure delete plugin you selected",
135
135
  "delete-template-confirm": "Are you sure delete template you selected",
136
+ "job-title": "Job Title",
137
+ "job-description": "Job Description",
136
138
  "delete-job": "Delete Job",
137
139
  "delete-job-confirm": "Are you sure you want to delete this job?",
138
140
  "delete-task": "Delete Task",
@@ -133,6 +133,8 @@
133
133
  "delete-template": "刪除樣板",
134
134
  "delete-plugin-confirm": "確定刪除選取的插件嗎?",
135
135
  "delete-template-confirm": "確定刪除選取的樣板嗎?",
136
+ "job-title": "工作標題",
137
+ "job-description": "工作敘述",
136
138
  "delete-job": "刪除工作",
137
139
  "delete-job-confirm": "確定刪除選取的工作嗎?",
138
140
  "delete-task": "刪除流程",
@@ -141,6 +141,8 @@ export declare const i18nDefaultData: {
141
141
  "delete-template": string;
142
142
  "delete-plugin-confirm": string;
143
143
  "delete-template-confirm": string;
144
+ "job-title": string;
145
+ "job-description": string;
144
146
  "delete-job": string;
145
147
  "delete-job-confirm": string;
146
148
  "delete-task": string;
@@ -560,6 +562,8 @@ export declare const i18nDefaultData: {
560
562
  "delete-template": string;
561
563
  "delete-plugin-confirm": string;
562
564
  "delete-template-confirm": string;
565
+ "job-title": string;
566
+ "job-description": string;
563
567
  "delete-job": string;
564
568
  "delete-job-confirm": string;
565
569
  "delete-task": string;
@@ -982,6 +986,8 @@ export declare const i18n: import("vue-i18n").I18n<{
982
986
  "delete-template": string;
983
987
  "delete-plugin-confirm": string;
984
988
  "delete-template-confirm": string;
989
+ "job-title": string;
990
+ "job-description": string;
985
991
  "delete-job": string;
986
992
  "delete-job-confirm": string;
987
993
  "delete-task": string;
@@ -1401,6 +1407,8 @@ export declare const i18n: import("vue-i18n").I18n<{
1401
1407
  "delete-template": string;
1402
1408
  "delete-plugin-confirm": string;
1403
1409
  "delete-template-confirm": string;
1410
+ "job-title": string;
1411
+ "job-description": string;
1404
1412
  "delete-job": string;
1405
1413
  "delete-job-confirm": string;
1406
1414
  "delete-task": string;
@@ -6,9 +6,10 @@ export declare class Project_Module {
6
6
  constructor(memory: Server);
7
7
  get memory(): MemoryData;
8
8
  get loader(): RecordLoader;
9
- ProjectJobCount(uuid: string): number;
10
- PopulateProject(uuid: string): Project | undefined;
11
- PopulateTask(uuid: string): Task | undefined;
9
+ ProjectJobCount(uuid: string): Promise<number>;
10
+ ReOrderProjectTask(uuid: string, uuids: Array<string>): Promise<void>;
11
+ PopulateProject(uuid: string): Promise<Project | undefined>;
12
+ PopulateTask(uuid: string): Promise<Task | undefined>;
12
13
  GetProjectRelatedTask(uuid: string): Promise<Array<Task>>;
13
14
  GetTaskRelatedJob(uuid: string): Promise<Array<Job>>;
14
15
  CloneProjects(uuids: Array<string>): Promise<Array<string>>;
@@ -9,7 +9,8 @@ class Project_Module {
9
9
  }
10
10
  get memory() { return this.server.memory; }
11
11
  get loader() { return this.server.current_loader; }
12
- ProjectJobCount(uuid) {
12
+ async ProjectJobCount(uuid) {
13
+ await this.loader.project.load(uuid, true);
13
14
  const p = this.memory.projects.find(p => p.uuid == uuid);
14
15
  if (!p)
15
16
  return 0;
@@ -17,58 +18,63 @@ class Project_Module {
17
18
  const counts = t.map(x => x.jobs_uuid.length);
18
19
  return counts.reduce((a, b) => a + b, 0);
19
20
  }
20
- PopulateProject(uuid) {
21
+ async ReOrderProjectTask(uuid, uuids) {
22
+ await this.loader.project.load(uuid, true);
23
+ const p = this.memory.projects.find(p => p.uuid == uuid);
24
+ if (!p)
25
+ return;
26
+ p.tasks_uuid = uuids;
27
+ this.loader.project.save(uuid, JSON.stringify(p, null, 4));
28
+ }
29
+ async PopulateProject(uuid) {
30
+ await this.loader.project.load(uuid, true);
21
31
  const p = this.memory.projects.find(p => p.uuid == uuid);
22
32
  if (!p)
23
33
  return undefined;
24
34
  const buffer = Object.assign({}, p);
25
- for (var x of buffer.tasks_uuid) {
26
- const t = this.PopulateTask(x);
27
- if (!t)
28
- return undefined;
29
- buffer.tasks.push(t);
30
- }
35
+ const ts = buffer.tasks_uuid.map(x => this.PopulateTask(x));
36
+ buffer.tasks = (await Promise.all(ts)).filter(x => x != undefined);
31
37
  return buffer;
32
38
  }
33
- PopulateTask(uuid) {
39
+ async PopulateTask(uuid) {
40
+ await this.loader.task.load(uuid, false);
34
41
  const p = this.memory.tasks.find(p => p.uuid == uuid);
35
42
  if (!p)
36
43
  return undefined;
37
44
  const buffer = Object.assign({}, p);
38
- for (var x of buffer.jobs_uuid) {
39
- const t = this.memory.jobs.find(t => t.uuid == x);
40
- if (!t)
41
- return undefined;
42
- buffer.jobs.push(t);
43
- }
45
+ const js = buffer.jobs_uuid.map(async (x) => {
46
+ await this.loader.job.load(uuid, false);
47
+ return this.memory.jobs.find(t => t.uuid == x);
48
+ });
49
+ buffer.jobs = (await Promise.all(js)).filter(x => x != undefined);
44
50
  return buffer;
45
51
  }
46
52
  async GetProjectRelatedTask(uuid) {
47
- await this.loader.project.load(uuid, true);
53
+ await this.loader.project.load(uuid, false);
48
54
  const p = this.memory.projects.find(x => x.uuid == uuid);
49
55
  if (!p)
50
56
  return [];
51
57
  const r = p.tasks_uuid.map(x => {
52
- return this.loader.task.load(x, true);
58
+ return this.loader.task.load(x, false);
53
59
  });
54
60
  await Promise.all(r);
55
61
  const tasks = p.tasks_uuid.map(x => this.memory.tasks.find(y => y.uuid == x)).filter(x => x != undefined);
56
62
  return tasks;
57
63
  }
58
64
  async GetTaskRelatedJob(uuid) {
59
- await this.loader.task.load(uuid, true);
65
+ await this.loader.task.load(uuid, false);
60
66
  const p = this.memory.tasks.find(x => x.uuid == uuid);
61
67
  if (!p)
62
68
  return [];
63
69
  const r = p.jobs_uuid.map(x => {
64
- return this.loader.job.load(x, true);
70
+ return this.loader.job.load(x, false);
65
71
  });
66
72
  await Promise.all(r);
67
73
  const jobs = p.jobs_uuid.map(x => this.memory.jobs.find(y => y.uuid == x)).filter(x => x != undefined);
68
74
  return jobs;
69
75
  }
70
76
  async CloneProjects(uuids) {
71
- const p = uuids.map(x => this.loader.project.load(x, true));
77
+ const p = uuids.map(x => this.loader.project.load(x, false));
72
78
  const ps = await Promise.all(p);
73
79
  const projects = ps.map(x => JSON.parse(x));
74
80
  projects.forEach((x, i) => x.uuid = (0, uuid_1.v6)({}, undefined, i));
@@ -82,7 +88,7 @@ class Project_Module {
82
88
  return projects.map(x => x.uuid);
83
89
  }
84
90
  async CloneTasks(uuids) {
85
- const p = uuids.map(x => this.loader.task.load(x, true));
91
+ const p = uuids.map(x => this.loader.task.load(x, false));
86
92
  const ps = await Promise.all(p);
87
93
  const tasks = ps.map(x => JSON.parse(x));
88
94
  tasks.forEach((x, i) => x.uuid = (0, uuid_1.v6)({}, undefined, 2500 + i));
@@ -96,7 +102,7 @@ class Project_Module {
96
102
  return tasks.map(x => x.uuid);
97
103
  }
98
104
  async CloneJobs(uuids) {
99
- const p = uuids.map(x => this.loader.job.load(x, true));
105
+ const p = uuids.map(x => this.loader.job.load(x, false));
100
106
  const ps = await Promise.all(p);
101
107
  const jobs = ps.map(x => JSON.parse(x));
102
108
  jobs.forEach((x, i) => x.uuid = (0, uuid_1.v6)({}, undefined, 5000 + i));
@@ -105,7 +111,7 @@ class Project_Module {
105
111
  return jobs.map(x => x.uuid);
106
112
  }
107
113
  async CascadeDeleteProject(uuid, bind) {
108
- await this.loader.project.load(uuid, true);
114
+ await this.loader.project.load(uuid, false);
109
115
  const p = this.memory.projects.find(p => p.uuid == uuid);
110
116
  if (!p)
111
117
  return;
@@ -117,7 +123,7 @@ class Project_Module {
117
123
  await this.Delete_Database_Idle(db);
118
124
  }
119
125
  async CascadeDeleteTask(uuid) {
120
- await this.loader.task.load(uuid, true);
126
+ await this.loader.task.load(uuid, false);
121
127
  const p = this.memory.tasks.find(p => p.uuid == uuid);
122
128
  if (!p)
123
129
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verteilen-core",
3
- "version": "1.3.18",
3
+ "version": "1.3.20",
4
4
  "license": "MIT",
5
5
  "homepage": "https://verteilen.github.io/wiki/",
6
6
  "author": "Elly",
package/src/lan/en.json CHANGED
@@ -133,6 +133,8 @@
133
133
  "delete-template": "Delete Template",
134
134
  "delete-plugin-confirm": "Are you sure delete plugin you selected",
135
135
  "delete-template-confirm": "Are you sure delete template you selected",
136
+ "job-title": "Job Title",
137
+ "job-description": "Job Description",
136
138
  "delete-job": "Delete Job",
137
139
  "delete-job-confirm": "Are you sure you want to delete this job?",
138
140
  "delete-task": "Delete Task",
@@ -133,6 +133,8 @@
133
133
  "delete-template": "刪除樣板",
134
134
  "delete-plugin-confirm": "確定刪除選取的插件嗎?",
135
135
  "delete-template-confirm": "確定刪除選取的樣板嗎?",
136
+ "job-title": "工作標題",
137
+ "job-description": "工作敘述",
136
138
  "delete-job": "刪除工作",
137
139
  "delete-job-confirm": "確定刪除選取的工作嗎?",
138
140
  "delete-task": "刪除流程",
@@ -18,42 +18,49 @@ export class Project_Module {
18
18
  public get memory(): MemoryData { return this.server.memory }
19
19
  public get loader(): RecordLoader { return this.server.current_loader }
20
20
 
21
- ProjectJobCount(uuid:string):number {
21
+ async ProjectJobCount(uuid:string):Promise<number> {
22
+ await this.loader.project.load(uuid, true)
22
23
  const p:Project | undefined = this.memory.projects.find(p=> p.uuid == uuid)
23
24
  if(!p) return 0
24
25
  const t:Array<Task> = p.tasks_uuid.map(t_uuid => this.memory.tasks.find(t => t.uuid == t_uuid)).filter(t => t != undefined)
25
26
  const counts = t.map(x => x.jobs_uuid.length)
26
27
  return counts.reduce((a,b) => a + b, 0)
27
28
  }
29
+ async ReOrderProjectTask(uuid:string, uuids:Array<string>):Promise<void> {
30
+ await this.loader.project.load(uuid, true)
31
+ const p:Project | undefined = this.memory.projects.find(p=> p.uuid == uuid)
32
+ if(!p) return
33
+ p.tasks_uuid = uuids
34
+ this.loader.project.save(uuid, JSON.stringify(p, null, 4))
35
+ }
28
36
 
29
37
  /**
30
38
  * Assign real data to instance
31
39
  * @param uuid Project UUID
32
40
  */
33
- PopulateProject(uuid:string):Project | undefined {
41
+ async PopulateProject(uuid:string):Promise<Project | undefined> {
42
+ await this.loader.project.load(uuid, true)
34
43
  const p:Project | undefined = this.memory.projects.find(p=> p.uuid == uuid)
35
44
  if(!p) return undefined
36
45
  const buffer:Project = Object.assign({}, p) as Project
37
- for(var x of buffer.tasks_uuid){
38
- const t:Task | undefined = this.PopulateTask(x)
39
- if(!t) return undefined
40
- buffer.tasks.push(t)
41
- }
46
+ const ts = buffer.tasks_uuid.map(x => this.PopulateTask(x))
47
+ buffer.tasks = (await Promise.all(ts)).filter(x => x != undefined)
42
48
  return buffer
43
49
  }
44
50
  /**
45
51
  * Assign real data to instance
46
52
  * @param uuid Task UUID
47
53
  */
48
- PopulateTask(uuid:string):Task | undefined {
54
+ async PopulateTask(uuid:string):Promise<Task | undefined> {
55
+ await this.loader.task.load(uuid, false)
49
56
  const p:Task | undefined = this.memory.tasks.find(p=> p.uuid == uuid)
50
57
  if(!p) return undefined
51
58
  const buffer:Task = Object.assign({}, p) as Task
52
- for(var x of buffer.jobs_uuid){
53
- const t:Job | undefined = this.memory.jobs.find(t => t.uuid == x)
54
- if(!t) return undefined
55
- buffer.jobs.push(t)
56
- }
59
+ const js = buffer.jobs_uuid.map(async x => {
60
+ await this.loader.job.load(uuid, false)
61
+ return this.memory.jobs.find(t => t.uuid == x)
62
+ })
63
+ buffer.jobs = (await Promise.all(js)).filter(x => x != undefined)
57
64
  return buffer
58
65
  }
59
66
  /**
@@ -62,11 +69,11 @@ export class Project_Module {
62
69
  * @returns Related Tasks
63
70
  */
64
71
  async GetProjectRelatedTask(uuid:string):Promise<Array<Task>> {
65
- await this.loader.project.load(uuid, true)
72
+ await this.loader.project.load(uuid, false)
66
73
  const p = this.memory.projects.find(x => x.uuid == uuid)
67
74
  if(!p) return []
68
75
  const r = p.tasks_uuid.map(x => {
69
- return this.loader.task.load(x, true)
76
+ return this.loader.task.load(x, false)
70
77
  })
71
78
  await Promise.all(r)
72
79
  const tasks = p.tasks_uuid.map(x => this.memory.tasks.find(y => y.uuid == x)).filter(x => x != undefined)
@@ -78,11 +85,11 @@ export class Project_Module {
78
85
  * @returns Related Jobs
79
86
  */
80
87
  async GetTaskRelatedJob(uuid:string):Promise<Array<Job>> {
81
- await this.loader.task.load(uuid, true)
88
+ await this.loader.task.load(uuid, false)
82
89
  const p = this.memory.tasks.find(x => x.uuid == uuid)
83
90
  if(!p) return []
84
91
  const r = p.jobs_uuid.map(x => {
85
- return this.loader.job.load(x, true)
92
+ return this.loader.job.load(x, false)
86
93
  })
87
94
  await Promise.all(r)
88
95
  const jobs = p.jobs_uuid.map(x => this.memory.jobs.find(y => y.uuid == x)).filter(x => x != undefined)
@@ -94,7 +101,7 @@ export class Project_Module {
94
101
  * @returns The new uuids list
95
102
  */
96
103
  async CloneProjects(uuids:Array<string>):Promise<Array<string>>{
97
- const p = uuids.map(x => this.loader.project.load(x, true))
104
+ const p = uuids.map(x => this.loader.project.load(x, false))
98
105
  const ps = await Promise.all(p)
99
106
  const projects:Array<Project> = ps.map(x => JSON.parse(x))
100
107
  projects.forEach((x, i) => x.uuid = uuidv6({}, undefined, i))
@@ -113,7 +120,7 @@ export class Project_Module {
113
120
  * @returns The new uuids list
114
121
  */
115
122
  async CloneTasks(uuids:Array<string>):Promise<Array<string>>{
116
- const p = uuids.map(x => this.loader.task.load(x, true))
123
+ const p = uuids.map(x => this.loader.task.load(x, false))
117
124
  const ps = await Promise.all(p)
118
125
  const tasks:Array<Task> = ps.map(x => JSON.parse(x))
119
126
  tasks.forEach((x, i) => x.uuid = uuidv6({}, undefined, 2500 + i))
@@ -132,7 +139,7 @@ export class Project_Module {
132
139
  * @returns The new uuids list
133
140
  */
134
141
  async CloneJobs(uuids:Array<string>):Promise<Array<string>>{
135
- const p = uuids.map(x => this.loader.job.load(x, true))
142
+ const p = uuids.map(x => this.loader.job.load(x, false))
136
143
  const ps = await Promise.all(p)
137
144
  const jobs:Array<Job> = ps.map(x => JSON.parse(x))
138
145
  jobs.forEach((x, i) => x.uuid = uuidv6({}, undefined, 5000 + i))
@@ -145,7 +152,7 @@ export class Project_Module {
145
152
  * @param uuid Project UUID
146
153
  */
147
154
  async CascadeDeleteProject(uuid:string, bind:boolean):Promise<void>{
148
- await this.loader.project.load(uuid, true)
155
+ await this.loader.project.load(uuid, false)
149
156
  const p:Project = this.memory.projects.find(p=> p.uuid == uuid)!
150
157
  if(!p) return
151
158
  const ps = p.tasks_uuid.map(t_uuid => this.CascadeDeleteTask(t_uuid))
@@ -159,7 +166,7 @@ export class Project_Module {
159
166
  * @param uuid Task UUID
160
167
  */
161
168
  async CascadeDeleteTask(uuid:string):Promise<void>{
162
- await this.loader.task.load(uuid, true)
169
+ await this.loader.task.load(uuid, false)
163
170
  const p:Task = this.memory.tasks.find(p=> p.uuid == uuid)!
164
171
  if(!p) return
165
172
  const ps = p.jobs_uuid.map(j_uuid => this.loader.job.delete(j_uuid))