From 69e0a6db3bfba4e31ed1ae7f5c5489d8604ac48d Mon Sep 17 00:00:00 2001 From: Trae Yelovich Date: Thu, 31 Oct 2024 10:37:23 -0400 Subject: [PATCH] refactor: require a non-empty path before submitting uss search Signed-off-by: Trae Yelovich --- .../__tests__/__unit__/trees/uss/USSTree.unit.test.ts | 2 -- packages/zowe-explorer/src/trees/uss/USSTree.ts | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__unit__/trees/uss/USSTree.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/trees/uss/USSTree.unit.test.ts index e3709ba0aa..12a9831ee4 100644 --- a/packages/zowe-explorer/__tests__/__unit__/trees/uss/USSTree.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/trees/uss/USSTree.unit.test.ts @@ -628,8 +628,6 @@ describe("USSTree Unit Tests - Function filterPrompt", () => { globalMocks.showInputBox.mockReturnValueOnce(undefined); await globalMocks.testTree.filterPrompt(globalMocks.testTree.mSessionNodes[1]); - expect(globalMocks.showInformationMessage.mock.calls.length).toBe(1); - expect(globalMocks.showInformationMessage.mock.calls[0][0]).toBe("You must enter a path."); }); it("Tests that filter() works on a file", async () => { diff --git a/packages/zowe-explorer/src/trees/uss/USSTree.ts b/packages/zowe-explorer/src/trees/uss/USSTree.ts index cc741e35a1..7d244b5d3b 100644 --- a/packages/zowe-explorer/src/trees/uss/USSTree.ts +++ b/packages/zowe-explorer/src/trees/uss/USSTree.ts @@ -744,11 +744,11 @@ export class USSTree extends ZoweTreeProvider implements Types const options: vscode.InputBoxOptions = { placeHolder: vscode.l10n.t("New filter"), value: remotepath, + validateInput: (input: string) => (input.length > 0 ? null : vscode.l10n.t("Please enter a valid USS path.")), }; // get user input remotepath = await Gui.showInputBox(options); - if (!remotepath || remotepath.length === 0) { - Gui.showMessage(vscode.l10n.t("You must enter a path.")); + if (remotepath == null) { return; } } else {