verteilen-core 1.3.9 → 1.3.10

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.
@@ -9,8 +9,8 @@ export declare class Project_Module {
9
9
  ProjectJobCount(uuid: string): number;
10
10
  PopulateProject(uuid: string): Project | undefined;
11
11
  PopulateTask(uuid: string): Task | undefined;
12
- GetProjectRelatedTask(uuid: string): Array<Task>;
13
- GetTaskRelatedJob(uuid: string): Array<Job>;
12
+ GetProjectRelatedTask(uuid: string): Promise<Array<Task>>;
13
+ GetTaskRelatedJob(uuid: string): Promise<Array<Job>>;
14
14
  CloneProjects(uuids: Array<string>): Promise<Array<string>>;
15
15
  CloneTasks(uuids: Array<string>): Promise<Array<string>>;
16
16
  CloneJobs(uuids: Array<string>): Promise<Array<string>>;
@@ -43,23 +43,29 @@ class Project_Module {
43
43
  }
44
44
  return buffer;
45
45
  }
46
- GetProjectRelatedTask(uuid) {
46
+ async GetProjectRelatedTask(uuid) {
47
+ await this.loader.project.load(uuid, true);
47
48
  const p = this.memory.projects.find(x => x.uuid == uuid);
48
49
  if (!p)
49
50
  return [];
50
51
  const r = p.tasks_uuid.map(x => {
51
- return this.memory.tasks.find(y => y.uuid == x);
52
- }).filter(x => x != undefined);
53
- return r;
52
+ return this.loader.task.load(x, true);
53
+ });
54
+ await Promise.all(r);
55
+ const tasks = this.memory.tasks.filter(x => p.tasks_uuid.includes(x.uuid));
56
+ return tasks;
54
57
  }
55
- GetTaskRelatedJob(uuid) {
58
+ async GetTaskRelatedJob(uuid) {
59
+ await this.loader.task.load(uuid, true);
56
60
  const p = this.memory.tasks.find(x => x.uuid == uuid);
57
61
  if (!p)
58
62
  return [];
59
63
  const r = p.jobs_uuid.map(x => {
60
- return this.memory.jobs.find(y => y.uuid == x);
61
- }).filter(x => x != undefined);
62
- return r;
64
+ return this.loader.job.load(x, true);
65
+ });
66
+ await Promise.all(r);
67
+ const jobs = this.memory.jobs.filter(x => p.jobs_uuid.includes(x.uuid));
68
+ return jobs;
63
69
  }
64
70
  async CloneProjects(uuids) {
65
71
  const p = uuids.map(x => this.loader.project.load(x, true));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verteilen-core",
3
- "version": "1.3.9",
3
+ "version": "1.3.10",
4
4
  "license": "MIT",
5
5
  "homepage": "https://verteilen.github.io/wiki/",
6
6
  "author": "Elly",
@@ -61,26 +61,32 @@ export class Project_Module {
61
61
  * @param uuid Project UUID
62
62
  * @returns Related Tasks
63
63
  */
64
- GetProjectRelatedTask(uuid:string):Array<Task> {
64
+ async GetProjectRelatedTask(uuid:string):Promise<Array<Task>> {
65
+ await this.loader.project.load(uuid, true)
65
66
  const p = this.memory.projects.find(x => x.uuid == uuid)
66
67
  if(!p) return []
67
68
  const r = p.tasks_uuid.map(x => {
68
- return this.memory.tasks.find(y => y.uuid == x)
69
- }).filter(x => x != undefined)
70
- return r
69
+ return this.loader.task.load(x, true)
70
+ })
71
+ await Promise.all(r)
72
+ const tasks = this.memory.tasks.filter(x => p.tasks_uuid.includes(x.uuid))
73
+ return tasks
71
74
  }
72
75
  /**
73
76
  * Get jobs from task related
74
77
  * @param uuid Task UUID
75
78
  * @returns Related Jobs
76
79
  */
77
- GetTaskRelatedJob(uuid:string):Array<Job> {
80
+ async GetTaskRelatedJob(uuid:string):Promise<Array<Job>> {
81
+ await this.loader.task.load(uuid, true)
78
82
  const p = this.memory.tasks.find(x => x.uuid == uuid)
79
83
  if(!p) return []
80
84
  const r = p.jobs_uuid.map(x => {
81
- return this.memory.jobs.find(y => y.uuid == x)
82
- }).filter(x => x != undefined)
83
- return r
85
+ return this.loader.job.load(x, true)
86
+ })
87
+ await Promise.all(r)
88
+ const jobs = this.memory.jobs.filter(x => p.jobs_uuid.includes(x.uuid))
89
+ return jobs
84
90
  }
85
91
  /**
86
92
  * Clone Project Container