Skip to content

Commit

Permalink
fix: update sorting to match 2.9.0 behavior
Browse files Browse the repository at this point in the history
Signed-off-by: Trae Yelovich <[email protected]>
  • Loading branch information
traeok committed Jul 7, 2023
1 parent afd5d8c commit a72091c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/zowe-explorer/src/job/ZoweJobNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,23 @@ export class Job extends ZoweTreeNode implements IZoweJobTreeNode {
}

// Only add new children that are not in the list of existing child nodes
const newChildren = Object.values(elementChildren)
.sort((a, b) => a.job.jobid - b.job.jobid)
.filter((c) => this.children.find((ch) => ch.label === c.label) == null);
const newChildren = Object.values(elementChildren).filter((c) => this.children.find((ch) => ch.label === c.label) == null);

// Remove any children that are no longer present in the built record
this.children = this.children
.concat(newChildren)
.filter((ch) => Object.values(elementChildren).find((recordCh) => recordCh.jobid === ch.job.jobid) == null);
.filter((ch) => Object.values(elementChildren).find((recordCh) => recordCh.jobid === ch.job.jobid) == null)
.sort((a, b) => {

Check warning on line 226 in packages/zowe-explorer/src/job/ZoweJobNode.ts

View check run for this annotation

Codecov / codecov/patch

packages/zowe-explorer/src/job/ZoweJobNode.ts#L226

Added line #L226 was not covered by tests
if (a.job.jobid > b.job.jobid) {
return 1;

Check warning on line 228 in packages/zowe-explorer/src/job/ZoweJobNode.ts

View check run for this annotation

Codecov / codecov/patch

packages/zowe-explorer/src/job/ZoweJobNode.ts#L228

Added line #L228 was not covered by tests
}

if (a.job.jobid < b.job.jobid) {
return -1;

Check warning on line 232 in packages/zowe-explorer/src/job/ZoweJobNode.ts

View check run for this annotation

Codecov / codecov/patch

packages/zowe-explorer/src/job/ZoweJobNode.ts#L232

Added line #L232 was not covered by tests
}

return 0;

Check warning on line 235 in packages/zowe-explorer/src/job/ZoweJobNode.ts

View check run for this annotation

Codecov / codecov/patch

packages/zowe-explorer/src/job/ZoweJobNode.ts#L235

Added line #L235 was not covered by tests
});
}
this.dirty = false;
return this.children;
Expand Down

0 comments on commit a72091c

Please sign in to comment.