Skip to content

Commit

Permalink
Merge pull request #1920 from zowe/procstep-in-jobs-view
Browse files Browse the repository at this point in the history
Updates to Spool File Labels in Jobs View
  • Loading branch information
JillieBeanSim authored Aug 25, 2022
2 parents b75904d + 215f54c commit 72f0b46
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ describe("ZoweJobNode unit tests - Function getChildren", () => {

const spoolFiles = await globalMocks.testJobNode.getChildren();
expect(spoolFiles.length).toBe(1);
expect(spoolFiles[0].label).toEqual("STEP:STDOUT(101)");
expect(spoolFiles[0].label).toEqual("STEP:STDOUT - 1");
expect(spoolFiles[0].owner).toEqual("fake");
});

Expand All @@ -319,7 +319,7 @@ describe("ZoweJobNode unit tests - Function getChildren", () => {
globalMocks.testJobNode.session.ISession = globalMocks.testSessionNoCred;
const spoolFiles = await globalMocks.testJobNode.getChildren();
expect(spoolFiles.length).toBe(1);
expect(spoolFiles[0].label).toEqual("STEP:STDOUT(101)");
expect(spoolFiles[0].label).toEqual("STEP:STDOUT - 1");
expect(spoolFiles[0].owner).toEqual("*");
});
});
Expand Down
31 changes: 30 additions & 1 deletion packages/zowe-explorer/src/job/ZoweJobNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export class Job extends ZoweTreeNode implements IZoweJobTreeNode {
private _prefix: string;
// tslint:disable-next-line: variable-name
private _searchId: string;
// tslint:disable-next-line: variable-name
private _tooltip: string;

constructor(
label: string,
Expand Down Expand Up @@ -128,8 +130,15 @@ export class Job extends ZoweTreeNode implements IZoweJobTreeNode {
prefix = spool.procstep;
}
const sessionName = this.getProfileName();
const procstep = spool.procstep ? spool.procstep : undefined;
let newLabel: string;
if (procstep) {
newLabel = `${spool.stepname}:${spool.ddname} - ${procstep}`;
} else {
newLabel = `${spool.stepname}:${spool.ddname} - ${spool["record-count"]}`;
}
const spoolNode = new Spool(
`${spool.stepname}:${spool.ddname}(${spool.id})`,
newLabel,
vscode.TreeItemCollapsibleState.None,
this,
this.session,
Expand All @@ -141,6 +150,17 @@ export class Job extends ZoweTreeNode implements IZoweJobTreeNode {
if (icon) {
spoolNode.iconPath = icon.path;
}
const arr = [];
Object.keys(spool).map((key) => {
if (key !== "records-url") {
arr.push({ [key]: spool[key] });
}
});
let newTooltip = "";
arr.forEach((item) => {
newTooltip += `${JSON.stringify(item).replace(/({|})/g, "")}\n`;
});
spoolNode.tooltip = newTooltip;
spoolNode.command = {
command: "zowe.jobs.zosJobsOpenspool",
title: "",
Expand Down Expand Up @@ -211,7 +231,16 @@ export class Job extends ZoweTreeNode implements IZoweJobTreeNode {
return this.getParent() ? this.getParent().getSessionNode() : this;
}

set tooltip(newTooltip: string) {
if (newTooltip) {
this._tooltip = newTooltip;
}
}

get tooltip(): string {
if (this._tooltip) {
return this._tooltip;
}
if (this.job !== null) {
if (this.job.retcode) {
return `${this.job.jobname}(${this.job.jobid}) - ${this.job.retcode}`;
Expand Down

0 comments on commit 72f0b46

Please sign in to comment.