Skip to content

Commit

Permalink
add jobs not found message
Browse files Browse the repository at this point in the history
Signed-off-by: Rudy Flores <[email protected]>
  • Loading branch information
rudyflores committed Jun 28, 2023
1 parent 0349fb6 commit d6aeeb0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,18 @@ describe("ZoweJobNode unit tests - Function getChildren", () => {
jest.spyOn(contextually, "isSession").mockReturnValueOnce(true);
await expect(globalMocks.testJobNode.getChildren()).resolves.toEqual([expectedJob]);
});

it("should return 'No jobs found' if no children is found", async () => {
const expectedJob = [new Job("No jobs found", vscode.TreeItemCollapsibleState.None, null, null, null, null)];
expectedJob[0].iconPath = null;
expectedJob[0].contextValue = "information";
const globalMocks = await createGlobalMocks();
await globalMocks.testJobsProvider.addSession("fake");
globalMocks.testJobsProvider.mSessionNodes[1].filtered = true;
jest.spyOn(globalMocks.testJobsProvider.mSessionNodes[1], "getJobs").mockResolvedValue([]);
const jobs = await globalMocks.testJobsProvider.mSessionNodes[1].getChildren();
expect(jobs).toEqual(expectedJob);
});
});

describe("ZoweJobNode unit tests - Function flipState", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"getChildren.search": "Use the search button to display jobs",
"getChildren.noSpoolFiles": "There are no JES spool messages to display",
"getChildren.noJobs": "No jobs found",
"getJobs.status.not.supported": "Filtering by job status is not yet supported with this profile type. Will show jobs with all statuses.",
"getChildren.error.response": "Retrieving response from "
}
16 changes: 15 additions & 1 deletion packages/zowe-explorer/src/job/ZoweJobNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,21 @@ export class Job extends ZoweTreeNode implements IZoweJobTreeNode {
}
return 0;
});
this.children = elementChildren;
if (!elementChildren.length) {
const noJobsNode = new Job(
localize("getChildren.noJobs", "No jobs found"),
vscode.TreeItemCollapsibleState.None,
null,
null,
null,
null
);
noJobsNode.contextValue = globals.INFORMATION_CONTEXT;
noJobsNode.iconPath = null;
this.children = [noJobsNode];
} else {
this.children = elementChildren;
}
}
this.dirty = false;
return this.children;
Expand Down

0 comments on commit d6aeeb0

Please sign in to comment.