Skip to content

Commit

Permalink
Merge pull request #2651 from SanthoshiBoyina/draft/local-filter
Browse files Browse the repository at this point in the history
Local filtering of Jobs with exec-member field
  • Loading branch information
JillieBeanSim authored Jan 9, 2024
2 parents 86bdfb5 + d0c333c commit 457e20c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
1 change: 1 addition & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
- 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)
- Fixed local filtering of jobs to work with SMFID (exec-member field). [#2651](https://github.com/zowe/vscode-extension-for-zowe/pull/2651)

## `2.13.1`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ const mockInputBox: vscode.InputBox = {
ignoreFocusOut: false,
onDidHide: jest.fn(),
};
function setJobObjects(job: zowe.IJob, newJobName: string, newJobId: string, newRetCode: string) {
function setJobObjects(job: zowe.IJob, newJobName: string, newJobId: string, newRetCode: string, newExecMember: string | undefined) {
job.jobname = newJobName;
job.jobid = newJobId;
job.retcode = newRetCode;
job["exec-member"] = newExecMember;
return job;
}

Expand Down Expand Up @@ -1036,19 +1037,19 @@ describe("getFavorites", () => {

describe("ZosJobsProvider Unit Test - Filter Jobs", () => {
const node1: IZoweJobTreeNode = new ZoweJobNode({
label: "jobnew",
label: "node1",
collapsibleState: vscode.TreeItemCollapsibleState.None,
job: setJobObjects(createIJobObject(), "ZOWEUSR1", "JOB04945", "CC 0000"),
job: setJobObjects(createIJobObject(), "ZOWEUSR1", "JOB04945", "CC 0000", "IPO1"),
});
const node2: IZoweJobTreeNode = new ZoweJobNode({
label: "jobnew",
label: "node2",
collapsibleState: vscode.TreeItemCollapsibleState.None,
job: setJobObjects(createIJobObject(), "ZOWEUSR2", "JOB05037", "CC 0000"),
job: setJobObjects(createIJobObject(), "ZOWEUSR2", "JOB05037", "CC 0000", undefined),
});
const node3: IZoweJobTreeNode = new ZoweJobNode({
label: "jobnew",
label: "node3",
collapsibleState: vscode.TreeItemCollapsibleState.None,
job: setJobObjects(createIJobObject(), "ZOWEUSR3", "TSU07707", "ABEND S222"),
job: setJobObjects(createIJobObject(), "ZOWEUSR3", "TSU07707", "ABEND S222", "IPO3"),
});

let globalMocks;
Expand Down Expand Up @@ -1086,6 +1087,7 @@ describe("ZosJobsProvider Unit Test - Filter Jobs", () => {
await testTree.filterJobsDialog(node1);
expect(filterJobsSpy).toHaveBeenCalled();
expect(filterJobsSpy).toBeCalledWith(node1);
expect(filterJobsSpy.mock.calls[0][0].children[0].job.jobname).toBe("ZOWEUSR2");
});

it("To check Clear filter for profile", async () => {
Expand Down
8 changes: 7 additions & 1 deletion packages/zowe-explorer/src/job/ZosJobsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,13 @@ export class ZosJobsProvider extends ZoweTreeProvider implements IZoweTree<IZowe
inputBox.placeholder = localize("filterJobs.prompt.message", "Enter local filter...");
inputBox.onDidChangeValue((query) => {
query = query.toUpperCase();
job["children"] = actual_jobs.filter((item) => `${item["job"].jobname}(${item["job"].jobid}) - ${item["job"].retcode}`.includes(query));
job["children"] = actual_jobs.filter((item) =>
item["job"]["exec-member"]
? `${item["job"].jobname}(${item["job"].jobid}) - ${item["job"]["exec-member"] as string} - ${item["job"].retcode}`.includes(
query
)
: `${item["job"].jobname}(${item["job"].jobid}) - ${item["job"].retcode}`.includes(query)
);
TreeProviders.job.refresh();
this.updateFilterForJob(job, query, isSession);
Gui.setStatusBarMessage(localize("filter.updated", "$(check) Filter updated for {0}", job.label as string), globals.MS_PER_SEC * 4);
Expand Down

0 comments on commit 457e20c

Please sign in to comment.