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

Updates to Spool File Labels in Jobs View #1920

Merged
merged 11 commits into from
Aug 25, 2022
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;
}
}
JillieBeanSim marked this conversation as resolved.
Show resolved Hide resolved

get tooltip(): string {
if (this._tooltip) {
return this._tooltip;
}
JillieBeanSim marked this conversation as resolved.
Show resolved Hide resolved
if (this.job !== null) {
if (this.job.retcode) {
return `${this.job.jobname}(${this.job.jobid}) - ${this.job.retcode}`;
Expand Down