Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local filtering of Jobs with exec-member field #2651

Merged
merged 5 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading