Skip to content

Commit

Permalink
Merge pull request #2644 from SanthoshiBoyina/fix/spool-order
Browse files Browse the repository at this point in the history
Bug: Order of Spool files reverses when the job is Expanded and Collapsed
  • Loading branch information
JillieBeanSim authored Jan 4, 2024
2 parents bb75547 + e7ae78b commit 15d8aeb
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
- Update dependencies for technical currency purposes.
- Fixed issue where USS file tag could get overwritten when changes to file are uploaded. [#2576](https://github.com/zowe/vscode-extension-for-zowe/issues/2576)
- Fixed failure to refresh token value after user logs in to authentication. [#2638](https://github.com/zowe/vscode-extension-for-zowe/issues/2638)
- Fixed order of spool files reverses when the Job is expanded and collapsed. [#2644](https://github.com/zowe/vscode-extension-for-zowe/pull/2644)

## `2.13.0`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,27 @@ describe("ZoweJobNode unit tests - Function getChildren", () => {
const jobs = await globalMocks.testJobsProvider.mSessionNodes[1].getChildren();
expect(jobs[0].label).toEqual("TESTJOB(JOB1234) - ACTIVE");
});

it("To check Order of Spool files don't reverse when the job is Expanded and Collapsed", async () => {
const globalMocks = await createGlobalMocks();
globalMocks.testJobsProvider.mSessionNodes[1]._owner = null;
globalMocks.testJobsProvider.mSessionNodes[1]._prefix = "*";
globalMocks.testJobsProvider.mSessionNodes[1]._searchId = "";
globalMocks.testJobNode.session.ISession = globalMocks.testSessionNoCred;
jest.spyOn(ZoweExplorerApiRegister, "getJesApi").mockReturnValueOnce({
getSpoolFiles: jest.fn().mockReturnValueOnce([
{ ...globalMocks.mockIJobFile, stepname: "JES2", ddname: "JESMSGLG", "record-count": 11 },
{ ...globalMocks.mockIJobFile, stepname: "JES2", ddname: "JESJCL", "record-count": 21 },
{ ...globalMocks.mockIJobFile, stepname: "JES2", ddname: "JESYSMSG", "record-count": 6 },
]),
} as any);
jest.spyOn(contextually, "isSession").mockReturnValueOnce(false);
const spoolFiles = await globalMocks.testJobNode.getChildren();
expect(spoolFiles.length).toBe(3);
expect(spoolFiles[0].label).toBe("JES2:JESMSGLG - 11");
expect(spoolFiles[1].label).toBe("JES2:JESJCL - 21");
expect(spoolFiles[2].label).toBe("JES2:JESYSMSG - 6");
});
});

describe("ZoweJobNode unit tests - Function flipState", () => {
Expand Down
12 changes: 8 additions & 4 deletions packages/zowe-explorer/src/job/ZoweJobNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,14 @@ export class ZoweJobNode extends ZoweTreeNode implements IZoweJobTreeNode {

const sortMethod = contextually.isSession(this) ? this.sort : { method: JobSortOpts.Id, direction: SortDirection.Ascending };
// 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.label === ch.label) != null)
.sort(ZoweJobNode.sortJobs(sortMethod));
this.children = contextually.isSession(this)
? this.children
.concat(newChildren)
.filter((ch) => Object.values(elementChildren).find((recordCh) => recordCh.label === ch.label) != null)
.sort(ZoweJobNode.sortJobs(sortMethod))
: this.children
.concat(newChildren)
.filter((ch) => Object.values(elementChildren).find((recordCh) => recordCh.label === ch.label) != null);
this.dirty = false;
return this.children;
}
Expand Down

0 comments on commit 15d8aeb

Please sign in to comment.