Skip to content

Commit

Permalink
Updated with error handling
Browse files Browse the repository at this point in the history
Signed-off-by: SanthoshiBoyina <[email protected]>
  • Loading branch information
SanthoshiBoyina1 committed Sep 28, 2023
1 parent 25a8f72 commit ae34f01
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 34 deletions.
4 changes: 3 additions & 1 deletion packages/zowe-explorer/i18n/sample/src/job/actions.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@
"cancelJobs.notImplemented": "The cancel function is not implemented in this API.",
"cancelJobs.notCancelled": "The job was not cancelled.",
"cancelJobs.failed": "One or more jobs failed to cancel: {0}",
"cancelJobs.succeeded": "Cancelled selected jobs successfully."
"cancelJobs.succeeded": "Cancelled selected jobs successfully.",
"filterJobs.message": "Inorder to filter jobs,first populate them using search icon",
"filterJobs.prompt.message": "Type here..."
}
69 changes: 36 additions & 33 deletions packages/zowe-explorer/src/job/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,16 +549,16 @@ export async function filterJobs(jobsProvider: IZoweTree<IZoweJobTreeNode>): Pro
for (const level of jobsProvider.mSessionNodes) {
if (level.label === "zosmf") {
acutal_jobs = level.children;
if (level.collapsibleState === 1) {
vscode.window.showInformationMessage("Inorder to filter jobs,first populate them using search icon");
if (level.collapsibleState === vscode.TreeItemCollapsibleState.Collapsed) {
Gui.infoMessage(localize("filterJobs.message", "Inorder to filter jobs,first populate them using search icon"));
flag = true;
}
}
}
if (flag) return;

const inputBox = await vscode.window.createInputBox();
inputBox.placeholder = "Type here...";
inputBox.placeholder = localize("filterJobs.prompt.message", "Type here...");
inputBox.onDidChangeValue((query) => {
query = query.toUpperCase();
for (const level of jobsProvider.mSessionNodes) {
Expand All @@ -579,37 +579,40 @@ export async function filterSpools(
job: IZoweJobTreeNode,
zoweFileProvider: IZoweTree<IZoweNodeType>
): Promise<vscode.InputBox> {
if (job["collapsibleState"] == 1) {
const spools = await getSpoolFiles(job);
const Spools = spools.map((spool) => {
const spoolNode = new Spool(
`${spool.stepname}:${spool.ddname} - ${spool["record-count"]}`,
vscode.TreeItemCollapsibleState.None,
job.getParent(),
job.getSession(),
spool,
job.job,
job.getParent()
try {
if (job["collapsibleState"] == vscode.TreeItemCollapsibleState.Collapsed) {
const Spools = (await getSpoolFiles(job)).map((spool) => {
const spoolNode = new Spool(
`${spool.stepname}:${spool.ddname} - ${spool["record-count"]}`,
vscode.TreeItemCollapsibleState.None,
job.getParent(),
job.getSession(),
spool,
job.job,
job.getParent()
);
return spoolNode;
});
job.children = Spools;

await TreeViewUtils.expandNode(job, zoweFileProvider);
job.collapsibleState = vscode.TreeItemCollapsibleState.Expanded;
jobsProvider.refresh();
}

const actual_spools = job.children;
const inputBox = vscode.window.createInputBox();
inputBox.placeholder = localize("filterJobs.prompt.message", "Type here...");
inputBox.onDidChangeValue((query) => {
query = query.toUpperCase();
job["children"] = actual_spools.filter((item) =>
`${item["spool"].stepname as string}:${item["spool"].ddname as string} - ${item["spool"]["record-count"] as string}`.includes(query)
);
return spoolNode;
jobsProvider.refresh();
});
job.children = Spools;

await TreeViewUtils.expandNode(job, zoweFileProvider);
job.collapsibleState = vscode.TreeItemCollapsibleState.Expanded;
jobsProvider.refresh();
inputBox.show();
return inputBox;
} catch (error) {
await errorHandling(error);
}

const actual_spools = job.children;
const inputBox = vscode.window.createInputBox();
inputBox.placeholder = "Type here...";
inputBox.onDidChangeValue((query) => {
query = query.toUpperCase();
job["children"] = actual_spools.filter((item) =>
`${item["spool"].stepname as string}:${item["spool"].ddname as string} - ${item["spool"]["record-count"] as string}`.includes(query)
);
jobsProvider.refresh();
});
inputBox.show();
return inputBox;
}

0 comments on commit ae34f01

Please sign in to comment.