Skip to content

Commit

Permalink
Merge pull request #2629 from SanthoshiBoyina/zowe_explorer_feat
Browse files Browse the repository at this point in the history
feat: Add SMFID to Jobs Tree View
  • Loading branch information
traeok authored Dec 19, 2023
2 parents 94db84d + f47317a commit 4e48524
Show file tree
Hide file tree
Showing 4 changed files with 47 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 @@ -20,6 +20,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
- Added Display confirmation dialog when submitting local JCL. [#2061](https://github.com/zowe/vscode-extension-for-zowe/issues/2061)
- Added support for adding a Zowe profile across all trees [#2603](https://github.com/zowe/vscode-extension-for-zowe/issues/2603)
- Added "Filter Jobs" feature in Jobs tree view: accessible via filter icon or right-clicking on session node. [#2599](https://github.com/zowe/vscode-extension-for-zowe/issues/2599)
- Added z/OS System Name (SMFID) to Zowe Explorer Jobs View. [#2629](https://github.com/zowe/vscode-extension-for-zowe/issues/2629)
- PROC and PROCLIB datasets are recognized as JCL files for syntax highlighting [#2614](https://github.com/zowe/vscode-extension-for-zowe/issues/2614)

### Bug fixes
Expand Down
3 changes: 2 additions & 1 deletion packages/zowe-explorer/__mocks__/mockCreators/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { IJob, IJobFile, imperative } from "@zowe/cli";
import { removeNodeFromArray } from "./shared";
import { PersistenceSchemaEnum } from "@zowe/zowe-explorer-api";

export function createIJobObject(): IJob {
export function createIJobObject() {
return {
jobid: "JOB1234",
jobname: "TESTJOB",
Expand All @@ -42,6 +42,7 @@ export function createIJobObject(): IJob {
subsystem: "SYS",
type: "JOB",
url: "fake/url",
"exec-member": "sampleMember",
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ describe("ZoweJobNode unit tests - Function getChildren", () => {
await globalMocks.testJobsProvider.addSession("fake");

const jobs = await globalMocks.testJobsProvider.mSessionNodes[1].getChildren();

expect(jobs.length).toBe(2);
expect(jobs[0].job.jobid).toEqual(globalMocks.testIJob.jobid);
expect(jobs[0].tooltip).toEqual("TESTJOB(JOB1234)");
Expand All @@ -324,7 +323,7 @@ describe("ZoweJobNode unit tests - Function getChildren", () => {
globalMocks.testJobsProvider.mSessionNodes[1].dirty = true;
const newJobs = await globalMocks.testJobsProvider.mSessionNodes[1].getChildren();

expect(newJobs[0].label).toEqual("TESTJOB(JOB1234) - CC 0000");
expect(newJobs[0].label).toEqual("TESTJOB(JOB1234) - sampleMember - CC 0000");
});

it("Tests that getChildren retrieves only child jobs which match a provided searchId", async () => {
Expand Down Expand Up @@ -423,6 +422,44 @@ describe("ZoweJobNode unit tests - Function getChildren", () => {
const jobs = await globalMocks.testJobsProvider.mSessionNodes[1].getChildren();
expect(jobs).toEqual(expectedJob);
});

it("To check smfid field in Jobs Tree View", async () => {
const globalMocks = await createGlobalMocks();

await globalMocks.testJobsProvider.addSession("fake");
globalMocks.testJobsProvider.mSessionNodes[1].searchId = "JOB1234";
globalMocks.testJobsProvider.mSessionNodes[1].dirty = true;
globalMocks.testJobsProvider.mSessionNodes[1].filtered = true;
globalMocks.testIJob.retcode = "ACTIVE";

const jobs = await globalMocks.testJobsProvider.mSessionNodes[1].getChildren();
expect(jobs[0].label).toEqual("TESTJOB(JOB1234) - sampleMember - ACTIVE");
});

it("smfid field is not in Jobs Tree View", async () => {
const globalMocks = await createGlobalMocks();

await globalMocks.testJobsProvider.addSession("fake");
globalMocks.testJobsProvider.mSessionNodes[1].searchId = "JOB1234";
globalMocks.testJobsProvider.mSessionNodes[1].dirty = true;
globalMocks.testJobsProvider.mSessionNodes[1].filtered = true;
globalMocks.testIJob.retcode = "ACTIVE";
globalMocks.testIJob["exec-member"] = "";
const jobs = await globalMocks.testJobsProvider.mSessionNodes[1].getChildren();
expect(jobs[0].label).toEqual("TESTJOB(JOB1234) - ACTIVE");
});

it("To check smfid field when return code is undefined", async () => {
const globalMocks = await createGlobalMocks();

await globalMocks.testJobsProvider.addSession("fake");
globalMocks.testJobsProvider.mSessionNodes[1].searchId = "JOB1234";
globalMocks.testJobsProvider.mSessionNodes[1].dirty = true;
globalMocks.testJobsProvider.mSessionNodes[1].filtered = true;

const jobs = await globalMocks.testJobsProvider.mSessionNodes[1].getChildren();
expect(jobs[0].label).toEqual("TESTJOB(JOB1234) - ACTIVE");
});
});

describe("ZoweJobNode unit tests - Function flipState", () => {
Expand Down
6 changes: 5 additions & 1 deletion packages/zowe-explorer/src/job/ZoweJobNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ export class Job extends ZoweTreeNode implements IZoweJobTreeNode {
jobs.forEach((job) => {
let nodeTitle: string;
if (job.retcode) {
nodeTitle = `${job.jobname}(${job.jobid}) - ${job.retcode}`;
nodeTitle =
job["exec-member"] !== undefined && job["exec-member"] !== ""
? `${job.jobname}(${job.jobid}) - ${job["exec-member"] as string} - ${job.retcode}`
: `${job.jobname}(${job.jobid}) - ${job.retcode}`;
} else {
nodeTitle = `${job.jobname}(${job.jobid}) - ${job.status}`;
}
Expand Down Expand Up @@ -374,6 +377,7 @@ export class Job extends ZoweTreeNode implements IZoweJobTreeNode {
owner,
prefix,
status,
execData: "Y",
});
} else {
this.statusNotSupportedMsg(status);
Expand Down

0 comments on commit 4e48524

Please sign in to comment.