verteilen-core 1.3.18 → 1.3.19

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,30 +18,35 @@ 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, true);
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, true);
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verteilen-core",
3
- "version": "1.3.18",
3
+ "version": "1.3.19",
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, true)
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, true)
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
  /**