From db651e428f334bcfe6ffbfba3d7492572678ca2e Mon Sep 17 00:00:00 2001 From: Jason Chung <76530054+JasonIBM@users.noreply.github.com> Date: Wed, 8 Nov 2023 14:14:49 -0500 Subject: [PATCH 01/76] Include job confirmation popup when submitting Signed-off-by: Jason Chung <76530054+JasonIBM@users.noreply.github.com> --- packages/zowe-explorer/src/dataset/actions.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/zowe-explorer/src/dataset/actions.ts b/packages/zowe-explorer/src/dataset/actions.ts index b7e6c9e6c0..ecacdfd6f7 100644 --- a/packages/zowe-explorer/src/dataset/actions.ts +++ b/packages/zowe-explorer/src/dataset/actions.ts @@ -984,11 +984,17 @@ export async function submitJcl(datasetProvider: api.IZoweTree { +async function confirmJobSubmission(node: api.IZoweTreeNode, ownsJob: boolean, fileName?: String): Promise { ZoweLogger.trace("dataset.actions.confirmJobSubmission called."); + const showConfirmationDialog = async (): Promise => { + let jclName = node != null ? node.getLabel().toString() : fileName.toString().substring(fileName.lastIndexOf("\\") + 1); + const selection = await api.Gui.warningMessage( - localize("confirmJobSubmission.confirm", "Are you sure you want to submit the following job?\n\n{0}", node.getLabel().toString()), + localize("confirmJobSubmission.confirm", "Are you sure you want to submit the following job?\n\n{0}", jclName), { items: [{ title: "Submit" }], vsCodeOpts: { modal: true } } ); - return selection != null && selection?.title === "Submit"; }; From 1894dcdf1d07d0bf3500c35bdac3953e4a508702 Mon Sep 17 00:00:00 2001 From: Jason Chung <76530054+JasonIBM@users.noreply.github.com> Date: Wed, 8 Nov 2023 14:30:33 -0500 Subject: [PATCH 02/76] updated changelog and fixed error with let Signed-off-by: Jason Chung <76530054+JasonIBM@users.noreply.github.com> --- packages/zowe-explorer/CHANGELOG.md | 2 ++ packages/zowe-explorer/src/dataset/actions.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/zowe-explorer/CHANGELOG.md b/packages/zowe-explorer/CHANGELOG.md index dc8ce095c8..1353897a33 100644 --- a/packages/zowe-explorer/CHANGELOG.md +++ b/packages/zowe-explorer/CHANGELOG.md @@ -8,6 +8,8 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen ### Bug fixes +- Display confirmation dialog when submitting local JCL. [#2061] (https://github.com/zowe/vscode-extension-for-zowe/issues/2061) + ## `2.12.0` ### New features and enhancements diff --git a/packages/zowe-explorer/src/dataset/actions.ts b/packages/zowe-explorer/src/dataset/actions.ts index ecacdfd6f7..355e23d2a2 100644 --- a/packages/zowe-explorer/src/dataset/actions.ts +++ b/packages/zowe-explorer/src/dataset/actions.ts @@ -1070,7 +1070,7 @@ async function confirmJobSubmission(node: api.IZoweTreeNode, ownsJob: boolean, f ZoweLogger.trace("dataset.actions.confirmJobSubmission called."); const showConfirmationDialog = async (): Promise => { - let jclName = node != null ? node.getLabel().toString() : fileName.toString().substring(fileName.lastIndexOf("\\") + 1); + const jclName = node != null ? node.getLabel().toString() : fileName.toString().substring(fileName.lastIndexOf("\\") + 1); const selection = await api.Gui.warningMessage( localize("confirmJobSubmission.confirm", "Are you sure you want to submit the following job?\n\n{0}", jclName), From 71d14186777aff8fa8d878cb93bc4bec7bcd5741 Mon Sep 17 00:00:00 2001 From: Jason Chung <76530054+JasonIBM@users.noreply.github.com> Date: Wed, 8 Nov 2023 14:46:16 -0500 Subject: [PATCH 03/76] added await and return if cancelled on confirm Signed-off-by: Jason Chung <76530054+JasonIBM@users.noreply.github.com> --- packages/zowe-explorer/src/dataset/actions.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/zowe-explorer/src/dataset/actions.ts b/packages/zowe-explorer/src/dataset/actions.ts index 355e23d2a2..0dabbf15d2 100644 --- a/packages/zowe-explorer/src/dataset/actions.ts +++ b/packages/zowe-explorer/src/dataset/actions.ts @@ -993,7 +993,9 @@ export async function submitJcl(datasetProvider: api.IZoweTree Date: Wed, 8 Nov 2023 15:06:44 -0500 Subject: [PATCH 04/76] fixed lint in changelog Signed-off-by: Jason Chung <76530054+JasonIBM@users.noreply.github.com> --- packages/zowe-explorer/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zowe-explorer/CHANGELOG.md b/packages/zowe-explorer/CHANGELOG.md index 1353897a33..bbcb3c1e0a 100644 --- a/packages/zowe-explorer/CHANGELOG.md +++ b/packages/zowe-explorer/CHANGELOG.md @@ -8,7 +8,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen ### Bug fixes -- Display confirmation dialog when submitting local JCL. [#2061] (https://github.com/zowe/vscode-extension-for-zowe/issues/2061) +- Display confirmation dialog when submitting local JCL. [#2061](https://github.com/zowe/vscode-extension-for-zowe/issues/2061) ## `2.12.0` From 4f53c22d2e9efcaae1e3dbf78ff72ed79b5eab56 Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Thu, 9 Nov 2023 13:53:22 -0500 Subject: [PATCH 05/76] bring back proper version Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- lerna.json | 2 +- packages/eslint-plugin-zowe-explorer/package.json | 2 +- packages/zowe-explorer-api/package.json | 2 +- packages/zowe-explorer-ftp-extension/package.json | 2 +- packages/zowe-explorer/package.json | 2 +- packages/zowe-explorer/src/webviews/package.json | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lerna.json b/lerna.json index b7ac25215f..be5de7fc16 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.12.2-SNAPSHOT", + "version": "2.13.0-SNAPSHOT", "command": { "version": { "forcePublish": true, diff --git a/packages/eslint-plugin-zowe-explorer/package.json b/packages/eslint-plugin-zowe-explorer/package.json index 4647f6addb..7d9500aee8 100644 --- a/packages/eslint-plugin-zowe-explorer/package.json +++ b/packages/eslint-plugin-zowe-explorer/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-zowe-explorer", - "version": "2.12.2-SNAPSHOT", + "version": "2.13.0-SNAPSHOT", "description": "Custom ESLint Rules for ZOWE Explorer", "keywords": [ "eslint", diff --git a/packages/zowe-explorer-api/package.json b/packages/zowe-explorer-api/package.json index 8d12257ea9..0ab60faf1e 100644 --- a/packages/zowe-explorer-api/package.json +++ b/packages/zowe-explorer-api/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zowe-explorer-api", - "version": "2.12.2-SNAPSHOT", + "version": "2.13.0-SNAPSHOT", "description": "Extensibility API for Zowe Explorer.", "publisher": "Zowe", "author": "Zowe", diff --git a/packages/zowe-explorer-ftp-extension/package.json b/packages/zowe-explorer-ftp-extension/package.json index 3a2b687348..75fc3a8153 100644 --- a/packages/zowe-explorer-ftp-extension/package.json +++ b/packages/zowe-explorer-ftp-extension/package.json @@ -5,7 +5,7 @@ "author": "Zowe", "license": "EPL-2.0", "description": "Adds zFTP support to Zowe Explorer demonstrating how to extend the Zowe Explorer using its extensibility API.", - "version": "2.12.2-SNAPSHOT", + "version": "2.13.0-SNAPSHOT", "icon": "resources/zowe-ftp-color.png", "repository": { "url": "https://github.com/zowe/vscode-extension-for-zowe" diff --git a/packages/zowe-explorer/package.json b/packages/zowe-explorer/package.json index 893bfdcf41..c2780996c7 100644 --- a/packages/zowe-explorer/package.json +++ b/packages/zowe-explorer/package.json @@ -2,7 +2,7 @@ "name": "vscode-extension-for-zowe", "displayName": "%displayName%", "description": "%description%", - "version": "2.12.2-SNAPSHOT", + "version": "2.13.0-SNAPSHOT", "publisher": "Zowe", "author": "Zowe", "license": "EPL-2.0", diff --git a/packages/zowe-explorer/src/webviews/package.json b/packages/zowe-explorer/src/webviews/package.json index bb8908b57f..894ac5f089 100644 --- a/packages/zowe-explorer/src/webviews/package.json +++ b/packages/zowe-explorer/src/webviews/package.json @@ -2,7 +2,7 @@ "name": "webviews", "private": true, "type": "module", - "version": "2.12.2-SNAPSHOT", + "version": "2.13.0-SNAPSHOT", "main": "index.js", "license": "EPL-2.0", "scripts": { From 82c3f3998d5e8077a40b2a3c7b365a60b68d8684 Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Thu, 9 Nov 2023 13:56:04 -0500 Subject: [PATCH 06/76] correct versions of api Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- packages/zowe-explorer-ftp-extension/package.json | 2 +- packages/zowe-explorer/package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/zowe-explorer-ftp-extension/package.json b/packages/zowe-explorer-ftp-extension/package.json index 75fc3a8153..2bb7410c46 100644 --- a/packages/zowe-explorer-ftp-extension/package.json +++ b/packages/zowe-explorer-ftp-extension/package.json @@ -48,7 +48,7 @@ }, "dependencies": { "@zowe/zos-ftp-for-zowe-cli": "2.1.2", - "@zowe/zowe-explorer-api": "2.12.2-SNAPSHOT", + "@zowe/zowe-explorer-api": "2.13.0-SNAPSHOT", "tmp": "0.2.1" }, "devDependencies": { diff --git a/packages/zowe-explorer/package.json b/packages/zowe-explorer/package.json index c2780996c7..189b6b3de0 100644 --- a/packages/zowe-explorer/package.json +++ b/packages/zowe-explorer/package.json @@ -1969,7 +1969,7 @@ "copy-webpack-plugin": "^6.4.1", "cross-env": "^5.2.0", "del": "^4.1.1", - "eslint-plugin-zowe-explorer": "2.12.2-SNAPSHOT", + "eslint-plugin-zowe-explorer": "2.13.0-SNAPSHOT", "event-stream": "^4.0.1", "expect": "^24.8.0", "geckodriver": "^1.19.1", @@ -1995,7 +1995,7 @@ }, "dependencies": { "@zowe/secrets-for-zowe-sdk": "7.18.4", - "@zowe/zowe-explorer-api": "2.12.2-SNAPSHOT", + "@zowe/zowe-explorer-api": "2.13.0-SNAPSHOT", "dayjs": "^1.11.10", "fs-extra": "8.0.1", "isbinaryfile": "4.0.4", From 160751e993efcedbd4ecf21dbdf08d18073ade20 Mon Sep 17 00:00:00 2001 From: Jason Chung <76530054+JasonIBM@users.noreply.github.com> Date: Thu, 9 Nov 2023 16:03:16 -0500 Subject: [PATCH 07/76] added unit test for coverage and updated changelog Signed-off-by: Jason Chung <76530054+JasonIBM@users.noreply.github.com> --- packages/zowe-explorer/CHANGELOG.md | 4 ++-- .../__unit__/job/actions.unit.test.ts | 22 +++++++++++++++++++ packages/zowe-explorer/src/dataset/actions.ts | 2 +- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/packages/zowe-explorer/CHANGELOG.md b/packages/zowe-explorer/CHANGELOG.md index bbcb3c1e0a..c6e4c1b370 100644 --- a/packages/zowe-explorer/CHANGELOG.md +++ b/packages/zowe-explorer/CHANGELOG.md @@ -6,9 +6,9 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen ### New features and enhancements -### Bug fixes +- Added Display confirmation dialog when submitting local JCL. [#2061](https://github.com/zowe/vscode-extension-for-zowe/issues/2061) -- Display confirmation dialog when submitting local JCL. [#2061](https://github.com/zowe/vscode-extension-for-zowe/issues/2061) +### Bug fixes ## `2.12.0` diff --git a/packages/zowe-explorer/__tests__/__unit__/job/actions.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/job/actions.unit.test.ts index dd91a263b2..65ccc5c90d 100644 --- a/packages/zowe-explorer/__tests__/__unit__/job/actions.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/job/actions.unit.test.ts @@ -451,6 +451,12 @@ describe("Jobs Actions Unit Tests - Function submitJcl", () => { }; } + beforeEach(() => { + jest.clearAllMocks(); + jest.restoreAllMocks(); + jest.resetAllMocks(); + }); + it("Checking submit of active text editor content as JCL", async () => { createGlobalMocks(); const blockMocks: any = createBlockMocks(); @@ -550,6 +556,22 @@ describe("Jobs Actions Unit Tests - Function submitJcl", () => { expect(blockMocks.errorGuiMsgSpy).toBeCalledWith(errorMsg); }); + it("Checking passing (submit) scenario of local JCL submission confirmation dialog JASON ", async () => { + const blockMocks: any = createBlockMocks(); + jest.spyOn(ZoweLogger, "trace").mockImplementation(); + Object.defineProperty(vscode.window, "activeTextEditor", { + value: { document: { fileName: "test" } } as any, + configurable: true, + }); + jest.spyOn(vscode.commands, "executeCommand").mockImplementation(); + jest.spyOn(ZoweLogger, "debug").mockImplementation(); + + // const confirmJobSubmissionSpy = jest.spyOn(dsActions as any, "confirmJobSubmission"); + await expect(dsActions.submitJcl(blockMocks.testDatasetTree, {} as any)).resolves.toEqual(undefined); + + //expect(confirmJobSubmissionSpy).toHaveBeenCalled(); + }); + it("Checking failed attempt to submit of active text editor content as JCL without profile chosen from quickpick", async () => { createGlobalMocks(); const blockMocks = createBlockMocks(); diff --git a/packages/zowe-explorer/src/dataset/actions.ts b/packages/zowe-explorer/src/dataset/actions.ts index 0dabbf15d2..b8dd157e53 100644 --- a/packages/zowe-explorer/src/dataset/actions.ts +++ b/packages/zowe-explorer/src/dataset/actions.ts @@ -1068,7 +1068,7 @@ export async function submitJcl(datasetProvider: api.IZoweTree { +export async function confirmJobSubmission(node: api.IZoweTreeNode, ownsJob: boolean, fileName?: String): Promise { ZoweLogger.trace("dataset.actions.confirmJobSubmission called."); const showConfirmationDialog = async (): Promise => { From 5855a4091b0cea858727ec43adb3e4257a92c195 Mon Sep 17 00:00:00 2001 From: Jason Chung <76530054+JasonIBM@users.noreply.github.com> Date: Thu, 9 Nov 2023 16:38:09 -0500 Subject: [PATCH 08/76] Updated to work with unit test + fixed code smells Signed-off-by: Jason Chung <76530054+JasonIBM@users.noreply.github.com> --- .../__tests__/__unit__/job/actions.unit.test.ts | 15 ++++----------- packages/zowe-explorer/src/dataset/actions.ts | 4 ++-- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__unit__/job/actions.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/job/actions.unit.test.ts index 65ccc5c90d..f948067496 100644 --- a/packages/zowe-explorer/__tests__/__unit__/job/actions.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/job/actions.unit.test.ts @@ -451,12 +451,6 @@ describe("Jobs Actions Unit Tests - Function submitJcl", () => { }; } - beforeEach(() => { - jest.clearAllMocks(); - jest.restoreAllMocks(); - jest.resetAllMocks(); - }); - it("Checking submit of active text editor content as JCL", async () => { createGlobalMocks(); const blockMocks: any = createBlockMocks(); @@ -556,7 +550,7 @@ describe("Jobs Actions Unit Tests - Function submitJcl", () => { expect(blockMocks.errorGuiMsgSpy).toBeCalledWith(errorMsg); }); - it("Checking passing (submit) scenario of local JCL submission confirmation dialog JASON ", async () => { + it("Checking passing (submit) scenario of local JCL submission confirmation dialog", async () => { const blockMocks: any = createBlockMocks(); jest.spyOn(ZoweLogger, "trace").mockImplementation(); Object.defineProperty(vscode.window, "activeTextEditor", { @@ -565,11 +559,10 @@ describe("Jobs Actions Unit Tests - Function submitJcl", () => { }); jest.spyOn(vscode.commands, "executeCommand").mockImplementation(); jest.spyOn(ZoweLogger, "debug").mockImplementation(); - - // const confirmJobSubmissionSpy = jest.spyOn(dsActions as any, "confirmJobSubmission"); + const confirmJobSubmissionSpy = jest.spyOn(dsActions, "confirmJobSubmission"); + confirmJobSubmissionSpy.mockResolvedValue(false); await expect(dsActions.submitJcl(blockMocks.testDatasetTree, {} as any)).resolves.toEqual(undefined); - - //expect(confirmJobSubmissionSpy).toHaveBeenCalled(); + confirmJobSubmissionSpy.mockRestore(); }); it("Checking failed attempt to submit of active text editor content as JCL without profile chosen from quickpick", async () => { diff --git a/packages/zowe-explorer/src/dataset/actions.ts b/packages/zowe-explorer/src/dataset/actions.ts index b8dd157e53..595ea181bd 100644 --- a/packages/zowe-explorer/src/dataset/actions.ts +++ b/packages/zowe-explorer/src/dataset/actions.ts @@ -993,7 +993,7 @@ export async function submitJcl(datasetProvider: api.IZoweTree { +export async function confirmJobSubmission(node: api.IZoweTreeNode, ownsJob: boolean, fileName?: string): Promise { ZoweLogger.trace("dataset.actions.confirmJobSubmission called."); const showConfirmationDialog = async (): Promise => { From a8f06e2a0ad90d1ddea75037f010ead3e74425dd Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Fri, 10 Nov 2023 14:24:32 -0500 Subject: [PATCH 09/76] Add option for hiding profile from all trees Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../zowe-explorer-api/src/tree/IZoweTree.ts | 8 +++- .../__mocks__/mockCreators/shared.ts | 41 ++++++++++++++++++- .../__unit__/dataset/DatasetTree.unit.test.ts | 19 ++++++++- .../__unit__/dataset/init.unit.test.ts | 2 +- .../__tests__/__unit__/extension.unit.test.ts | 4 +- .../__unit__/job/ZoweJobNode.unit.test.ts | 11 +++-- .../__tests__/__unit__/job/init.unit.test.ts | 2 +- .../__unit__/uss/USSTree.unit.test.ts | 14 +++++-- .../__tests__/__unit__/uss/init.unit.test.ts | 2 +- .../utils/ProfileManagement.unit.test.ts | 6 ++- .../src/utils/ProfileManagement.i18n.json | 6 +++ .../src/abstract/ZoweTreeProvider.ts | 20 ++++++--- .../zowe-explorer/src/dataset/DatasetTree.ts | 14 +++++-- packages/zowe-explorer/src/dataset/init.ts | 23 ++++++----- .../zowe-explorer/src/job/ZosJobsProvider.ts | 15 +++++-- packages/zowe-explorer/src/job/init.ts | 10 ++--- .../zowe-explorer/src/shared/TreeProviders.ts | 30 ++++++++------ packages/zowe-explorer/src/shared/init.ts | 10 +++-- packages/zowe-explorer/src/uss/USSTree.ts | 14 +++++-- packages/zowe-explorer/src/uss/init.ts | 10 ++--- .../src/utils/ProfileManagement.ts | 37 +++++++++++++++-- 21 files changed, 228 insertions(+), 70 deletions(-) diff --git a/packages/zowe-explorer-api/src/tree/IZoweTree.ts b/packages/zowe-explorer-api/src/tree/IZoweTree.ts index 9b5799d9e9..55ec8d8b0a 100644 --- a/packages/zowe-explorer-api/src/tree/IZoweTree.ts +++ b/packages/zowe-explorer-api/src/tree/IZoweTree.ts @@ -206,8 +206,9 @@ export interface IZoweTree extends vscode.TreeDataProvider { /** * Deletes a root node from the tree. * @param node: A root node representing a session + * @param hideFromAllTrees: whether to hide from all trees or just the single tree */ - deleteSession(node: IZoweTreeNode); + deleteSession(node: IZoweTreeNode, hideFromAllTrees?: boolean); /** * Lets the user open a dataset by filtering the currently-loaded list */ @@ -268,6 +269,11 @@ export interface IZoweTree extends vscode.TreeDataProvider { * @param {string} name the member to remove */ removeFileHistory?(name: string); + /** + * Removes session from the session array + * @param {string} name the sessions to remove + */ + removeSession?(name: string): void; /** * Returns a new dataset filter string, from an old filter and a new string * diff --git a/packages/zowe-explorer/__mocks__/mockCreators/shared.ts b/packages/zowe-explorer/__mocks__/mockCreators/shared.ts index 07d17faaf5..9a3ffa5a90 100644 --- a/packages/zowe-explorer/__mocks__/mockCreators/shared.ts +++ b/packages/zowe-explorer/__mocks__/mockCreators/shared.ts @@ -13,7 +13,7 @@ import { ZoweTreeProvider } from "../../src/abstract/ZoweTreeProvider"; import { ZoweDatasetNode } from "../../src/dataset/ZoweDatasetNode"; import { ZoweUSSNode } from "../../src/uss/ZoweUSSNode"; import * as vscode from "vscode"; -import { ValidProfileEnum } from "@zowe/zowe-explorer-api"; +import { ValidProfileEnum, IZoweTreeNode } from "@zowe/zowe-explorer-api"; import { FilterDescriptor } from "../../src/utils/ProfilesUtils"; import { imperative, ZosmfSession } from "@zowe/cli"; import { SettingsConfig } from "../../src/utils/SettingsConfig"; @@ -548,3 +548,42 @@ export function createOutputChannel() { replace: jest.fn(), } as vscode.OutputChannel; } + +export function createMockNode(name: string): IZoweTreeNode { + return { + dirty: false, + getLabel: jest.fn(() => name), + getChildren: jest.fn(), + getParent: jest.fn(), + getProfile: jest.fn(), + getProfileName: jest.fn(), + getSession: jest.fn(), + getSessionNode: jest.fn(), + setProfileToChoice: jest.fn(), + setSessionToChoice: jest.fn(), + label: name, + }; +} + +export function createTreeProviders() { + return { + ds: { + mSessionNodes: [createMockNode("zosmf"), createMockNode("zosmf2")], + deleteSession: jest.fn(), + removeSession: jest.fn(), + refresh: jest.fn(), + } as any, + uss: { + mSessionNodes: [createMockNode("zosmf"), createMockNode("zosmf2")], + deleteSession: jest.fn(), + removeSession: jest.fn(), + refresh: jest.fn(), + } as any, + job: { + mSessionNodes: [createMockNode("zosmf"), createMockNode("zosmf2")], + removeSession: jest.fn(), + deleteSession: jest.fn(), + refresh: jest.fn(), + } as any, + }; +} diff --git a/packages/zowe-explorer/__tests__/__unit__/dataset/DatasetTree.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/dataset/DatasetTree.unit.test.ts index d4f853238b..da0d4a9b24 100644 --- a/packages/zowe-explorer/__tests__/__unit__/dataset/DatasetTree.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/dataset/DatasetTree.unit.test.ts @@ -40,6 +40,7 @@ import { createValidIProfile, createInstanceOfProfileInfo, createGetConfigMock, + createTreeProviders, } from "../../../__mocks__/mockCreators/shared"; import { createDatasetSessionNode, createDatasetTree, createDatasetFavoritesNode } from "../../../__mocks__/mockCreators/datasets"; import { bindMvsApi, createMvsApi } from "../../../__mocks__/mockCreators/api"; @@ -49,6 +50,7 @@ import * as dsUtils from "../../../src/dataset/utils"; import { SettingsConfig } from "../../../src/utils/SettingsConfig"; import * as sharedActions from "../../../src/shared/actions"; import { ZoweLogger } from "../../../src/utils/LoggerUtils"; +import { TreeProviders } from "../../../src/shared/TreeProviders"; jest.mock("fs"); jest.mock("util"); @@ -63,6 +65,7 @@ function createGlobalMocks() { mockShowWarningMessage: jest.fn(), mockProfileInfo: createInstanceOfProfileInfo(), mockProfilesCache: new ProfilesCache(zowe.imperative.Logger.getAppLogger()), + mockTreeProviders: createTreeProviders(), }; globalMocks.mockProfileInstance = createInstanceOfProfile(globalMocks.testProfileLoaded); @@ -1327,7 +1330,7 @@ describe("Dataset Tree Unit Tests - Function deleteSession", () => { }; } - it("Checking common run of function", async () => { + it("Checking common run of function", () => { createGlobalMocks(); const blockMocks = createBlockMocks(); @@ -1339,6 +1342,20 @@ describe("Dataset Tree Unit Tests - Function deleteSession", () => { expect(testTree.mSessionNodes.map((node) => node.label)).toEqual(["Favorites"]); }); + + it("Checking case profile needs to be hidden for all trees", async () => { + const globalMocks = createGlobalMocks(); + const blockMocks = createBlockMocks(); + + jest.spyOn(TreeProviders, "providers", "get").mockReturnValue(globalMocks.mockTreeProviders); + mocked(vscode.window.createTreeView).mockReturnValueOnce(blockMocks.treeView); + const testTree = new DatasetTree(); + testTree.mSessionNodes.push(blockMocks.datasetSessionNode); + + testTree.deleteSession(testTree.mSessionNodes[1], true); + + expect(testTree.mSessionNodes.map((node) => node.label)).toEqual(["Favorites"]); + }); }); describe("Dataset Tree Unit Tests - Function flipState", () => { function createBlockMocks() { diff --git a/packages/zowe-explorer/__tests__/__unit__/dataset/init.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/dataset/init.unit.test.ts index 443446b047..86d1595754 100644 --- a/packages/zowe-explorer/__tests__/__unit__/dataset/init.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/dataset/init.unit.test.ts @@ -137,7 +137,7 @@ describe("Test src/dataset/extension", () => { name: "zowe.ds.removeSession", mock: [ { spy: jest.spyOn(contextuals, "isDsSession"), arg: [test.value], ret: true }, - { spy: jest.spyOn(dsProvider, "deleteSession"), arg: [test.value] }, + { spy: jest.spyOn(dsProvider, "deleteSession"), arg: [test.value, undefined] }, ], }, { diff --git a/packages/zowe-explorer/__tests__/__unit__/extension.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/extension.unit.test.ts index 5c9bc961a8..14aee629ab 100644 --- a/packages/zowe-explorer/__tests__/__unit__/extension.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/extension.unit.test.ts @@ -546,10 +546,12 @@ describe("Extension Unit Tests", () => { getProfile: jest.fn(), getParent: jest.fn().mockReturnValue({ getLabel: jest.fn() }), label: "TestNode", + getLabel: jest.fn(() => "TestNode"), }; + const deleteSessionSpy = jest.spyOn(providerObject.prototype, "deleteSession"); const commandFunction = allCommands.find((cmd) => command === cmd.cmd); - await (commandFunction as any).fun(testNode, [testNode]); + await (commandFunction as any).fun(testNode, [testNode], true); expect(deleteSessionSpy).toHaveBeenCalled(); } diff --git a/packages/zowe-explorer/__tests__/__unit__/job/ZoweJobNode.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/job/ZoweJobNode.unit.test.ts index 2d5351b450..34097a5e0b 100644 --- a/packages/zowe-explorer/__tests__/__unit__/job/ZoweJobNode.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/job/ZoweJobNode.unit.test.ts @@ -26,10 +26,12 @@ import { createInstanceOfProfile, createISessionWithoutCredentials, createInstanceOfProfileInfo, + createTreeProviders, } from "../../../__mocks__/mockCreators/shared"; import * as contextually from "../../../src/shared/context"; import { ZoweLogger } from "../../../src/utils/LoggerUtils"; import { bindJesApi, createJesApi } from "../../../__mocks__/mockCreators/api"; +import { TreeProviders } from "../../../src/shared/TreeProviders"; async function createGlobalMocks() { const globalMocks = { @@ -86,6 +88,7 @@ async function createGlobalMocks() { }), mockProfileInfo: createInstanceOfProfileInfo(), mockProfilesCache: new ProfilesCache(zowe.imperative.Logger.getAppLogger()), + mockTreeProviders: createTreeProviders(), }; Object.defineProperty(globals, "LOG", { value: jest.fn(), configurable: true }); @@ -237,10 +240,12 @@ describe("ZoweJobNode unit tests - Function addSession", () => { describe("ZoweJobNode unit tests - Function deleteSession", () => { it("Tests that deleteSession removes the session from the tree", async () => { const globalMocks = await createGlobalMocks(); - + jest.spyOn(TreeProviders, "providers", "get").mockReturnValue(globalMocks.mockTreeProviders); + globalMocks.testJobsProvider.mSessionNodes = globalMocks.mockTreeProviders.ds.mSessionNodes; await globalMocks.testJobsProvider.deleteSession(globalMocks.testJobsProvider.mSessionNodes[1]); - - expect(globalMocks.testJobsProvider.mSessionNodes.length).toBe(1); + expect(globalMocks.mockTreeProviders.ds.mSessionNodes.length).toEqual(2); + expect(globalMocks.mockTreeProviders.uss.mSessionNodes.length).toEqual(2); + expect(globalMocks.mockTreeProviders.job.mSessionNodes.length).toEqual(2); }); }); diff --git a/packages/zowe-explorer/__tests__/__unit__/job/init.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/job/init.unit.test.ts index 9a9f9fdd85..c510fe0d36 100644 --- a/packages/zowe-explorer/__tests__/__unit__/job/init.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/job/init.unit.test.ts @@ -122,7 +122,7 @@ describe("Test src/jobs/extension", () => { name: "zowe.jobs.removeJobsSession", mock: [ { spy: jest.spyOn(contextuals, "isJobsSession"), arg: [test.value], ret: true }, - { spy: jest.spyOn(jobsProvider, "deleteSession"), arg: [test.value] }, + { spy: jest.spyOn(jobsProvider, "deleteSession"), arg: [test.value, undefined] }, ], }, { diff --git a/packages/zowe-explorer/__tests__/__unit__/uss/USSTree.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/uss/USSTree.unit.test.ts index 88a9389e34..80be9d8640 100644 --- a/packages/zowe-explorer/__tests__/__unit__/uss/USSTree.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/uss/USSTree.unit.test.ts @@ -23,6 +23,7 @@ import { createInstanceOfProfile, createValidIProfile, createTreeView, + createTreeProviders, } from "../../../__mocks__/mockCreators/shared"; import * as globals from "../../../src/globals"; import * as vscode from "vscode"; @@ -32,6 +33,7 @@ import { getIconByNode } from "../../../src/generators/icons"; import * as workspaceUtils from "../../../src/utils/workspace"; import { createUssApi, bindUssApi } from "../../../__mocks__/mockCreators/api"; import { ZoweLogger } from "../../../src/utils/LoggerUtils"; +import { TreeProviders } from "../../../src/shared/TreeProviders"; async function createGlobalMocks() { const globalMocks = { @@ -76,6 +78,7 @@ async function createGlobalMocks() { testTree: null, profilesForValidation: { status: "active", name: "fake" }, mockProfilesCache: new ProfilesCache(zowe.imperative.Logger.getAppLogger()), + mockTreeProviders: createTreeProviders(), }; globalMocks.mockTextDocuments.push(globalMocks.mockTextDocumentDirty); @@ -503,7 +506,7 @@ describe("USSTree Unit Tests - Function USSTree.deleteSession()", () => { const newMocks = { testTree2: new USSTree(), testSessionNode: new ZoweUSSNode("testSessionNode", vscode.TreeItemCollapsibleState.Collapsed, null, globalMocks.testSession, null), - startLength: null, + startLength: 0, }; const ussSessionTestNode = createUSSSessionNode(globalMocks.testSession, globalMocks.testProfile); newMocks.testTree2.mSessionNodes.push(ussSessionTestNode); @@ -517,8 +520,13 @@ describe("USSTree Unit Tests - Function USSTree.deleteSession()", () => { const globalMocks = await createGlobalMocks(); const blockMocks = await createBlockMocks(globalMocks); - blockMocks.testTree2.deleteSession(blockMocks.testTree2.mSessionNodes[blockMocks.startLength - 1]); - expect(blockMocks.testTree2.mSessionNodes.length).toEqual(blockMocks.startLength - 1); + jest.spyOn(TreeProviders, "providers", "get").mockReturnValue(globalMocks.mockTreeProviders); + + blockMocks.testTree2.mSessionNodes = globalMocks.mockTreeProviders.ds.mSessionNodes; + blockMocks.testTree2.deleteSession(globalMocks.mockTreeProviders.ds.mSessionNodes[1]); + expect(globalMocks.mockTreeProviders.ds.mSessionNodes.length).toEqual(2); + expect(globalMocks.mockTreeProviders.uss.mSessionNodes.length).toEqual(2); + expect(globalMocks.mockTreeProviders.job.mSessionNodes.length).toEqual(2); }); }); diff --git a/packages/zowe-explorer/__tests__/__unit__/uss/init.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/uss/init.unit.test.ts index b06e8c6882..99d10a9001 100644 --- a/packages/zowe-explorer/__tests__/__unit__/uss/init.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/uss/init.unit.test.ts @@ -99,7 +99,7 @@ describe("Test src/dataset/extension", () => { name: "zowe.uss.removeSession", mock: [ { spy: jest.spyOn(contextuals, "isUssSession"), arg: [test.value], ret: true }, - { spy: jest.spyOn(ussFileProvider, "deleteSession"), arg: [test.value] }, + { spy: jest.spyOn(ussFileProvider, "deleteSession"), arg: [test.value, undefined] }, ], }, { diff --git a/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts index 2cd395f690..6144d55419 100644 --- a/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts @@ -140,9 +140,10 @@ describe("ProfileManagement unit tests", () => { configurable: true, }); mocks.mockResolveQp.mockResolvedValueOnce(mocks.mockHideProfChosen); + mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptHideFromAllTreesQpItems"]()[0]); await ProfileManagement.manageProfile(mocks.mockDsSessionNode); expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg); - expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.removeSession", mocks.mockDsSessionNode); + expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.removeSession", mocks.mockDsSessionNode, null, true); }); it("profile using basic authentication should see delete commands called when Delete Profile chosen with v1 profile", async () => { const mocks = createBlockMocks(createGlobalMocks()); @@ -187,9 +188,10 @@ describe("ProfileManagement unit tests", () => { it("profile using token authentication should see correct command called for hiding a unix tree session node", async () => { const mocks = createBlockMocks(createGlobalMocks()); mocks.mockResolveQp.mockResolvedValueOnce(mocks.mockHideProfChosen); + mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptHideFromAllTreesQpItems"]()[1]); await ProfileManagement.manageProfile(mocks.mockUnixSessionNode); expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg); - expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.uss.removeSession", mocks.mockUnixSessionNode); + expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.uss.removeSession", mocks.mockUnixSessionNode, null, false); }); it("profile using token authentication should see correct command called for enabling validation a unix tree session node", async () => { const mocks = createBlockMocks(createGlobalMocks()); diff --git a/packages/zowe-explorer/i18n/sample/src/utils/ProfileManagement.i18n.json b/packages/zowe-explorer/i18n/sample/src/utils/ProfileManagement.i18n.json index f487573b50..d5673c600a 100644 --- a/packages/zowe-explorer/i18n/sample/src/utils/ProfileManagement.i18n.json +++ b/packages/zowe-explorer/i18n/sample/src/utils/ProfileManagement.i18n.json @@ -3,6 +3,12 @@ "qpPlaceholders.qp.basic": "Profile {0} is using basic authentication. Choose a profile action.", "qpPlaceholders.qp.token": "Profile {0} is using token authentication. Choose a profile action.", "qpPlaceholders.qp.choose": "Profile {0} doesn't specify an authentication method. Choose a profile action.", + "ProfileManagement.promptHideFromAllTrees.allLbl": "Yes", + "ProfileManagement.promptHideFromAllTrees.allDesc": "Hide for all trees", + "ProfileManagement.promptHideFromAllTrees.currentLbl": "No", + "ProfileManagement.promptHideFromAllTrees.currentDesc": "Hide for current tree selected", + "ProfileManagement.promptHideFromAllTrees.howToHide": "Do you wish to hide this profile from all trees?", + "ProfileManagement.handleHideProfiles.cancelled": "Operation Cancelled", "addBasicAuthQpItem.addCredentials.qpLabel": "$(plus) Add Credentials", "addBasicAuthQpItem.addCredentials.qpDetail": "Add username and password for basic authentication", "updateBasicAuthQpItem.updateCredentials.qpLabel": "$(refresh) Update Credentials", diff --git a/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts b/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts index eddd2868d5..c1ba543d03 100644 --- a/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts +++ b/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts @@ -22,6 +22,8 @@ import { setProfile, setSession, errorHandling } from "../utils/ProfilesUtils"; import * as nls from "vscode-nls"; import { SettingsConfig } from "../utils/SettingsConfig"; import { ZoweLogger } from "../utils/LoggerUtils"; +import { TreeProviders } from "../shared/TreeProviders"; +import { IZoweProviders } from "../shared/init"; // Set up localization nls.config({ @@ -182,6 +184,18 @@ export class ZoweTreeProvider { return undefined; } + public deleteSession(node: IZoweTreeNode): void { + ZoweLogger.trace("ZoweTreeProvider.deleteSession called."); + for (const key of Object.keys(TreeProviders.providers) as Array) { + const provider = TreeProviders.providers[key]; + provider.mSessionNodes = (provider.mSessionNodes as IZoweTreeNode[]).filter( + (mSessionNode: IZoweTreeNode) => mSessionNode.getLabel() !== node.getLabel() + ); + provider.removeSession(node.getLabel() as string); + provider.refresh(); + } + } + public async editSession(node: IZoweTreeNode, zoweFileProvider: IZoweTree): Promise { ZoweLogger.trace("ZoweTreeProvider.editSession called."); const profile = node.getProfile(); @@ -289,10 +303,4 @@ export class ZoweTreeProvider { ZoweLogger.trace("ZoweTreeProvider.createZoweSession called."); await Profiles.getInstance().createZoweSession(zoweFileProvider); } - - protected deleteSessionByLabel(revisedLabel: string): void { - ZoweLogger.trace("ZoweTreeProvider.deleteSessionByLabel called."); - this.mHistory.removeSession(revisedLabel); - this.refresh(); - } } diff --git a/packages/zowe-explorer/src/dataset/DatasetTree.ts b/packages/zowe-explorer/src/dataset/DatasetTree.ts index a9903ac8e0..39447a61f3 100644 --- a/packages/zowe-explorer/src/dataset/DatasetTree.ts +++ b/packages/zowe-explorer/src/dataset/DatasetTree.ts @@ -482,10 +482,13 @@ export class DatasetTree extends ZoweTreeProvider implements IZoweTree tempNode.label.toString() !== node.label.toString()); - this.mHistory.removeSession(node.label as string); + if (hideFromAllTrees) { + super.deleteSession(node); + } + this.mSessionNodes = this.mSessionNodes.filter((mSessionNode: IZoweDatasetTreeNode) => mSessionNode.getLabel() !== node.getLabel()); + this.removeSession(node.getLabel() as string); this.refresh(); } @@ -769,6 +772,11 @@ export class DatasetTree extends ZoweTreeProvider implements IZoweTree> { +export async function initDatasetProvider(context: vscode.ExtensionContext): Promise { ZoweLogger.trace("dataset.init.initDatasetProvider called."); const datasetProvider = await createDatasetTree(globals.LOG); if (datasetProvider == null) { @@ -109,14 +109,17 @@ export async function initDatasetProvider(context: vscode.ExtensionContext): Pro }) ); context.subscriptions.push( - vscode.commands.registerCommand("zowe.ds.removeSession", async (node: IZoweDatasetTreeNode, nodeList: IZoweDatasetTreeNode[]) => { - let selectedNodes = getSelectedNodeList(node, nodeList); - selectedNodes = selectedNodes.filter((sNode) => contextuals.isDsSession(sNode)); - for (const select of selectedNodes) { - datasetProvider.deleteSession(select); + vscode.commands.registerCommand( + "zowe.ds.removeSession", + async (node: IZoweDatasetTreeNode, nodeList: IZoweDatasetTreeNode[], hideFromAllTrees: boolean) => { + let selectedNodes = getSelectedNodeList(node, nodeList); + selectedNodes = selectedNodes.filter((sNode) => contextuals.isDsSession(sNode)); + for (const select of selectedNodes) { + datasetProvider.deleteSession(select, hideFromAllTrees); + } + await TreeViewUtils.fixVsCodeMultiSelect(datasetProvider); } - await TreeViewUtils.fixVsCodeMultiSelect(datasetProvider); - }) + ) ); context.subscriptions.push( vscode.commands.registerCommand("zowe.ds.removeFavorite", async (node, nodeList) => { diff --git a/packages/zowe-explorer/src/job/ZosJobsProvider.ts b/packages/zowe-explorer/src/job/ZosJobsProvider.ts index cd61cc7717..67337f4ee9 100644 --- a/packages/zowe-explorer/src/job/ZosJobsProvider.ts +++ b/packages/zowe-explorer/src/job/ZosJobsProvider.ts @@ -633,6 +633,11 @@ export class ZosJobsProvider extends ZoweTreeProvider implements IZoweTree tempNode.label !== node.label); - this.deleteSessionByLabel(node.getLabel() as string); + if (hideFromAllTrees) { + super.deleteSession(node); + } + this.mSessionNodes = this.mSessionNodes.filter((mSessionNode: IZoweJobTreeNode) => mSessionNode.getLabel() !== node.getLabel()); + this.removeSession(node.getLabel() as string); + this.refresh(); } /** diff --git a/packages/zowe-explorer/src/job/init.ts b/packages/zowe-explorer/src/job/init.ts index 81527474a2..01c92cdc80 100644 --- a/packages/zowe-explorer/src/job/init.ts +++ b/packages/zowe-explorer/src/job/init.ts @@ -13,16 +13,16 @@ import * as globals from "../globals"; import * as vscode from "vscode"; import * as jobActions from "./actions"; import * as refreshActions from "../shared/refresh"; -import { IZoweJobTreeNode, IZoweTreeNode, IZoweTree } from "@zowe/zowe-explorer-api"; +import { IZoweJobTreeNode, IZoweTreeNode } from "@zowe/zowe-explorer-api"; import { Profiles } from "../Profiles"; -import { createJobsTree } from "./ZosJobsProvider"; +import { ZosJobsProvider, createJobsTree } from "./ZosJobsProvider"; import * as contextuals from "../shared/context"; import { Job } from "./ZoweJobNode"; import { getSelectedNodeList } from "../shared/utils"; import { initSubscribers } from "../shared/init"; import { ZoweLogger } from "../utils/LoggerUtils"; -export async function initJobsProvider(context: vscode.ExtensionContext): Promise> { +export async function initJobsProvider(context: vscode.ExtensionContext): Promise { ZoweLogger.trace("job.init.initJobsProvider called."); const jobsProvider = await createJobsTree(globals.LOG); if (jobsProvider == null) { @@ -75,11 +75,11 @@ export async function initJobsProvider(context: vscode.ExtensionContext): Promis context.subscriptions.push(vscode.commands.registerCommand("zowe.jobs.setOwner", (job) => jobActions.setOwner(job, jobsProvider))); context.subscriptions.push(vscode.commands.registerCommand("zowe.jobs.setPrefix", (job) => jobActions.setPrefix(job, jobsProvider))); context.subscriptions.push( - vscode.commands.registerCommand("zowe.jobs.removeJobsSession", (job, jobList) => { + vscode.commands.registerCommand("zowe.jobs.removeJobsSession", (job, jobList, hideFromAllTrees) => { let selectedNodes = getSelectedNodeList(job, jobList); selectedNodes = selectedNodes.filter((element) => contextuals.isJobsSession(element)); for (const item of selectedNodes) { - jobsProvider.deleteSession(item); + jobsProvider.deleteSession(item, hideFromAllTrees); } }) ); diff --git a/packages/zowe-explorer/src/shared/TreeProviders.ts b/packages/zowe-explorer/src/shared/TreeProviders.ts index 703f60c990..cf9bc4b93e 100644 --- a/packages/zowe-explorer/src/shared/TreeProviders.ts +++ b/packages/zowe-explorer/src/shared/TreeProviders.ts @@ -10,34 +10,38 @@ */ import * as vscode from "vscode"; -import { IZoweTree, IZoweTreeNode } from "@zowe/zowe-explorer-api"; import { IZoweProviders } from "./init"; +import { DatasetTree } from "../dataset/DatasetTree"; +import { USSTree } from "../uss/USSTree"; +import { ZosJobsProvider } from "../job/ZosJobsProvider"; + +type ProviderFunctions = { + ds: (context: vscode.ExtensionContext) => Promise; + uss: (context: vscode.ExtensionContext) => Promise; + job: (context: vscode.ExtensionContext) => Promise; +}; -type ProviderFunction = (context: vscode.ExtensionContext) => Promise>; export class TreeProviders { - static #ds: IZoweTree; - static #uss: IZoweTree; - static #job: IZoweTree; - - public static async initializeProviders( - context: vscode.ExtensionContext, - initializers: { ds: ProviderFunction; uss: ProviderFunction; job: ProviderFunction } - ): Promise { + static #ds: DatasetTree; + static #uss: USSTree; + static #job: ZosJobsProvider; + + public static async initializeProviders(context: vscode.ExtensionContext, initializers: ProviderFunctions): Promise { TreeProviders.#ds = await initializers.ds(context); TreeProviders.#uss = await initializers.uss(context); TreeProviders.#job = await initializers.job(context); return TreeProviders.providers; } - public static get ds(): IZoweTree { + public static get ds(): DatasetTree { return TreeProviders.#ds; } - public static get uss(): IZoweTree { + public static get uss(): USSTree { return TreeProviders.#uss; } - public static get job(): IZoweTree { + public static get job(): ZosJobsProvider { return TreeProviders.#job; } diff --git a/packages/zowe-explorer/src/shared/init.ts b/packages/zowe-explorer/src/shared/init.ts index 8c0dcec39d..e519df9d0a 100644 --- a/packages/zowe-explorer/src/shared/init.ts +++ b/packages/zowe-explorer/src/shared/init.ts @@ -29,6 +29,9 @@ import { SettingsConfig } from "../utils/SettingsConfig"; import { spoolFilePollEvent } from "../job/actions"; import { HistoryView } from "./HistoryView"; import { ProfileManagement } from "../utils/ProfileManagement"; +import { DatasetTree } from "../dataset/DatasetTree"; +import { USSTree } from "../uss/USSTree"; +import { ZosJobsProvider } from "../job/ZosJobsProvider"; // Set up localization nls.config({ @@ -38,10 +41,9 @@ nls.config({ const localize: nls.LocalizeFunc = nls.loadMessageBundle(); export interface IZoweProviders { - ds: IZoweTree; - uss: IZoweTree; - job: IZoweTree; - // [key: string]: IZoweTree; + ds: DatasetTree; + uss: USSTree; + job: ZosJobsProvider; } export function registerRefreshCommand( diff --git a/packages/zowe-explorer/src/uss/USSTree.ts b/packages/zowe-explorer/src/uss/USSTree.ts index 58cde526ab..01bc371c75 100644 --- a/packages/zowe-explorer/src/uss/USSTree.ts +++ b/packages/zowe-explorer/src/uss/USSTree.ts @@ -363,10 +363,13 @@ export class USSTree extends ZoweTreeProvider implements IZoweTree tempNode.label.toString() !== node.label.toString()); - this.mHistory.removeSession(node.label as string); + if (hideFromAllTrees) { + super.deleteSession(node); + } + this.mSessionNodes = this.mSessionNodes.filter((mSessionNode: IZoweUSSTreeNode) => mSessionNode.getLabel() !== node.getLabel()); + this.removeSession(node.getLabel() as string); this.refresh(); } @@ -856,6 +859,11 @@ export class USSTree extends ZoweTreeProvider implements IZoweTree> { +export async function initUSSProvider(context: vscode.ExtensionContext): Promise { ZoweLogger.trace("init.initUSSProvider called."); const ussFileProvider: IZoweTree = await createUSSTree(globals.LOG); if (ussFileProvider == null) { @@ -84,11 +84,11 @@ export async function initUSSProvider(context: vscode.ExtensionContext): Promise vscode.commands.registerCommand("zowe.uss.ZoweUSSNode.open", (node: IZoweUSSTreeNode): void => node.openUSS(false, true, ussFileProvider)) ); context.subscriptions.push( - vscode.commands.registerCommand("zowe.uss.removeSession", async (node: IZoweUSSTreeNode, nodeList) => { + vscode.commands.registerCommand("zowe.uss.removeSession", async (node: IZoweUSSTreeNode, nodeList, hideFromAllTrees: boolean) => { let selectedNodes = getSelectedNodeList(node, nodeList); selectedNodes = selectedNodes.filter((element) => contextuals.isUssSession(element)); for (const item of selectedNodes) { - ussFileProvider.deleteSession(item); + ussFileProvider.deleteSession(item, hideFromAllTrees); } await TreeViewUtils.fixVsCodeMultiSelect(ussFileProvider); }) @@ -191,5 +191,5 @@ export async function initUSSProvider(context: vscode.ExtensionContext): Promise ); initSubscribers(context, ussFileProvider); - return ussFileProvider; + return ussFileProvider as USSTree; } diff --git a/packages/zowe-explorer/src/utils/ProfileManagement.ts b/packages/zowe-explorer/src/utils/ProfileManagement.ts index 5825a8fdac..bfb617062f 100644 --- a/packages/zowe-explorer/src/utils/ProfileManagement.ts +++ b/packages/zowe-explorer/src/utils/ProfileManagement.ts @@ -245,14 +245,45 @@ export class ProfileManagement { await vscode.commands.executeCommand("zowe.ds.deleteProfile", node); } + private static getPromptHideFromAllTreesQpItems(): vscode.QuickPickItem[] { + const qpItemAll: vscode.QuickPickItem = { + label: localize("ProfileManagement.promptHideFromAllTrees.allLbl", "Yes"), + description: localize("ProfileManagement.promptHideFromAllTrees.allDesc", "Hide for all trees"), + }; + const qpItemCurrent: vscode.QuickPickItem = { + label: localize("ProfileManagement.promptHideFromAllTrees.currentLbl", "No"), + description: localize("ProfileManagement.promptHideFromAllTrees.currentDesc", "Hide for current tree selected"), + }; + return [qpItemAll, qpItemCurrent]; + } + + private static async promptHideFromAllTrees(): Promise { + const qp = Gui.createQuickPick(); + qp.placeholder = localize("ProfileManagement.promptHideFromAllTrees.howToHide", "Do you wish to hide this profile from all trees?"); + qp.items = this.getPromptHideFromAllTreesQpItems(); + qp.activeItems = [qp.items[0]]; + qp.show(); + const selection = await Gui.resolveQuickPick(qp); + qp.hide(); + return selection; + } + private static async handleHideProfiles(node: IZoweTreeNode): Promise { + const selection = await this.promptHideFromAllTrees(); + if (!selection) { + Gui.infoMessage(localize("ProfileManagement.handleHideProfiles.cancelled", "Operation Cancelled")); + return; + } + const [all] = this.getPromptHideFromAllTreesQpItems(); + const shouldHideFromAllTrees = selection.label === all.label ? true : false; + if (isZoweDatasetTreeNode(node)) { - return vscode.commands.executeCommand("zowe.ds.removeSession", node); + return vscode.commands.executeCommand("zowe.ds.removeSession", node, null, shouldHideFromAllTrees); } if (isZoweUSSTreeNode(node)) { - return vscode.commands.executeCommand("zowe.uss.removeSession", node); + return vscode.commands.executeCommand("zowe.uss.removeSession", node, null, shouldHideFromAllTrees); } - return vscode.commands.executeCommand("zowe.jobs.removeJobsSession", node); + return vscode.commands.executeCommand("zowe.jobs.removeJobsSession", node, null, shouldHideFromAllTrees); } private static async handleEnableProfileValidation(node: IZoweTreeNode): Promise { From 99e963f63310854c6fe8d38012a47ed442eb7952 Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Fri, 10 Nov 2023 14:43:03 -0500 Subject: [PATCH 10/76] Add changelog and address code smell Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- packages/zowe-explorer-api/CHANGELOG.md | 2 ++ packages/zowe-explorer/CHANGELOG.md | 2 ++ packages/zowe-explorer/src/utils/ProfileManagement.ts | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/zowe-explorer-api/CHANGELOG.md b/packages/zowe-explorer-api/CHANGELOG.md index e60ca4eb87..02aafa51df 100644 --- a/packages/zowe-explorer-api/CHANGELOG.md +++ b/packages/zowe-explorer-api/CHANGELOG.md @@ -6,6 +6,8 @@ All notable changes to the "zowe-explorer-api" extension will be documented in t ### New features and enhancements +- Added new optional boolean parameter `hideFromAllTrees` to `IZoweTree.deleteSession` for specifying whether to hide from all trees or current tree. [#2567](https://github.com/zowe/vscode-extension-for-zowe/issues/2567) + ### Bug fixes ## `2.12.0` diff --git a/packages/zowe-explorer/CHANGELOG.md b/packages/zowe-explorer/CHANGELOG.md index dc8ce095c8..b182971d91 100644 --- a/packages/zowe-explorer/CHANGELOG.md +++ b/packages/zowe-explorer/CHANGELOG.md @@ -6,6 +6,8 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen ### New features and enhancements +- Added support for hiding a Zowe profile across all trees [#2567](https://github.com/zowe/vscode-extension-for-zowe/issues/2567) + ### Bug fixes ## `2.12.0` diff --git a/packages/zowe-explorer/src/utils/ProfileManagement.ts b/packages/zowe-explorer/src/utils/ProfileManagement.ts index bfb617062f..2ccd62b3dc 100644 --- a/packages/zowe-explorer/src/utils/ProfileManagement.ts +++ b/packages/zowe-explorer/src/utils/ProfileManagement.ts @@ -275,7 +275,7 @@ export class ProfileManagement { return; } const [all] = this.getPromptHideFromAllTreesQpItems(); - const shouldHideFromAllTrees = selection.label === all.label ? true : false; + const shouldHideFromAllTrees = selection.label === all.label; if (isZoweDatasetTreeNode(node)) { return vscode.commands.executeCommand("zowe.ds.removeSession", node, null, shouldHideFromAllTrees); From 62ab10bd0b8b922b2a92c252ecb7e8c65c697a8d Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Fri, 10 Nov 2023 14:47:00 -0500 Subject: [PATCH 11/76] fix broken theia check Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../__tests__/__theia__/theia/extension.theiaChrome.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts index 239aadb46a..287c1fc772 100644 --- a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts +++ b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts @@ -143,6 +143,8 @@ export async function hideProfileInUss() { const manageProfile = driverChrome.wait(until.elementLocated(By.xpath(UssLocators.emptyInputBoxXpath)), WAITTIME); manageProfile.sendKeys("Hide Profile"); manageProfile.sendKeys(Key.ENTER); + manageProfile.sendKeys("No"); + manageProfile.sendKeys(Key.ENTER); } export async function hideProfileInJobs() { @@ -153,6 +155,8 @@ export async function hideProfileInJobs() { const manageProfile = driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.emptyInputBoxXpath)), WAITTIME); manageProfile.sendKeys("Hide Profile"); manageProfile.sendKeys(Key.ENTER); + manageProfile.sendKeys("No"); + manageProfile.sendKeys(Key.ENTER); } export async function verifyProfileIsHideInUss() { From 9dea82a39df7a64349b95d16ebc62c9ef67b66d8 Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Fri, 10 Nov 2023 15:14:36 -0500 Subject: [PATCH 12/76] address duplicate code Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../zowe-explorer/src/abstract/ZoweTreeProvider.ts | 12 +++++++----- packages/zowe-explorer/src/dataset/DatasetTree.ts | 4 +--- packages/zowe-explorer/src/job/ZosJobsProvider.ts | 4 +--- packages/zowe-explorer/src/uss/USSTree.ts | 4 +--- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts b/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts index c1ba543d03..01cc0c2fcd 100644 --- a/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts +++ b/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts @@ -184,15 +184,17 @@ export class ZoweTreeProvider { return undefined; } + public deleteSessionForProvider(node: IZoweTreeNode, provider: IZoweTree): void { + provider.mSessionNodes = provider.mSessionNodes.filter((mSessionNode: IZoweTreeNode) => mSessionNode.getLabel() !== node.getLabel()); + provider.removeSession(node.getLabel() as string); + provider.refresh(); + } + public deleteSession(node: IZoweTreeNode): void { ZoweLogger.trace("ZoweTreeProvider.deleteSession called."); for (const key of Object.keys(TreeProviders.providers) as Array) { const provider = TreeProviders.providers[key]; - provider.mSessionNodes = (provider.mSessionNodes as IZoweTreeNode[]).filter( - (mSessionNode: IZoweTreeNode) => mSessionNode.getLabel() !== node.getLabel() - ); - provider.removeSession(node.getLabel() as string); - provider.refresh(); + this.deleteSessionForProvider(node, provider); } } diff --git a/packages/zowe-explorer/src/dataset/DatasetTree.ts b/packages/zowe-explorer/src/dataset/DatasetTree.ts index 39447a61f3..9e51a0923f 100644 --- a/packages/zowe-explorer/src/dataset/DatasetTree.ts +++ b/packages/zowe-explorer/src/dataset/DatasetTree.ts @@ -487,9 +487,7 @@ export class DatasetTree extends ZoweTreeProvider implements IZoweTree mSessionNode.getLabel() !== node.getLabel()); - this.removeSession(node.getLabel() as string); - this.refresh(); + super.deleteSessionForProvider(node, this); } /** diff --git a/packages/zowe-explorer/src/job/ZosJobsProvider.ts b/packages/zowe-explorer/src/job/ZosJobsProvider.ts index 67337f4ee9..d7cd4eda24 100644 --- a/packages/zowe-explorer/src/job/ZosJobsProvider.ts +++ b/packages/zowe-explorer/src/job/ZosJobsProvider.ts @@ -886,9 +886,7 @@ export class ZosJobsProvider extends ZoweTreeProvider implements IZoweTree mSessionNode.getLabel() !== node.getLabel()); - this.removeSession(node.getLabel() as string); - this.refresh(); + super.deleteSessionForProvider(node, this); } /** diff --git a/packages/zowe-explorer/src/uss/USSTree.ts b/packages/zowe-explorer/src/uss/USSTree.ts index 01bc371c75..a8469bed3c 100644 --- a/packages/zowe-explorer/src/uss/USSTree.ts +++ b/packages/zowe-explorer/src/uss/USSTree.ts @@ -368,9 +368,7 @@ export class USSTree extends ZoweTreeProvider implements IZoweTree mSessionNode.getLabel() !== node.getLabel()); - this.removeSession(node.getLabel() as string); - this.refresh(); + super.deleteSessionForProvider(node, this); } /** From 4e4ff90737b592a852d7c067eb82b294b4e0c85c Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Fri, 10 Nov 2023 16:09:26 -0500 Subject: [PATCH 13/76] further code cleanup Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../__mocks__/mockCreators/shared.ts | 10 ++++---- .../__unit__/dataset/DatasetTree.unit.test.ts | 19 ++++++++++----- .../__unit__/job/ZoweJobNode.unit.test.ts | 5 +++- .../__unit__/uss/USSTree.unit.test.ts | 5 +++- .../src/abstract/ZoweTreeProvider.ts | 24 +++++++++++-------- .../zowe-explorer/src/dataset/DatasetTree.ts | 5 +--- .../zowe-explorer/src/job/ZosJobsProvider.ts | 5 +--- packages/zowe-explorer/src/shared/context.ts | 15 ++++++++++++ packages/zowe-explorer/src/uss/USSTree.ts | 5 +--- 9 files changed, 59 insertions(+), 34 deletions(-) diff --git a/packages/zowe-explorer/__mocks__/mockCreators/shared.ts b/packages/zowe-explorer/__mocks__/mockCreators/shared.ts index 9a3ffa5a90..213a92b69a 100644 --- a/packages/zowe-explorer/__mocks__/mockCreators/shared.ts +++ b/packages/zowe-explorer/__mocks__/mockCreators/shared.ts @@ -17,6 +17,7 @@ import { ValidProfileEnum, IZoweTreeNode } from "@zowe/zowe-explorer-api"; import { FilterDescriptor } from "../../src/utils/ProfilesUtils"; import { imperative, ZosmfSession } from "@zowe/cli"; import { SettingsConfig } from "../../src/utils/SettingsConfig"; +import * as globals from "../../src/globals"; export function createPersistentConfig() { return { @@ -549,7 +550,7 @@ export function createOutputChannel() { } as vscode.OutputChannel; } -export function createMockNode(name: string): IZoweTreeNode { +export function createMockNode(name: string, context: string): IZoweTreeNode { return { dirty: false, getLabel: jest.fn(() => name), @@ -562,25 +563,26 @@ export function createMockNode(name: string): IZoweTreeNode { setProfileToChoice: jest.fn(), setSessionToChoice: jest.fn(), label: name, + contextValue: context, }; } export function createTreeProviders() { return { ds: { - mSessionNodes: [createMockNode("zosmf"), createMockNode("zosmf2")], + mSessionNodes: [createMockNode("zosmf", globals.DS_SESSION_CONTEXT), createMockNode("zosmf2", globals.DS_SESSION_CONTEXT)], deleteSession: jest.fn(), removeSession: jest.fn(), refresh: jest.fn(), } as any, uss: { - mSessionNodes: [createMockNode("zosmf"), createMockNode("zosmf2")], + mSessionNodes: [createMockNode("zosmf", globals.USS_SESSION_CONTEXT), createMockNode("zosmf2", globals.USS_SESSION_CONTEXT)], deleteSession: jest.fn(), removeSession: jest.fn(), refresh: jest.fn(), } as any, job: { - mSessionNodes: [createMockNode("zosmf"), createMockNode("zosmf2")], + mSessionNodes: [createMockNode("zosmf", globals.JOBS_SESSION_CONTEXT), createMockNode("zosmf2", globals.JOBS_SESSION_CONTEXT)], removeSession: jest.fn(), deleteSession: jest.fn(), refresh: jest.fn(), diff --git a/packages/zowe-explorer/__tests__/__unit__/dataset/DatasetTree.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/dataset/DatasetTree.unit.test.ts index da0d4a9b24..09f6d5a132 100644 --- a/packages/zowe-explorer/__tests__/__unit__/dataset/DatasetTree.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/dataset/DatasetTree.unit.test.ts @@ -41,6 +41,7 @@ import { createInstanceOfProfileInfo, createGetConfigMock, createTreeProviders, + createMockNode, } from "../../../__mocks__/mockCreators/shared"; import { createDatasetSessionNode, createDatasetTree, createDatasetFavoritesNode } from "../../../__mocks__/mockCreators/datasets"; import { bindMvsApi, createMvsApi } from "../../../__mocks__/mockCreators/api"; @@ -1331,30 +1332,36 @@ describe("Dataset Tree Unit Tests - Function deleteSession", () => { } it("Checking common run of function", () => { - createGlobalMocks(); + const globalMocks = createGlobalMocks(); const blockMocks = createBlockMocks(); + jest.spyOn(TreeProviders, "providers", "get").mockReturnValue(globalMocks.mockTreeProviders); mocked(vscode.window.createTreeView).mockReturnValueOnce(blockMocks.treeView); const testTree = new DatasetTree(); - testTree.mSessionNodes.push(blockMocks.datasetSessionNode); + testTree.mSessionNodes = globalMocks.mockTreeProviders.ds.mSessionNodes; + testTree.mSessionNodes.push(createMockNode("Favorites", globals.DS_SESSION_CONTEXT)); + testTree.deleteSession(testTree.mSessionNodes[0]); testTree.deleteSession(testTree.mSessionNodes[1]); - expect(testTree.mSessionNodes.map((node) => node.label)).toEqual(["Favorites"]); + expect(globalMocks.mockTreeProviders.ds.mSessionNodes.map((node) => node.label)).toEqual(["Favorites"]); }); - it("Checking case profile needs to be hidden for all trees", async () => { + it("Checking case profile needs to be hidden for all trees", () => { const globalMocks = createGlobalMocks(); const blockMocks = createBlockMocks(); jest.spyOn(TreeProviders, "providers", "get").mockReturnValue(globalMocks.mockTreeProviders); mocked(vscode.window.createTreeView).mockReturnValueOnce(blockMocks.treeView); const testTree = new DatasetTree(); - testTree.mSessionNodes.push(blockMocks.datasetSessionNode); + testTree.mSessionNodes = globalMocks.mockTreeProviders.ds.mSessionNodes; + testTree.deleteSession(testTree.mSessionNodes[0], true); testTree.deleteSession(testTree.mSessionNodes[1], true); - expect(testTree.mSessionNodes.map((node) => node.label)).toEqual(["Favorites"]); + expect(globalMocks.mockTreeProviders.ds.mSessionNodes.map((node) => node.label)).toEqual([]); + expect(globalMocks.mockTreeProviders.uss.mSessionNodes.map((node) => node.label)).toEqual([]); + expect(globalMocks.mockTreeProviders.job.mSessionNodes.map((node) => node.label)).toEqual([]); }); }); describe("Dataset Tree Unit Tests - Function flipState", () => { diff --git a/packages/zowe-explorer/__tests__/__unit__/job/ZoweJobNode.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/job/ZoweJobNode.unit.test.ts index 34097a5e0b..b56f9f1d9e 100644 --- a/packages/zowe-explorer/__tests__/__unit__/job/ZoweJobNode.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/job/ZoweJobNode.unit.test.ts @@ -242,10 +242,13 @@ describe("ZoweJobNode unit tests - Function deleteSession", () => { const globalMocks = await createGlobalMocks(); jest.spyOn(TreeProviders, "providers", "get").mockReturnValue(globalMocks.mockTreeProviders); globalMocks.testJobsProvider.mSessionNodes = globalMocks.mockTreeProviders.ds.mSessionNodes; - await globalMocks.testJobsProvider.deleteSession(globalMocks.testJobsProvider.mSessionNodes[1]); expect(globalMocks.mockTreeProviders.ds.mSessionNodes.length).toEqual(2); expect(globalMocks.mockTreeProviders.uss.mSessionNodes.length).toEqual(2); expect(globalMocks.mockTreeProviders.job.mSessionNodes.length).toEqual(2); + await globalMocks.testJobsProvider.deleteSession(globalMocks.testJobsProvider.mSessionNodes[1], true); + expect(globalMocks.mockTreeProviders.ds.mSessionNodes.length).toEqual(1); + expect(globalMocks.mockTreeProviders.uss.mSessionNodes.length).toEqual(1); + expect(globalMocks.mockTreeProviders.job.mSessionNodes.length).toEqual(1); }); }); diff --git a/packages/zowe-explorer/__tests__/__unit__/uss/USSTree.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/uss/USSTree.unit.test.ts index 80be9d8640..27acebaffc 100644 --- a/packages/zowe-explorer/__tests__/__unit__/uss/USSTree.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/uss/USSTree.unit.test.ts @@ -523,10 +523,13 @@ describe("USSTree Unit Tests - Function USSTree.deleteSession()", () => { jest.spyOn(TreeProviders, "providers", "get").mockReturnValue(globalMocks.mockTreeProviders); blockMocks.testTree2.mSessionNodes = globalMocks.mockTreeProviders.ds.mSessionNodes; - blockMocks.testTree2.deleteSession(globalMocks.mockTreeProviders.ds.mSessionNodes[1]); expect(globalMocks.mockTreeProviders.ds.mSessionNodes.length).toEqual(2); expect(globalMocks.mockTreeProviders.uss.mSessionNodes.length).toEqual(2); expect(globalMocks.mockTreeProviders.job.mSessionNodes.length).toEqual(2); + blockMocks.testTree2.deleteSession(globalMocks.mockTreeProviders.ds.mSessionNodes[1], true); + expect(globalMocks.mockTreeProviders.ds.mSessionNodes.length).toEqual(1); + expect(globalMocks.mockTreeProviders.uss.mSessionNodes.length).toEqual(1); + expect(globalMocks.mockTreeProviders.job.mSessionNodes.length).toEqual(1); }); }); diff --git a/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts b/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts index 01cc0c2fcd..7bb7161c4c 100644 --- a/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts +++ b/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts @@ -184,17 +184,15 @@ export class ZoweTreeProvider { return undefined; } - public deleteSessionForProvider(node: IZoweTreeNode, provider: IZoweTree): void { - provider.mSessionNodes = provider.mSessionNodes.filter((mSessionNode: IZoweTreeNode) => mSessionNode.getLabel() !== node.getLabel()); - provider.removeSession(node.getLabel() as string); - provider.refresh(); - } - - public deleteSession(node: IZoweTreeNode): void { + public deleteSession(node: IZoweTreeNode, hideFromAllTrees?: boolean): void { ZoweLogger.trace("ZoweTreeProvider.deleteSession called."); - for (const key of Object.keys(TreeProviders.providers) as Array) { - const provider = TreeProviders.providers[key]; - this.deleteSessionForProvider(node, provider); + if (hideFromAllTrees) { + for (const key of Object.keys(TreeProviders.providers) as Array) { + const currentProvider = TreeProviders.providers[key]; + this.deleteSessionForProvider(node, currentProvider); + } + } else { + this.deleteSessionForProvider(node, TreeProviders.providers[contextually.getSessionType(node)]); } } @@ -305,4 +303,10 @@ export class ZoweTreeProvider { ZoweLogger.trace("ZoweTreeProvider.createZoweSession called."); await Profiles.getInstance().createZoweSession(zoweFileProvider); } + + private deleteSessionForProvider(node: IZoweTreeNode, provider: IZoweTree): void { + provider.mSessionNodes = provider.mSessionNodes.filter((mSessionNode: IZoweTreeNode) => mSessionNode.getLabel() !== node.getLabel()); + provider.removeSession(node.getLabel() as string); + provider.refresh(); + } } diff --git a/packages/zowe-explorer/src/dataset/DatasetTree.ts b/packages/zowe-explorer/src/dataset/DatasetTree.ts index 9e51a0923f..bdd7004c75 100644 --- a/packages/zowe-explorer/src/dataset/DatasetTree.ts +++ b/packages/zowe-explorer/src/dataset/DatasetTree.ts @@ -484,10 +484,7 @@ export class DatasetTree extends ZoweTreeProvider implements IZoweTree Date: Mon, 13 Nov 2023 12:36:58 -0500 Subject: [PATCH 14/76] Address typing comment by trae for USSTree Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- packages/zowe-explorer/src/uss/USSTree.ts | 1 + packages/zowe-explorer/src/uss/init.ts | 31 ++++++++++++++--------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/packages/zowe-explorer/src/uss/USSTree.ts b/packages/zowe-explorer/src/uss/USSTree.ts index 248c09f5d2..ce76ec0e31 100644 --- a/packages/zowe-explorer/src/uss/USSTree.ts +++ b/packages/zowe-explorer/src/uss/USSTree.ts @@ -64,6 +64,7 @@ export class USSTree extends ZoweTreeProvider implements IZoweTree; + public copying: Promise; public constructor() { super( diff --git a/packages/zowe-explorer/src/uss/init.ts b/packages/zowe-explorer/src/uss/init.ts index 1dfe3658a3..496b6b455d 100644 --- a/packages/zowe-explorer/src/uss/init.ts +++ b/packages/zowe-explorer/src/uss/init.ts @@ -13,7 +13,7 @@ import * as globals from "../globals"; import * as vscode from "vscode"; import * as ussActions from "./actions"; import * as refreshActions from "../shared/refresh"; -import { IZoweUSSTreeNode, IZoweTreeNode, IZoweTree } from "@zowe/zowe-explorer-api"; +import { IZoweUSSTreeNode, IZoweTreeNode } from "@zowe/zowe-explorer-api"; import { Profiles } from "../Profiles"; import * as contextuals from "../shared/context"; import { getSelectedNodeList } from "../shared/utils"; @@ -24,7 +24,7 @@ import { TreeViewUtils } from "../utils/TreeViewUtils"; export async function initUSSProvider(context: vscode.ExtensionContext): Promise { ZoweLogger.trace("init.initUSSProvider called."); - const ussFileProvider: IZoweTree = await createUSSTree(globals.LOG); + const ussFileProvider: USSTree = await createUSSTree(globals.LOG); if (ussFileProvider == null) { return null; } @@ -75,7 +75,7 @@ export async function initUSSProvider(context: vscode.ExtensionContext): Promise }) ); context.subscriptions.push( - vscode.commands.registerCommand("zowe.uss.fullPath", (node: IZoweUSSTreeNode): void => ussFileProvider.filterPrompt(node)) + vscode.commands.registerCommand("zowe.uss.fullPath", (node: IZoweUSSTreeNode): Promise => ussFileProvider.filterPrompt(node)) ); context.subscriptions.push( vscode.commands.registerCommand("zowe.uss.editSession", async (node) => ussFileProvider.editSession(node, ussFileProvider)) @@ -132,7 +132,7 @@ export async function initUSSProvider(context: vscode.ExtensionContext): Promise }) ); context.subscriptions.push( - vscode.commands.registerCommand("zowe.uss.renameNode", (node: IZoweUSSTreeNode): void => ussFileProvider.rename(node)) + vscode.commands.registerCommand("zowe.uss.renameNode", (node: IZoweUSSTreeNode): Promise => ussFileProvider.rename(node)) ); context.subscriptions.push( vscode.commands.registerCommand("zowe.uss.uploadDialog", async (node: IZoweUSSTreeNode) => ussActions.uploadDialog(node, ussFileProvider)) @@ -147,13 +147,16 @@ export async function initUSSProvider(context: vscode.ExtensionContext): Promise ) ); context.subscriptions.push( - vscode.commands.registerCommand("zowe.uss.saveSearch", (node: IZoweUSSTreeNode): void => ussFileProvider.saveSearch(node)) + vscode.commands.registerCommand( + "zowe.uss.saveSearch", + (node: IZoweUSSTreeNode): Promise => ussFileProvider.saveSearch(node) + ) ); context.subscriptions.push( - vscode.commands.registerCommand("zowe.uss.removeSavedSearch", (node: IZoweUSSTreeNode): void => ussFileProvider.removeFavorite(node)) + vscode.commands.registerCommand("zowe.uss.removeSavedSearch", (node: IZoweUSSTreeNode): Promise => ussFileProvider.removeFavorite(node)) ); context.subscriptions.push( - vscode.commands.registerCommand("zowe.uss.removeFavProfile", (node): void => ussFileProvider.removeFavProfile(node.label, true)) + vscode.commands.registerCommand("zowe.uss.removeFavProfile", (node): Promise => ussFileProvider.removeFavProfile(node.label, true)) ); context.subscriptions.push( vscode.commands.registerCommand("zowe.uss.disableValidation", (node) => { @@ -167,8 +170,12 @@ export async function initUSSProvider(context: vscode.ExtensionContext): Promise ussFileProvider.refreshElement(node); }) ); - context.subscriptions.push(vscode.commands.registerCommand("zowe.uss.ssoLogin", (node: IZoweTreeNode): void => ussFileProvider.ssoLogin(node))); - context.subscriptions.push(vscode.commands.registerCommand("zowe.uss.ssoLogout", (node: IZoweTreeNode): void => ussFileProvider.ssoLogout(node))); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.ssoLogin", (node: IZoweTreeNode): Promise => ussFileProvider.ssoLogin(node)) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.ssoLogout", (node: IZoweTreeNode): Promise => ussFileProvider.ssoLogout(node)) + ); context.subscriptions.push( vscode.commands.registerCommand("zowe.uss.pasteUssFile", async (node: IZoweUSSTreeNode) => { if (ussFileProvider.copying != null) { @@ -185,11 +192,11 @@ export async function initUSSProvider(context: vscode.ExtensionContext): Promise }) ); context.subscriptions.push( - vscode.workspace.onDidChangeConfiguration((e) => { - ussFileProvider.onDidChangeConfiguration(e); + vscode.workspace.onDidChangeConfiguration(async (e) => { + await ussFileProvider.onDidChangeConfiguration(e); }) ); initSubscribers(context, ussFileProvider); - return ussFileProvider as USSTree; + return ussFileProvider; } From d3de38e56128150e006bb99fbf4f43d07e44d89c Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Mon, 13 Nov 2023 12:41:26 -0500 Subject: [PATCH 15/76] Add support for sync of profile validation Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../__tests__/__theia__/theia/Locators.ts | 2 +- .../__tests__/__unit__/extension.unit.test.ts | 2 +- .../__tests__/__unit__/job/init.unit.test.ts | 2 +- .../i18n/sample/package.i18n.json | 1 - .../src/utils/ProfileManagement.i18n.json | 12 ++-- packages/zowe-explorer/package.json | 6 +- packages/zowe-explorer/package.nls.json | 1 - packages/zowe-explorer/src/Profiles.ts | 36 ++++++++-- .../src/abstract/ZoweTreeProvider.ts | 5 +- packages/zowe-explorer/src/dataset/init.ts | 8 +-- packages/zowe-explorer/src/job/init.ts | 10 +-- .../zowe-explorer/src/shared/TreeProviders.ts | 8 +++ packages/zowe-explorer/src/shared/context.ts | 2 +- packages/zowe-explorer/src/uss/init.ts | 8 +-- .../src/utils/ProfileManagement.ts | 65 ++++++++++--------- 15 files changed, 104 insertions(+), 64 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__theia__/theia/Locators.ts b/packages/zowe-explorer/__tests__/__theia__/theia/Locators.ts index 5e3eb996bc..0ac0d8cc36 100644 --- a/packages/zowe-explorer/__tests__/__theia__/theia/Locators.ts +++ b/packages/zowe-explorer/__tests__/__theia__/theia/Locators.ts @@ -59,7 +59,7 @@ export const JobsLocators = { favoriteProfileInJobsXpath: "(//div[contains(@id,'Favorites') and contains(@id,'TestSeleniumProfile')])", addToFavoriteOptionXpath: "//li[@data-command='zowe.jobs.addFavorite']", removeFavoriteProfileFromJobsOptionXpath: "//li[@data-command='zowe.jobs.removeFavProfile']", - hideProfileFromJobsOptionXpath: "//li[@data-command='zowe.jobs.removeJobsSession']", + hideProfileFromJobsOptionXpath: "//li[@data-command='zowe.jobs.removeSession']", secondJobsProfileBeforeHidingXpath: "(//div[contains(@id,'TestSeleniumProfile')])[2]", manageProfileFromJobsXpath: "(//li[@data-command='zowe.profileManagement'])", }; diff --git a/packages/zowe-explorer/__tests__/__unit__/extension.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/extension.unit.test.ts index 14aee629ab..6b2b6ccc80 100644 --- a/packages/zowe-explorer/__tests__/__unit__/extension.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/extension.unit.test.ts @@ -223,7 +223,7 @@ async function createGlobalMocks() { "zowe.jobs.addJobsSession", "zowe.jobs.setOwner", "zowe.jobs.setPrefix", - "zowe.jobs.removeJobsSession", + "zowe.jobs.removeSession", "zowe.jobs.downloadSpool", "zowe.jobs.downloadSpoolBinary", "zowe.jobs.getJobJcl", diff --git a/packages/zowe-explorer/__tests__/__unit__/job/init.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/job/init.unit.test.ts index c510fe0d36..09b7fa8ad0 100644 --- a/packages/zowe-explorer/__tests__/__unit__/job/init.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/job/init.unit.test.ts @@ -119,7 +119,7 @@ describe("Test src/jobs/extension", () => { mock: [{ spy: jest.spyOn(jobActions, "setPrefix"), arg: [test.value, jobsProvider] }], }, { - name: "zowe.jobs.removeJobsSession", + name: "zowe.jobs.removeSession", mock: [ { spy: jest.spyOn(contextuals, "isJobsSession"), arg: [test.value], ret: true }, { spy: jest.spyOn(jobsProvider, "deleteSession"), arg: [test.value, undefined] }, diff --git a/packages/zowe-explorer/i18n/sample/package.i18n.json b/packages/zowe-explorer/i18n/sample/package.i18n.json index 9171dbc128..466d9ebf81 100644 --- a/packages/zowe-explorer/i18n/sample/package.i18n.json +++ b/packages/zowe-explorer/i18n/sample/package.i18n.json @@ -63,7 +63,6 @@ "refreshJobsServer": "Refresh", "refreshAllJobs": "Refresh Jobs View", "addJobsSession": "Add Profile to Jobs View", - "removeJobsSession": "Hide Profile", "downloadSpool": "Download All", "downloadSpoolBinary": "Download All (Binary)", "cancelJobs": "Cancel Job", diff --git a/packages/zowe-explorer/i18n/sample/src/utils/ProfileManagement.i18n.json b/packages/zowe-explorer/i18n/sample/src/utils/ProfileManagement.i18n.json index d5673c600a..69c1b26868 100644 --- a/packages/zowe-explorer/i18n/sample/src/utils/ProfileManagement.i18n.json +++ b/packages/zowe-explorer/i18n/sample/src/utils/ProfileManagement.i18n.json @@ -3,12 +3,14 @@ "qpPlaceholders.qp.basic": "Profile {0} is using basic authentication. Choose a profile action.", "qpPlaceholders.qp.token": "Profile {0} is using token authentication. Choose a profile action.", "qpPlaceholders.qp.choose": "Profile {0} doesn't specify an authentication method. Choose a profile action.", - "ProfileManagement.promptHideFromAllTrees.allLbl": "Yes", - "ProfileManagement.promptHideFromAllTrees.allDesc": "Hide for all trees", - "ProfileManagement.promptHideFromAllTrees.currentLbl": "No", - "ProfileManagement.promptHideFromAllTrees.currentDesc": "Hide for current tree selected", - "ProfileManagement.promptHideFromAllTrees.howToHide": "Do you wish to hide this profile from all trees?", + "ProfileManagement.getPromptChangeForAllTreesOptions.allLbl": "Yes", + "ProfileManagement.getPromptChangeForAllTreesOptions.allDesc": "Apply to all trees", + "ProfileManagement.getPromptChangeForAllTreesOptions.currentLbl": "No", + "ProfileManagement.getPromptChangeForAllTreesOptions.currentDesc": "Apply to current tree selected", + "ProfileManagement.promptChangeForAllTrees.howToChange": "Do you wish to apply this for all trees?", "ProfileManagement.handleHideProfiles.cancelled": "Operation Cancelled", + "ProfileManagement.handleEnableProfileValidation.cancelled": "Operation Cancelled", + "ProfileManagement.handleDisableProfileValidation.cancelled": "Operation Cancelled", "addBasicAuthQpItem.addCredentials.qpLabel": "$(plus) Add Credentials", "addBasicAuthQpItem.addCredentials.qpDetail": "Add username and password for basic authentication", "updateBasicAuthQpItem.updateCredentials.qpLabel": "$(refresh) Update Credentials", diff --git a/packages/zowe-explorer/package.json b/packages/zowe-explorer/package.json index a5d29c0c2b..76f7f043fc 100644 --- a/packages/zowe-explorer/package.json +++ b/packages/zowe-explorer/package.json @@ -713,8 +713,8 @@ } }, { - "command": "zowe.jobs.removeJobsSession", - "title": "%removeJobsSession%", + "command": "zowe.jobs.removeSession", + "title": "%removeSession%", "category": "Zowe Explorer" }, { @@ -1684,7 +1684,7 @@ "when": "never" }, { - "command": "zowe.jobs.removeJobsSession", + "command": "zowe.jobs.removeSession", "when": "never" }, { diff --git a/packages/zowe-explorer/package.nls.json b/packages/zowe-explorer/package.nls.json index 9171dbc128..466d9ebf81 100644 --- a/packages/zowe-explorer/package.nls.json +++ b/packages/zowe-explorer/package.nls.json @@ -63,7 +63,6 @@ "refreshJobsServer": "Refresh", "refreshAllJobs": "Refresh Jobs View", "addJobsSession": "Add Profile to Jobs View", - "removeJobsSession": "Hide Profile", "downloadSpool": "Download All", "downloadSpoolBinary": "Download All (Binary)", "cancelJobs": "Cancel Job", diff --git a/packages/zowe-explorer/src/Profiles.ts b/packages/zowe-explorer/src/Profiles.ts index bad675e265..eb7dd57606 100644 --- a/packages/zowe-explorer/src/Profiles.ts +++ b/packages/zowe-explorer/src/Profiles.ts @@ -182,12 +182,26 @@ export class Profiles extends ProfilesCache { return profileStatus; } - public disableValidation(node: IZoweNodeType): IZoweNodeType { + public disableValidation(node: IZoweNodeType, shouldHideFromAllTrees: boolean): IZoweNodeType { ZoweLogger.trace("Profiles.disableValidation called."); - this.disableValidationContext(node); + if (shouldHideFromAllTrees) { + this.disableValidtionContextForAllTrees(node.getLabel().toString()); + } else { + this.disableValidationContext(node); + } return node; } + public disableValidtionContextForAllTrees(label: string): IZoweNodeType[] { + const treeNodes = TreeProviders.getSessionForAllTrees(label); + treeNodes.forEach((treeNode) => { + if (treeNode) { + this.disableValidationContext(treeNode); + } + }); + return treeNodes; + } + public disableValidationContext(node: IZoweNodeType): IZoweNodeType { ZoweLogger.trace("Profiles.disableValidationContext called."); const theProfile: zowe.imperative.IProfileLoaded = node.getProfile(); @@ -203,12 +217,26 @@ export class Profiles extends ProfilesCache { return node; } - public enableValidation(node: IZoweNodeType): IZoweNodeType { + public enableValidation(node: IZoweNodeType, shouldHideFromAllTrees: boolean): IZoweNodeType { ZoweLogger.trace("Profiles.enableValidation called."); - this.enableValidationContext(node); + if (shouldHideFromAllTrees) { + this.enableValidationContextForAllTrees(node.getLabel().toString()); + } else { + this.enableValidationContext(node); + } return node; } + public enableValidationContextForAllTrees(label: string): IZoweNodeType[] { + const treeNodes = TreeProviders.getSessionForAllTrees(label); + treeNodes.forEach((treeNode) => { + if (treeNode) { + this.enableValidationContext(treeNode); + } + }); + return treeNodes; + } + public enableValidationContext(node: IZoweNodeType): IZoweNodeType { ZoweLogger.trace("Profiles.enableValidationContext called."); const theProfile: zowe.imperative.IProfileLoaded = node.getProfile(); diff --git a/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts b/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts index 7bb7161c4c..9dca5d0a65 100644 --- a/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts +++ b/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts @@ -192,7 +192,10 @@ export class ZoweTreeProvider { this.deleteSessionForProvider(node, currentProvider); } } else { - this.deleteSessionForProvider(node, TreeProviders.providers[contextually.getSessionType(node)]); + this.deleteSessionForProvider( + node, + TreeProviders.providers[contextually.getSessionType(node) === "jobs" ? "job" : contextually.getSessionType(node)] + ); } } diff --git a/packages/zowe-explorer/src/dataset/init.ts b/packages/zowe-explorer/src/dataset/init.ts index 6325a88557..d0e4fe0ca8 100644 --- a/packages/zowe-explorer/src/dataset/init.ts +++ b/packages/zowe-explorer/src/dataset/init.ts @@ -188,14 +188,14 @@ export async function initDatasetProvider(context: vscode.ExtensionContext): Pro }) ); context.subscriptions.push( - vscode.commands.registerCommand("zowe.ds.disableValidation", (node) => { - Profiles.getInstance().disableValidation(node); + vscode.commands.registerCommand("zowe.ds.disableValidation", (node, shouldHideFromAllTrees) => { + Profiles.getInstance().disableValidation(node, shouldHideFromAllTrees); datasetProvider.refreshElement(node); }) ); context.subscriptions.push( - vscode.commands.registerCommand("zowe.ds.enableValidation", (node) => { - Profiles.getInstance().enableValidation(node); + vscode.commands.registerCommand("zowe.ds.enableValidation", (node, shouldHideFromAllTrees) => { + Profiles.getInstance().enableValidation(node, shouldHideFromAllTrees); datasetProvider.refreshElement(node); }) ); diff --git a/packages/zowe-explorer/src/job/init.ts b/packages/zowe-explorer/src/job/init.ts index 01c92cdc80..2bf054add9 100644 --- a/packages/zowe-explorer/src/job/init.ts +++ b/packages/zowe-explorer/src/job/init.ts @@ -75,7 +75,7 @@ export async function initJobsProvider(context: vscode.ExtensionContext): Promis context.subscriptions.push(vscode.commands.registerCommand("zowe.jobs.setOwner", (job) => jobActions.setOwner(job, jobsProvider))); context.subscriptions.push(vscode.commands.registerCommand("zowe.jobs.setPrefix", (job) => jobActions.setPrefix(job, jobsProvider))); context.subscriptions.push( - vscode.commands.registerCommand("zowe.jobs.removeJobsSession", (job, jobList, hideFromAllTrees) => { + vscode.commands.registerCommand("zowe.jobs.removeSession", (job, jobList, hideFromAllTrees) => { let selectedNodes = getSelectedNodeList(job, jobList); selectedNodes = selectedNodes.filter((element) => contextuals.isJobsSession(element)); for (const item of selectedNodes) { @@ -131,14 +131,14 @@ export async function initJobsProvider(context: vscode.ExtensionContext): Promis vscode.commands.registerCommand("zowe.jobs.removeFavProfile", async (node): Promise => jobsProvider.removeFavProfile(node.label, true)) ); context.subscriptions.push( - vscode.commands.registerCommand("zowe.jobs.disableValidation", (node) => { - Profiles.getInstance().disableValidation(node); + vscode.commands.registerCommand("zowe.jobs.disableValidation", (node, shouldHideFromAllTrees) => { + Profiles.getInstance().disableValidation(node, shouldHideFromAllTrees); jobsProvider.refreshElement(node); }) ); context.subscriptions.push( - vscode.commands.registerCommand("zowe.jobs.enableValidation", (node) => { - Profiles.getInstance().enableValidation(node); + vscode.commands.registerCommand("zowe.jobs.enableValidation", (node, shouldHideFromAllTrees) => { + Profiles.getInstance().enableValidation(node, shouldHideFromAllTrees); jobsProvider.refreshElement(node); }) ); diff --git a/packages/zowe-explorer/src/shared/TreeProviders.ts b/packages/zowe-explorer/src/shared/TreeProviders.ts index cf9bc4b93e..011a24fd99 100644 --- a/packages/zowe-explorer/src/shared/TreeProviders.ts +++ b/packages/zowe-explorer/src/shared/TreeProviders.ts @@ -14,6 +14,7 @@ import { IZoweProviders } from "./init"; import { DatasetTree } from "../dataset/DatasetTree"; import { USSTree } from "../uss/USSTree"; import { ZosJobsProvider } from "../job/ZosJobsProvider"; +import { IZoweNodeType } from "@zowe/zowe-explorer-api"; type ProviderFunctions = { ds: (context: vscode.ExtensionContext) => Promise; @@ -52,4 +53,11 @@ export class TreeProviders { job: TreeProviders.#job, }; } + + public static getSessionForAllTrees(name: string): IZoweNodeType[] { + const dsNode = TreeProviders.ds.mSessionNodes.find((mSessionNode) => mSessionNode.label === name); + const ussNode = TreeProviders.uss.mSessionNodes.find((mSessionNode) => mSessionNode.label === name); + const jobNode = TreeProviders.job.mSessionNodes.find((mSessionNode) => mSessionNode.label === name); + return [dsNode, ussNode, jobNode]; + } } diff --git a/packages/zowe-explorer/src/shared/context.ts b/packages/zowe-explorer/src/shared/context.ts index 8ee950c37f..14782b4c2d 100644 --- a/packages/zowe-explorer/src/shared/context.ts +++ b/packages/zowe-explorer/src/shared/context.ts @@ -35,7 +35,7 @@ export function getSessionType(node: TreeItem): string { return "uss"; } if (isJobsSession(node)) { - return "job"; + return "jobs"; } throw new imperative.ImperativeError({ msg: "Session node passed in does not have a type" }); diff --git a/packages/zowe-explorer/src/uss/init.ts b/packages/zowe-explorer/src/uss/init.ts index 1dfe3658a3..5e6de3ee30 100644 --- a/packages/zowe-explorer/src/uss/init.ts +++ b/packages/zowe-explorer/src/uss/init.ts @@ -156,14 +156,14 @@ export async function initUSSProvider(context: vscode.ExtensionContext): Promise vscode.commands.registerCommand("zowe.uss.removeFavProfile", (node): void => ussFileProvider.removeFavProfile(node.label, true)) ); context.subscriptions.push( - vscode.commands.registerCommand("zowe.uss.disableValidation", (node) => { - Profiles.getInstance().disableValidation(node); + vscode.commands.registerCommand("zowe.uss.disableValidation", (node, shouldHideFromAllTrees) => { + Profiles.getInstance().disableValidation(node, shouldHideFromAllTrees); ussFileProvider.refreshElement(node); }) ); context.subscriptions.push( - vscode.commands.registerCommand("zowe.uss.enableValidation", (node) => { - Profiles.getInstance().enableValidation(node); + vscode.commands.registerCommand("zowe.uss.enableValidation", (node, shouldHideFromAllTrees) => { + Profiles.getInstance().enableValidation(node, shouldHideFromAllTrees); ussFileProvider.refreshElement(node); }) ); diff --git a/packages/zowe-explorer/src/utils/ProfileManagement.ts b/packages/zowe-explorer/src/utils/ProfileManagement.ts index 2ccd62b3dc..160331fea0 100644 --- a/packages/zowe-explorer/src/utils/ProfileManagement.ts +++ b/packages/zowe-explorer/src/utils/ProfileManagement.ts @@ -17,7 +17,7 @@ import { ProfilesUtils } from "./ProfilesUtils"; import * as nls from "vscode-nls"; import { Profiles } from "../Profiles"; import { ZoweExplorerApiRegister } from "../ZoweExplorerApiRegister"; -import { isZoweDatasetTreeNode, isZoweUSSTreeNode } from "../shared/utils"; +import { getSessionType } from "../shared/context"; // Set up localization nls.config({ @@ -245,22 +245,22 @@ export class ProfileManagement { await vscode.commands.executeCommand("zowe.ds.deleteProfile", node); } - private static getPromptHideFromAllTreesQpItems(): vscode.QuickPickItem[] { + private static getPromptChangeForAllTreesOptions(): vscode.QuickPickItem[] { const qpItemAll: vscode.QuickPickItem = { - label: localize("ProfileManagement.promptHideFromAllTrees.allLbl", "Yes"), - description: localize("ProfileManagement.promptHideFromAllTrees.allDesc", "Hide for all trees"), + label: localize("ProfileManagement.getPromptChangeForAllTreesOptions.allLbl", "Yes"), + description: localize("ProfileManagement.getPromptChangeForAllTreesOptions.allDesc", "Apply to all trees"), }; const qpItemCurrent: vscode.QuickPickItem = { - label: localize("ProfileManagement.promptHideFromAllTrees.currentLbl", "No"), - description: localize("ProfileManagement.promptHideFromAllTrees.currentDesc", "Hide for current tree selected"), + label: localize("ProfileManagement.getPromptChangeForAllTreesOptions.currentLbl", "No"), + description: localize("ProfileManagement.getPromptChangeForAllTreesOptions.currentDesc", "Apply to current tree selected"), }; return [qpItemAll, qpItemCurrent]; } - private static async promptHideFromAllTrees(): Promise { + private static async promptChangeForAllTrees(): Promise { const qp = Gui.createQuickPick(); - qp.placeholder = localize("ProfileManagement.promptHideFromAllTrees.howToHide", "Do you wish to hide this profile from all trees?"); - qp.items = this.getPromptHideFromAllTreesQpItems(); + qp.placeholder = localize("ProfileManagement.promptChangeForAllTrees.howToChange", "Do you wish to apply this for all trees?"); + qp.items = this.getPromptChangeForAllTreesOptions(); qp.activeItems = [qp.items[0]]; qp.show(); const selection = await Gui.resolveQuickPick(qp); @@ -268,41 +268,42 @@ export class ProfileManagement { return selection; } - private static async handleHideProfiles(node: IZoweTreeNode): Promise { - const selection = await this.promptHideFromAllTrees(); + private static async handleChangeForAllTrees(): Promise { + const selection = await this.promptChangeForAllTrees(); if (!selection) { - Gui.infoMessage(localize("ProfileManagement.handleHideProfiles.cancelled", "Operation Cancelled")); return; } - const [all] = this.getPromptHideFromAllTreesQpItems(); - const shouldHideFromAllTrees = selection.label === all.label; + const [all] = this.getPromptChangeForAllTreesOptions(); + return selection.label === all.label; + } - if (isZoweDatasetTreeNode(node)) { - return vscode.commands.executeCommand("zowe.ds.removeSession", node, null, shouldHideFromAllTrees); - } - if (isZoweUSSTreeNode(node)) { - return vscode.commands.executeCommand("zowe.uss.removeSession", node, null, shouldHideFromAllTrees); + private static async handleHideProfiles(node: IZoweTreeNode): Promise { + const shouldHideFromAllTrees = await this.handleChangeForAllTrees(); + if (shouldHideFromAllTrees === undefined) { + Gui.infoMessage(localize("ProfileManagement.handleHideProfiles.cancelled", "Operation Cancelled")); + return; } - return vscode.commands.executeCommand("zowe.jobs.removeJobsSession", node, null, shouldHideFromAllTrees); + const type: string = getSessionType(node); + return vscode.commands.executeCommand(`zowe.${type}.removeSession`, node, null, shouldHideFromAllTrees); } private static async handleEnableProfileValidation(node: IZoweTreeNode): Promise { - if (isZoweDatasetTreeNode(node)) { - return vscode.commands.executeCommand("zowe.ds.enableValidation", node); - } - if (isZoweUSSTreeNode(node)) { - return vscode.commands.executeCommand("zowe.uss.enableValidation", node); + const shouldHideFromAllTrees = await this.handleChangeForAllTrees(); + if (shouldHideFromAllTrees === undefined) { + Gui.infoMessage(localize("ProfileManagement.handleEnableProfileValidation.cancelled", "Operation Cancelled")); + return; } - return vscode.commands.executeCommand("zowe.jobs.enableValidation", node); + const type: string = getSessionType(node); + return vscode.commands.executeCommand(`zowe.${type}.enableValidation`, node, shouldHideFromAllTrees); } private static async handleDisableProfileValidation(node: IZoweTreeNode): Promise { - if (isZoweDatasetTreeNode(node)) { - return vscode.commands.executeCommand("zowe.ds.disableValidation", node); - } - if (isZoweUSSTreeNode(node)) { - return vscode.commands.executeCommand("zowe.uss.disableValidation", node); + const shouldHideFromAllTrees = await this.handleChangeForAllTrees(); + if (shouldHideFromAllTrees === undefined) { + Gui.infoMessage(localize("ProfileManagement.handleDisableProfileValidation.cancelled", "Operation Cancelled")); + return; } - return vscode.commands.executeCommand("zowe.jobs.disableValidation", node); + const type: string = getSessionType(node); + return vscode.commands.executeCommand(`zowe.${type}.disableValidation`, node, shouldHideFromAllTrees); } } From 245e016ebe7b64b96a80c128dba1cedf94258782 Mon Sep 17 00:00:00 2001 From: Jason Chung <76530054+JasonIBM@users.noreply.github.com> Date: Mon, 13 Nov 2023 14:12:56 -0500 Subject: [PATCH 16/76] check for fileName null condition Signed-off-by: Jason Chung <76530054+JasonIBM@users.noreply.github.com> --- packages/zowe-explorer/src/dataset/actions.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/zowe-explorer/src/dataset/actions.ts b/packages/zowe-explorer/src/dataset/actions.ts index 595ea181bd..3af4d7f8f7 100644 --- a/packages/zowe-explorer/src/dataset/actions.ts +++ b/packages/zowe-explorer/src/dataset/actions.ts @@ -1072,7 +1072,12 @@ export async function confirmJobSubmission(node: api.IZoweTreeNode, ownsJob: boo ZoweLogger.trace("dataset.actions.confirmJobSubmission called."); const showConfirmationDialog = async (): Promise => { - const jclName = node != null ? node.getLabel().toString() : fileName.toString().substring(fileName.lastIndexOf("\\") + 1); + let jclName = ""; + if (node == null && fileName !== null) { + jclName = fileName.toString().substring(fileName.lastIndexOf("\\") + 1); + } else { + jclName = node.getLabel().toString(); + } const selection = await api.Gui.warningMessage( localize("confirmJobSubmission.confirm", "Are you sure you want to submit the following job?\n\n{0}", jclName), From 147bf0a37e866d666622fd1bc163263b80bf7201 Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Mon, 13 Nov 2023 14:35:54 -0500 Subject: [PATCH 17/76] fix broken unit tests Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../utils/ProfileManagement.unit.test.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts index 6144d55419..0d59b65a09 100644 --- a/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts @@ -140,7 +140,7 @@ describe("ProfileManagement unit tests", () => { configurable: true, }); mocks.mockResolveQp.mockResolvedValueOnce(mocks.mockHideProfChosen); - mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptHideFromAllTreesQpItems"]()[0]); + mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptChangeForAllTreesOptions"]()[0]); await ProfileManagement.manageProfile(mocks.mockDsSessionNode); expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg); expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.removeSession", mocks.mockDsSessionNode, null, true); @@ -188,7 +188,7 @@ describe("ProfileManagement unit tests", () => { it("profile using token authentication should see correct command called for hiding a unix tree session node", async () => { const mocks = createBlockMocks(createGlobalMocks()); mocks.mockResolveQp.mockResolvedValueOnce(mocks.mockHideProfChosen); - mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptHideFromAllTreesQpItems"]()[1]); + mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptChangeForAllTreesOptions"]()[1]); await ProfileManagement.manageProfile(mocks.mockUnixSessionNode); expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg); expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.uss.removeSession", mocks.mockUnixSessionNode, null, false); @@ -196,16 +196,18 @@ describe("ProfileManagement unit tests", () => { it("profile using token authentication should see correct command called for enabling validation a unix tree session node", async () => { const mocks = createBlockMocks(createGlobalMocks()); mocks.mockResolveQp.mockResolvedValueOnce(mocks.mockEnableValidationChosen); + mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptChangeForAllTreesOptions"]()[1]); await ProfileManagement.manageProfile(mocks.mockUnixSessionNode); expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg); - expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.uss.enableValidation", mocks.mockUnixSessionNode); + expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.uss.enableValidation", mocks.mockUnixSessionNode, false); }); it("profile using token authentication should see correct command called for disabling validation a unix tree session node", async () => { const mocks = createBlockMocks(createGlobalMocks()); mocks.mockResolveQp.mockResolvedValueOnce(mocks.mockDisableValidationChosen); + mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptChangeForAllTreesOptions"]()[1]); await ProfileManagement.manageProfile(mocks.mockUnixSessionNode); expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg); - expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.uss.disableValidation", mocks.mockUnixSessionNode); + expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.uss.disableValidation", mocks.mockUnixSessionNode, false); }); }); describe("unit tests around no auth declared selections", () => { @@ -246,16 +248,18 @@ describe("ProfileManagement unit tests", () => { it("profile using token authentication should see correct command called for enabling validation a data set tree session node", async () => { const mocks = createBlockMocks(createGlobalMocks()); mocks.mockResolveQp.mockResolvedValueOnce(mocks.mockEnableValidationChosen); + mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptChangeForAllTreesOptions"]()[0]); await ProfileManagement.manageProfile(mocks.mockDsSessionNode); expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg); - expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.enableValidation", mocks.mockDsSessionNode); + expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.enableValidation", mocks.mockDsSessionNode, true); }); it("profile using token authentication should see correct command called for disabling validation a data set tree session node", async () => { const mocks = createBlockMocks(createGlobalMocks()); mocks.mockResolveQp.mockResolvedValueOnce(mocks.mockDisableValidationChosen); + mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptChangeForAllTreesOptions"]()[0]); await ProfileManagement.manageProfile(mocks.mockDsSessionNode); expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg); - expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.disableValidation", mocks.mockDsSessionNode); + expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.disableValidation", mocks.mockDsSessionNode, true); }); }); }); From f758b24ec40c4ba3282e7338ad421e8a8649582a Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Mon, 13 Nov 2023 14:41:27 -0500 Subject: [PATCH 18/76] add changelog Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- packages/zowe-explorer/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/zowe-explorer/CHANGELOG.md b/packages/zowe-explorer/CHANGELOG.md index b182971d91..7f26d1f810 100644 --- a/packages/zowe-explorer/CHANGELOG.md +++ b/packages/zowe-explorer/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen ### New features and enhancements - Added support for hiding a Zowe profile across all trees [#2567](https://github.com/zowe/vscode-extension-for-zowe/issues/2567) +- Added support for enabling/disabling validation for a Zowe profile across all trees [#2570](https://github.com/zowe/vscode-extension-for-zowe/issues/2570) ### Bug fixes From 535d1db7ad0596adaf96095c5519aeb3041faef2 Mon Sep 17 00:00:00 2001 From: Jason Chung <76530054+JasonIBM@users.noreply.github.com> Date: Mon, 13 Nov 2023 16:31:40 -0500 Subject: [PATCH 19/76] new unit test for coverage and condensed if line Signed-off-by: Jason Chung <76530054+JasonIBM@users.noreply.github.com> --- .../__unit__/dataset/actions.unit.test.ts | 52 +++++++++++++++++++ .../__unit__/job/actions.unit.test.ts | 2 +- packages/zowe-explorer/src/dataset/actions.ts | 10 ++-- 3 files changed, 56 insertions(+), 8 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__unit__/dataset/actions.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/dataset/actions.unit.test.ts index 93aeba652e..d15404a1de 100644 --- a/packages/zowe-explorer/__tests__/__unit__/dataset/actions.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/dataset/actions.unit.test.ts @@ -3746,3 +3746,55 @@ describe("Dataset Actions Unit Tests - Function allocateLike", () => { expect(errorHandlingSpy).toHaveBeenCalledWith(errorMessage, "test", "Unable to create data set."); }); }); + +describe("Dataset Actions Unit Tests - Function confirmJobSubmission", () => { + function createBlockMocks() { + const session = createISession(); + const imperativeProfile = createIProfile(); + const treeView = createTreeView(); + const datasetSessionNode = createDatasetSessionNode(session, imperativeProfile); + const testDatasetTree = createDatasetTree(datasetSessionNode, treeView); + const testNode = new ZoweDatasetNode("nodePDS", vscode.TreeItemCollapsibleState.None, datasetSessionNode, null); + const testSDSNode = new ZoweDatasetNode("nodeSDS", vscode.TreeItemCollapsibleState.None, datasetSessionNode, null); + const profileInstance = createInstanceOfProfile(imperativeProfile); + const mvsApi = createMvsApi(imperativeProfile); + + bindMvsApi(mvsApi); + testNode.contextValue = globals.DS_PDS_CONTEXT; + testSDSNode.contextValue = globals.DS_DS_CONTEXT; + + mocked(Profiles.getInstance).mockReturnValue(profileInstance); + mocked(vscode.window.showInputBox).mockImplementation((options) => { + options.validateInput("test"); + return Promise.resolve("test"); + }); + jest.spyOn(datasetSessionNode, "getChildren").mockResolvedValue([testNode, testSDSNode]); + testDatasetTree.createFilterString.mockReturnValue("test"); + + return { + session, + treeView, + testNode, + testSDSNode, + profileInstance, + imperativeProfile, + datasetSessionNode, + mvsApi, + testDatasetTree, + }; + } + it("Should use use local JCL doc name for confirmJobSubmission", async () => { + createGlobalMocks(); + const blockMocks = createBlockMocks(); + jest.spyOn(vscode.workspace, "getConfiguration").mockImplementation( + () => + ({ + get: () => sharedUtils.JOB_SUBMIT_DIALOG_OPTS[1], + } as any) + ); + jest.spyOn(Gui, "warningMessage").mockResolvedValue({ + title: "Submit", + }); + await expect(dsActions.confirmJobSubmission(null, true, "Profile\\test.jcl")).resolves.toEqual(true); + }); +}); diff --git a/packages/zowe-explorer/__tests__/__unit__/job/actions.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/job/actions.unit.test.ts index f948067496..0e11306ac0 100644 --- a/packages/zowe-explorer/__tests__/__unit__/job/actions.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/job/actions.unit.test.ts @@ -550,7 +550,7 @@ describe("Jobs Actions Unit Tests - Function submitJcl", () => { expect(blockMocks.errorGuiMsgSpy).toBeCalledWith(errorMsg); }); - it("Checking passing (submit) scenario of local JCL submission confirmation dialog", async () => { + it("Checking cancel option scenario of local JCL submission confirmation dialog", async () => { const blockMocks: any = createBlockMocks(); jest.spyOn(ZoweLogger, "trace").mockImplementation(); Object.defineProperty(vscode.window, "activeTextEditor", { diff --git a/packages/zowe-explorer/src/dataset/actions.ts b/packages/zowe-explorer/src/dataset/actions.ts index 3af4d7f8f7..4c17d6ca9f 100644 --- a/packages/zowe-explorer/src/dataset/actions.ts +++ b/packages/zowe-explorer/src/dataset/actions.ts @@ -1072,12 +1072,8 @@ export async function confirmJobSubmission(node: api.IZoweTreeNode, ownsJob: boo ZoweLogger.trace("dataset.actions.confirmJobSubmission called."); const showConfirmationDialog = async (): Promise => { - let jclName = ""; - if (node == null && fileName !== null) { - jclName = fileName.toString().substring(fileName.lastIndexOf("\\") + 1); - } else { - jclName = node.getLabel().toString(); - } + const jclName = + node == null && fileName !== null ? fileName.toString().substring(fileName.lastIndexOf("\\") + 1) : node.getLabel().toString(); const selection = await api.Gui.warningMessage( localize("confirmJobSubmission.confirm", "Are you sure you want to submit the following job?\n\n{0}", jclName), @@ -1087,6 +1083,7 @@ export async function confirmJobSubmission(node: api.IZoweTreeNode, ownsJob: boo }; const confirmationOption: string = vscode.workspace.getConfiguration().get("zowe.jobs.confirmSubmission"); + switch (JOB_SUBMIT_DIALOG_OPTS.indexOf(confirmationOption)) { case JobSubmitDialogOpts.OtherUserJobs: if (!ownsJob && !(await showConfirmationDialog())) { @@ -1107,7 +1104,6 @@ export async function confirmJobSubmission(node: api.IZoweTreeNode, ownsJob: boo default: break; } - return true; } From 971e0e8274d22effe111771d56a589e975c41fbc Mon Sep 17 00:00:00 2001 From: Jason Chung <76530054+JasonIBM@users.noreply.github.com> Date: Mon, 13 Nov 2023 16:40:11 -0500 Subject: [PATCH 20/76] Cut down on unneeded things in blockMocks Signed-off-by: Jason Chung <76530054+JasonIBM@users.noreply.github.com> --- .../__unit__/dataset/actions.unit.test.ts | 29 +------------------ 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__unit__/dataset/actions.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/dataset/actions.unit.test.ts index 0380be8683..9ba2433fc6 100644 --- a/packages/zowe-explorer/__tests__/__unit__/dataset/actions.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/dataset/actions.unit.test.ts @@ -3734,39 +3734,12 @@ describe("Dataset Actions Unit Tests - Function allocateLike", () => { describe("Dataset Actions Unit Tests - Function confirmJobSubmission", () => { function createBlockMocks() { - const session = createISession(); - const imperativeProfile = createIProfile(); - const treeView = createTreeView(); - const datasetSessionNode = createDatasetSessionNode(session, imperativeProfile); - const testDatasetTree = createDatasetTree(datasetSessionNode, treeView); - const testNode = new ZoweDatasetNode("nodePDS", vscode.TreeItemCollapsibleState.None, datasetSessionNode, null); - const testSDSNode = new ZoweDatasetNode("nodeSDS", vscode.TreeItemCollapsibleState.None, datasetSessionNode, null); - const profileInstance = createInstanceOfProfile(imperativeProfile); - const mvsApi = createMvsApi(imperativeProfile); - - bindMvsApi(mvsApi); - testNode.contextValue = globals.DS_PDS_CONTEXT; - testSDSNode.contextValue = globals.DS_DS_CONTEXT; - - mocked(Profiles.getInstance).mockReturnValue(profileInstance); mocked(vscode.window.showInputBox).mockImplementation((options) => { options.validateInput("test"); return Promise.resolve("test"); }); - jest.spyOn(datasetSessionNode, "getChildren").mockResolvedValue([testNode, testSDSNode]); - testDatasetTree.createFilterString.mockReturnValue("test"); - return { - session, - treeView, - testNode, - testSDSNode, - profileInstance, - imperativeProfile, - datasetSessionNode, - mvsApi, - testDatasetTree, - }; + return {}; } it("Should use use local JCL doc name for confirmJobSubmission", async () => { createGlobalMocks(); From 3c811ae95b110afa3ce1a6db3990c5b4696d1e30 Mon Sep 17 00:00:00 2001 From: Trae Yelovich Date: Mon, 13 Nov 2023 15:50:57 -0500 Subject: [PATCH 21/76] fix: Variable access before null/undefined check Signed-off-by: Trae Yelovich --- packages/zowe-explorer/src/shared/utils.ts | 5 +++-- packages/zowe-explorer/src/utils/ProfilesUtils.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/zowe-explorer/src/shared/utils.ts b/packages/zowe-explorer/src/shared/utils.ts index a20a1f9d79..4001261e29 100644 --- a/packages/zowe-explorer/src/shared/utils.ts +++ b/packages/zowe-explorer/src/shared/utils.ts @@ -297,8 +297,9 @@ export function willForceUpload( ); if (uploadResponse.success) { Gui.showMessage(uploadResponse.commandResponse); - if (node && uploadResponse?.apiResponse[0]?.etag) { - node.setEtag(uploadResponse.apiResponse[0].etag); + const apiResponse = uploadResponse.apiResponse ? uploadResponse.apiResponse[0] : {}; + if (node && apiResponse.etag) { + node.setEtag(apiResponse.etag); } } else { await markDocumentUnsaved(doc); diff --git a/packages/zowe-explorer/src/utils/ProfilesUtils.ts b/packages/zowe-explorer/src/utils/ProfilesUtils.ts index d5557c7e14..eaa23c1148 100644 --- a/packages/zowe-explorer/src/utils/ProfilesUtils.ts +++ b/packages/zowe-explorer/src/utils/ProfilesUtils.ts @@ -306,7 +306,7 @@ export class ProfilesUtils { ) ); const customCredentialManagerExtension = - credentialManagerMap?.credMgrZEName && vscode.extensions.getExtension(credentialManagerMap.credMgrZEName); + credentialManagerMap.credMgrZEName && vscode.extensions.getExtension(credentialManagerMap.credMgrZEName); const credentialManager = await ProfilesUtils.activateCredentialManagerOverride(customCredentialManagerExtension); if (credentialManager) { Object.setPrototypeOf(credentialManager.prototype, imperative.AbstractCredentialManager.prototype); From 3cc1a0722fdd9d51ba6aa605d68738c0ff165b97 Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Tue, 14 Nov 2023 09:52:04 -0500 Subject: [PATCH 22/76] add code coverage Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../__mocks__/mockCreators/shared.ts | 2 +- .../__unit__/Profiles.extended.unit.test.ts | 66 +++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/packages/zowe-explorer/__mocks__/mockCreators/shared.ts b/packages/zowe-explorer/__mocks__/mockCreators/shared.ts index 213a92b69a..70a66533d1 100644 --- a/packages/zowe-explorer/__mocks__/mockCreators/shared.ts +++ b/packages/zowe-explorer/__mocks__/mockCreators/shared.ts @@ -556,7 +556,7 @@ export function createMockNode(name: string, context: string): IZoweTreeNode { getLabel: jest.fn(() => name), getChildren: jest.fn(), getParent: jest.fn(), - getProfile: jest.fn(), + getProfile: jest.fn(() => ({ name } as imperative.IProfileLoaded)), getProfileName: jest.fn(), getSession: jest.fn(), getSessionNode: jest.fn(), diff --git a/packages/zowe-explorer/__tests__/__unit__/Profiles.extended.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/Profiles.extended.unit.test.ts index 63d23dc6b3..a487e58eb9 100644 --- a/packages/zowe-explorer/__tests__/__unit__/Profiles.extended.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/Profiles.extended.unit.test.ts @@ -22,6 +22,7 @@ import { createConfigLoad, createTeamConfigMock, createUnsecureTeamConfigMock, + createMockNode, } from "../../__mocks__/mockCreators/shared"; import { createDatasetSessionNode, createDatasetTree } from "../../__mocks__/mockCreators/datasets"; import { createProfileManager, newTestSchemas } from "../../__mocks__/mockCreators/profiles"; @@ -63,6 +64,7 @@ async function createGlobalMocks() { testTeamConfigProfile: createTeamConfigMock(), testUnsecureTeamConfigProfile: createUnsecureTeamConfigMock(), testUSSTree: null, + testNode: createMockNode("test", globals.DS_SESSION_CONTEXT), testSession: createISession(), mockCliProfileManager: createProfileManager(), ProgressLocation: jest.fn().mockImplementation(() => { @@ -1882,3 +1884,67 @@ describe("Profiles Unit Tests - function clearFilterFromAllTrees", () => { expect(getProfileSpy).toBeCalledTimes(3); }); }); + +describe("Profiles Unit Tests - function disableValidation", () => { + afterEach(() => { + jest.clearAllMocks(); + jest.restoreAllMocks(); + jest.resetAllMocks(); + }); + + it("should disable validation for the profile on all trees", async () => { + const globalMocks = await createGlobalMocks(); + const disableValidationContextForAllTreesSpy = jest.spyOn(Profiles.getInstance(), "disableValidtionContextForAllTrees"); + jest.spyOn(TreeProviders, "getSessionForAllTrees").mockReturnValue([ + createMockNode("test2", globals.DS_SESSION_CONTEXT), + globalMocks.testNode, + ]); + expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT); + expect(Profiles.getInstance().disableValidation(globalMocks.testNode, true)).toEqual(globalMocks.testNode); + expect(disableValidationContextForAllTreesSpy).toBeCalledTimes(1); + expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT + globals.VALIDATE_SUFFIX); + }); + + it("should disable validation for the profile on the current tree", async () => { + const globalMocks = await createGlobalMocks(); + const disableValidationContextForAllTreesSpy = jest.spyOn(Profiles.getInstance(), "disableValidtionContextForAllTrees"); + const disableValidationContextSpy = jest.spyOn(Profiles.getInstance(), "disableValidationContext"); + expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT); + expect(Profiles.getInstance().disableValidation(globalMocks.testNode, false)).toEqual(globalMocks.testNode); + expect(disableValidationContextForAllTreesSpy).toBeCalledTimes(0); + expect(disableValidationContextSpy).toBeCalledTimes(1); + expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT + globals.VALIDATE_SUFFIX); + }); +}); + +describe("Profiles Unit Tests - function enableValidation", () => { + afterEach(() => { + jest.clearAllMocks(); + jest.restoreAllMocks(); + jest.resetAllMocks(); + }); + + it("should enable validation for the profile on all trees", async () => { + const globalMocks = await createGlobalMocks(); + const enableValidationContextForAllTreesSpy = jest.spyOn(Profiles.getInstance(), "enableValidationContextForAllTrees"); + jest.spyOn(TreeProviders, "getSessionForAllTrees").mockReturnValue([ + createMockNode("test2", globals.DS_SESSION_CONTEXT), + globalMocks.testNode, + ]); + expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT); + expect(Profiles.getInstance().enableValidation(globalMocks.testNode, true)).toEqual(globalMocks.testNode); + expect(enableValidationContextForAllTreesSpy).toBeCalledTimes(1); + expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT + globals.VALIDATE_SUFFIX); + }); + + it("should enable validation for the profile on the current tree", async () => { + const globalMocks = await createGlobalMocks(); + const enableValidationContextForAllTreesSpy = jest.spyOn(Profiles.getInstance(), "enableValidationContextForAllTrees"); + const enableValidationContextSpy = jest.spyOn(Profiles.getInstance(), "enableValidationContext"); + expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT); + expect(Profiles.getInstance().enableValidation(globalMocks.testNode, false)).toEqual(globalMocks.testNode); + expect(enableValidationContextForAllTreesSpy).toBeCalledTimes(0); + expect(enableValidationContextSpy).toBeCalledTimes(1); + expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT + globals.VALIDATE_SUFFIX); + }); +}); From 2cd636cd5db9003b1a647b9e4cd9c4b3d64721b9 Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Tue, 14 Nov 2023 10:42:05 -0500 Subject: [PATCH 23/76] address billie's comments Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../utils/ProfileManagement.unit.test.ts | 6 +++++- .../zowe-explorer/src/shared/TreeProviders.ts | 16 ++++++++++++++++ .../zowe-explorer/src/utils/ProfileManagement.ts | 11 ++++++++--- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts index e71078dab5..f5fde8eed9 100644 --- a/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts @@ -23,6 +23,7 @@ import * as vscode from "vscode"; import { imperative } from "@zowe/cli"; import { ZoweUSSNode } from "../../../src/uss/ZoweUSSNode"; import { ZoweExplorerApiRegister } from "../../../src/ZoweExplorerApiRegister"; +import { TreeProviders } from "../../../src/shared/TreeProviders"; jest.mock("fs"); jest.mock("vscode"); @@ -54,6 +55,7 @@ describe("ProfileManagement unit tests", () => { mockDisableValidationChosen: ProfileManagement.disableProfileValildationQpItem[ProfileManagement.AuthQpLabels.disable], mockProfileInfo: { usingTeamConfig: true }, mockProfileInstance: null as any, + mockTreeProviders: sharedMock.createTreeProviders(), debugLogSpy: null as any, promptSpy: null as any, editSpy: null as any, @@ -141,11 +143,12 @@ describe("ProfileManagement unit tests", () => { value: jest.fn().mockResolvedValue(mocks.mockProfileInfo as imperative.ProfileInfo), configurable: true, }); + jest.spyOn(TreeProviders, "providers", "get").mockReturnValue(mocks.mockTreeProviders); mocks.mockResolveQp.mockResolvedValueOnce(mocks.mockHideProfChosen); mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptHideFromAllTreesQpItems"]()[0]); await ProfileManagement.manageProfile(mocks.mockDsSessionNode); expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg); - expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.removeSession", mocks.mockDsSessionNode, null, true); + expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.removeSession", mocks.mockDsSessionNode, null, false); }); it("profile using basic authentication should see delete commands called when Delete Profile chosen with v1 profile", async () => { const mocks = createBlockMocks(createGlobalMocks()); @@ -189,6 +192,7 @@ describe("ProfileManagement unit tests", () => { }); it("profile using token authentication should see correct command called for hiding a unix tree session node", async () => { const mocks = createBlockMocks(createGlobalMocks()); + jest.spyOn(TreeProviders, "providers", "get").mockReturnValue(mocks.mockTreeProviders); mocks.mockResolveQp.mockResolvedValueOnce(mocks.mockHideProfChosen); mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptHideFromAllTreesQpItems"]()[1]); await ProfileManagement.manageProfile(mocks.mockUnixSessionNode); diff --git a/packages/zowe-explorer/src/shared/TreeProviders.ts b/packages/zowe-explorer/src/shared/TreeProviders.ts index cf9bc4b93e..d6d39ebae3 100644 --- a/packages/zowe-explorer/src/shared/TreeProviders.ts +++ b/packages/zowe-explorer/src/shared/TreeProviders.ts @@ -14,6 +14,7 @@ import { IZoweProviders } from "./init"; import { DatasetTree } from "../dataset/DatasetTree"; import { USSTree } from "../uss/USSTree"; import { ZosJobsProvider } from "../job/ZosJobsProvider"; +import { IZoweNodeType } from "@zowe/zowe-explorer-api"; type ProviderFunctions = { ds: (context: vscode.ExtensionContext) => Promise; @@ -52,4 +53,19 @@ export class TreeProviders { job: TreeProviders.#job, }; } + + public static sessionIsPresentInOtherTrees(sessionName: string): boolean { + const found = []; + for (const key of Object.keys(TreeProviders.providers)) { + const provider = TreeProviders.providers[key]; + const session = provider.mSessionNodes.find((mSessionNode) => mSessionNode.label === sessionName); + if (session) { + found.push(session); + } + if (found.length > 1) { + return true; + } + } + return false; + } } diff --git a/packages/zowe-explorer/src/utils/ProfileManagement.ts b/packages/zowe-explorer/src/utils/ProfileManagement.ts index 3c23893b51..f0f2f9a064 100644 --- a/packages/zowe-explorer/src/utils/ProfileManagement.ts +++ b/packages/zowe-explorer/src/utils/ProfileManagement.ts @@ -18,6 +18,7 @@ import * as nls from "vscode-nls"; import { Profiles } from "../Profiles"; import { ZoweExplorerApiRegister } from "../ZoweExplorerApiRegister"; import { isZoweDatasetTreeNode, isZoweUSSTreeNode } from "../shared/utils"; +import { TreeProviders } from "../shared/TreeProviders"; // Set up localization nls.config({ @@ -275,10 +276,14 @@ export class ProfileManagement { return [qpItemAll, qpItemCurrent]; } - private static async promptHideFromAllTrees(): Promise { + private static async promptHideFromAllTrees(node: IZoweTreeNode): Promise { + const [qpItemAll, qpItemCurrent] = this.getPromptHideFromAllTreesQpItems(); + if (!TreeProviders.sessionIsPresentInOtherTrees(node.getLabel().toString())) { + return qpItemCurrent; + } const qp = Gui.createQuickPick(); qp.placeholder = localize("ProfileManagement.promptHideFromAllTrees.howToHide", "Do you wish to hide this profile from all trees?"); - qp.items = this.getPromptHideFromAllTreesQpItems(); + qp.items = [qpItemAll, qpItemCurrent]; qp.activeItems = [qp.items[0]]; qp.show(); const selection = await Gui.resolveQuickPick(qp); @@ -287,7 +292,7 @@ export class ProfileManagement { } private static async handleHideProfiles(node: IZoweTreeNode): Promise { - const selection = await this.promptHideFromAllTrees(); + const selection = await this.promptHideFromAllTrees(node); if (!selection) { Gui.infoMessage(localize("ProfileManagement.handleHideProfiles.cancelled", "Operation Cancelled")); return; From 3f0d8308a8154043b6bee73b7b65b21132662b31 Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Tue, 14 Nov 2023 10:56:17 -0500 Subject: [PATCH 24/76] resolve merge conflict Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../zowe-explorer/src/utils/ProfileManagement.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/zowe-explorer/src/utils/ProfileManagement.ts b/packages/zowe-explorer/src/utils/ProfileManagement.ts index a67070773c..09a1cade9e 100644 --- a/packages/zowe-explorer/src/utils/ProfileManagement.ts +++ b/packages/zowe-explorer/src/utils/ProfileManagement.ts @@ -18,7 +18,6 @@ import * as nls from "vscode-nls"; import { Profiles } from "../Profiles"; import { ZoweExplorerApiRegister } from "../ZoweExplorerApiRegister"; import { getSessionType } from "../shared/context"; -import { isZoweDatasetTreeNode, isZoweUSSTreeNode } from "../shared/utils"; import { TreeProviders } from "../shared/TreeProviders"; // Set up localization @@ -278,7 +277,7 @@ export class ProfileManagement { } private static async promptChangeForAllTrees(node: IZoweTreeNode): Promise { - const [qpItemAll, qpItemCurrent] = this.getPromptHideFromAllTreesQpItems(); + const [qpItemAll, qpItemCurrent] = this.getPromptChangeForAllTreesOptions(); if (!TreeProviders.sessionIsPresentInOtherTrees(node.getLabel().toString())) { return qpItemCurrent; } @@ -292,8 +291,8 @@ export class ProfileManagement { return selection; } - private static async handleChangeForAllTrees(): Promise { - const selection = await this.promptChangeForAllTrees(); + private static async handleChangeForAllTrees(node: IZoweTreeNode): Promise { + const selection = await this.promptChangeForAllTrees(node); if (!selection) { return; } @@ -302,7 +301,7 @@ export class ProfileManagement { } private static async handleHideProfiles(node: IZoweTreeNode): Promise { - const shouldHideFromAllTrees = await this.handleChangeForAllTrees(); + const shouldHideFromAllTrees = await this.handleChangeForAllTrees(node); if (shouldHideFromAllTrees === undefined) { Gui.infoMessage(localize("ProfileManagement.handleHideProfiles.cancelled", "Operation Cancelled")); return; @@ -312,7 +311,7 @@ export class ProfileManagement { } private static async handleEnableProfileValidation(node: IZoweTreeNode): Promise { - const shouldHideFromAllTrees = await this.handleChangeForAllTrees(); + const shouldHideFromAllTrees = await this.handleChangeForAllTrees(node); if (shouldHideFromAllTrees === undefined) { Gui.infoMessage(localize("ProfileManagement.handleEnableProfileValidation.cancelled", "Operation Cancelled")); return; @@ -322,7 +321,7 @@ export class ProfileManagement { } private static async handleDisableProfileValidation(node: IZoweTreeNode): Promise { - const shouldHideFromAllTrees = await this.handleChangeForAllTrees(); + const shouldHideFromAllTrees = await this.handleChangeForAllTrees(node); if (shouldHideFromAllTrees === undefined) { Gui.infoMessage(localize("ProfileManagement.handleDisableProfileValidation.cancelled", "Operation Cancelled")); return; From 2735b0cf93776c420ed1a5fb8c7cbb1f66804675 Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Tue, 14 Nov 2023 11:50:57 -0500 Subject: [PATCH 25/76] add code coverage Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../__unit__/shared/TreeProvider.unit.test.ts | 11 ++++++++ .../__unit__/shared/context.unit.test.ts | 19 +++++++++++++ .../utils/ProfileManagement.unit.test.ts | 27 ++++++++++++++++++- .../zowe-explorer/src/shared/TreeProviders.ts | 1 - 4 files changed, 56 insertions(+), 2 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__unit__/shared/TreeProvider.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/shared/TreeProvider.unit.test.ts index 7b1f542251..61d19d652b 100644 --- a/packages/zowe-explorer/__tests__/__unit__/shared/TreeProvider.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/shared/TreeProvider.unit.test.ts @@ -41,3 +41,14 @@ describe("TreeProvider Unit Tests - Function getters", () => { expect(TreeProviders.job).toEqual(mockTree); }); }); + +describe("TreeProvider Unit Tests - Function sessionIsPresentInOtherTrees", () => { + it("should return true if session is present in another tree", async () => { + await TreeProviders.initializeProviders({} as any, { + ds: () => ({ mSessionNodes: [{ label: "test1" }, { label: "test2" }] } as any), + uss: () => ({ mSessionNodes: [{ label: "test3" }, { label: "test4" }] } as any), + job: () => ({ mSessionNodes: [{ label: "test5" }, { label: "test1" }] } as any), + }); + expect(TreeProviders.sessionIsPresentInOtherTrees("test1")).toEqual(true); + }); +}); diff --git a/packages/zowe-explorer/__tests__/__unit__/shared/context.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/shared/context.unit.test.ts index df219a63b4..bc8268721d 100644 --- a/packages/zowe-explorer/__tests__/__unit__/shared/context.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/shared/context.unit.test.ts @@ -449,4 +449,23 @@ describe("Context helper tests", () => { treeItem.contextValue = "test"; expect(contextually.getBaseContext(treeItem)).toEqual(treeItem.contextValue); }); + + it("Test getSessionType returning 'uss'", () => { + treeItem.contextValue = globals.USS_SESSION_CONTEXT; + expect(contextually.getSessionType(treeItem)).toEqual("uss"); + }); + + it("Test getSessionType returning 'job'", () => { + treeItem.contextValue = globals.JOBS_SESSION_CONTEXT; + expect(contextually.getSessionType(treeItem)).toEqual("job"); + }); + + it("Test getSessionType returning error if node has no type", () => { + treeItem.contextValue = undefined; + try { + contextually.getSessionType(treeItem); + } catch (err) { + expect(err.message).toEqual("Session node passed in does not have a type"); + } + }); }); diff --git a/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts index f5fde8eed9..5a47aacfc7 100644 --- a/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts @@ -22,6 +22,7 @@ import { Profiles } from "../../../src/Profiles"; import * as vscode from "vscode"; import { imperative } from "@zowe/cli"; import { ZoweUSSNode } from "../../../src/uss/ZoweUSSNode"; +import { Job } from "../../../src/job/ZoweJobNode"; import { ZoweExplorerApiRegister } from "../../../src/ZoweExplorerApiRegister"; import { TreeProviders } from "../../../src/shared/TreeProviders"; @@ -42,6 +43,7 @@ describe("ProfileManagement unit tests", () => { opCancelledSpy: jest.spyOn(Gui, "infoMessage"), mockDsSessionNode: ZoweDatasetNode, mockUnixSessionNode: ZoweUSSNode, + mockJobSessionNode: Job, mockResolveQp: jest.fn(), mockCreateQp: jest.fn(), mockUpdateChosen: ProfileManagement.basicAuthUpdateQpItems[ProfileManagement.AuthQpLabels.update], @@ -143,12 +145,15 @@ describe("ProfileManagement unit tests", () => { value: jest.fn().mockResolvedValue(mocks.mockProfileInfo as imperative.ProfileInfo), configurable: true, }); + mocks.mockTreeProviders.ds.mSessionNodes.push(mocks.mockDsSessionNode); + mocks.mockTreeProviders.uss.mSessionNodes.push(mocks.mockDsSessionNode); + mocks.mockTreeProviders.job.mSessionNodes.push(mocks.mockDsSessionNode); jest.spyOn(TreeProviders, "providers", "get").mockReturnValue(mocks.mockTreeProviders); mocks.mockResolveQp.mockResolvedValueOnce(mocks.mockHideProfChosen); mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptHideFromAllTreesQpItems"]()[0]); await ProfileManagement.manageProfile(mocks.mockDsSessionNode); expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg); - expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.removeSession", mocks.mockDsSessionNode, null, false); + expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.removeSession", mocks.mockDsSessionNode, null, true); }); it("profile using basic authentication should see delete commands called when Delete Profile chosen with v1 profile", async () => { const mocks = createBlockMocks(createGlobalMocks()); @@ -264,6 +269,26 @@ describe("ProfileManagement unit tests", () => { expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.disableValidation", mocks.mockDsSessionNode); }); }); + + describe("handleHideProfiles unit tests", () => { + it("should display 'operation cancelled' if no option is selected for hiding a profile", async () => { + const mocks = createGlobalMocks(); + const infoMessageSpy = jest.spyOn(Gui, "infoMessage"); + jest.spyOn(ProfileManagement as any, "promptHideFromAllTrees").mockReturnValue(undefined); + await expect(ProfileManagement["handleHideProfiles"](mocks.mockDsSessionNode)).resolves.toEqual(undefined); + expect(infoMessageSpy).toBeCalledTimes(1); + }); + it("should hide the job session", async () => { + const mocks = createGlobalMocks(); + const commandSpy = jest.spyOn(vscode.commands, "executeCommand"); + jest.spyOn(ProfileManagement as any, "promptHideFromAllTrees").mockReturnValue( + ProfileManagement["getPromptHideFromAllTreesQpItems"]()[1] + ); + await expect(ProfileManagement["handleHideProfiles"](mocks.mockJobSessionNode)).resolves.toEqual(undefined); + expect(commandSpy).toHaveBeenCalledWith("zowe.jobs.removeJobsSession", mocks.mockJobSessionNode, null, false); + }); + }); + describe("getRegisteredProfileNameList unit tests", () => { function createBlockMocks(globalMocks): any { const theMocks = { diff --git a/packages/zowe-explorer/src/shared/TreeProviders.ts b/packages/zowe-explorer/src/shared/TreeProviders.ts index d6d39ebae3..c5894f9384 100644 --- a/packages/zowe-explorer/src/shared/TreeProviders.ts +++ b/packages/zowe-explorer/src/shared/TreeProviders.ts @@ -14,7 +14,6 @@ import { IZoweProviders } from "./init"; import { DatasetTree } from "../dataset/DatasetTree"; import { USSTree } from "../uss/USSTree"; import { ZosJobsProvider } from "../job/ZosJobsProvider"; -import { IZoweNodeType } from "@zowe/zowe-explorer-api"; type ProviderFunctions = { ds: (context: vscode.ExtensionContext) => Promise; From ff33dc9fea9bd978e91f3a2431be29e5a811a593 Mon Sep 17 00:00:00 2001 From: anaxceron Date: Tue, 14 Nov 2023 16:21:19 -0500 Subject: [PATCH 26/76] Update README.md Adding info re: Zowe project structure and governance in ReadMe file to meet CII Silver Badge criteria Signed-off-by: anaxceron --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 3915bd35dd..73ac5cdf11 100644 --- a/README.md +++ b/README.md @@ -101,3 +101,9 @@ For more information on how to contribute, see [Contributor Guidance](https://gi ## External Links Check out more about using Zowe Explorer and Zowe on [Medium](https://medium.com/zowe) and [Awesome Zowe](https://github.com/tucker01/awesome-zowe). + +## Project Structure and Governance + +Zowe Explorer is a component of the Zowe Open Mainframe Project, part of the Linux Foundation. + +To learn more about how Zowe is structured and governed, see the [Technical Steering Committee Strucutre and Governance documentation](https://github.com/zowe/community/blob/master/Technical-Steering-Committee/tsc-governance.md). From 93a98c32b650709a34a50f7ac258c91fbd1e6275 Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Tue, 14 Nov 2023 16:43:52 -0500 Subject: [PATCH 27/76] cover edge cases and add code coverage Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../__mocks__/mockCreators/shared.ts | 27 ++++++++++-- .../__unit__/shared/TreeProvider.unit.test.ts | 6 +-- .../__unit__/shared/context.unit.test.ts | 2 +- .../utils/ProfileManagement.unit.test.ts | 44 ++++++++++--------- .../zowe-explorer/src/shared/TreeProviders.ts | 33 ++++++++------ .../src/utils/ProfileManagement.ts | 15 ++++++- 6 files changed, 82 insertions(+), 45 deletions(-) diff --git a/packages/zowe-explorer/__mocks__/mockCreators/shared.ts b/packages/zowe-explorer/__mocks__/mockCreators/shared.ts index 70a66533d1..d61f013411 100644 --- a/packages/zowe-explorer/__mocks__/mockCreators/shared.ts +++ b/packages/zowe-explorer/__mocks__/mockCreators/shared.ts @@ -556,7 +556,17 @@ export function createMockNode(name: string, context: string): IZoweTreeNode { getLabel: jest.fn(() => name), getChildren: jest.fn(), getParent: jest.fn(), - getProfile: jest.fn(() => ({ name } as imperative.IProfileLoaded)), + getProfile: jest.fn(() => ({ + name, + profile: { + host: "fake", + port: 999, + rejectUnauthorize: false, + }, + type: "zosmf", + message: "", + failNotFound: false, + })), getProfileName: jest.fn(), getSession: jest.fn(), getSessionNode: jest.fn(), @@ -570,19 +580,28 @@ export function createMockNode(name: string, context: string): IZoweTreeNode { export function createTreeProviders() { return { ds: { - mSessionNodes: [createMockNode("zosmf", globals.DS_SESSION_CONTEXT), createMockNode("zosmf2", globals.DS_SESSION_CONTEXT)], + mSessionNodes: [ + createMockNode("zosmf", globals.DS_SESSION_CONTEXT + globals.VALIDATE_SUFFIX), + createMockNode("zosmf2", globals.DS_SESSION_CONTEXT + globals.NO_VALIDATE_SUFFIX), + ], deleteSession: jest.fn(), removeSession: jest.fn(), refresh: jest.fn(), } as any, uss: { - mSessionNodes: [createMockNode("zosmf", globals.USS_SESSION_CONTEXT), createMockNode("zosmf2", globals.USS_SESSION_CONTEXT)], + mSessionNodes: [ + createMockNode("zosmf", globals.USS_SESSION_CONTEXT + globals.VALIDATE_SUFFIX), + createMockNode("zosmf2", globals.USS_SESSION_CONTEXT + globals.NO_VALIDATE_SUFFIX), + ], deleteSession: jest.fn(), removeSession: jest.fn(), refresh: jest.fn(), } as any, job: { - mSessionNodes: [createMockNode("zosmf", globals.JOBS_SESSION_CONTEXT), createMockNode("zosmf2", globals.JOBS_SESSION_CONTEXT)], + mSessionNodes: [ + createMockNode("zosmf", globals.JOBS_SESSION_CONTEXT + globals.VALIDATE_SUFFIX), + createMockNode("zosmf2", globals.JOBS_SESSION_CONTEXT + globals.NO_VALIDATE_SUFFIX), + ], removeSession: jest.fn(), deleteSession: jest.fn(), refresh: jest.fn(), diff --git a/packages/zowe-explorer/__tests__/__unit__/shared/TreeProvider.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/shared/TreeProvider.unit.test.ts index 61d19d652b..ce96dce04e 100644 --- a/packages/zowe-explorer/__tests__/__unit__/shared/TreeProvider.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/shared/TreeProvider.unit.test.ts @@ -45,9 +45,9 @@ describe("TreeProvider Unit Tests - Function getters", () => { describe("TreeProvider Unit Tests - Function sessionIsPresentInOtherTrees", () => { it("should return true if session is present in another tree", async () => { await TreeProviders.initializeProviders({} as any, { - ds: () => ({ mSessionNodes: [{ label: "test1" }, { label: "test2" }] } as any), - uss: () => ({ mSessionNodes: [{ label: "test3" }, { label: "test4" }] } as any), - job: () => ({ mSessionNodes: [{ label: "test5" }, { label: "test1" }] } as any), + ds: () => ({ mSessionNodes: [{ getLabel: () => "test1" }, { getLabel: () => "test2" }] } as any), + uss: () => ({ mSessionNodes: [{ getLabel: () => "test3" }, { getLabel: () => "test4" }] } as any), + job: () => ({ mSessionNodes: [{ getLabel: () => "test5" }, { getLabel: () => "test1" }] } as any), }); expect(TreeProviders.sessionIsPresentInOtherTrees("test1")).toEqual(true); }); diff --git a/packages/zowe-explorer/__tests__/__unit__/shared/context.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/shared/context.unit.test.ts index bc8268721d..d1818d37e2 100644 --- a/packages/zowe-explorer/__tests__/__unit__/shared/context.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/shared/context.unit.test.ts @@ -457,7 +457,7 @@ describe("Context helper tests", () => { it("Test getSessionType returning 'job'", () => { treeItem.contextValue = globals.JOBS_SESSION_CONTEXT; - expect(contextually.getSessionType(treeItem)).toEqual("job"); + expect(contextually.getSessionType(treeItem)).toEqual("jobs"); }); it("Test getSessionType returning error if node has no type", () => { diff --git a/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts index af1389b0e3..f49e22a680 100644 --- a/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts @@ -16,7 +16,7 @@ import * as dsMock from "../../../__mocks__/mockCreators/datasets"; import * as unixMock from "../../../__mocks__/mockCreators/uss"; import * as profUtils from "../../../src/utils/ProfilesUtils"; import { ProfileManagement } from "../../../src/utils/ProfileManagement"; -import { Gui } from "@zowe/zowe-explorer-api"; +import { Gui, IZoweTreeNode } from "@zowe/zowe-explorer-api"; import { ZoweLogger } from "../../../src/utils/LoggerUtils"; import { Profiles } from "../../../src/Profiles"; import * as vscode from "vscode"; @@ -65,6 +65,11 @@ describe("ProfileManagement unit tests", () => { logoutSpy: null as any, logMsg: null as any, commandSpy: null as any, + mockTreeProviderNodes: (): void => { + newMocks.mockTreeProviders.ds.mSessionNodes.push(newMocks.mockDsSessionNode); + newMocks.mockTreeProviders.uss.mSessionNodes.push(newMocks.mockUnixSessionNode); + newMocks.mockTreeProviders.job.mSessionNodes.push(newMocks.mockJobSessionNode); + }, }; Object.defineProperty(profUtils.ProfilesUtils, "promptCredentials", { value: jest.fn(), configurable: true }); newMocks.promptSpy = jest.spyOn(profUtils.ProfilesUtils, "promptCredentials"); @@ -97,6 +102,7 @@ describe("ProfileManagement unit tests", () => { newMocks.logoutSpy = jest.spyOn(newMocks.mockProfileInstance, "ssoLogout"); Object.defineProperty(vscode.commands, "executeCommand", { value: jest.fn(), configurable: true }); newMocks.commandSpy = jest.spyOn(vscode.commands, "executeCommand"); + jest.spyOn(TreeProviders, "providers", "get").mockReturnValue(newMocks.mockTreeProviders); return newMocks; } @@ -145,15 +151,11 @@ describe("ProfileManagement unit tests", () => { value: jest.fn().mockResolvedValue(mocks.mockProfileInfo as imperative.ProfileInfo), configurable: true, }); - mocks.mockTreeProviders.ds.mSessionNodes.push(mocks.mockDsSessionNode); - mocks.mockTreeProviders.uss.mSessionNodes.push(mocks.mockDsSessionNode); - mocks.mockTreeProviders.job.mSessionNodes.push(mocks.mockDsSessionNode); - jest.spyOn(TreeProviders, "providers", "get").mockReturnValue(mocks.mockTreeProviders); mocks.mockResolveQp.mockResolvedValueOnce(mocks.mockHideProfChosen); - mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptChangeForAllTreesOptions"]()[0]); + mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptChangeForAllTreesOptions"]()[1]); await ProfileManagement.manageProfile(mocks.mockDsSessionNode); expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg); - expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.removeSession", mocks.mockDsSessionNode, null, true); + expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.removeSession", mocks.mockDsSessionNode, null, false); }); it("profile using basic authentication should see delete commands called when Delete Profile chosen with v1 profile", async () => { const mocks = createBlockMocks(createGlobalMocks()); @@ -197,7 +199,6 @@ describe("ProfileManagement unit tests", () => { }); it("profile using token authentication should see correct command called for hiding a unix tree session node", async () => { const mocks = createBlockMocks(createGlobalMocks()); - jest.spyOn(TreeProviders, "providers", "get").mockReturnValue(mocks.mockTreeProviders); mocks.mockResolveQp.mockResolvedValueOnce(mocks.mockHideProfChosen); mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptChangeForAllTreesOptions"]()[1]); await ProfileManagement.manageProfile(mocks.mockUnixSessionNode); @@ -208,9 +209,9 @@ describe("ProfileManagement unit tests", () => { const mocks = createBlockMocks(createGlobalMocks()); mocks.mockResolveQp.mockResolvedValueOnce(mocks.mockEnableValidationChosen); mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptChangeForAllTreesOptions"]()[1]); - await ProfileManagement.manageProfile(mocks.mockUnixSessionNode); - expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg); - expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.uss.enableValidation", mocks.mockUnixSessionNode, false); + await ProfileManagement.manageProfile(mocks.mockTreeProviders.uss.mSessionNodes[0]); + expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg.replace("sestest", "zosmf")); + expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.uss.enableValidation", mocks.mockTreeProviders.uss.mSessionNodes[0], false); }); it("profile using token authentication should see correct command called for disabling validation a unix tree session node", async () => { const mocks = createBlockMocks(createGlobalMocks()); @@ -260,17 +261,17 @@ describe("ProfileManagement unit tests", () => { const mocks = createBlockMocks(createGlobalMocks()); mocks.mockResolveQp.mockResolvedValueOnce(mocks.mockEnableValidationChosen); mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptChangeForAllTreesOptions"]()[0]); - await ProfileManagement.manageProfile(mocks.mockDsSessionNode); - expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg); - expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.enableValidation", mocks.mockDsSessionNode, true); + await ProfileManagement.manageProfile(mocks.mockTreeProviders.ds.mSessionNodes[1]); + expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg.replace("sestest", "zosmf2")); + expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.enableValidation", mocks.mockTreeProviders.ds.mSessionNodes[1], true); }); it("profile using token authentication should see correct command called for disabling validation a data set tree session node", async () => { const mocks = createBlockMocks(createGlobalMocks()); mocks.mockResolveQp.mockResolvedValueOnce(mocks.mockDisableValidationChosen); mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptChangeForAllTreesOptions"]()[0]); - await ProfileManagement.manageProfile(mocks.mockDsSessionNode); - expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg); - expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.disableValidation", mocks.mockDsSessionNode, true); + await ProfileManagement.manageProfile(mocks.mockTreeProviders.ds.mSessionNodes[0]); + expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg.replace("sestest", "zosmf")); + expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.disableValidation", mocks.mockTreeProviders.ds.mSessionNodes[0], true); }); }); @@ -278,18 +279,19 @@ describe("ProfileManagement unit tests", () => { it("should display 'operation cancelled' if no option is selected for hiding a profile", async () => { const mocks = createGlobalMocks(); const infoMessageSpy = jest.spyOn(Gui, "infoMessage"); - jest.spyOn(ProfileManagement as any, "promptHideFromAllTrees").mockReturnValue(undefined); + jest.spyOn(ProfileManagement as any, "promptChangeForAllTrees").mockReturnValue(undefined); await expect(ProfileManagement["handleHideProfiles"](mocks.mockDsSessionNode)).resolves.toEqual(undefined); expect(infoMessageSpy).toBeCalledTimes(1); }); it("should hide the job session", async () => { const mocks = createGlobalMocks(); const commandSpy = jest.spyOn(vscode.commands, "executeCommand"); - jest.spyOn(ProfileManagement as any, "promptHideFromAllTrees").mockReturnValue( - ProfileManagement["getPromptHideFromAllTreesQpItems"]()[1] + jest.spyOn(ProfileManagement as any, "promptChangeForAllTrees").mockReturnValue( + ProfileManagement["getPromptChangeForAllTreesOptions"]()[1] ); + mocks.mockJobSessionNode.contextValue = globals.JOBS_SESSION_CONTEXT; await expect(ProfileManagement["handleHideProfiles"](mocks.mockJobSessionNode)).resolves.toEqual(undefined); - expect(commandSpy).toHaveBeenCalledWith("zowe.jobs.removeJobsSession", mocks.mockJobSessionNode, null, false); + expect(commandSpy).toHaveBeenCalledWith("zowe.jobs.removeSession", mocks.mockJobSessionNode, null, false); }); }); diff --git a/packages/zowe-explorer/src/shared/TreeProviders.ts b/packages/zowe-explorer/src/shared/TreeProviders.ts index c909d3af71..a5192ea858 100644 --- a/packages/zowe-explorer/src/shared/TreeProviders.ts +++ b/packages/zowe-explorer/src/shared/TreeProviders.ts @@ -14,6 +14,8 @@ import { IZoweProviders } from "./init"; import { DatasetTree } from "../dataset/DatasetTree"; import { USSTree } from "../uss/USSTree"; import { ZosJobsProvider } from "../job/ZosJobsProvider"; +import { IZoweNodeType } from "@zowe/zowe-explorer-api"; +import { getSessionType } from "./context"; type ProviderFunctions = { ds: (context: vscode.ExtensionContext) => Promise; @@ -54,24 +56,27 @@ export class TreeProviders { } public static getSessionForAllTrees(name: string): IZoweNodeType[] { - const dsNode = TreeProviders.ds.mSessionNodes.find((mSessionNode) => mSessionNode.label === name); - const ussNode = TreeProviders.uss.mSessionNodes.find((mSessionNode) => mSessionNode.label === name); - const jobNode = TreeProviders.job.mSessionNodes.find((mSessionNode) => mSessionNode.label === name); - return [dsNode, ussNode, jobNode]; - } - - public static sessionIsPresentInOtherTrees(sessionName: string): boolean { - const found = []; + const sessions: IZoweNodeType[] = []; for (const key of Object.keys(TreeProviders.providers)) { const provider = TreeProviders.providers[key]; - const session = provider.mSessionNodes.find((mSessionNode) => mSessionNode.label === sessionName); + const session = provider.mSessionNodes.find((mSessionNode: IZoweNodeType) => mSessionNode.getLabel().toString() === name); if (session) { - found.push(session); - } - if (found.length > 1) { - return true; + sessions.push(session); } } - return false; + return sessions; + } + + public static sessionIsPresentInOtherTrees(sessionName: string): boolean { + const sessions = this.getSessionForAllTrees(sessionName); + return sessions.length > 1; + } + + public static contextValueExistsAcrossTrees(node: IZoweNodeType, contextValue: string): boolean { + const sessions = this.getSessionForAllTrees(node.getLabel().toString()); + const sessionContextInOtherTree = sessions.find( + (session) => session.contextValue.includes(contextValue) && getSessionType(session) !== getSessionType(node) + ); + return sessionContextInOtherTree !== undefined; } } diff --git a/packages/zowe-explorer/src/utils/ProfileManagement.ts b/packages/zowe-explorer/src/utils/ProfileManagement.ts index 09a1cade9e..ba82f4d64d 100644 --- a/packages/zowe-explorer/src/utils/ProfileManagement.ts +++ b/packages/zowe-explorer/src/utils/ProfileManagement.ts @@ -311,7 +311,12 @@ export class ProfileManagement { } private static async handleEnableProfileValidation(node: IZoweTreeNode): Promise { - const shouldHideFromAllTrees = await this.handleChangeForAllTrees(node); + let shouldHideFromAllTrees: boolean | undefined; + if (TreeProviders.contextValueExistsAcrossTrees(node, globals.NO_VALIDATE_SUFFIX)) { + shouldHideFromAllTrees = await this.handleChangeForAllTrees(node); + } else { + shouldHideFromAllTrees = false; + } if (shouldHideFromAllTrees === undefined) { Gui.infoMessage(localize("ProfileManagement.handleEnableProfileValidation.cancelled", "Operation Cancelled")); return; @@ -321,7 +326,12 @@ export class ProfileManagement { } private static async handleDisableProfileValidation(node: IZoweTreeNode): Promise { - const shouldHideFromAllTrees = await this.handleChangeForAllTrees(node); + let shouldHideFromAllTrees: boolean | undefined; + if (TreeProviders.contextValueExistsAcrossTrees(node, globals.VALIDATE_SUFFIX)) { + shouldHideFromAllTrees = await this.handleChangeForAllTrees(node); + } else { + shouldHideFromAllTrees = false; + } if (shouldHideFromAllTrees === undefined) { Gui.infoMessage(localize("ProfileManagement.handleDisableProfileValidation.cancelled", "Operation Cancelled")); return; @@ -329,6 +339,7 @@ export class ProfileManagement { const type: string = getSessionType(node); return vscode.commands.executeCommand(`zowe.${type}.disableValidation`, node, shouldHideFromAllTrees); } + private static isProfileRegisteredWithTree(tree: globals.Trees, profile: imperative.IProfileLoaded): boolean { switch (tree) { case globals.Trees.MVS: { From b4563fad09514a3047d59b5ef16444cbca7a20d6 Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Tue, 14 Nov 2023 16:47:08 -0500 Subject: [PATCH 28/76] address code smell Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../__tests__/__unit__/utils/ProfileManagement.unit.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts index f49e22a680..08608a6aef 100644 --- a/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts @@ -16,7 +16,7 @@ import * as dsMock from "../../../__mocks__/mockCreators/datasets"; import * as unixMock from "../../../__mocks__/mockCreators/uss"; import * as profUtils from "../../../src/utils/ProfilesUtils"; import { ProfileManagement } from "../../../src/utils/ProfileManagement"; -import { Gui, IZoweTreeNode } from "@zowe/zowe-explorer-api"; +import { Gui } from "@zowe/zowe-explorer-api"; import { ZoweLogger } from "../../../src/utils/LoggerUtils"; import { Profiles } from "../../../src/Profiles"; import * as vscode from "vscode"; From d6f6c769ca35e515b22a50e8f2a3b5da43b7163a Mon Sep 17 00:00:00 2001 From: Billie Simmons <49491949+JillieBeanSim@users.noreply.github.com> Date: Thu, 16 Nov 2023 11:47:02 -0500 Subject: [PATCH 29/76] merge origin/maintenance Signed-off-by: Billie Simmons <49491949+JillieBeanSim@users.noreply.github.com> --- .../eslint-plugin-zowe-explorer/CHANGELOG.md | 2 ++ packages/zowe-explorer-api/CHANGELOG.md | 2 ++ .../zowe-explorer-ftp-extension/CHANGELOG.md | 2 ++ packages/zowe-explorer/CHANGELOG.md | 6 ++++ .../__unit__/shared/utils.unit.test.ts | 14 ++++++-- .../__unit__/uss/actions.unit.test.ts | 16 +++++++++ .../i18n/sample/src/uss/actions.i18n.json | 1 + packages/zowe-explorer/src/dataset/actions.ts | 14 +++----- packages/zowe-explorer/src/shared/utils.ts | 34 +++++++------------ packages/zowe-explorer/src/uss/actions.ts | 18 ++++++---- 10 files changed, 70 insertions(+), 39 deletions(-) diff --git a/packages/eslint-plugin-zowe-explorer/CHANGELOG.md b/packages/eslint-plugin-zowe-explorer/CHANGELOG.md index 73e0d5ac57..0f96394fc8 100644 --- a/packages/eslint-plugin-zowe-explorer/CHANGELOG.md +++ b/packages/eslint-plugin-zowe-explorer/CHANGELOG.md @@ -6,6 +6,8 @@ All notable changes to the "eslint-plugin-zowe-explorer" package will be documen ### Bug fixes +## `2.12.2` + ## `2.12.1` ## `2.12.0` diff --git a/packages/zowe-explorer-api/CHANGELOG.md b/packages/zowe-explorer-api/CHANGELOG.md index 5b753f9975..4133e271c3 100644 --- a/packages/zowe-explorer-api/CHANGELOG.md +++ b/packages/zowe-explorer-api/CHANGELOG.md @@ -10,6 +10,8 @@ All notable changes to the "zowe-explorer-api" extension will be documented in t ### Bug fixes +## `2.12.2` + ## `2.12.1` ## `2.12.0` diff --git a/packages/zowe-explorer-ftp-extension/CHANGELOG.md b/packages/zowe-explorer-ftp-extension/CHANGELOG.md index 4689ba55ee..48696bd600 100644 --- a/packages/zowe-explorer-ftp-extension/CHANGELOG.md +++ b/packages/zowe-explorer-ftp-extension/CHANGELOG.md @@ -6,6 +6,8 @@ All notable changes to the "zowe-explorer-ftp-extension" extension will be docum ### Bug fixes +## `2.12.2` + ## `2.12.1` ### Bug fixes diff --git a/packages/zowe-explorer/CHANGELOG.md b/packages/zowe-explorer/CHANGELOG.md index 0624e0cd0f..b8680e84a8 100644 --- a/packages/zowe-explorer/CHANGELOG.md +++ b/packages/zowe-explorer/CHANGELOG.md @@ -11,6 +11,12 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen ### Bug fixes +## `2.12.2` + +### Bug fixes + +- Fixed issue where etag was not updated for USS files after conflict is detected and user selects Overwrite option. + ## `2.12.1` ### Bug fixes diff --git a/packages/zowe-explorer/__tests__/__unit__/shared/utils.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/shared/utils.unit.test.ts index 149c2724cb..0689703674 100644 --- a/packages/zowe-explorer/__tests__/__unit__/shared/utils.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/shared/utils.unit.test.ts @@ -239,7 +239,12 @@ describe("Test uploadContents", () => { { fileName: "whatever", } as any, - null + null, + { + profile: { + encoding: 123, + }, + } as any ); expect(ZoweExplorerApiRegister.getUssApi(null).putContents).toBeCalled(); }); @@ -264,7 +269,12 @@ describe("Test uploadContents", () => { { fileName: "whatever", } as any, - null + null, + { + profile: { + encoding: codepage, + }, + } as any ); expect(ZoweExplorerApiRegister.getMvsApi(null).putContents).toBeCalled(); }); diff --git a/packages/zowe-explorer/__tests__/__unit__/uss/actions.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/uss/actions.unit.test.ts index 57a79fe578..22cff58154 100644 --- a/packages/zowe-explorer/__tests__/__unit__/uss/actions.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/uss/actions.unit.test.ts @@ -23,6 +23,7 @@ import { createTextDocument, createFileResponse, createValidIProfile, + createInstanceOfProfile, } from "../../../__mocks__/mockCreators/shared"; import { ZoweExplorerApiRegister } from "../../../src/ZoweExplorerApiRegister"; import { Profiles } from "../../../src/Profiles"; @@ -427,6 +428,7 @@ describe("USS Action Unit Tests - Function saveUSSFile", () => { const newMocks = { node: null, mockGetEtag: null, + profileInstance: createInstanceOfProfile(globalMocks.testProfile), testUSSTree: null, testResponse: createFileResponse({ items: [] }), testDoc: createTextDocument(path.join(globals.USS_DIR, "usstest", "u", "myuser", "testFile")), @@ -528,6 +530,20 @@ describe("USS Action Unit Tests - Function saveUSSFile", () => { expect(globalMocks.showErrorMessage.mock.calls[0][0]).toBe("Error: Test Error"); expect(mocked(vscode.workspace.applyEdit)).toHaveBeenCalledTimes(2); }); + + it("Tests that saveUSSFile fails when session cannot be located", async () => { + const globalMocks = createGlobalMocks(); + const blockMocks = await createBlockMocks(globalMocks); + + blockMocks.profileInstance.loadNamedProfile.mockReturnValueOnce(undefined); + mocked(Profiles.getInstance).mockReturnValue(blockMocks.profileInstance); + const testDocument = createTextDocument("u/myuser/testFile", blockMocks.node); + (testDocument as any).fileName = path.join(globals.USS_DIR, testDocument.fileName); + + await ussNodeActions.saveUSSFile(testDocument, blockMocks.testUSSTree); + expect(globalMocks.showErrorMessage.mock.calls.length).toBe(1); + expect(globalMocks.showErrorMessage.mock.calls[0][0]).toBe("Could not locate session when saving USS file."); + }); }); describe("USS Action Unit Tests - Functions uploadDialog & uploadFile", () => { diff --git a/packages/zowe-explorer/i18n/sample/src/uss/actions.i18n.json b/packages/zowe-explorer/i18n/sample/src/uss/actions.i18n.json index af28a02ab9..4219524aa2 100644 --- a/packages/zowe-explorer/i18n/sample/src/uss/actions.i18n.json +++ b/packages/zowe-explorer/i18n/sample/src/uss/actions.i18n.json @@ -7,6 +7,7 @@ "uploadFile.putContents": "Uploading USS file", "copyPath.infoMessage": "Copy Path is not yet supported in Theia.", "saveUSSFile.log.debug.saveRequest": "save requested for USS file ", + "saveUSSFile.session.error": "Could not locate session when saving USS file.", "saveUSSFile.response.title": "Saving file...", "deleteUssPrompt.confirmation.delete": "Delete", "deleteUssPrompt.confirmation.message": "Are you sure you want to delete the following item?\nThis will permanently remove the following file or folder from your system.\n\n{0}", diff --git a/packages/zowe-explorer/src/dataset/actions.ts b/packages/zowe-explorer/src/dataset/actions.ts index 1bc3be5aa8..3c03e10f44 100644 --- a/packages/zowe-explorer/src/dataset/actions.ts +++ b/packages/zowe-explorer/src/dataset/actions.ts @@ -25,7 +25,7 @@ import { JobSubmitDialogOpts, JOB_SUBMIT_DIALOG_OPTS, getDefaultUri, - compareFileContent, + uploadContent, } from "../shared/utils"; import { ZoweExplorerApiRegister } from "../ZoweExplorerApiRegister"; import { Profiles } from "../Profiles"; @@ -1589,7 +1589,7 @@ export async function saveFile(doc: vscode.TextDocument, datasetProvider: api.IZ const ending = doc.fileName.substring(start); const sesName = ending.substring(0, ending.indexOf(path.sep)); const profile = Profiles.getInstance().loadNamedProfile(sesName); - const fileLabel = doc.fileName.split("/").slice(-1)[0]; + const fileLabel = path.basename(doc.fileName); const dataSetName = fileLabel.substring(0, fileLabel.indexOf("(")); const memberName = fileLabel.substring(fileLabel.indexOf("(") + 1, fileLabel.indexOf(")")); if (!profile) { @@ -1664,13 +1664,7 @@ export async function saveFile(doc: vscode.TextDocument, datasetProvider: api.IZ title: localize("saveFile.progress.title", "Saving data set..."), }, () => { - if (prof.profile?.encoding) { - uploadOptions.encoding = prof.profile.encoding; - } - return ZoweExplorerApiRegister.getMvsApi(prof).putContents(doc.fileName, label, { - ...uploadOptions, - responseTimeout: prof.profile?.responseTimeout, - }); + return uploadContent(node, doc, label, prof, null, uploadOptions.etag, uploadOptions.returnEtag); } ); if (uploadResponse.success) { @@ -1681,7 +1675,7 @@ export async function saveFile(doc: vscode.TextDocument, datasetProvider: api.IZ setFileSaved(true); } } else if (!uploadResponse.success && uploadResponse.commandResponse.includes("Rest API failure with HTTP(S) status 412")) { - resolveFileConflict(node, profile, doc, fileLabel, label); + resolveFileConflict(node, prof, doc, fileLabel, label); } else { await markDocumentUnsaved(doc); api.Gui.errorMessage(uploadResponse.commandResponse); diff --git a/packages/zowe-explorer/src/shared/utils.ts b/packages/zowe-explorer/src/shared/utils.ts index a20a1f9d79..7f548f3b41 100644 --- a/packages/zowe-explorer/src/shared/utils.ts +++ b/packages/zowe-explorer/src/shared/utils.ts @@ -217,19 +217,14 @@ export async function uploadContent( etagToUpload?: string, returnEtag?: boolean ): Promise { + const uploadOptions: IUploadOptions = { + etag: etagToUpload, + returnEtag: true, + encoding: profile.profile?.encoding, + responseTimeout: profile.profile?.responseTimeout, + }; if (isZoweDatasetTreeNode(node)) { - // Upload without passing the etag to force upload - const uploadOptions: IUploadOptions = { - returnEtag: true, - }; - const prof = node.getProfile(); - if (prof.profile.encoding) { - uploadOptions.encoding = prof.profile.encoding; - } - return ZoweExplorerApiRegister.getMvsApi(prof).putContents(doc.fileName, remotePath, { - responseTimeout: prof.profile?.responseTimeout, - ...uploadOptions, - }); + return ZoweExplorerApiRegister.getMvsApi(profile).putContents(doc.fileName, remotePath, uploadOptions); } else { // if new api method exists, use it if (ZoweExplorerApiRegister.getUssApi(profile).putContent) { @@ -238,16 +233,12 @@ export async function uploadContent( statusMessage: localize("uploadContent.putContents", "Uploading USS file"), stageName: 0, // TaskStage.IN_PROGRESS - https://github.com/kulshekhar/ts-jest/issues/281 }; - const options: IUploadOptions = { + const result = ZoweExplorerApiRegister.getUssApi(profile).putContent(doc.fileName, remotePath, { binary, localEncoding: null, - etag: etagToUpload, - returnEtag, - encoding: profile.profile?.encoding, task, - responseTimeout: profile.profile?.responseTimeout, - }; - const result = ZoweExplorerApiRegister.getUssApi(profile).putContent(doc.fileName, remotePath, options); + ...uploadOptions, + }); return result; } else { return ZoweExplorerApiRegister.getUssApi(profile).putContents(doc.fileName, remotePath, binary, null, etagToUpload, returnEtag); @@ -297,8 +288,9 @@ export function willForceUpload( ); if (uploadResponse.success) { Gui.showMessage(uploadResponse.commandResponse); - if (node && uploadResponse?.apiResponse[0]?.etag) { - node.setEtag(uploadResponse.apiResponse[0].etag); + if (node) { + // Upload API returns a singleton array for data sets and an object for USS files + node.setEtag(uploadResponse.apiResponse[0]?.etag ?? uploadResponse.apiResponse.etag); } } else { await markDocumentUnsaved(doc); diff --git a/packages/zowe-explorer/src/uss/actions.ts b/packages/zowe-explorer/src/uss/actions.ts index 2d61c41e95..0618ab58a4 100644 --- a/packages/zowe-explorer/src/uss/actions.ts +++ b/packages/zowe-explorer/src/uss/actions.ts @@ -275,6 +275,14 @@ export async function saveUSSFile(doc: vscode.TextDocument, ussFileProvider: IZo const start = path.join(globals.USS_DIR + path.sep).length; const ending = doc.fileName.substring(start); const sesName = ending.substring(0, ending.indexOf(path.sep)); + const profile = Profiles.getInstance().loadNamedProfile(sesName); + if (!profile) { + const sessionError = localize("saveUSSFile.session.error", "Could not locate session when saving USS file."); + ZoweLogger.error(sessionError); + await Gui.errorMessage(sessionError); + return; + } + const remote = ending.substring(sesName.length).replace(/\\/g, "/"); const directories = doc.fileName.split(path.sep).splice(doc.fileName.split(path.sep).indexOf("_U_") + 1); directories.splice(1, 2); @@ -315,17 +323,16 @@ export async function saveUSSFile(doc: vscode.TextDocument, ussFileProvider: IZo } } + const prof = node?.getProfile() ?? profile; try { - if (sesNode) { - binary = binary || (await ZoweExplorerApiRegister.getUssApi(sesNode.getProfile()).isFileTagBinOrAscii(remote)); - } + binary = binary || (await ZoweExplorerApiRegister.getUssApi(prof).isFileTagBinOrAscii(remote)); const uploadResponse: IZosFilesResponse = await Gui.withProgress( { location: vscode.ProgressLocation.Window, title: localize("saveUSSFile.response.title", "Saving file..."), }, () => { - return uploadContent(sesNode, doc, remote, sesNode.getProfile(), binary, etagToUpload, returnEtag); + return uploadContent(node, doc, remote, prof, binary, etagToUpload, returnEtag); } ); if (uploadResponse.success) { @@ -344,8 +351,7 @@ export async function saveUSSFile(doc: vscode.TextDocument, ussFileProvider: IZo // TODO: error handling must not be zosmf specific const errorMessage = err ? err.message : err.toString(); if (errorMessage.includes("Rest API failure with HTTP(S) status 412")) { - const fileLabel = doc.fileName.split("/").slice(-1)[0]; - resolveFileConflict(node, sesNode.getProfile(), doc, fileLabel, remote, binary); + resolveFileConflict(node, prof, doc, path.basename(doc.fileName), remote, binary); } else { await markDocumentUnsaved(doc); await errorHandling(err, sesName); From 7c30e752c5fb334fa5ff1c12e7a61f70edb94a6f Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Thu, 16 Nov 2023 14:54:30 -0500 Subject: [PATCH 30/76] only disable/enable validation for all trees Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../__unit__/Profiles.extended.unit.test.ts | 23 ++++-------- .../utils/ProfileManagement.unit.test.ts | 8 ++--- packages/zowe-explorer/src/Profiles.ts | 36 +++++-------------- packages/zowe-explorer/src/dataset/init.ts | 8 ++--- packages/zowe-explorer/src/job/init.ts | 8 ++--- packages/zowe-explorer/src/uss/init.ts | 8 ++--- .../src/utils/ProfileManagement.ts | 24 ++----------- 7 files changed, 33 insertions(+), 82 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__unit__/Profiles.extended.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/Profiles.extended.unit.test.ts index a487e58eb9..4ac80396ad 100644 --- a/packages/zowe-explorer/__tests__/__unit__/Profiles.extended.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/Profiles.extended.unit.test.ts @@ -1894,24 +1894,18 @@ describe("Profiles Unit Tests - function disableValidation", () => { it("should disable validation for the profile on all trees", async () => { const globalMocks = await createGlobalMocks(); - const disableValidationContextForAllTreesSpy = jest.spyOn(Profiles.getInstance(), "disableValidtionContextForAllTrees"); - jest.spyOn(TreeProviders, "getSessionForAllTrees").mockReturnValue([ - createMockNode("test2", globals.DS_SESSION_CONTEXT), - globalMocks.testNode, - ]); + jest.spyOn(TreeProviders, "getSessionForAllTrees").mockReturnValue([globalMocks.testNode]); expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT); - expect(Profiles.getInstance().disableValidation(globalMocks.testNode, true)).toEqual(globalMocks.testNode); - expect(disableValidationContextForAllTreesSpy).toBeCalledTimes(1); + expect(Profiles.getInstance().disableValidation(globalMocks.testNode)).toEqual(globalMocks.testNode); expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT + globals.VALIDATE_SUFFIX); }); it("should disable validation for the profile on the current tree", async () => { const globalMocks = await createGlobalMocks(); - const disableValidationContextForAllTreesSpy = jest.spyOn(Profiles.getInstance(), "disableValidtionContextForAllTrees"); + jest.spyOn(TreeProviders, "getSessionForAllTrees").mockReturnValue([globalMocks.testNode]); const disableValidationContextSpy = jest.spyOn(Profiles.getInstance(), "disableValidationContext"); expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT); - expect(Profiles.getInstance().disableValidation(globalMocks.testNode, false)).toEqual(globalMocks.testNode); - expect(disableValidationContextForAllTreesSpy).toBeCalledTimes(0); + expect(Profiles.getInstance().disableValidation(globalMocks.testNode)).toEqual(globalMocks.testNode); expect(disableValidationContextSpy).toBeCalledTimes(1); expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT + globals.VALIDATE_SUFFIX); }); @@ -1926,24 +1920,21 @@ describe("Profiles Unit Tests - function enableValidation", () => { it("should enable validation for the profile on all trees", async () => { const globalMocks = await createGlobalMocks(); - const enableValidationContextForAllTreesSpy = jest.spyOn(Profiles.getInstance(), "enableValidationContextForAllTrees"); jest.spyOn(TreeProviders, "getSessionForAllTrees").mockReturnValue([ createMockNode("test2", globals.DS_SESSION_CONTEXT), globalMocks.testNode, ]); expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT); - expect(Profiles.getInstance().enableValidation(globalMocks.testNode, true)).toEqual(globalMocks.testNode); - expect(enableValidationContextForAllTreesSpy).toBeCalledTimes(1); + expect(Profiles.getInstance().enableValidation(globalMocks.testNode)).toEqual(globalMocks.testNode); expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT + globals.VALIDATE_SUFFIX); }); it("should enable validation for the profile on the current tree", async () => { const globalMocks = await createGlobalMocks(); - const enableValidationContextForAllTreesSpy = jest.spyOn(Profiles.getInstance(), "enableValidationContextForAllTrees"); const enableValidationContextSpy = jest.spyOn(Profiles.getInstance(), "enableValidationContext"); + jest.spyOn(TreeProviders, "getSessionForAllTrees").mockReturnValue([globalMocks.testNode]); expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT); - expect(Profiles.getInstance().enableValidation(globalMocks.testNode, false)).toEqual(globalMocks.testNode); - expect(enableValidationContextForAllTreesSpy).toBeCalledTimes(0); + expect(Profiles.getInstance().enableValidation(globalMocks.testNode)).toEqual(globalMocks.testNode); expect(enableValidationContextSpy).toBeCalledTimes(1); expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT + globals.VALIDATE_SUFFIX); }); diff --git a/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts index 08608a6aef..3a5abca368 100644 --- a/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts @@ -211,7 +211,7 @@ describe("ProfileManagement unit tests", () => { mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptChangeForAllTreesOptions"]()[1]); await ProfileManagement.manageProfile(mocks.mockTreeProviders.uss.mSessionNodes[0]); expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg.replace("sestest", "zosmf")); - expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.uss.enableValidation", mocks.mockTreeProviders.uss.mSessionNodes[0], false); + expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.uss.enableValidation", mocks.mockTreeProviders.uss.mSessionNodes[0]); }); it("profile using token authentication should see correct command called for disabling validation a unix tree session node", async () => { const mocks = createBlockMocks(createGlobalMocks()); @@ -219,7 +219,7 @@ describe("ProfileManagement unit tests", () => { mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptChangeForAllTreesOptions"]()[1]); await ProfileManagement.manageProfile(mocks.mockUnixSessionNode); expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg); - expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.uss.disableValidation", mocks.mockUnixSessionNode, false); + expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.uss.disableValidation", mocks.mockUnixSessionNode); }); }); describe("unit tests around no auth declared selections", () => { @@ -263,7 +263,7 @@ describe("ProfileManagement unit tests", () => { mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptChangeForAllTreesOptions"]()[0]); await ProfileManagement.manageProfile(mocks.mockTreeProviders.ds.mSessionNodes[1]); expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg.replace("sestest", "zosmf2")); - expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.enableValidation", mocks.mockTreeProviders.ds.mSessionNodes[1], true); + expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.enableValidation", mocks.mockTreeProviders.ds.mSessionNodes[1]); }); it("profile using token authentication should see correct command called for disabling validation a data set tree session node", async () => { const mocks = createBlockMocks(createGlobalMocks()); @@ -271,7 +271,7 @@ describe("ProfileManagement unit tests", () => { mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptChangeForAllTreesOptions"]()[0]); await ProfileManagement.manageProfile(mocks.mockTreeProviders.ds.mSessionNodes[0]); expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg.replace("sestest", "zosmf")); - expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.disableValidation", mocks.mockTreeProviders.ds.mSessionNodes[0], true); + expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.disableValidation", mocks.mockTreeProviders.ds.mSessionNodes[0]); }); }); diff --git a/packages/zowe-explorer/src/Profiles.ts b/packages/zowe-explorer/src/Profiles.ts index eb7dd57606..631ce53d5b 100644 --- a/packages/zowe-explorer/src/Profiles.ts +++ b/packages/zowe-explorer/src/Profiles.ts @@ -182,24 +182,15 @@ export class Profiles extends ProfilesCache { return profileStatus; } - public disableValidation(node: IZoweNodeType, shouldHideFromAllTrees: boolean): IZoweNodeType { + public disableValidation(node: IZoweNodeType): IZoweNodeType { ZoweLogger.trace("Profiles.disableValidation called."); - if (shouldHideFromAllTrees) { - this.disableValidtionContextForAllTrees(node.getLabel().toString()); - } else { - this.disableValidationContext(node); - } - return node; - } - - public disableValidtionContextForAllTrees(label: string): IZoweNodeType[] { - const treeNodes = TreeProviders.getSessionForAllTrees(label); + const treeNodes = TreeProviders.getSessionForAllTrees(node.getLabel().toString()); treeNodes.forEach((treeNode) => { if (treeNode) { this.disableValidationContext(treeNode); } }); - return treeNodes; + return node; } public disableValidationContext(node: IZoweNodeType): IZoweNodeType { @@ -207,8 +198,7 @@ export class Profiles extends ProfilesCache { const theProfile: zowe.imperative.IProfileLoaded = node.getProfile(); this.validationArraySetup(theProfile, false); if (node.contextValue.includes(globals.VALIDATE_SUFFIX)) { - node.contextValue = node.contextValue.replace(globals.VALIDATE_SUFFIX, ""); - node.contextValue += globals.NO_VALIDATE_SUFFIX; + node.contextValue = node.contextValue.replace(globals.VALIDATE_SUFFIX, globals.NO_VALIDATE_SUFFIX); } else if (node.contextValue.includes(globals.NO_VALIDATE_SUFFIX)) { return node; } else { @@ -217,24 +207,15 @@ export class Profiles extends ProfilesCache { return node; } - public enableValidation(node: IZoweNodeType, shouldHideFromAllTrees: boolean): IZoweNodeType { + public enableValidation(node: IZoweNodeType): IZoweNodeType { ZoweLogger.trace("Profiles.enableValidation called."); - if (shouldHideFromAllTrees) { - this.enableValidationContextForAllTrees(node.getLabel().toString()); - } else { - this.enableValidationContext(node); - } - return node; - } - - public enableValidationContextForAllTrees(label: string): IZoweNodeType[] { - const treeNodes = TreeProviders.getSessionForAllTrees(label); + const treeNodes = TreeProviders.getSessionForAllTrees(node.getLabel().toString()); treeNodes.forEach((treeNode) => { if (treeNode) { this.enableValidationContext(treeNode); } }); - return treeNodes; + return node; } public enableValidationContext(node: IZoweNodeType): IZoweNodeType { @@ -242,8 +223,7 @@ export class Profiles extends ProfilesCache { const theProfile: zowe.imperative.IProfileLoaded = node.getProfile(); this.validationArraySetup(theProfile, true); if (node.contextValue.includes(globals.NO_VALIDATE_SUFFIX)) { - node.contextValue = node.contextValue.replace(globals.NO_VALIDATE_SUFFIX, ""); - node.contextValue += globals.VALIDATE_SUFFIX; + node.contextValue = node.contextValue.replace(globals.NO_VALIDATE_SUFFIX, globals.VALIDATE_SUFFIX); } else if (node.contextValue.includes(globals.VALIDATE_SUFFIX)) { return node; } else { diff --git a/packages/zowe-explorer/src/dataset/init.ts b/packages/zowe-explorer/src/dataset/init.ts index d0e4fe0ca8..6325a88557 100644 --- a/packages/zowe-explorer/src/dataset/init.ts +++ b/packages/zowe-explorer/src/dataset/init.ts @@ -188,14 +188,14 @@ export async function initDatasetProvider(context: vscode.ExtensionContext): Pro }) ); context.subscriptions.push( - vscode.commands.registerCommand("zowe.ds.disableValidation", (node, shouldHideFromAllTrees) => { - Profiles.getInstance().disableValidation(node, shouldHideFromAllTrees); + vscode.commands.registerCommand("zowe.ds.disableValidation", (node) => { + Profiles.getInstance().disableValidation(node); datasetProvider.refreshElement(node); }) ); context.subscriptions.push( - vscode.commands.registerCommand("zowe.ds.enableValidation", (node, shouldHideFromAllTrees) => { - Profiles.getInstance().enableValidation(node, shouldHideFromAllTrees); + vscode.commands.registerCommand("zowe.ds.enableValidation", (node) => { + Profiles.getInstance().enableValidation(node); datasetProvider.refreshElement(node); }) ); diff --git a/packages/zowe-explorer/src/job/init.ts b/packages/zowe-explorer/src/job/init.ts index 2bf054add9..0a334b4613 100644 --- a/packages/zowe-explorer/src/job/init.ts +++ b/packages/zowe-explorer/src/job/init.ts @@ -131,14 +131,14 @@ export async function initJobsProvider(context: vscode.ExtensionContext): Promis vscode.commands.registerCommand("zowe.jobs.removeFavProfile", async (node): Promise => jobsProvider.removeFavProfile(node.label, true)) ); context.subscriptions.push( - vscode.commands.registerCommand("zowe.jobs.disableValidation", (node, shouldHideFromAllTrees) => { - Profiles.getInstance().disableValidation(node, shouldHideFromAllTrees); + vscode.commands.registerCommand("zowe.jobs.disableValidation", (node) => { + Profiles.getInstance().disableValidation(node); jobsProvider.refreshElement(node); }) ); context.subscriptions.push( - vscode.commands.registerCommand("zowe.jobs.enableValidation", (node, shouldHideFromAllTrees) => { - Profiles.getInstance().enableValidation(node, shouldHideFromAllTrees); + vscode.commands.registerCommand("zowe.jobs.enableValidation", (node) => { + Profiles.getInstance().enableValidation(node); jobsProvider.refreshElement(node); }) ); diff --git a/packages/zowe-explorer/src/uss/init.ts b/packages/zowe-explorer/src/uss/init.ts index debe3b0927..496b6b455d 100644 --- a/packages/zowe-explorer/src/uss/init.ts +++ b/packages/zowe-explorer/src/uss/init.ts @@ -159,14 +159,14 @@ export async function initUSSProvider(context: vscode.ExtensionContext): Promise vscode.commands.registerCommand("zowe.uss.removeFavProfile", (node): Promise => ussFileProvider.removeFavProfile(node.label, true)) ); context.subscriptions.push( - vscode.commands.registerCommand("zowe.uss.disableValidation", (node, shouldHideFromAllTrees) => { - Profiles.getInstance().disableValidation(node, shouldHideFromAllTrees); + vscode.commands.registerCommand("zowe.uss.disableValidation", (node) => { + Profiles.getInstance().disableValidation(node); ussFileProvider.refreshElement(node); }) ); context.subscriptions.push( - vscode.commands.registerCommand("zowe.uss.enableValidation", (node, shouldHideFromAllTrees) => { - Profiles.getInstance().enableValidation(node, shouldHideFromAllTrees); + vscode.commands.registerCommand("zowe.uss.enableValidation", (node) => { + Profiles.getInstance().enableValidation(node); ussFileProvider.refreshElement(node); }) ); diff --git a/packages/zowe-explorer/src/utils/ProfileManagement.ts b/packages/zowe-explorer/src/utils/ProfileManagement.ts index ba82f4d64d..19a5dcccc4 100644 --- a/packages/zowe-explorer/src/utils/ProfileManagement.ts +++ b/packages/zowe-explorer/src/utils/ProfileManagement.ts @@ -311,33 +311,13 @@ export class ProfileManagement { } private static async handleEnableProfileValidation(node: IZoweTreeNode): Promise { - let shouldHideFromAllTrees: boolean | undefined; - if (TreeProviders.contextValueExistsAcrossTrees(node, globals.NO_VALIDATE_SUFFIX)) { - shouldHideFromAllTrees = await this.handleChangeForAllTrees(node); - } else { - shouldHideFromAllTrees = false; - } - if (shouldHideFromAllTrees === undefined) { - Gui.infoMessage(localize("ProfileManagement.handleEnableProfileValidation.cancelled", "Operation Cancelled")); - return; - } const type: string = getSessionType(node); - return vscode.commands.executeCommand(`zowe.${type}.enableValidation`, node, shouldHideFromAllTrees); + return vscode.commands.executeCommand(`zowe.${type}.enableValidation`, node); } private static async handleDisableProfileValidation(node: IZoweTreeNode): Promise { - let shouldHideFromAllTrees: boolean | undefined; - if (TreeProviders.contextValueExistsAcrossTrees(node, globals.VALIDATE_SUFFIX)) { - shouldHideFromAllTrees = await this.handleChangeForAllTrees(node); - } else { - shouldHideFromAllTrees = false; - } - if (shouldHideFromAllTrees === undefined) { - Gui.infoMessage(localize("ProfileManagement.handleDisableProfileValidation.cancelled", "Operation Cancelled")); - return; - } const type: string = getSessionType(node); - return vscode.commands.executeCommand(`zowe.${type}.disableValidation`, node, shouldHideFromAllTrees); + return vscode.commands.executeCommand(`zowe.${type}.disableValidation`, node); } private static isProfileRegisteredWithTree(tree: globals.Trees, profile: imperative.IProfileLoaded): boolean { From c1646d06d35285574c008e1b545a947a24019e6a Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Thu, 16 Nov 2023 15:12:35 -0500 Subject: [PATCH 31/76] add code coverage Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../__unit__/shared/TreeProvider.unit.test.ts | 23 ++++++++++++++++--- .../src/utils/ProfileManagement.i18n.json | 2 -- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__unit__/shared/TreeProvider.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/shared/TreeProvider.unit.test.ts index ce96dce04e..77ff9d9572 100644 --- a/packages/zowe-explorer/__tests__/__unit__/shared/TreeProvider.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/shared/TreeProvider.unit.test.ts @@ -10,6 +10,7 @@ */ import { createTreeView } from "../../../__mocks__/mockCreators/shared"; +import { DS_SESSION_CONTEXT, JOBS_SESSION_CONTEXT, USS_SESSION_CONTEXT, VALIDATE_SUFFIX } from "../../../src/globals"; import { TreeProviders } from "../../../src/shared/TreeProviders"; describe("TreeProvider Unit Tests - Function getters", () => { @@ -45,10 +46,26 @@ describe("TreeProvider Unit Tests - Function getters", () => { describe("TreeProvider Unit Tests - Function sessionIsPresentInOtherTrees", () => { it("should return true if session is present in another tree", async () => { await TreeProviders.initializeProviders({} as any, { - ds: () => ({ mSessionNodes: [{ getLabel: () => "test1" }, { getLabel: () => "test2" }] } as any), - uss: () => ({ mSessionNodes: [{ getLabel: () => "test3" }, { getLabel: () => "test4" }] } as any), - job: () => ({ mSessionNodes: [{ getLabel: () => "test5" }, { getLabel: () => "test1" }] } as any), + ds: (): any => ({ mSessionNodes: [{ getLabel: () => "test1" }, { getLabel: () => "test2" }] } as any), + uss: (): any => ({ mSessionNodes: [{ getLabel: () => "test3" }, { getLabel: () => "test4" }] } as any), + job: (): any => ({ mSessionNodes: [{ getLabel: () => "test5" }, { getLabel: () => "test1" }] } as any), }); expect(TreeProviders.sessionIsPresentInOtherTrees("test1")).toEqual(true); }); }); + +describe("TreeProvider Unit Tests - Function contextValueExistsAcrossTrees", () => { + it("should return true if the context value passed in exists across other trees", () => { + jest.spyOn(TreeProviders, "getSessionForAllTrees").mockReturnValue([ + { getLabel: () => "test1", contextValue: DS_SESSION_CONTEXT + VALIDATE_SUFFIX } as any, + { getLabel: () => "test1", contextValue: USS_SESSION_CONTEXT + VALIDATE_SUFFIX } as any, + { getLabel: () => "test1", contextValue: JOBS_SESSION_CONTEXT + VALIDATE_SUFFIX } as any, + ]); + expect( + TreeProviders.contextValueExistsAcrossTrees( + { getLabel: () => "test1", contextValue: DS_SESSION_CONTEXT + VALIDATE_SUFFIX } as any, + VALIDATE_SUFFIX + ) + ).toEqual(true); + }); +}); diff --git a/packages/zowe-explorer/i18n/sample/src/utils/ProfileManagement.i18n.json b/packages/zowe-explorer/i18n/sample/src/utils/ProfileManagement.i18n.json index 69c1b26868..986da68bd8 100644 --- a/packages/zowe-explorer/i18n/sample/src/utils/ProfileManagement.i18n.json +++ b/packages/zowe-explorer/i18n/sample/src/utils/ProfileManagement.i18n.json @@ -9,8 +9,6 @@ "ProfileManagement.getPromptChangeForAllTreesOptions.currentDesc": "Apply to current tree selected", "ProfileManagement.promptChangeForAllTrees.howToChange": "Do you wish to apply this for all trees?", "ProfileManagement.handleHideProfiles.cancelled": "Operation Cancelled", - "ProfileManagement.handleEnableProfileValidation.cancelled": "Operation Cancelled", - "ProfileManagement.handleDisableProfileValidation.cancelled": "Operation Cancelled", "addBasicAuthQpItem.addCredentials.qpLabel": "$(plus) Add Credentials", "addBasicAuthQpItem.addCredentials.qpDetail": "Add username and password for basic authentication", "updateBasicAuthQpItem.updateCredentials.qpLabel": "$(refresh) Update Credentials", From cbd42e209589363565ec589e5e37262ecb0e7ebf Mon Sep 17 00:00:00 2001 From: zaid <72139621+zaidmstrr@users.noreply.github.com> Date: Fri, 17 Nov 2023 12:26:10 +0530 Subject: [PATCH 32/76] Update CODEOWNERS I updated the file and comment out the unactive user and write the further steps to be followed by any admin. As i don't know the all project owners/maintainers so i leave it blank, this can be edited by the any owner later on. I request to any maintainer please update the file with your "@" in the 5th line of code to make you to review any PR created. Signed-off-by: zaid <72139621+zaidmstrr@users.noreply.github.com> --- CODEOWNERS | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index bad1d7108f..8a59cd1c3e 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -2,8 +2,7 @@ # Each line is a file pattern followed by one or more owners. # These owners will be the default owners for everything in the repo. -* @heumi01 @deich01 @norjo14 @normi10 @honas02 @tucja02 - +#* @user #add the default owner name here and remove '#' from the beginning and remove this comment. Owners can be multiple # Order is important. The last matching pattern has the most precedence. # So if a pull request only touches javascript files, only these owners # will be requested to review. @@ -11,3 +10,6 @@ # You can also use email addresses if you prefer. #docs/* docs@example.com + +# This file itself is owned by members who are assigned the Project Admin role in this project. +CODEOWNERS "Project Admin" From b501a92cecef407d6f1ea38c92d7925d9eb254ef Mon Sep 17 00:00:00 2001 From: zaid <72139621+zaidmstrr@users.noreply.github.com> Date: Fri, 17 Nov 2023 12:39:23 +0530 Subject: [PATCH 33/76] Update CODEOWNERS I updated the file and comment out the unactive user and write the further steps to be followed by any admin. As i don't know the all project owners/maintainers so i leave it blank, this can be edited by the any owner later on. I request to any maintainer please update the file with your "@" in the 5th line of code to make you to review any PR created. Signed-off-by: zaid <72139621+zaidmstrr@users.noreply.github.com> --- CODEOWNERS | 3 --- 1 file changed, 3 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index 8a59cd1c3e..4a0721ba5d 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -10,6 +10,3 @@ # You can also use email addresses if you prefer. #docs/* docs@example.com - -# This file itself is owned by members who are assigned the Project Admin role in this project. -CODEOWNERS "Project Admin" From 30d1b337c0f93c8fad91974d485f34597903a3f3 Mon Sep 17 00:00:00 2001 From: Trae Yelovich Date: Fri, 17 Nov 2023 11:15:38 -0500 Subject: [PATCH 34/76] fix: Resolve new coverity issue in confirmJobSubmission Signed-off-by: Trae Yelovich --- .../__tests__/__unit__/dataset/actions.unit.test.ts | 8 +++----- packages/zowe-explorer/src/dataset/actions.ts | 12 +++++------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__unit__/dataset/actions.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/dataset/actions.unit.test.ts index 9ba2433fc6..b6ebc4c6e5 100644 --- a/packages/zowe-explorer/__tests__/__unit__/dataset/actions.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/dataset/actions.unit.test.ts @@ -3733,17 +3733,15 @@ describe("Dataset Actions Unit Tests - Function allocateLike", () => { }); describe("Dataset Actions Unit Tests - Function confirmJobSubmission", () => { - function createBlockMocks() { + function createBlockMocks(): void { mocked(vscode.window.showInputBox).mockImplementation((options) => { options.validateInput("test"); return Promise.resolve("test"); }); - - return {}; } it("Should use use local JCL doc name for confirmJobSubmission", async () => { createGlobalMocks(); - const blockMocks = createBlockMocks(); + createBlockMocks(); jest.spyOn(vscode.workspace, "getConfiguration").mockImplementation( () => ({ @@ -3753,6 +3751,6 @@ describe("Dataset Actions Unit Tests - Function confirmJobSubmission", () => { jest.spyOn(Gui, "warningMessage").mockResolvedValue({ title: "Submit", }); - await expect(dsActions.confirmJobSubmission(null, true, "Profile\\test.jcl")).resolves.toEqual(true); + await expect(dsActions.confirmJobSubmission("Profile\\test.jcl", true)).resolves.toEqual(true); }); }); diff --git a/packages/zowe-explorer/src/dataset/actions.ts b/packages/zowe-explorer/src/dataset/actions.ts index 3c03e10f44..4a89c1e7dc 100644 --- a/packages/zowe-explorer/src/dataset/actions.ts +++ b/packages/zowe-explorer/src/dataset/actions.ts @@ -996,7 +996,7 @@ export async function submitJcl(datasetProvider: api.IZoweTree { +export async function confirmJobSubmission(nodeOrFileName: api.IZoweTreeNode | string, ownsJob: boolean): Promise { ZoweLogger.trace("dataset.actions.confirmJobSubmission called."); - const showConfirmationDialog = async (): Promise => { - const jclName = - node == null && fileName !== null ? fileName.toString().substring(fileName.lastIndexOf("\\") + 1) : node.getLabel().toString(); + const jclName = typeof nodeOrFileName === "string" ? path.basename(nodeOrFileName) : nodeOrFileName.getLabel().toString(); + const showConfirmationDialog = async (): Promise => { const selection = await api.Gui.warningMessage( localize("confirmJobSubmission.confirm", "Are you sure you want to submit the following job?\n\n{0}", jclName), { items: [{ title: "Submit" }], vsCodeOpts: { modal: true } } From a0a80cd411193117f90fed39088d042ce68fbdc9 Mon Sep 17 00:00:00 2001 From: zaid <72139621+zaidmstrr@users.noreply.github.com> Date: Fri, 17 Nov 2023 22:31:06 +0530 Subject: [PATCH 35/76] Delete CODEOWNERS Deleted successfully, please merge the changes Signed-off-by: zaid <72139621+zaidmstrr@users.noreply.github.com> --- CODEOWNERS | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 CODEOWNERS diff --git a/CODEOWNERS b/CODEOWNERS deleted file mode 100644 index 4a0721ba5d..0000000000 --- a/CODEOWNERS +++ /dev/null @@ -1,12 +0,0 @@ -# Lines starting with '#' are comments. -# Each line is a file pattern followed by one or more owners. - -# These owners will be the default owners for everything in the repo. -#* @user #add the default owner name here and remove '#' from the beginning and remove this comment. Owners can be multiple -# Order is important. The last matching pattern has the most precedence. -# So if a pull request only touches javascript files, only these owners -# will be requested to review. -#*.js @octocat @github/js - -# You can also use email addresses if you prefer. -#docs/* docs@example.com From 6c7f471d4525e484caa053c2fb38b04f62815602 Mon Sep 17 00:00:00 2001 From: Billie Simmons <49491949+JillieBeanSim@users.noreply.github.com> Date: Mon, 20 Nov 2023 11:54:09 -0500 Subject: [PATCH 36/76] update cli dependency Signed-off-by: Billie Simmons <49491949+JillieBeanSim@users.noreply.github.com> --- package.json | 2 +- packages/zowe-explorer-api/package.json | 2 +- samples/tree-view-sample/package.json | 1 - samples/uss-profile-sample/package.json | 2 +- yarn.lock | 189 +++++++++--------------- 5 files changed, 72 insertions(+), 124 deletions(-) diff --git a/package.json b/package.json index db383ebdf1..5473e1d918 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "vscode": "^1.53.2" }, "dependencies": { - "@zowe/cli": "7.18.0", + "@zowe/cli": "7.19.0", "vscode-nls": "4.1.2" }, "devDependencies": { diff --git a/packages/zowe-explorer-api/package.json b/packages/zowe-explorer-api/package.json index 0ab60faf1e..5cad0d3917 100644 --- a/packages/zowe-explorer-api/package.json +++ b/packages/zowe-explorer-api/package.json @@ -18,7 +18,7 @@ }, "dependencies": { "@types/vscode": "^1.53.2", - "@zowe/cli": "^7.18.0", + "@zowe/cli": "7.19.0", "@zowe/secrets-for-zowe-sdk": "7.18.4", "handlebars": "^4.7.7", "semver": "^7.5.3" diff --git a/samples/tree-view-sample/package.json b/samples/tree-view-sample/package.json index eb7d9a00dc..fef8028638 100644 --- a/samples/tree-view-sample/package.json +++ b/samples/tree-view-sample/package.json @@ -49,7 +49,6 @@ "watch": "tsc -watch -p ./" }, "dependencies": { - "@zowe/imperative": "^5.18.0", "@zowe/zowe-explorer-api": "file:../../packages/zowe-explorer-api" }, "devDependencies": { diff --git a/samples/uss-profile-sample/package.json b/samples/uss-profile-sample/package.json index 956ffb9893..9c8223de14 100644 --- a/samples/uss-profile-sample/package.json +++ b/samples/uss-profile-sample/package.json @@ -33,7 +33,7 @@ "watch": "tsc -watch -p ./" }, "dependencies": { - "@zowe/cli": "^7.18.0", + "@zowe/cli": "7.19.0", "@zowe/zowe-explorer-api": "file:../../packages/zowe-explorer-api", "ssh2-sftp-client": "^9.1.0" }, diff --git a/yarn.lock b/yarn.lock index 5243ccd7c9..2a7b8a1b33 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2642,46 +2642,44 @@ resolved "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz" integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== -"@zowe/cli@7.18.0", "@zowe/cli@^7.18.0": - version "7.18.0" - resolved "https://zowe.jfrog.io/zowe/api/npm/npm-local-release/@zowe/cli/-/@zowe/cli-7.18.0.tgz" - integrity sha512-2nvHtsQ5Z2vHilQhKUhRwKvbz5YOzqDTOFRAy4PiA7+NePgq4J0a10U+pd+GxnsG7Hl/Gna26hc9+61Iy8Z1WQ== - dependencies: - "@zowe/core-for-zowe-sdk" "7.18.0" - "@zowe/imperative" "5.18.0" - "@zowe/perf-timing" "1.0.7" - "@zowe/provisioning-for-zowe-sdk" "7.18.0" - "@zowe/zos-console-for-zowe-sdk" "7.18.0" - "@zowe/zos-files-for-zowe-sdk" "7.18.0" - "@zowe/zos-jobs-for-zowe-sdk" "7.18.0" - "@zowe/zos-logs-for-zowe-sdk" "7.18.0" - "@zowe/zos-tso-for-zowe-sdk" "7.18.0" - "@zowe/zos-uss-for-zowe-sdk" "7.18.0" - "@zowe/zos-workflows-for-zowe-sdk" "7.18.0" - "@zowe/zosmf-for-zowe-sdk" "7.18.0" +"@zowe/cli@7.19.0": + version "7.19.0" + resolved "https://registry.npmjs.org/@zowe/cli/-/cli-7.19.0.tgz#ee053f35438484f1271af333c954b851d0ea747b" + integrity sha512-hkAwsdYWkI+DMsP8nbCUb3pRfzMuaTh663v5L+tGJtizBpDKpFGYYQ9buv0eOskPi4d5/+bae089aT8VavgwAw== + dependencies: + "@zowe/core-for-zowe-sdk" "7.19.0" + "@zowe/imperative" "5.19.0" + "@zowe/provisioning-for-zowe-sdk" "7.19.0" + "@zowe/zos-console-for-zowe-sdk" "7.19.0" + "@zowe/zos-files-for-zowe-sdk" "7.19.0" + "@zowe/zos-jobs-for-zowe-sdk" "7.19.0" + "@zowe/zos-logs-for-zowe-sdk" "7.19.0" + "@zowe/zos-tso-for-zowe-sdk" "7.19.0" + "@zowe/zos-uss-for-zowe-sdk" "7.19.0" + "@zowe/zos-workflows-for-zowe-sdk" "7.19.0" + "@zowe/zosmf-for-zowe-sdk" "7.19.0" find-process "1.4.7" get-stream "6.0.1" lodash "4.17.21" minimatch "5.0.1" tar "6.1.14" optionalDependencies: - "@zowe/secrets-for-zowe-sdk" "7.18.0" + "@zowe/secrets-for-zowe-sdk" "7.18.6" -"@zowe/core-for-zowe-sdk@7.18.0": - version "7.18.0" - resolved "https://zowe.jfrog.io/zowe/api/npm/npm-local-release/@zowe/core-for-zowe-sdk/-/@zowe/core-for-zowe-sdk-7.18.0.tgz" - integrity sha512-a5yMfDkoEGiOnREitNWIydnc+JnWEb2TElFiwcoPV5ewKEZZ6t9SPa2c1NKzsxZgM2OePBVvpBqMOi7lEVNMsg== +"@zowe/core-for-zowe-sdk@7.19.0": + version "7.19.0" + resolved "https://registry.npmjs.org/@zowe/core-for-zowe-sdk/-/core-for-zowe-sdk-7.19.0.tgz#36113036954b9554a0e927a15510ded444c85fc1" + integrity sha512-u7safSLwN4Rctt/ihGjEO3NFljDOANKtmqvw/pqoy+G1DcGswR4i9J3rbors8THfodiG2FXBsTxv9+l3qzUVkQ== dependencies: comment-json "4.1.1" string-width "4.2.3" -"@zowe/imperative@5.18.0": - version "5.18.0" - resolved "https://zowe.jfrog.io/zowe/api/npm/npm-local-release/@zowe/imperative/-/@zowe/imperative-5.18.0.tgz" - integrity sha512-SE0WfySTkaxJa1s26lexQuN1efUPhKe2P2A9MXjzHl7+OOLg+QU0gGS8SpVS1yEXQi+yZfGPorPEqEn2DC+n5A== +"@zowe/imperative@5.19.0": + version "5.19.0" + resolved "https://registry.npmjs.org/@zowe/imperative/-/imperative-5.19.0.tgz#7f8deb89030bf2f649cd2351fe12095da46dce6c" + integrity sha512-XhhNUnZprtf1zqn/vkuH4tbxJrAinYWAgGw6WU9yZ7vPAeqYIEWwd9Na+D1/ols3unet64cd1lhvHG3xKSMKUw== dependencies: "@types/yargs" "13.0.4" - "@zowe/perf-timing" "1.0.7" chalk "2.4.2" cli-table3 "0.6.2" comment-json "4.1.1" @@ -2718,40 +2716,32 @@ yamljs "0.3.0" yargs "15.3.1" -"@zowe/perf-timing@1.0.7": - version "1.0.7" - resolved "https://registry.npmjs.org/@zowe/perf-timing/-/perf-timing-1.0.7.tgz" - integrity sha512-2txq0yg+POxkGQH6xe4l5wCItwy40YPuSK9cqCWVzrLgPxcvC+serhIkmJosaIMDxQe0e+vLd/mEED4l8nQGRA== - dependencies: - fs-extra "8.1.0" - pkg-up "2.0.0" - -"@zowe/provisioning-for-zowe-sdk@7.18.0": - version "7.18.0" - resolved "https://zowe.jfrog.io/zowe/api/npm/npm-local-release/@zowe/provisioning-for-zowe-sdk/-/@zowe/provisioning-for-zowe-sdk-7.18.0.tgz" - integrity sha512-ZqfNuQOQ0ohMBJjFI4itF+mH3V8EKiQw9n+pgf9qjyAXMfuvq6B0QmtzO5pvKy9IrFwokDQH3C2tfsY5EGL62A== +"@zowe/provisioning-for-zowe-sdk@7.19.0": + version "7.19.0" + resolved "https://registry.npmjs.org/@zowe/provisioning-for-zowe-sdk/-/provisioning-for-zowe-sdk-7.19.0.tgz#a63378cd0c1201cc42abff282d99b5bdb1354aec" + integrity sha512-f2j8p1g+VVCEz9pZrLr4dSZe1T7oznxA3cVcC3YsbQxCUnZVXfB+sNkOThlyjdzorRFBzfnyrkVad3wt2VZxBw== dependencies: js-yaml "4.1.0" -"@zowe/secrets-for-zowe-sdk@7.18.0": - version "7.18.0" - resolved "https://zowe.jfrog.io/zowe/api/npm/npm-local-release/@zowe/secrets-for-zowe-sdk/-/@zowe/secrets-for-zowe-sdk-7.18.0.tgz" - integrity sha512-QyZQh45pZEj9PWkqaTfMFIFDiHpMI4aCaZSbsbhanz54h/kN1s6nT4ri43EjQ3J3aUsG2wEjKkotjBZdGg3cHw== - "@zowe/secrets-for-zowe-sdk@7.18.4": version "7.18.4" resolved "https://zowe.jfrog.io/zowe/api/npm/npm-local-release/@zowe/secrets-for-zowe-sdk/-/@zowe/secrets-for-zowe-sdk-7.18.4.tgz" integrity sha512-MCJBHSCbf2TdN9/5pbJNC6LWrWgnmYt0zVINs6g8Tlf/UmVBh08TlrROzPfL5aYi7FWPa64BHur40x/e1eNalg== -"@zowe/zos-console-for-zowe-sdk@7.18.0": - version "7.18.0" - resolved "https://zowe.jfrog.io/zowe/api/npm/npm-local-release/@zowe/zos-console-for-zowe-sdk/-/@zowe/zos-console-for-zowe-sdk-7.18.0.tgz" - integrity sha512-sVWHNuJFncHqN75nKan8Ybx1wvAWo8fqPjk3CLbChWXOS9iSFIjArirrqFODWMvgQ0p+3+ns2v88OOJ/WIQsiQ== +"@zowe/secrets-for-zowe-sdk@7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@zowe/secrets-for-zowe-sdk/-/secrets-for-zowe-sdk-7.18.6.tgz#6b854b344babb291c26d19d82633099a46e08452" + integrity sha512-YyS1NoXddb147mBQpu5/dTfo1gdwGa/xdg85U8KCngA+RHCmNct3n2rbK3tHx9C9H6rlgjeS+Mrux5Q+PHJUgQ== + +"@zowe/zos-console-for-zowe-sdk@7.19.0": + version "7.19.0" + resolved "https://registry.npmjs.org/@zowe/zos-console-for-zowe-sdk/-/zos-console-for-zowe-sdk-7.19.0.tgz#9431731e49cef3993f7428e5e81f1565f6572e70" + integrity sha512-0YNLP8wK3ja+gY0Aj8K89J8dwiZr/d+vIaN7qB42584t991UaNOZjDNt5A416Qc3DwVTlQGDBpHKnlAFiykexA== -"@zowe/zos-files-for-zowe-sdk@7.18.0": - version "7.18.0" - resolved "https://zowe.jfrog.io/zowe/api/npm/npm-local-release/@zowe/zos-files-for-zowe-sdk/-/@zowe/zos-files-for-zowe-sdk-7.18.0.tgz" - integrity sha512-D25+TaUj+2d8h9JRxiy6pzkLFst0t0tbGK433LZsF4O1TzrbQsM4VRdcLYKrzBbQkSsYOyyasxAs4HUjKWdr4w== +"@zowe/zos-files-for-zowe-sdk@7.19.0": + version "7.19.0" + resolved "https://registry.npmjs.org/@zowe/zos-files-for-zowe-sdk/-/zos-files-for-zowe-sdk-7.19.0.tgz#e378cc7a13c4577ab30e879d63bc760203297761" + integrity sha512-ZUTRxjLPEFAXKEUrLQmRI+hFW9KtxEarkaYJKtOpaQgkB14L62fSdfhw3prRwQalwNhLdm+RPvrJjvijnz1fag== dependencies: get-stream "6.0.1" minimatch "5.0.1" @@ -2763,43 +2753,43 @@ dependencies: zos-node-accessor "1.0.14" -"@zowe/zos-jobs-for-zowe-sdk@7.18.0": - version "7.18.0" - resolved "https://zowe.jfrog.io/zowe/api/npm/npm-local-release/@zowe/zos-jobs-for-zowe-sdk/-/@zowe/zos-jobs-for-zowe-sdk-7.18.0.tgz" - integrity sha512-PX2AMeyJjJjkJDq+a4HxrY9PypmMq7Z0NFAmJCCv/wp+DXaGyYYK3Kc5SNU/SSVqyJYv03blkFR78GEAhJK+4A== +"@zowe/zos-jobs-for-zowe-sdk@7.19.0": + version "7.19.0" + resolved "https://registry.npmjs.org/@zowe/zos-jobs-for-zowe-sdk/-/zos-jobs-for-zowe-sdk-7.19.0.tgz#5e2fe76368d6e4a8ce7c40254e9b767464e496f8" + integrity sha512-oLs53Wzh8vP7ytzdlmja4l6bxRFDkgQiREfDZ44vwTGpX2oAAsCXzGBtaM9EBxfSIOtHyCMDucWcj4ho2KPIhQ== dependencies: - "@zowe/zos-files-for-zowe-sdk" "7.18.0" + "@zowe/zos-files-for-zowe-sdk" "7.19.0" -"@zowe/zos-logs-for-zowe-sdk@7.18.0": - version "7.18.0" - resolved "https://zowe.jfrog.io/zowe/api/npm/npm-local-release/@zowe/zos-logs-for-zowe-sdk/-/@zowe/zos-logs-for-zowe-sdk-7.18.0.tgz" - integrity sha512-88lNA85LX8OYRvuTYrqJhjMGwc+BcudGM4wQ2JQwVshg/y622fWAV1w5O0vCFPEXxBi5pCT0YdKMYmLeGc4vkQ== +"@zowe/zos-logs-for-zowe-sdk@7.19.0": + version "7.19.0" + resolved "https://registry.npmjs.org/@zowe/zos-logs-for-zowe-sdk/-/zos-logs-for-zowe-sdk-7.19.0.tgz#9f97bdff593867519c8ada718b19ac405a01ea84" + integrity sha512-tBqrDyUrZP17wLBVjDx5ol8de77pK3Bbb2LvmVErC8Z5VIY7yH+6iJQmnKeLduSiRpaAcK46citZNmLkGbGkbw== -"@zowe/zos-tso-for-zowe-sdk@7.18.0": - version "7.18.0" - resolved "https://zowe.jfrog.io/zowe/api/npm/npm-local-release/@zowe/zos-tso-for-zowe-sdk/-/@zowe/zos-tso-for-zowe-sdk-7.18.0.tgz" - integrity sha512-7hZb9pgngwU7PuCoyFXIUgldnZCM1dJiAxWG1VNlH+5zwOljzaveBz4cjvtqIuJTBYA7V3+gq4xj6/QNXNC97Q== +"@zowe/zos-tso-for-zowe-sdk@7.19.0": + version "7.19.0" + resolved "https://registry.npmjs.org/@zowe/zos-tso-for-zowe-sdk/-/zos-tso-for-zowe-sdk-7.19.0.tgz#8983e05e130228955e9d054160fe89cf0a1e6bf0" + integrity sha512-5LUD9K7oxyo8/EmLw2/mWIi8fJFt4aX+Ja+iKcC62vdt+R3o73AbNBuAeP0Vj6IghmODZ1rAVA7oyYEkXBYdDg== dependencies: - "@zowe/zosmf-for-zowe-sdk" "7.18.0" + "@zowe/zosmf-for-zowe-sdk" "7.19.0" -"@zowe/zos-uss-for-zowe-sdk@7.18.0": - version "7.18.0" - resolved "https://zowe.jfrog.io/zowe/api/npm/npm-local-release/@zowe/zos-uss-for-zowe-sdk/-/@zowe/zos-uss-for-zowe-sdk-7.18.0.tgz" - integrity sha512-cK+Y8uN5qGfxsaR3UYxThOC9Deb5m0YP4UzA7QX2rWnPvetdzGddmJhXxLcZ2qbbVhqOpdqFxSPkOsp0E/l8Kw== +"@zowe/zos-uss-for-zowe-sdk@7.19.0": + version "7.19.0" + resolved "https://registry.npmjs.org/@zowe/zos-uss-for-zowe-sdk/-/zos-uss-for-zowe-sdk-7.19.0.tgz#588939eef3642dbf85a69a3a4e8b94da9909d731" + integrity sha512-TNk4x0etnUt9RWiYuN4ooxvbb2+Zi6ZQF1gHeVP3M96lR/O89LKhBlwK4LOjEn/6+9M3CCdbRylCqjbqJehijQ== dependencies: ssh2 "1.11.0" -"@zowe/zos-workflows-for-zowe-sdk@7.18.0": - version "7.18.0" - resolved "https://zowe.jfrog.io/zowe/api/npm/npm-local-release/@zowe/zos-workflows-for-zowe-sdk/-/@zowe/zos-workflows-for-zowe-sdk-7.18.0.tgz" - integrity sha512-fwohyemEHrc5q9UQTToYRB8+YX1NjpsyoKYt4dEEEkiEOwHZ/99vPqM6dpVm/mj7iZyTfpgHuxB4lPEZNdD21A== +"@zowe/zos-workflows-for-zowe-sdk@7.19.0": + version "7.19.0" + resolved "https://registry.npmjs.org/@zowe/zos-workflows-for-zowe-sdk/-/zos-workflows-for-zowe-sdk-7.19.0.tgz#aba933cb3675651b386b862c9afe79518639f7c2" + integrity sha512-J9zHUJzL4QPKg2NiRPkCIu1v36aAn4wAOQHl4o74h0dH3Ncz7fI1DDxUTlSAaA9W6dHFJV9g4YEToUpwn07mQQ== dependencies: - "@zowe/zos-files-for-zowe-sdk" "7.18.0" + "@zowe/zos-files-for-zowe-sdk" "7.19.0" -"@zowe/zosmf-for-zowe-sdk@7.18.0": - version "7.18.0" - resolved "https://zowe.jfrog.io/zowe/api/npm/npm-local-release/@zowe/zosmf-for-zowe-sdk/-/@zowe/zosmf-for-zowe-sdk-7.18.0.tgz" - integrity sha512-nxB9zmWHamXYcCLKOlJtsAEhl6maLHRtSbAuPupytbNgtH6z5bt6WuHefJbq03wy0D2smWMiNk+zuTE4Lim/6A== +"@zowe/zosmf-for-zowe-sdk@7.19.0": + version "7.19.0" + resolved "https://registry.npmjs.org/@zowe/zosmf-for-zowe-sdk/-/zosmf-for-zowe-sdk-7.19.0.tgz#e6fc7f7ae4aaa6531345dc5ac38bcc55d52bda45" + integrity sha512-pdy4mrRbvEmmhs9Vuuak5T3gaMpG6SK8WkET0i3/TiIuG0aAU1g9vMgcnfeHJyz82jXQrjfvHeGX5ei74zGWqg== abab@^2.0.3, abab@^2.0.5: version "2.0.6" @@ -5631,13 +5621,6 @@ find-up@^1.0.0: path-exists "^2.0.0" pinkie-promise "^2.0.0" -find-up@^2.1.0: - version "2.1.0" - resolved "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz" - integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c= - dependencies: - locate-path "^2.0.0" - find-up@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz" @@ -7916,14 +7899,6 @@ loader-utils@^2.0.0: emojis-list "^3.0.0" json5 "^2.1.2" -locate-path@^2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz" - integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4= - dependencies: - p-locate "^2.0.0" - path-exists "^3.0.0" - locate-path@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz" @@ -9056,13 +9031,6 @@ p-defer@^1.0.0: resolved "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz" integrity sha1-n26xgvbJqozXQwBKfU+WsZaw+ww= -p-limit@^1.1.0: - version "1.3.0" - resolved "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz" - integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q== - dependencies: - p-try "^1.0.0" - p-limit@^2.0.0, p-limit@^2.2.0: version "2.3.0" resolved "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz" @@ -9077,13 +9045,6 @@ p-limit@^3.0.2, p-limit@^3.1.0: dependencies: yocto-queue "^0.1.0" -p-locate@^2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz" - integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM= - dependencies: - p-limit "^1.1.0" - p-locate@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz" @@ -9117,11 +9078,6 @@ p-map@^4.0.0: dependencies: aggregate-error "^3.0.0" -p-try@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz" - integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M= - p-try@^2.0.0: version "2.2.0" resolved "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz" @@ -9425,13 +9381,6 @@ pkg-dir@^4.1.0, pkg-dir@^4.2.0: dependencies: find-up "^4.0.0" -pkg-up@2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/pkg-up/-/pkg-up-2.0.0.tgz" - integrity sha1-yBmscoBZpGHKscOImivjxJoATX8= - dependencies: - find-up "^2.1.0" - pkg-up@^3.0.0: version "3.1.0" resolved "https://registry.npmjs.org/pkg-up/-/pkg-up-3.1.0.tgz" From ae236fe9ab69b45b6249672df3373dc4128bea10 Mon Sep 17 00:00:00 2001 From: Billie Simmons <49491949+JillieBeanSim@users.noreply.github.com> Date: Mon, 27 Nov 2023 10:35:51 -0500 Subject: [PATCH 37/76] update secrets to match latest cli version Signed-off-by: Billie Simmons <49491949+JillieBeanSim@users.noreply.github.com> --- packages/zowe-explorer-api/package.json | 2 +- packages/zowe-explorer/package.json | 2 +- yarn.lock | 5 ----- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/zowe-explorer-api/package.json b/packages/zowe-explorer-api/package.json index 5cad0d3917..e2be0fa376 100644 --- a/packages/zowe-explorer-api/package.json +++ b/packages/zowe-explorer-api/package.json @@ -19,7 +19,7 @@ "dependencies": { "@types/vscode": "^1.53.2", "@zowe/cli": "7.19.0", - "@zowe/secrets-for-zowe-sdk": "7.18.4", + "@zowe/secrets-for-zowe-sdk": "7.18.6", "handlebars": "^4.7.7", "semver": "^7.5.3" }, diff --git a/packages/zowe-explorer/package.json b/packages/zowe-explorer/package.json index 2943f8f963..056593e750 100644 --- a/packages/zowe-explorer/package.json +++ b/packages/zowe-explorer/package.json @@ -1994,7 +1994,7 @@ "webpack-cli": "^3.3.11" }, "dependencies": { - "@zowe/secrets-for-zowe-sdk": "7.18.4", + "@zowe/secrets-for-zowe-sdk": "7.18.6", "@zowe/zowe-explorer-api": "2.13.0-SNAPSHOT", "dayjs": "^1.11.10", "fs-extra": "8.0.1", diff --git a/yarn.lock b/yarn.lock index 2a7b8a1b33..5f32b42838 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2723,11 +2723,6 @@ dependencies: js-yaml "4.1.0" -"@zowe/secrets-for-zowe-sdk@7.18.4": - version "7.18.4" - resolved "https://zowe.jfrog.io/zowe/api/npm/npm-local-release/@zowe/secrets-for-zowe-sdk/-/@zowe/secrets-for-zowe-sdk-7.18.4.tgz" - integrity sha512-MCJBHSCbf2TdN9/5pbJNC6LWrWgnmYt0zVINs6g8Tlf/UmVBh08TlrROzPfL5aYi7FWPa64BHur40x/e1eNalg== - "@zowe/secrets-for-zowe-sdk@7.18.6": version "7.18.6" resolved "https://registry.npmjs.org/@zowe/secrets-for-zowe-sdk/-/secrets-for-zowe-sdk-7.18.6.tgz#6b854b344babb291c26d19d82633099a46e08452" From 665911c1fd367f048f477d8f2911ef25c2010af1 Mon Sep 17 00:00:00 2001 From: zFernand0 <37381190+zFernand0@users.noreply.github.com> Date: Tue, 28 Nov 2023 15:21:28 +0000 Subject: [PATCH 38/76] fix(ds): Typecast known numberic values if present Signed-off-by: zFernand0 <37381190+zFernand0@users.noreply.github.com> --- packages/zowe-explorer/src/dataset/actions.ts | 2 +- packages/zowe-explorer/src/globals.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/zowe-explorer/src/dataset/actions.ts b/packages/zowe-explorer/src/dataset/actions.ts index 4a89c1e7dc..c6654a1dd4 100644 --- a/packages/zowe-explorer/src/dataset/actions.ts +++ b/packages/zowe-explorer/src/dataset/actions.ts @@ -631,7 +631,7 @@ export async function createFile(node: api.IZoweDatasetTreeNode, datasetProvider if (property.key === `dsName`) { dsName = property.value; } else { - if (typeof propertiesFromDsType[property.key] === "number") { + if (typeof propertiesFromDsType[property.key] === "number" || property.type === "number") { dsPropsForAPI[property.key] = Number(property.value); } else { dsPropsForAPI[property.key] = property.value; diff --git a/packages/zowe-explorer/src/globals.ts b/packages/zowe-explorer/src/globals.ts index f52ae42730..659137fed1 100644 --- a/packages/zowe-explorer/src/globals.ts +++ b/packages/zowe-explorer/src/globals.ts @@ -146,12 +146,14 @@ export const DATA_SET_PROPERTIES = [ key: `avgblk`, label: `Average Block Length`, value: null, + type: `number`, placeHolder: localize("createFile.attribute.avgblk", `Enter the average block length (if allocation unit = BLK)`), }, { key: `blksize`, label: `Block Size`, value: null, + type: `number`, placeHolder: localize("createFile.attribute.blksize", `Enter a block size`), }, { @@ -170,6 +172,7 @@ export const DATA_SET_PROPERTIES = [ key: `dirblk`, label: `Directory Blocks`, value: null, + type: `number`, placeHolder: localize("createFile.attribute.dirblk", `Enter the number of directory blocks`), }, { @@ -200,6 +203,7 @@ export const DATA_SET_PROPERTIES = [ key: `primary`, label: `Primary Space`, value: null, + type: `number`, placeHolder: localize("createFile.attribute.primary", `Enter the primary space allocation`), }, { @@ -212,12 +216,14 @@ export const DATA_SET_PROPERTIES = [ key: `lrecl`, label: `Record Length`, value: null, + type: `number`, placeHolder: localize("createFile.attribute.lrecl", `Enter the logical record length`), }, { key: `secondary`, label: `Secondary Space`, value: null, + type: `number`, placeHolder: localize("createFile.attribute.secondary", `Enter the secondary space allocation`), }, { From d63be00fbddd25a8fe7d6f91c4b2ee38fec98857 Mon Sep 17 00:00:00 2001 From: zFernand0 <37381190+zFernand0@users.noreply.github.com> Date: Tue, 28 Nov 2023 15:23:41 +0000 Subject: [PATCH 39/76] update changelog Signed-off-by: zFernand0 <37381190+zFernand0@users.noreply.github.com> --- packages/zowe-explorer/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/zowe-explorer/CHANGELOG.md b/packages/zowe-explorer/CHANGELOG.md index ab0f61df80..d24f981698 100644 --- a/packages/zowe-explorer/CHANGELOG.md +++ b/packages/zowe-explorer/CHANGELOG.md @@ -12,6 +12,8 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen ### Bug fixes +- Fixed dataset allocation issue when secondary space (or other numeric values that did not exists in the dataset-template) where specified [#2591](https://github.com/zowe/vscode-extension-for-zowe/issues/2591) + ## `2.12.2` ### Bug fixes From c8f80bd2549d065fa74936c71c37d9b2ac8b6d3f Mon Sep 17 00:00:00 2001 From: Santhoshi Boyina Date: Wed, 29 Nov 2023 15:35:38 +0530 Subject: [PATCH 40/76] feat: Issue ZDPT-8744: add clear filter option Signed-off-by: Santhoshi Boyina --- .../__tests__/__unit__/extension.unit.test.ts | 1 + .../__unit__/job/ZosJobsProvider.unit.test.ts | 109 ++++++++++++++++++ .../__tests__/__unit__/job/init.unit.test.ts | 5 + .../sample/src/job/ZosJobsProvider.i18n.json | 6 + .../i18n/sample/src/job/utils.i18n.json | 4 +- packages/zowe-explorer/package.json | 16 +++ packages/zowe-explorer/src/globals.ts | 2 +- .../zowe-explorer/src/job/ZosJobsProvider.ts | 62 ++++++++++ packages/zowe-explorer/src/job/init.ts | 6 + packages/zowe-explorer/src/job/utils.ts | 5 + 10 files changed, 214 insertions(+), 2 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__unit__/extension.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/extension.unit.test.ts index 6b2b6ccc80..0157603bdf 100644 --- a/packages/zowe-explorer/__tests__/__unit__/extension.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/extension.unit.test.ts @@ -243,6 +243,7 @@ async function createGlobalMocks() { "zowe.jobs.stopPolling", "zowe.jobs.cancelJob", "zowe.jobs.sortBy", + "zowe.jobs.filterJobs", "zowe.manualPoll", "zowe.editHistory", "zowe.promptCredentials", diff --git a/packages/zowe-explorer/__tests__/__unit__/job/ZosJobsProvider.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/job/ZosJobsProvider.unit.test.ts index 00d7bd60bb..5e7fda1b6d 100644 --- a/packages/zowe-explorer/__tests__/__unit__/job/ZosJobsProvider.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/job/ZosJobsProvider.unit.test.ts @@ -35,6 +35,46 @@ import { jobStringValidator } from "../../../src/shared/utils"; import { ZoweLogger } from "../../../src/utils/LoggerUtils"; import { Poller } from "@zowe/zowe-explorer-api/src/utils"; import { SettingsConfig } from "../../../src/utils/SettingsConfig"; +import { TreeProviders } from "../../../src/shared/TreeProviders"; + +jest.mock("vscode"); +const showMock = jest.fn(); +const onDidChangeValueMock = { + event: (callback: (value: string) => void): vscode.Disposable => { + const disposable = { + dispose: jest.fn(), + }; + callback(""); + return disposable; + }, +}; +const mockInputBox: vscode.InputBox = { + title: "", + value: "", + placeholder: "", + password: false, + onDidChangeValue: onDidChangeValueMock.event, + onDidAccept: jest.fn(), + show: showMock, + hide: jest.fn(), + dispose: jest.fn(), + buttons: [], + onDidTriggerButton: jest.fn(), + prompt: "", + validationMessage: "", + step: 1, + totalSteps: 100, + enabled: true, + busy: false, + ignoreFocusOut: false, + onDidHide: jest.fn(), +}; +function setJobObjects(job: zowe.IJob, newJobName: string, newJobId: string, newRetCode: string) { + job.jobname = newJobName; + job.jobid = newJobId; + job.retcode = newRetCode; + return job; +} async function createGlobalMocks() { const globalMocks = { @@ -126,6 +166,12 @@ async function createGlobalMocks() { value: globalMocks.mockGetSpoolFiles, configurable: true, }); + Object.defineProperty(vscode.window, "createInputBox", { + value: jest.fn(() => mockInputBox), + configurable: true, + }); + + Object.defineProperty(Gui, "infoMessage", { value: jest.fn(), configurable: true }); Object.defineProperty(vscode.window, "createTreeView", { value: globalMocks.createTreeView, configurable: true }); Object.defineProperty(vscode.window, "showQuickPick", { value: globalMocks.mockShowQuickPick, configurable: true }); Object.defineProperty(vscode, "ConfigurationTarget", { value: globalMocks.enums, configurable: true }); @@ -973,3 +1019,66 @@ describe("getFavorites", () => { expect(tree.getFavorites()).toEqual(["test1", "test2", "test3"]); }); }); + +describe("ZosJobsProvider Unit Test - Filter Jobs", () => { + const node1: IZoweJobTreeNode = new Job( + "jobnew", + vscode.TreeItemCollapsibleState.None, + null, + null, + setJobObjects(createIJobObject(), "ZOWEUSR1", "JOB04945", "CC 0000"), + null + ); + const node2: IZoweJobTreeNode = new Job( + "jobnew", + vscode.TreeItemCollapsibleState.None, + null, + null, + setJobObjects(createIJobObject(), "ZOWEUSR2", "JOB05037", "CC 0000"), + null + ); + const node3: IZoweJobTreeNode = new Job( + "jobnew", + vscode.TreeItemCollapsibleState.None, + null, + null, + setJobObjects(createIJobObject(), "ZOWEUSR3", "TSU07707", "ABEND S222"), + null + ); + + let globalMocks; + beforeEach(async () => { + globalMocks = await createGlobalMocks(); + const mockTreeProvider = { + refresh: jest.fn(), + } as any; + jest.spyOn(TreeProviders, "job", "get").mockReturnValue(mockTreeProvider); + }); + + afterEach(() => { + jest.restoreAllMocks(); + jest.resetAllMocks(); + jest.clearAllMocks(); + }); + + it("To show showInformationMessage", async () => { + const testTree = new ZosJobsProvider(); + node1.collapsibleState = vscode.TreeItemCollapsibleState.Collapsed; + await testTree.filterJobsDialog(node1); + expect(mocked(Gui.infoMessage)).toHaveBeenCalled(); + }); + + it("To filter jobs based on a combination of JobName, JobId and Return code", async () => { + const testTree = new ZosJobsProvider(); + node1.collapsibleState = vscode.TreeItemCollapsibleState.Expanded; + node1.children = [node2, node3]; + const createInputBoxSpy = jest.spyOn(vscode.window, "createInputBox"); + mockInputBox.value = "ZOWEUSR2(JOB05037) - CC 0000"; + createInputBoxSpy.mockReturnValue(mockInputBox); + globalMocks.mockShowQuickPick.mockReturnValueOnce("Go to Local Filtering"); + const filterJobsSpy = jest.spyOn(testTree, "filterJobsDialog"); + await testTree.filterJobsDialog(node1); + expect(filterJobsSpy).toHaveBeenCalled(); + expect(filterJobsSpy).toBeCalledWith(node1); + }); +}); diff --git a/packages/zowe-explorer/__tests__/__unit__/job/init.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/job/init.unit.test.ts index 09b7fa8ad0..ad149bfe7f 100644 --- a/packages/zowe-explorer/__tests__/__unit__/job/init.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/job/init.unit.test.ts @@ -54,6 +54,7 @@ describe("Test src/jobs/extension", () => { onDidChangeConfiguration: jest.fn(), pollData: jest.fn(), refreshElement: jest.fn(), + filterJobsDialog: jest.fn(), }; const commands: IJestIt[] = [ { @@ -219,6 +220,10 @@ describe("Test src/jobs/extension", () => { mock: [{ spy: jest.spyOn(jobActions, "cancelJobs"), arg: [jobsProvider, [exampleData.job]] }], parm: [exampleData.job], }, + { + name: "zowe.jobs.filterJobs", + mock: [{ spy: jest.spyOn(jobsProvider, "filterJobsDialog"), arg: [test.value] }], + }, ]; beforeAll(async () => { diff --git a/packages/zowe-explorer/i18n/sample/src/job/ZosJobsProvider.i18n.json b/packages/zowe-explorer/i18n/sample/src/job/ZosJobsProvider.i18n.json index 934948d954..bb9c7efcde 100644 --- a/packages/zowe-explorer/i18n/sample/src/job/ZosJobsProvider.i18n.json +++ b/packages/zowe-explorer/i18n/sample/src/job/ZosJobsProvider.i18n.json @@ -23,6 +23,12 @@ "zowe.polling.intervalOption": "Poll interval (in ms) for: {0}", "zowe.polling.cancelled": "Polling dismissed for {0}; operation cancelled.", "zowe.polling.statusBar": "$(sync~spin) Polling: {0}...", + "filter.description": "Filter: {0}", + "filterJobs.message": "Use the search button to display jobs", + "filterJobs.placeholder": "Set a filter...", + "filter.cleared": "$(check) Filter cleared for {0}", + "filterJobs.prompt.message": "Enter local filter...", + "filter.updated": "$(check) Filter updated for {0}", "zosJobsProvider.specifyCriteria": "Create new...", "zosJobsProvider.option.submit": "$(check) Submit this query" } diff --git a/packages/zowe-explorer/i18n/sample/src/job/utils.i18n.json b/packages/zowe-explorer/i18n/sample/src/job/utils.i18n.json index b32e729f24..8964356ce5 100644 --- a/packages/zowe-explorer/i18n/sample/src/job/utils.i18n.json +++ b/packages/zowe-explorer/i18n/sample/src/job/utils.i18n.json @@ -3,5 +3,7 @@ "jobs.sortByDateSubmitted": "$(calendar) Date Submitted", "jobs.sortByName": "$(case-sensitive) Job Name", "jobs.sortByReturnCode": "$(symbol-numeric) Return Code", - "setSortDirection": "$(fold) Sort Direction" + "setSortDirection": "$(fold) Sort Direction", + "filterJobs.quickpick.message": "Go to Local Filtering", + "filterJobs.clearProfileFilter": "$(clear-all) Clear filter for profile" } diff --git a/packages/zowe-explorer/package.json b/packages/zowe-explorer/package.json index 056593e750..f9f02c027c 100644 --- a/packages/zowe-explorer/package.json +++ b/packages/zowe-explorer/package.json @@ -766,6 +766,12 @@ "title": "%cancelJobs%", "category": "Zowe Explorer" }, + { + "command": "zowe.jobs.filterJobs", + "title": "Filter Jobs", + "category": "Zowe Explorer", + "icon": "$(list-filter)" + }, { "command": "zowe.jobs.search", "title": "%jobs.search%", @@ -1229,6 +1235,11 @@ "command": "zowe.jobs.removeSearchFavorite", "group": "inline" }, + { + "when": "view == zowe.jobs.explorer && viewItem =~ /^(?!.*_fav.*)server.*/ && !listMultiSelection", + "command": "zowe.jobs.filterJobs", + "group": "inline" + }, { "when": "view == zowe.jobs.explorer && viewItem =~ /^(?!.*_fav.*)server.*/ && !listMultiSelection", "command": "zowe.jobs.search", @@ -1284,6 +1295,11 @@ "command": "zowe.jobs.addFavorite", "group": "002_zowe_jobsWorkspace@0" }, + { + "when": "view == zowe.jobs.explorer && viewItem =~ /^(?!.*_fav.*)server.*/ && !listMultiSelection", + "command": "zowe.jobs.filterJobs", + "group": "002_zowe_jobsProfileModification@99" + }, { "when": "view == zowe.jobs.explorer && viewItem =~ /^job.*_fav.*/", "command": "zowe.jobs.removeFavorite", diff --git a/packages/zowe-explorer/src/globals.ts b/packages/zowe-explorer/src/globals.ts index f52ae42730..77ab8403d4 100644 --- a/packages/zowe-explorer/src/globals.ts +++ b/packages/zowe-explorer/src/globals.ts @@ -35,7 +35,7 @@ export let DS_DIR: string; export let CONFIG_PATH; // set during activate export let ISTHEIA = false; // set during activate export let LOG: imperative.Logger; -export const COMMAND_COUNT = 115; +export const COMMAND_COUNT = 116; export const MAX_SEARCH_HISTORY = 5; export const MAX_FILE_HISTORY = 10; export const MS_PER_SEC = 1000; diff --git a/packages/zowe-explorer/src/job/ZosJobsProvider.ts b/packages/zowe-explorer/src/job/ZosJobsProvider.ts index 4346b4abab..d5f8bed4f7 100644 --- a/packages/zowe-explorer/src/job/ZosJobsProvider.ts +++ b/packages/zowe-explorer/src/job/ZosJobsProvider.ts @@ -29,6 +29,8 @@ import SpoolProvider, { encodeJobFile } from "../SpoolProvider"; import { Poller } from "@zowe/zowe-explorer-api/src/utils"; import { PollDecorator } from "../utils/DecorationProviders"; import { TreeViewUtils } from "../utils/TreeViewUtils"; +import { TreeProviders } from "../shared/TreeProviders"; +import { JOB_FILTER_OPTS } from "./utils"; // Set up localization nls.config({ @@ -1158,6 +1160,66 @@ export class ZosJobsProvider extends ZoweTreeProvider implements IZoweTree { + if (job.collapsibleState === vscode.TreeItemCollapsibleState.Collapsed) { + Gui.infoMessage(localize("filterJobs.message", "Use the search button to display jobs")); + return; + } + const selection = await Gui.showQuickPick(JOB_FILTER_OPTS, { + placeHolder: localize("filterJobs.placeholder", "Set a filter..."), + }); + const filterMethod = JOB_FILTER_OPTS.indexOf(selection); + + const isSession = contextually.isSession(job); + const userDismissed = filterMethod < 0; + if (userDismissed || selection === "$(clear-all) Clear filter for profile") { + if (selection === "$(clear-all) Clear filter for profile") { + this.updateFilterForJob(job, null, isSession); + Gui.setStatusBarMessage(localize("filter.cleared", "$(check) Filter cleared for {0}", job.label as string), globals.MS_PER_SEC * 4); + } + return; + } + if (!("filter" in job) && !("actualJobs" in job)) { + job.actualJobs = job["children"]; + } + this.nodeDataChanged(job); + + job.description = ""; + const actual_jobs: IZoweJobTreeNode[] = job["actualJobs"]; + const inputBox = await vscode.window.createInputBox(); + inputBox.placeholder = localize("filterJobs.prompt.message", "Enter local filter..."); + inputBox.onDidChangeValue((query) => { + query = query.toUpperCase(); + job["children"] = actual_jobs.filter((item) => `${item["job"].jobname}(${item["job"].jobid}) - ${item["job"].retcode}`.includes(query)); + TreeProviders.job.refresh(); + this.updateFilterForJob(job, query, isSession); + Gui.setStatusBarMessage(localize("filter.updated", "$(check) Filter updated for {0}", job.label as string), globals.MS_PER_SEC * 4); + }); + job.children = actual_jobs; + this.nodeDataChanged(job); + inputBox.onDidAccept(() => { + inputBox.hide(); + }); + inputBox.show(); + return inputBox; + } } /** diff --git a/packages/zowe-explorer/src/job/init.ts b/packages/zowe-explorer/src/job/init.ts index 0a334b4613..22208c7388 100644 --- a/packages/zowe-explorer/src/job/init.ts +++ b/packages/zowe-explorer/src/job/init.ts @@ -172,6 +172,12 @@ export async function initJobsProvider(context: vscode.ExtensionContext): Promis }) ); context.subscriptions.push(vscode.commands.registerCommand("zowe.jobs.sortBy", async (job) => jobActions.sortJobs(job, jobsProvider))); + context.subscriptions.push( + vscode.commands.registerCommand( + "zowe.jobs.filterJobs", + async (job: IZoweJobTreeNode): Promise => jobsProvider.filterJobsDialog(job) + ) + ); initSubscribers(context, jobsProvider); return jobsProvider; } diff --git a/packages/zowe-explorer/src/job/utils.ts b/packages/zowe-explorer/src/job/utils.ts index 9747139144..84157e52cd 100644 --- a/packages/zowe-explorer/src/job/utils.ts +++ b/packages/zowe-explorer/src/job/utils.ts @@ -37,6 +37,11 @@ export const JOB_SORT_KEYS: Record { ZoweLogger.trace("job.utils.resolveQuickPickHelper called."); return new Promise((c) => { From f3929e91c47d6f763ecc9f82d05fdc8574864c0e Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Wed, 29 Nov 2023 12:58:17 -0500 Subject: [PATCH 41/76] add ability to add profile to all trees Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../zowe-explorer-api/src/tree/IZoweTree.ts | 16 ++- .../__mocks__/mockCreators/shared.ts | 4 + .../__theia__/theia/extension.theiaChrome.ts | 6 + .../__theia__/theia/extension.theiaFirefox.ts | 6 + .../__unit__/Profiles.extended.unit.test.ts | 8 +- .../__unit__/dataset/DatasetTree.unit.test.ts | 13 ++ .../__unit__/job/ZoweJobNode.unit.test.ts | 7 +- .../__unit__/uss/USSTree.unit.test.ts | 6 + .../utils/ProfileManagement.unit.test.ts | 1 + packages/zowe-explorer/src/Profiles.ts | 23 ++- .../src/abstract/ZoweTreeProvider.ts | 78 +++++++++- .../zowe-explorer/src/dataset/DatasetTree.ts | 115 +++++---------- .../zowe-explorer/src/job/ZosJobsProvider.ts | 114 +++++---------- packages/zowe-explorer/src/uss/USSTree.ts | 136 ++++++------------ .../src/utils/ProfileManagement.ts | 54 ++++--- 15 files changed, 299 insertions(+), 288 deletions(-) diff --git a/packages/zowe-explorer-api/src/tree/IZoweTree.ts b/packages/zowe-explorer-api/src/tree/IZoweTree.ts index 55ec8d8b0a..977d3e5e0c 100644 --- a/packages/zowe-explorer-api/src/tree/IZoweTree.ts +++ b/packages/zowe-explorer-api/src/tree/IZoweTree.ts @@ -10,6 +10,7 @@ */ import * as vscode from "vscode"; +import { imperative } from "@zowe/cli"; import { IZoweTreeNode } from "./IZoweTreeNode"; import { DataSetAllocTemplate, PersistenceSchemaEnum } from "../profiles/UserSettings"; @@ -63,14 +64,27 @@ export interface IZoweTree extends vscode.TreeDataProvider { * Adds a session to the container * @param sessionName * @param type e.g. zosmf + * @param provider tree provider to add to, undefined will add for all */ - addSession(sessionName?: string, type?: string): Promise; + addSession(sessionName?: string, type?: string, provider?: IZoweTree): Promise; + + /** + * Adds a single session to the tree + * @param profile the profile to add to the tree + */ + addSingleSession(profile: imperative.IProfileLoaded): Promise; + /** * Edit a session to the container * @param node This parameter identifies the node that needs to be called */ editSession(node: IZoweTreeNode, zoweFileProvider: IZoweTree): Promise; + /** + * Get sessions from persistent object of provider + */ + getSessions(): string[]; + /** * Add a new session to the container * @param zoweFileProvider The tree to which the profile should be added diff --git a/packages/zowe-explorer/__mocks__/mockCreators/shared.ts b/packages/zowe-explorer/__mocks__/mockCreators/shared.ts index d61f013411..f8bf718380 100644 --- a/packages/zowe-explorer/__mocks__/mockCreators/shared.ts +++ b/packages/zowe-explorer/__mocks__/mockCreators/shared.ts @@ -281,6 +281,7 @@ export function createTreeView(selection?): vscode.TreeView { visible: true, onDidChangeVisibility: jest.fn(), dispose: jest.fn(), + addSingleSession: jest.fn(), } as unknown as vscode.TreeView; } @@ -587,6 +588,7 @@ export function createTreeProviders() { deleteSession: jest.fn(), removeSession: jest.fn(), refresh: jest.fn(), + addSingleSession: jest.fn(), } as any, uss: { mSessionNodes: [ @@ -596,6 +598,7 @@ export function createTreeProviders() { deleteSession: jest.fn(), removeSession: jest.fn(), refresh: jest.fn(), + addSingleSession: jest.fn(), } as any, job: { mSessionNodes: [ @@ -605,6 +608,7 @@ export function createTreeProviders() { removeSession: jest.fn(), deleteSession: jest.fn(), refresh: jest.fn(), + addSingleSession: jest.fn(), } as any, }; } diff --git a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts index 287c1fc772..5867a5de3c 100644 --- a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts +++ b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts @@ -325,6 +325,9 @@ export async function addProfileDetails(profileName: string) { await driverChrome.sleep(SHORTSLEEPTIME); const responseTimeout = await driverChrome.findElement(By.xpath(DatasetsLocators.emptyInputBoxXpath)); responseTimeout.sendKeys(Key.ENTER); + const addToTrees = await driverChrome.findElement(By.xpath(DatasetsLocators.emptyInputBoxXpath)); + addToTrees.sendKeys("No"); + addToTrees.sendKeys(Key.ENTER); } export async function clickOnDatasetsPanel() { await driverChrome.findElement(By.id(DatasetsLocators.datasetsPanelId)).click(); @@ -332,6 +335,9 @@ export async function clickOnDatasetsPanel() { export async function clickOnAddSessionInDatasets() { await driverChrome.findElement(By.id(DatasetsLocators.datasetsAddSessionId)).click(); + const addToTrees = await driverChrome.findElement(By.xpath(DatasetsLocators.emptyInputBoxXpath)); + addToTrees.sendKeys("No"); + addToTrees.sendKeys(Key.ENTER); } export async function getDatasetsDefaultProfilename() { diff --git a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts index 1f52bc1851..9432b37dce 100644 --- a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts +++ b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts @@ -72,12 +72,18 @@ export async function addProfileDetailsInUss(profileName: string) { const ussProfileName = await driverFirefox.findElement(By.xpath(UssLocators.emptyInputBoxXpath)); ussProfileName.sendKeys(profileName); ussProfileName.sendKeys(Key.ENTER); + const addToTrees = await driverFirefox.findElement(By.xpath(DatasetsLocators.emptyInputBoxXpath)); + addToTrees.sendKeys("No"); + addToTrees.sendKeys(Key.ENTER); } export async function addProfileDetailsInJobs(profileName: string) { const jobsProfileName = await driverFirefox.findElement(By.xpath(JobsLocators.emptyInputBoxXpath)); jobsProfileName.sendKeys(profileName); jobsProfileName.sendKeys(Key.ENTER); + const addToTrees = await driverFirefox.findElement(By.xpath(DatasetsLocators.emptyInputBoxXpath)); + addToTrees.sendKeys("No"); + addToTrees.sendKeys(Key.ENTER); } export async function getUssDefaultProfilename() { diff --git a/packages/zowe-explorer/__tests__/__unit__/Profiles.extended.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/Profiles.extended.unit.test.ts index a487e58eb9..3990c99224 100644 --- a/packages/zowe-explorer/__tests__/__unit__/Profiles.extended.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/Profiles.extended.unit.test.ts @@ -573,13 +573,19 @@ describe("Profiles Unit Tests - Function createZoweSession", () => { hide: jest.fn(), value: "test", } as any); - jest.spyOn(Gui, "resolveQuickPick").mockResolvedValueOnce(new utils.FilterDescriptor("Test")); + jest.spyOn(Gui, "resolveQuickPick").mockResolvedValueOnce(new utils.FilterDescriptor("Test1")); + jest.spyOn(Gui, "resolveQuickPick").mockResolvedValueOnce(new utils.FilterDescriptor("Test2")); jest.spyOn(Profiles.getInstance(), "getProfileInfo").mockResolvedValue({ usingTeamConfig: false, } as any); jest.spyOn(Gui, "showInputBox").mockResolvedValue("test"); jest.spyOn(Profiles.getInstance(), "createNewConnection").mockResolvedValue("Test"); const refreshSpy = jest.spyOn(Profiles.getInstance(), "refresh").mockImplementation(); + jest.spyOn(TreeProviders, "providers", "get").mockReturnValue({ + ds: { addSingleSession: jest.fn(), mSessionNodes: [...globalMocks.testUSSTree.mSessionNodes], refresh: jest.fn() } as any, + uss: { addSingleSession: jest.fn(), mSessionNodes: [...globalMocks.testUSSTree.mSessionNodes], refresh: jest.fn() } as any, + jobs: { addSingleSession: jest.fn(), mSessionNodes: [...globalMocks.testUSSTree.mSessionNodes], refresh: jest.fn() } as any, + } as any); await expect(Profiles.getInstance().createZoweSession(globalMocks.testUSSTree)).resolves.not.toThrow(); expect(refreshSpy).toBeCalledTimes(1); expect(spyInfo).toBeCalledWith("New profile created, test."); diff --git a/packages/zowe-explorer/__tests__/__unit__/dataset/DatasetTree.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/dataset/DatasetTree.unit.test.ts index 09f6d5a132..8a340affa0 100644 --- a/packages/zowe-explorer/__tests__/__unit__/dataset/DatasetTree.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/dataset/DatasetTree.unit.test.ts @@ -929,6 +929,12 @@ describe("Dataset Tree Unit Tests - Function addSession", () => { mocked(vscode.window.createTreeView).mockReturnValueOnce(blockMocks.treeView); const testTree = new DatasetTree(); testTree.mSessionNodes.push(blockMocks.datasetSessionNode); + jest.spyOn(testTree, "addSingleSession").mockImplementation(); + jest.spyOn(TreeProviders, "providers", "get").mockReturnValue({ + ds: { addSingleSession: jest.fn(), mSessionNodes: [blockMocks.datasetSessionNode], refresh: jest.fn() } as any, + uss: { addSingleSession: jest.fn(), mSessionNodes: [blockMocks.datasetSessionNode], refresh: jest.fn() } as any, + jobs: { addSingleSession: jest.fn(), mSessionNodes: [blockMocks.datasetSessionNode], refresh: jest.fn() } as any, + } as any); await testTree.addSession(blockMocks.imperativeProfile.name); expect(testTree.mSessionNodes[1].label).toBe(blockMocks.imperativeProfile.name); @@ -1553,6 +1559,13 @@ describe("Dataset Tree Unit Tests - Function datasetFilterPrompt", () => { ); favoriteSearch.contextValue = globals.DS_SESSION_CONTEXT + globals.FAV_SUFFIX; + jest.spyOn(testTree, "addSingleSession").mockImplementation(); + jest.spyOn(TreeProviders, "providers", "get").mockReturnValue({ + ds: { addSingleSession: jest.fn(), mSessionNodes: [blockMocks.datasetSessionNode], refresh: jest.fn() } as any, + uss: { addSingleSession: jest.fn(), mSessionNodes: [blockMocks.datasetSessionNode], refresh: jest.fn() } as any, + jobs: { addSingleSession: jest.fn(), mSessionNodes: [blockMocks.datasetSessionNode], refresh: jest.fn() } as any, + } as any); + await testTree.datasetFilterPrompt(favoriteSearch); expect(addSessionSpy).toHaveBeenLastCalledWith(blockMocks.datasetSessionNode.label.trim()); diff --git a/packages/zowe-explorer/__tests__/__unit__/job/ZoweJobNode.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/job/ZoweJobNode.unit.test.ts index b56f9f1d9e..3e2d253370 100644 --- a/packages/zowe-explorer/__tests__/__unit__/job/ZoweJobNode.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/job/ZoweJobNode.unit.test.ts @@ -219,9 +219,12 @@ describe("ZoweJobNode unit tests - Function createJobsTree", () => { describe("ZoweJobNode unit tests - Function addSession", () => { it("Tests that addSession adds the session to the tree", async () => { const globalMocks = await createGlobalMocks(); - + jest.spyOn(TreeProviders, "providers", "get").mockReturnValue({ + ds: { addSingleSession: jest.fn(), mSessionNodes: [...globalMocks.testJobsProvider.mSessionNodes], refresh: jest.fn() } as any, + uss: { addSingleSession: jest.fn(), mSessionNodes: [...globalMocks.testJobsProvider.mSessionNodes], refresh: jest.fn() } as any, + jobs: { addSingleSession: jest.fn(), mSessionNodes: [...globalMocks.testJobsProvider.mSessionNodes], refresh: jest.fn() } as any, + } as any); await globalMocks.testJobsProvider.addSession("sestest"); - expect(globalMocks.testJobsProvider.mSessionNodes[1]).toBeDefined(); expect(globalMocks.testJobsProvider.mSessionNodes[1].label).toEqual("sestest"); }); diff --git a/packages/zowe-explorer/__tests__/__unit__/uss/USSTree.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/uss/USSTree.unit.test.ts index 27acebaffc..074823f5e3 100644 --- a/packages/zowe-explorer/__tests__/__unit__/uss/USSTree.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/uss/USSTree.unit.test.ts @@ -184,6 +184,12 @@ async function createGlobalMocks() { value: jest.fn().mockReturnValue({ usingTeamConfig: false }), }); + jest.spyOn(TreeProviders, "providers", "get").mockReturnValue({ + ds: { addSingleSession: jest.fn(), mSessionNodes: [...globalMocks.testTree.mSessionNodes], refresh: jest.fn() } as any, + uss: { addSingleSession: jest.fn(), mSessionNodes: [...globalMocks.testTree.mSessionNodes], refresh: jest.fn() } as any, + jobs: { addSingleSession: jest.fn(), mSessionNodes: [...globalMocks.testTree.mSessionNodes], refresh: jest.fn() } as any, + } as any); + return globalMocks; } diff --git a/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts index 08608a6aef..a68fe568d8 100644 --- a/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts @@ -290,6 +290,7 @@ describe("ProfileManagement unit tests", () => { ProfileManagement["getPromptChangeForAllTreesOptions"]()[1] ); mocks.mockJobSessionNode.contextValue = globals.JOBS_SESSION_CONTEXT; + mocks.mockJobSessionNode.getLabel = jest.fn(() => "test"); await expect(ProfileManagement["handleHideProfiles"](mocks.mockJobSessionNode)).resolves.toEqual(undefined); expect(commandSpy).toHaveBeenCalledWith("zowe.jobs.removeSession", mocks.mockJobSessionNode, null, false); }); diff --git a/packages/zowe-explorer/src/Profiles.ts b/packages/zowe-explorer/src/Profiles.ts index eb7dd57606..3563ed5a12 100644 --- a/packages/zowe-explorer/src/Profiles.ts +++ b/packages/zowe-explorer/src/Profiles.ts @@ -38,6 +38,7 @@ import * as nls from "vscode-nls"; import { SettingsConfig } from "./utils/SettingsConfig"; import { ZoweLogger } from "./utils/LoggerUtils"; import { TreeProviders } from "./shared/TreeProviders"; +import { ProfileManagement } from "./utils/ProfileManagement"; // Set up localization nls.config({ @@ -458,13 +459,23 @@ export class Profiles extends ProfilesCache { await errorHandling(error, newprofile); } ZoweLogger.info(localize("createZoweSession.createNewProfile", "New profile created, {0}.", chosenProfile)); - await zoweFileProvider.addSession(newprofile); - await zoweFileProvider.refresh(); + + if (await this.shouldAddForAllTrees(newprofile)) { + await zoweFileProvider.addSession(newprofile); + } else { + await zoweFileProvider.addSession(newprofile, undefined, zoweFileProvider); + } + + zoweFileProvider.refresh(); } } } else if (chosenProfile) { ZoweLogger.info(localize("createZoweSession.addProfile", "The profile {0} has been added to the {1} tree.", chosenProfile, treeType)); - await zoweFileProvider.addSession(chosenProfile); + if (await this.shouldAddForAllTrees(chosenProfile)) { + await zoweFileProvider.addSession(chosenProfile); + } else { + await zoweFileProvider.addSession(chosenProfile, undefined, zoweFileProvider); + } } else { ZoweLogger.debug(debugMsg); } @@ -1905,4 +1916,10 @@ export class Profiles extends ProfilesCache { newConfig.autoStore = false; } } + + private async shouldAddForAllTrees(nodeName: string): Promise { + const [qpAll] = ProfileManagement.getPromptChangeForAllTreesOptions(); + const selection = await ProfileManagement.promptChangeForAllTrees(nodeName, true); + return selection?.label === qpAll.label; + } } diff --git a/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts b/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts index 9dca5d0a65..02470767ee 100644 --- a/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts +++ b/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts @@ -24,6 +24,7 @@ import { SettingsConfig } from "../utils/SettingsConfig"; import { ZoweLogger } from "../utils/LoggerUtils"; import { TreeProviders } from "../shared/TreeProviders"; import { IZoweProviders } from "../shared/init"; +import { resetValidationSettings } from "../shared/actions"; // Set up localization nls.config({ @@ -184,6 +185,18 @@ export class ZoweTreeProvider { return undefined; } + public async addSession(sessionName?: string, profileType?: string, provider?: IZoweTree): Promise { + ZoweLogger.trace("ZoweTreeProvider.addSession called."); + if (provider) { + await this.addSessionForProvider(sessionName, profileType, provider); + } else { + for (const key of Object.keys(TreeProviders.providers)) { + const tree = TreeProviders.providers[key]; + await this.addSessionForProvider(sessionName, profileType, tree); + } + } + } + public deleteSession(node: IZoweTreeNode, hideFromAllTrees?: boolean): void { ZoweLogger.trace("ZoweTreeProvider.deleteSession called."); if (hideFromAllTrees) { @@ -212,7 +225,7 @@ export class ZoweTreeProvider { } else { zoweFileProvider.deleteSession(node.getSessionNode()); this.mHistory.addSession(node.label as string); - await zoweFileProvider.addSession(node.getProfileName()); + await zoweFileProvider.addSession(node.getProfileName(), undefined, zoweFileProvider); } this.refresh(); // Remove the edited profile from profilesForValidation @@ -312,4 +325,67 @@ export class ZoweTreeProvider { provider.removeSession(node.getLabel() as string); provider.refresh(); } + + private async addSessionForProvider(sessionName?: string, profileType?: string, treeProvider?: IZoweTree): Promise { + const isUsingAutomaticProfileValidation: boolean = SettingsConfig.getDirectValue(globals.SETTINGS_AUTOMATIC_PROFILE_VALIDATION); + if (sessionName) { + await this.loadProfileBySessionName(sessionName, treeProvider, isUsingAutomaticProfileValidation); + } else { + await this.loadProfileByPersistedProfile(treeProvider, profileType, isUsingAutomaticProfileValidation); + } + treeProvider.refresh(); + } + + private async loadProfileBySessionName( + sessionName: string, + treeProvider: IZoweTree, + isUsingAutomaticProfileValidation: boolean + ): Promise { + const profile: imperative.IProfileLoaded = Profiles.getInstance().loadNamedProfile(sessionName.trim()); + if (profile) { + await treeProvider.addSingleSession(profile); + for (const node of treeProvider.mSessionNodes) { + if (node.label !== "Favorites") { + const name = node.getProfileName(); + if (name === profile.name) { + resetValidationSettings(node, isUsingAutomaticProfileValidation); + } + } + } + } + } + + private async loadProfileByPersistedProfile( + treeProvider: IZoweTree, + profileType: string, + isUsingAutomaticProfileValidation: boolean + ): Promise { + const profiles: imperative.IProfileLoaded[] = await Profiles.getInstance().fetchAllProfiles(); + if (profiles) { + for (const profile of profiles) { + if (!treeProvider.mSessionNodes.find((mSessionNode) => mSessionNode.label.toString().trim() === profile.name.trim())) { + for (const session of treeProvider.getSessions()) { + if (session && session.trim() === profile.name) { + await treeProvider.addSingleSession(profile); + for (const node of treeProvider.mSessionNodes) { + if (node.label !== "Favorites") { + const name = node.getProfileName(); + if (name === profile.name) { + resetValidationSettings(node, isUsingAutomaticProfileValidation); + } + } + } + } + } + } + } + } + if (treeProvider.mSessionNodes.length === 1) { + try { + await treeProvider.addSingleSession(Profiles.getInstance().getDefaultProfile(profileType)); + } catch (error) { + ZoweLogger.warn(error); + } + } + } } diff --git a/packages/zowe-explorer/src/dataset/DatasetTree.ts b/packages/zowe-explorer/src/dataset/DatasetTree.ts index bdd7004c75..36b39cd25f 100644 --- a/packages/zowe-explorer/src/dataset/DatasetTree.ts +++ b/packages/zowe-explorer/src/dataset/DatasetTree.ts @@ -39,7 +39,6 @@ import { getIconById, getIconByNode, IconId, IIconItem } from "../generators/ico import * as dayjs from "dayjs"; import * as fs from "fs"; import * as contextually from "../shared/context"; -import { resetValidationSettings } from "../shared/actions"; import { closeOpenedTextFile } from "../utils/workspace"; import { IDataSet, IListOptions, imperative } from "@zowe/cli"; import { DATASET_FILTER_OPTS, DATASET_SORT_OPTS, validateDataSetName, validateMemberName } from "./utils"; @@ -62,7 +61,7 @@ const localize: nls.LocalizeFunc = nls.loadMessageBundle(); export async function createDatasetTree(log: imperative.Logger): Promise { const tree = new DatasetTree(); tree.initializeFavorites(log); - await tree.addSession(); + await tree.addSession(undefined, undefined, tree); return tree; } @@ -424,57 +423,44 @@ export class DatasetTree extends ZoweTreeProvider implements IZoweTree { + public async addSession(sessionName?: string, profileType?: string, provider?: IZoweTree): Promise { ZoweLogger.trace("DatasetTree.addSession called."); - const setting: boolean = SettingsConfig.getDirectValue(globals.SETTINGS_AUTOMATIC_PROFILE_VALIDATION); - // Loads profile associated with passed sessionName, default if none passed - if (sessionName) { - const profile: imperative.IProfileLoaded = Profiles.getInstance().loadNamedProfile(sessionName); - if (profile) { - await this.addSingleSession(profile); - for (const node of this.mSessionNodes) { - if (node.label !== "Favorites") { - const name = node.getProfileName(); - if (name === profile.name) { - resetValidationSettings(node, setting); - } - } - } + await super.addSession(sessionName, profileType, provider); + } + + /** + * Adds a single session to the tree + * @param profile the profile to add to the tree + */ + public async addSingleSession(profile: imperative.IProfileLoaded): Promise { + ZoweLogger.trace("DatasetTree.addSingleSession called."); + if (profile) { + // If session is already added, do nothing + if (this.mSessionNodes.find((tNode) => tNode.label.toString() === profile.name)) { + return; } - } else { - const profiles: imperative.IProfileLoaded[] = await Profiles.getInstance().fetchAllProfiles(); - if (profiles) { - for (const theProfile of profiles) { - // If session is already added, do nothing - if (this.mSessionNodes.find((tempNode) => tempNode.label.toString() === theProfile.name)) { - continue; - } - for (const session of this.mHistory.getSessions()) { - if (session === theProfile.name) { - await this.addSingleSession(theProfile); - for (const node of this.mSessionNodes) { - if (node.label !== "Favorites") { - const name = node.getProfileName(); - if (name === theProfile.name) { - resetValidationSettings(node, setting); - } - } - } - } - } + // Uses loaded profile to create a session with the MVS API + let session: imperative.Session; + try { + session = ZoweExplorerApiRegister.getMvsApi(profile).getSession(); + } catch (err) { + if (err.toString().includes("hostname")) { + ZoweLogger.error(err); + } else { + await errorHandling(err, profile.name); } } - if (this.mSessionNodes.length === 1) { - try { - await this.addSingleSession(Profiles.getInstance().getDefaultProfile(profileType)); - } catch (error) { - // catch and log error of no default, - // if not type passed getDefaultProfile assumes zosmf - ZoweLogger.warn(error); - } + // Creates ZoweDatasetNode to track new session and pushes it to mSessionNodes + const node = new ZoweDatasetNode(profile.name, vscode.TreeItemCollapsibleState.Collapsed, null, session, undefined, undefined, profile); + node.contextValue = globals.DS_SESSION_CONTEXT + (profile.type !== "zosmf" ? `.profile=${profile.type}.` : ""); + await this.refreshHomeProfileContext(node); + const icon = getIconByNode(node); + if (icon) { + node.iconPath = icon.path; } + this.mSessionNodes.push(node); + this.mHistory.addSession(profile.name); } - this.refresh(); } /** @@ -1288,41 +1274,6 @@ export class DatasetTree extends ZoweTreeProvider implements IZoweTree { - ZoweLogger.trace("DatasetTree.addSingleSession called."); - if (profile) { - // If session is already added, do nothing - if (this.mSessionNodes.find((tNode) => tNode.label.toString() === profile.name)) { - return; - } - // Uses loaded profile to create a session with the MVS API - let session: imperative.Session; - try { - session = await ZoweExplorerApiRegister.getMvsApi(profile).getSession(); - } catch (err) { - if (err.toString().includes("hostname")) { - ZoweLogger.error(err); - } else { - await errorHandling(err, profile.name); - } - } - // Creates ZoweDatasetNode to track new session and pushes it to mSessionNodes - const node = new ZoweDatasetNode(profile.name, vscode.TreeItemCollapsibleState.Collapsed, null, session, undefined, undefined, profile); - node.contextValue = globals.DS_SESSION_CONTEXT + (profile.type !== "zosmf" ? `.profile=${profile.type}.` : ""); - await this.refreshHomeProfileContext(node); - const icon = getIconByNode(node); - if (icon) { - node.iconPath = icon.path; - } - this.mSessionNodes.push(node); - this.mHistory.addSession(profile.name); - } - } - /** * Sorts some (or all) PDS children nodes using the given sorting method. * @param node The session whose PDS members should be sorted, or a PDS whose children should be sorted diff --git a/packages/zowe-explorer/src/job/ZosJobsProvider.ts b/packages/zowe-explorer/src/job/ZosJobsProvider.ts index 4346b4abab..4d3e0fefa2 100644 --- a/packages/zowe-explorer/src/job/ZosJobsProvider.ts +++ b/packages/zowe-explorer/src/job/ZosJobsProvider.ts @@ -21,7 +21,6 @@ import { getAppName, sortTreeItems, jobStringValidator } from "../shared/utils"; import { ZoweTreeProvider } from "../abstract/ZoweTreeProvider"; import { getIconByNode } from "../generators/icons"; import * as contextually from "../shared/context"; -import { resetValidationSettings } from "../shared/actions"; import { SettingsConfig } from "../utils/SettingsConfig"; import { ZoweLogger } from "../utils/LoggerUtils"; import * as nls from "vscode-nls"; @@ -29,6 +28,7 @@ import SpoolProvider, { encodeJobFile } from "../SpoolProvider"; import { Poller } from "@zowe/zowe-explorer-api/src/utils"; import { PollDecorator } from "../utils/DecorationProviders"; import { TreeViewUtils } from "../utils/TreeViewUtils"; +import { IZoweTreeNode } from "@zowe/zowe-explorer-api"; // Set up localization nls.config({ @@ -71,7 +71,7 @@ export async function createJobsTree(log: imperative.Logger): Promise { + public async addSession(sessionName?: string, profileType?: string, provider?: IZoweTree): Promise { ZoweLogger.trace("ZosJobsProvider.addSession called."); - const setting: boolean = SettingsConfig.getDirectValue(globals.SETTINGS_AUTOMATIC_PROFILE_VALIDATION); - // Loads profile associated with passed sessionName, default if none passed - if (sessionName) { - const theProfile: imperative.IProfileLoaded = Profiles.getInstance().loadNamedProfile(sessionName); - if (theProfile) { - await this.addSingleSession(theProfile); - } - for (const node of this.mSessionNodes) { - const name = node.getProfileName(); - if (name === theProfile.name) { - await resetValidationSettings(node, setting); - } + await super.addSession(sessionName, profileType, provider); + } + + /** + * Adds a single session to the tree + * @param profile the profile to add to the tree + */ + public async addSingleSession(profile: imperative.IProfileLoaded): Promise { + ZoweLogger.trace("ZosJobsProvider.addSingleSession called."); + if (profile) { + // If session is already added, do nothing + if (this.mSessionNodes.find((tNode) => tNode.label.toString() === profile.name)) { + return; } - } else { - const allProfiles: imperative.IProfileLoaded[] = await Profiles.getInstance().fetchAllProfiles(); - if (allProfiles) { - for (const sessionProfile of allProfiles) { - // If session is already added, do nothing - if (this.mSessionNodes.find((tempNode) => tempNode.label.toString() === sessionProfile.name)) { - continue; - } - for (const session of this.mHistory.getSessions()) { - if (session === sessionProfile.name) { - await this.addSingleSession(sessionProfile); - for (const node of this.mSessionNodes) { - const name = node.getProfileName(); - if (name === sessionProfile.name) { - await resetValidationSettings(node, setting); - } - } - } - } + // Uses loaded profile to create a zosmf session with Zowe + let session: imperative.Session; + try { + session = ZoweExplorerApiRegister.getJesApi(profile).getSession(); + } catch (err) { + if (err.toString().includes("hostname")) { + ZoweLogger.error(err); + } else { + await errorHandling(err, profile.name); } } - if (this.mSessionNodes.length === 1) { - try { - await this.addSingleSession(Profiles.getInstance().getDefaultProfile(profileType)); - } catch (error) { - // catch and log error of no default, - // if not type passed getDefaultProfile assumes zosmf - ZoweLogger.warn(error); - } + // Creates ZoweNode to track new session and pushes it to mSessionNodes + const node = new Job(profile.name, vscode.TreeItemCollapsibleState.Collapsed, null, session, null, profile); + node.contextValue = globals.JOBS_SESSION_CONTEXT; + await this.refreshHomeProfileContext(node); + const icon = getIconByNode(node); + if (icon) { + node.iconPath = icon.path; } + node.dirty = true; + this.mSessionNodes.push(node); + this.mHistory.addSession(profile.name); } - this.refresh(); } public async delete(node: IZoweJobTreeNode): Promise { @@ -1028,42 +1020,6 @@ export class ZosJobsProvider extends ZoweTreeProvider implements IZoweTree { - ZoweLogger.trace("ZosJobsProvider.addSingleSession called."); - if (profile) { - // If session is already added, do nothing - if (this.mSessionNodes.find((tNode) => tNode.label.toString() === profile.name)) { - return; - } - // Uses loaded profile to create a zosmf session with Zowe - let session: imperative.Session; - try { - session = await ZoweExplorerApiRegister.getJesApi(profile).getSession(); - } catch (err) { - if (err.toString().includes("hostname")) { - ZoweLogger.error(err); - } else { - await errorHandling(err, profile.name); - } - } - // Creates ZoweNode to track new session and pushes it to mSessionNodes - const node = new Job(profile.name, vscode.TreeItemCollapsibleState.Collapsed, null, session, null, profile); - node.contextValue = globals.JOBS_SESSION_CONTEXT; - await this.refreshHomeProfileContext(node); - const icon = getIconByNode(node); - if (icon) { - node.iconPath = icon.path; - } - node.dirty = true; - this.mSessionNodes.push(node); - this.mHistory.addSession(profile.name); - } - } - /** * Given user-provided input, determine whether the input is a valid polling interval. * @param value The polling interval provided by the user diff --git a/packages/zowe-explorer/src/uss/USSTree.ts b/packages/zowe-explorer/src/uss/USSTree.ts index ce76ec0e31..de4f774e41 100644 --- a/packages/zowe-explorer/src/uss/USSTree.ts +++ b/packages/zowe-explorer/src/uss/USSTree.ts @@ -24,10 +24,9 @@ import { getIconByNode } from "../generators/icons"; import * as contextually from "../shared/context"; import * as nls from "vscode-nls"; -import { resetValidationSettings } from "../shared/actions"; -import { SettingsConfig } from "../utils/SettingsConfig"; import { ZoweLogger } from "../utils/LoggerUtils"; import { TreeViewUtils } from "../utils/TreeViewUtils"; +import { IZoweTreeNode } from "@zowe/zowe-explorer-api"; // Set up localization nls.config({ @@ -45,7 +44,7 @@ export async function createUSSTree(log: imperative.Logger): Promise { ZoweLogger.trace("uss.USSTree.createUSSTree called."); const tree = new USSTree(); await tree.initializeFavorites(log); - await tree.addSession(); + await tree.addSession(undefined, undefined, tree); return tree; } @@ -309,54 +308,55 @@ export class USSTree extends ZoweTreeProvider implements IZoweTree { + public async addSession(sessionName?: string, profileType?: string, provider?: IZoweTree): Promise { ZoweLogger.trace("USSTree.addSession called."); - const setting: boolean = SettingsConfig.getDirectValue(globals.SETTINGS_AUTOMATIC_PROFILE_VALIDATION); - // Loads profile associated with passed sessionName, persisted profiles or default if none passed - if (sessionName) { - const profile: imperative.IProfileLoaded = Profiles.getInstance().loadNamedProfile(sessionName.trim()); - - if (profile) { - await this.addSingleSession(profile); - for (const node of this.mSessionNodes) { - const name = node.getProfileName(); - if (name === profile.name) { - await resetValidationSettings(node, setting); - } - } + await super.addSession(sessionName, profileType, provider); + } + + /** + * Adds a single session to the tree + * @param profile the profile to add to the tree + */ + public async addSingleSession(profile: imperative.IProfileLoaded): Promise { + ZoweLogger.trace("USSTree.addSingleSession called."); + if (profile) { + // If session is already added, do nothing + if (this.mSessionNodes.find((tNode) => tNode.label.toString() === profile.name)) { + return; } - } else { - const profiles: imperative.IProfileLoaded[] = await Profiles.getInstance().fetchAllProfiles(); - if (profiles) { - for (const theProfile of profiles) { - // If session is already added, do nothing - if (this.mSessionNodes.find((tempNode) => tempNode.label.toString().trim() === theProfile.name.trim())) { - continue; - } - for (const session of this.mHistory.getSessions()) { - if (session && session.trim() === theProfile.name) { - await this.addSingleSession(theProfile); - for (const node of this.mSessionNodes) { - const name = node.getProfileName(); - if (name === theProfile.name) { - await resetValidationSettings(node, setting); - } - } - } - } + // Uses loaded profile to create a session with the USS API + let session: imperative.Session; + try { + session = ZoweExplorerApiRegister.getUssApi(profile).getSession(); + } catch (err) { + if (err.toString().includes("hostname")) { + ZoweLogger.error(err); + } else { + await errorHandling(err, profile.name); } } - if (this.mSessionNodes.length === 1) { - try { - await this.addSingleSession(Profiles.getInstance().getDefaultProfile(profileType)); - } catch (error) { - // catch and log error of no default, - // if not type passed getDefaultProfile assumes zosmf - ZoweLogger.warn(error); - } + // Creates ZoweNode to track new session and pushes it to mSessionNodes + const node = new ZoweUSSNode( + profile.name, + vscode.TreeItemCollapsibleState.Collapsed, + null, + session, + null, + false, + profile.name, + null, + profile + ); + node.contextValue = globals.USS_SESSION_CONTEXT; + await this.refreshHomeProfileContext(node); + const icon = getIconByNode(node); + if (icon) { + node.iconPath = icon.path; } + node.dirty = true; + this.mSessionNodes.push(node); + this.mHistory.addSession(profile.name); } - this.refresh(); } /** @@ -932,50 +932,4 @@ export class USSTree extends ZoweTreeProvider implements IZoweTree { - ZoweLogger.trace("USSTree.addSingleSession called."); - if (profile) { - // If session is already added, do nothing - if (this.mSessionNodes.find((tNode) => tNode.label.toString() === profile.name)) { - return; - } - // Uses loaded profile to create a session with the USS API - let session: imperative.Session; - try { - session = await ZoweExplorerApiRegister.getUssApi(profile).getSession(); - } catch (err) { - if (err.toString().includes("hostname")) { - ZoweLogger.error(err); - } else { - await errorHandling(err, profile.name); - } - } - // Creates ZoweNode to track new session and pushes it to mSessionNodes - const node = new ZoweUSSNode( - profile.name, - vscode.TreeItemCollapsibleState.Collapsed, - null, - session, - null, - false, - profile.name, - null, - profile - ); - node.contextValue = globals.USS_SESSION_CONTEXT; - await this.refreshHomeProfileContext(node); - const icon = getIconByNode(node); - if (icon) { - node.iconPath = icon.path; - } - node.dirty = true; - this.mSessionNodes.push(node); - this.mHistory.addSession(profile.name); - } - } } diff --git a/packages/zowe-explorer/src/utils/ProfileManagement.ts b/packages/zowe-explorer/src/utils/ProfileManagement.ts index ba82f4d64d..b34614ee09 100644 --- a/packages/zowe-explorer/src/utils/ProfileManagement.ts +++ b/packages/zowe-explorer/src/utils/ProfileManagement.ts @@ -133,6 +133,31 @@ export class ProfileManagement { description: localize("logoutQpItem.logout.qpDetail", "Log out to invalidate and remove stored token value"), }, }; + public static getPromptChangeForAllTreesOptions(): vscode.QuickPickItem[] { + const qpItemAll: vscode.QuickPickItem = { + label: localize("ProfileManagement.getPromptChangeForAllTreesOptions.allLbl", "Yes"), + description: localize("ProfileManagement.getPromptChangeForAllTreesOptions.allDesc", "Apply to all trees"), + }; + const qpItemCurrent: vscode.QuickPickItem = { + label: localize("ProfileManagement.getPromptChangeForAllTreesOptions.currentLbl", "No"), + description: localize("ProfileManagement.getPromptChangeForAllTreesOptions.currentDesc", "Apply to current tree selected"), + }; + return [qpItemAll, qpItemCurrent]; + } + public static async promptChangeForAllTrees(nodeName: string, checkPresence: boolean): Promise { + const [qpItemAll, qpItemCurrent] = this.getPromptChangeForAllTreesOptions(); + if (TreeProviders.sessionIsPresentInOtherTrees(nodeName) === checkPresence) { + return qpItemCurrent; + } + const qp = Gui.createQuickPick(); + qp.placeholder = localize("ProfileManagement.promptChangeForAllTrees.howToChange", "Do you wish to apply this for all trees?"); + qp.items = [qpItemAll, qpItemCurrent]; + qp.activeItems = [qp.items[0]]; + qp.show(); + const selection = await Gui.resolveQuickPick(qp); + qp.hide(); + return selection; + } private static async setupProfileManagementQp(managementType: string, node: IZoweTreeNode): Promise { const profile = node.getProfile(); const qp = Gui.createQuickPick(); @@ -264,35 +289,8 @@ export class ProfileManagement { await vscode.commands.executeCommand("zowe.ds.deleteProfile", node); } - private static getPromptChangeForAllTreesOptions(): vscode.QuickPickItem[] { - const qpItemAll: vscode.QuickPickItem = { - label: localize("ProfileManagement.getPromptChangeForAllTreesOptions.allLbl", "Yes"), - description: localize("ProfileManagement.getPromptChangeForAllTreesOptions.allDesc", "Apply to all trees"), - }; - const qpItemCurrent: vscode.QuickPickItem = { - label: localize("ProfileManagement.getPromptChangeForAllTreesOptions.currentLbl", "No"), - description: localize("ProfileManagement.getPromptChangeForAllTreesOptions.currentDesc", "Apply to current tree selected"), - }; - return [qpItemAll, qpItemCurrent]; - } - - private static async promptChangeForAllTrees(node: IZoweTreeNode): Promise { - const [qpItemAll, qpItemCurrent] = this.getPromptChangeForAllTreesOptions(); - if (!TreeProviders.sessionIsPresentInOtherTrees(node.getLabel().toString())) { - return qpItemCurrent; - } - const qp = Gui.createQuickPick(); - qp.placeholder = localize("ProfileManagement.promptChangeForAllTrees.howToChange", "Do you wish to apply this for all trees?"); - qp.items = [qpItemAll, qpItemCurrent]; - qp.activeItems = [qp.items[0]]; - qp.show(); - const selection = await Gui.resolveQuickPick(qp); - qp.hide(); - return selection; - } - private static async handleChangeForAllTrees(node: IZoweTreeNode): Promise { - const selection = await this.promptChangeForAllTrees(node); + const selection = await this.promptChangeForAllTrees(node.getLabel().toString(), false); if (!selection) { return; } From d341c867b9024601ddb5f8d2643c572a67bfba86 Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Wed, 29 Nov 2023 13:01:05 -0500 Subject: [PATCH 42/76] run prepublish Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../i18n/sample/src/utils/ProfileManagement.i18n.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/zowe-explorer/i18n/sample/src/utils/ProfileManagement.i18n.json b/packages/zowe-explorer/i18n/sample/src/utils/ProfileManagement.i18n.json index 986da68bd8..79b2dd6a84 100644 --- a/packages/zowe-explorer/i18n/sample/src/utils/ProfileManagement.i18n.json +++ b/packages/zowe-explorer/i18n/sample/src/utils/ProfileManagement.i18n.json @@ -1,13 +1,13 @@ { - "profiles.operation.cancelled": "Operation Cancelled", - "qpPlaceholders.qp.basic": "Profile {0} is using basic authentication. Choose a profile action.", - "qpPlaceholders.qp.token": "Profile {0} is using token authentication. Choose a profile action.", - "qpPlaceholders.qp.choose": "Profile {0} doesn't specify an authentication method. Choose a profile action.", "ProfileManagement.getPromptChangeForAllTreesOptions.allLbl": "Yes", "ProfileManagement.getPromptChangeForAllTreesOptions.allDesc": "Apply to all trees", "ProfileManagement.getPromptChangeForAllTreesOptions.currentLbl": "No", "ProfileManagement.getPromptChangeForAllTreesOptions.currentDesc": "Apply to current tree selected", "ProfileManagement.promptChangeForAllTrees.howToChange": "Do you wish to apply this for all trees?", + "profiles.operation.cancelled": "Operation Cancelled", + "qpPlaceholders.qp.basic": "Profile {0} is using basic authentication. Choose a profile action.", + "qpPlaceholders.qp.token": "Profile {0} is using token authentication. Choose a profile action.", + "qpPlaceholders.qp.choose": "Profile {0} doesn't specify an authentication method. Choose a profile action.", "ProfileManagement.handleHideProfiles.cancelled": "Operation Cancelled", "addBasicAuthQpItem.addCredentials.qpLabel": "$(plus) Add Credentials", "addBasicAuthQpItem.addCredentials.qpDetail": "Add username and password for basic authentication", From 1cef5c19dbed64419662e94d407e2cc37ef3b013 Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Wed, 29 Nov 2023 13:02:31 -0500 Subject: [PATCH 43/76] address code smells Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- packages/zowe-explorer/src/job/ZosJobsProvider.ts | 3 +-- packages/zowe-explorer/src/uss/USSTree.ts | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/zowe-explorer/src/job/ZosJobsProvider.ts b/packages/zowe-explorer/src/job/ZosJobsProvider.ts index 4d3e0fefa2..d83f822588 100644 --- a/packages/zowe-explorer/src/job/ZosJobsProvider.ts +++ b/packages/zowe-explorer/src/job/ZosJobsProvider.ts @@ -12,7 +12,7 @@ import * as vscode from "vscode"; import * as globals from "../globals"; import { IJob, imperative } from "@zowe/cli"; -import { Gui, ValidProfileEnum, IZoweTree, IZoweJobTreeNode, PersistenceSchemaEnum, NodeInteraction } from "@zowe/zowe-explorer-api"; +import { Gui, ValidProfileEnum, IZoweTree, IZoweTreeNode, IZoweJobTreeNode, PersistenceSchemaEnum, NodeInteraction } from "@zowe/zowe-explorer-api"; import { FilterItem, errorHandling } from "../utils/ProfilesUtils"; import { Profiles } from "../Profiles"; import { ZoweExplorerApiRegister } from "../ZoweExplorerApiRegister"; @@ -28,7 +28,6 @@ import SpoolProvider, { encodeJobFile } from "../SpoolProvider"; import { Poller } from "@zowe/zowe-explorer-api/src/utils"; import { PollDecorator } from "../utils/DecorationProviders"; import { TreeViewUtils } from "../utils/TreeViewUtils"; -import { IZoweTreeNode } from "@zowe/zowe-explorer-api"; // Set up localization nls.config({ diff --git a/packages/zowe-explorer/src/uss/USSTree.ts b/packages/zowe-explorer/src/uss/USSTree.ts index de4f774e41..373cf598fb 100644 --- a/packages/zowe-explorer/src/uss/USSTree.ts +++ b/packages/zowe-explorer/src/uss/USSTree.ts @@ -15,7 +15,7 @@ import * as path from "path"; import { imperative } from "@zowe/cli"; import { FilterItem, FilterDescriptor, errorHandling, syncSessionNode } from "../utils/ProfilesUtils"; import { sortTreeItems, getAppName, checkIfChildPath } from "../shared/utils"; -import { Gui, IZoweTree, IZoweUSSTreeNode, NodeInteraction, ValidProfileEnum, PersistenceSchemaEnum } from "@zowe/zowe-explorer-api"; +import { Gui, IZoweTree, IZoweTreeNode, IZoweUSSTreeNode, NodeInteraction, ValidProfileEnum, PersistenceSchemaEnum } from "@zowe/zowe-explorer-api"; import { Profiles } from "../Profiles"; import { ZoweExplorerApiRegister } from "../ZoweExplorerApiRegister"; import { ZoweUSSNode } from "./ZoweUSSNode"; @@ -26,7 +26,6 @@ import * as contextually from "../shared/context"; import * as nls from "vscode-nls"; import { ZoweLogger } from "../utils/LoggerUtils"; import { TreeViewUtils } from "../utils/TreeViewUtils"; -import { IZoweTreeNode } from "@zowe/zowe-explorer-api"; // Set up localization nls.config({ From c21212944b6771774e453c9b69bd69c7afe92b2e Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Wed, 29 Nov 2023 13:12:25 -0500 Subject: [PATCH 44/76] add changelog Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- packages/zowe-explorer-api/CHANGELOG.md | 1 + packages/zowe-explorer/CHANGELOG.md | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/zowe-explorer-api/CHANGELOG.md b/packages/zowe-explorer-api/CHANGELOG.md index 4133e271c3..ef38ef0696 100644 --- a/packages/zowe-explorer-api/CHANGELOG.md +++ b/packages/zowe-explorer-api/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to the "zowe-explorer-api" extension will be documented in t ### New features and enhancements - Added new optional boolean parameter `hideFromAllTrees` to `IZoweTree.deleteSession` for specifying whether to hide from all trees or current tree. [#2567](https://github.com/zowe/vscode-extension-for-zowe/issues/2567) +- Added new optional parameter `provider` of type `IZoweTree` for `IZoweTree.addSession` to specify a tree to add the profile to. ### Bug fixes diff --git a/packages/zowe-explorer/CHANGELOG.md b/packages/zowe-explorer/CHANGELOG.md index ab0f61df80..49fa60de30 100644 --- a/packages/zowe-explorer/CHANGELOG.md +++ b/packages/zowe-explorer/CHANGELOG.md @@ -9,6 +9,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen - Added support for hiding a Zowe profile across all trees [#2567](https://github.com/zowe/vscode-extension-for-zowe/issues/2567) - Added support for enabling/disabling validation for a Zowe profile across all trees [#2570](https://github.com/zowe/vscode-extension-for-zowe/issues/2570) - 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) ### Bug fixes From d2999cd6bd209ca0b06c21309752b8bf295ab566 Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Wed, 29 Nov 2023 14:33:18 -0500 Subject: [PATCH 45/76] fix broken theia check Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../__tests__/__theia__/theia/extension.theiaChrome.ts | 5 +---- .../__tests__/__theia__/theia/extension.theiaFirefox.ts | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts index 5867a5de3c..6512d64c5a 100644 --- a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts +++ b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts @@ -325,7 +325,7 @@ export async function addProfileDetails(profileName: string) { await driverChrome.sleep(SHORTSLEEPTIME); const responseTimeout = await driverChrome.findElement(By.xpath(DatasetsLocators.emptyInputBoxXpath)); responseTimeout.sendKeys(Key.ENTER); - const addToTrees = await driverChrome.findElement(By.xpath(DatasetsLocators.emptyInputBoxXpath)); + const addToTrees = driverChrome.wait(until.elementLocated(By.xpath(UssLocators.emptyInputBoxXpath)), WAITTIME); addToTrees.sendKeys("No"); addToTrees.sendKeys(Key.ENTER); } @@ -335,9 +335,6 @@ export async function clickOnDatasetsPanel() { export async function clickOnAddSessionInDatasets() { await driverChrome.findElement(By.id(DatasetsLocators.datasetsAddSessionId)).click(); - const addToTrees = await driverChrome.findElement(By.xpath(DatasetsLocators.emptyInputBoxXpath)); - addToTrees.sendKeys("No"); - addToTrees.sendKeys(Key.ENTER); } export async function getDatasetsDefaultProfilename() { diff --git a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts index 9432b37dce..0b0b6fb98c 100644 --- a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts +++ b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts @@ -72,7 +72,7 @@ export async function addProfileDetailsInUss(profileName: string) { const ussProfileName = await driverFirefox.findElement(By.xpath(UssLocators.emptyInputBoxXpath)); ussProfileName.sendKeys(profileName); ussProfileName.sendKeys(Key.ENTER); - const addToTrees = await driverFirefox.findElement(By.xpath(DatasetsLocators.emptyInputBoxXpath)); + const addToTrees = driverFirefox.wait(until.elementLocated(By.xpath(UssLocators.emptyInputBoxXpath)), WAITTIME); addToTrees.sendKeys("No"); addToTrees.sendKeys(Key.ENTER); } @@ -81,7 +81,7 @@ export async function addProfileDetailsInJobs(profileName: string) { const jobsProfileName = await driverFirefox.findElement(By.xpath(JobsLocators.emptyInputBoxXpath)); jobsProfileName.sendKeys(profileName); jobsProfileName.sendKeys(Key.ENTER); - const addToTrees = await driverFirefox.findElement(By.xpath(DatasetsLocators.emptyInputBoxXpath)); + const addToTrees = driverFirefox.wait(until.elementLocated(By.xpath(UssLocators.emptyInputBoxXpath)), WAITTIME); addToTrees.sendKeys("No"); addToTrees.sendKeys(Key.ENTER); } From 821526ac64ac693c76724af0f3fce6abcd7b8753 Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Wed, 29 Nov 2023 15:43:52 -0500 Subject: [PATCH 46/76] add code coverage Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../__theia__/theia/extension.theiaChrome.ts | 2 +- .../__theia__/theia/extension.theiaFirefox.ts | 2 +- .../abstract/ZoweTreeProvider.unit.test.ts | 45 ++++++++++++++++++- 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts index 6512d64c5a..52a07cee02 100644 --- a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts +++ b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts @@ -325,7 +325,7 @@ export async function addProfileDetails(profileName: string) { await driverChrome.sleep(SHORTSLEEPTIME); const responseTimeout = await driverChrome.findElement(By.xpath(DatasetsLocators.emptyInputBoxXpath)); responseTimeout.sendKeys(Key.ENTER); - const addToTrees = driverChrome.wait(until.elementLocated(By.xpath(UssLocators.emptyInputBoxXpath)), WAITTIME); + const addToTrees = driverChrome.wait(until.elementLocated(By.xpath(DatasetsLocators.emptyInputBoxXpath)), WAITTIME); addToTrees.sendKeys("No"); addToTrees.sendKeys(Key.ENTER); } diff --git a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts index 0b0b6fb98c..76c46ceab5 100644 --- a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts +++ b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts @@ -81,7 +81,7 @@ export async function addProfileDetailsInJobs(profileName: string) { const jobsProfileName = await driverFirefox.findElement(By.xpath(JobsLocators.emptyInputBoxXpath)); jobsProfileName.sendKeys(profileName); jobsProfileName.sendKeys(Key.ENTER); - const addToTrees = driverFirefox.wait(until.elementLocated(By.xpath(UssLocators.emptyInputBoxXpath)), WAITTIME); + const addToTrees = driverFirefox.wait(until.elementLocated(By.xpath(JobsLocators.emptyInputBoxXpath)), WAITTIME); addToTrees.sendKeys("No"); addToTrees.sendKeys(Key.ENTER); } diff --git a/packages/zowe-explorer/__tests__/__unit__/abstract/ZoweTreeProvider.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/abstract/ZoweTreeProvider.unit.test.ts index 0771a57f74..8665e4de7a 100644 --- a/packages/zowe-explorer/__tests__/__unit__/abstract/ZoweTreeProvider.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/abstract/ZoweTreeProvider.unit.test.ts @@ -31,6 +31,9 @@ import { SettingsConfig } from "../../../src/utils/SettingsConfig"; import { ZoweTreeProvider } from "../../../src/abstract/ZoweTreeProvider"; import { ZoweLogger } from "../../../src/utils/LoggerUtils"; import { createDatasetSessionNode } from "../../../__mocks__/mockCreators/datasets"; +import { TreeProviders } from "../../../src/shared/TreeProviders"; +import { createDatasetTree } from "../../../src/dataset/DatasetTree"; +import * as sharedActions from "../../../src/shared/actions"; async function createGlobalMocks() { const globalMocks = { @@ -49,6 +52,7 @@ async function createGlobalMocks() { testSession: createISession(), testResponse: createFileResponse({ items: [] }), testUSSTree: null, + testDSTree: null, testUSSNode: null, testSessionNode: null, testTreeProvider: new ZoweTreeProvider(PersistenceSchemaEnum.USS, null), @@ -191,13 +195,29 @@ describe("ZoweJobNode unit tests - Function editSession", () => { it("Tests that editSession is executed successfully ", async () => { const globalMocks = await createGlobalMocks(); const blockMocks = await createBlockMocks(globalMocks); - const checkSession = jest.spyOn(blockMocks.testJobsProvider, "editSession"); const spy = jest.spyOn(ZoweLogger, "trace"); await blockMocks.testJobsProvider.editSession(blockMocks.jobNode, globalMocks.testUSSTree); expect(globalMocks.mockEditSession).toHaveBeenCalled(); expect(spy).toBeCalled(); spy.mockClear(); }); + it("Tests that the session is edited and added to only the specific tree modified", async () => { + const globalMocks = await createGlobalMocks(); + const blockMocks = await createBlockMocks(globalMocks); + const deleteSessionForProviderSpy = jest.spyOn(ZoweTreeProvider.prototype as any, "deleteSessionForProvider"); + const mockJobProvider = { + addSingleSession: jest.fn(), + mSessionNodes: [blockMocks.jobNode], + refresh: jest.fn(), + removeSession: jest.fn(), + } as any; + jest.spyOn(TreeProviders, "providers", "get").mockReturnValue({ job: mockJobProvider } as any); + jest.spyOn(blockMocks.jobNode, "getSession").mockReturnValue(null); + blockMocks.jobNode.contextValue = globals.JOBS_SESSION_CONTEXT; + await blockMocks.testJobsProvider.editSession(blockMocks.jobNode, globalMocks.testUSSTree); + expect(globalMocks.mockEditSession).toHaveBeenCalled(); + expect(deleteSessionForProviderSpy).toBeCalledWith(blockMocks.jobNode, mockJobProvider); + }); }); describe("Tree Provider unit tests, function getTreeItem", () => { @@ -510,3 +530,26 @@ describe("Tree Provider Unit Tests - function ssoLogout", () => { expect(blockMocks.executeCommandSpy).not.toHaveBeenCalledWith("zowe.ds.refreshAll"); }); }); + +describe("Tree Provider Unit Tests - function loadProfileByPersistedProfile", () => { + it("should reset validation settings and warn the user of an error when loading default", async () => { + const globalMocks = await createGlobalMocks(); + globalMocks.testDSTree = createDatasetTree(imperative.Logger.getAppLogger()); + globalMocks.testDSTree.mSessionNodes = [ + { label: "profile1", getProfileName: (): string => "sestest" }, + { label: "profile2", getProfileName: (): string => "sestest" }, + ]; + globalMocks.testDSTree.getSessions = (): string[] => ["sestest"]; + globalMocks.testDSTree.addSingleSession = jest.fn(); + + const resetValidationSettingsSpy = jest.spyOn(sharedActions, "resetValidationSettings"); + resetValidationSettingsSpy.mockImplementation(); + + const zoweLoggerWarnSpy = jest.spyOn(ZoweLogger, "warn"); + + await expect(ZoweTreeProvider.prototype["loadProfileByPersistedProfile"](globalMocks.testDSTree, "zosmf", true)).resolves.not.toThrow(); + expect(globalMocks.testDSTree.addSingleSession).toBeCalledTimes(1); + expect(resetValidationSettingsSpy).toBeCalledTimes(2); + expect(zoweLoggerWarnSpy).toBeCalledTimes(2); + }); +}); From b67e45b9721527023258867ae0d09c139744f39f Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Wed, 29 Nov 2023 16:32:04 -0500 Subject: [PATCH 47/76] code cleanup Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../__theia__/theia/extension.theiaChrome.ts | 6 +++--- .../__theia__/theia/extension.theiaFirefox.ts | 4 ++-- .../__unit__/Profiles.extended.unit.test.ts | 18 ++++++++++++++++ packages/zowe-explorer/src/Profiles.ts | 10 ++------- .../src/utils/ProfileManagement.ts | 21 +++++++++---------- 5 files changed, 35 insertions(+), 24 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts index 52a07cee02..ef47178675 100644 --- a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts +++ b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts @@ -325,9 +325,9 @@ export async function addProfileDetails(profileName: string) { await driverChrome.sleep(SHORTSLEEPTIME); const responseTimeout = await driverChrome.findElement(By.xpath(DatasetsLocators.emptyInputBoxXpath)); responseTimeout.sendKeys(Key.ENTER); - const addToTrees = driverChrome.wait(until.elementLocated(By.xpath(DatasetsLocators.emptyInputBoxXpath)), WAITTIME); - addToTrees.sendKeys("No"); - addToTrees.sendKeys(Key.ENTER); + const addToAllTrees = await driverChrome.findElement(By.xpath(DatasetsLocators.emptyInputBoxXpath)); + addToAllTrees.sendKeys("No"); + addToAllTrees.sendKeys(Key.ENTER); } export async function clickOnDatasetsPanel() { await driverChrome.findElement(By.id(DatasetsLocators.datasetsPanelId)).click(); diff --git a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts index 76c46ceab5..b8b1844c57 100644 --- a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts +++ b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts @@ -72,7 +72,7 @@ export async function addProfileDetailsInUss(profileName: string) { const ussProfileName = await driverFirefox.findElement(By.xpath(UssLocators.emptyInputBoxXpath)); ussProfileName.sendKeys(profileName); ussProfileName.sendKeys(Key.ENTER); - const addToTrees = driverFirefox.wait(until.elementLocated(By.xpath(UssLocators.emptyInputBoxXpath)), WAITTIME); + const addToTrees = await driverFirefox.findElement(By.xpath(UssLocators.emptyInputBoxXpath)); addToTrees.sendKeys("No"); addToTrees.sendKeys(Key.ENTER); } @@ -81,7 +81,7 @@ export async function addProfileDetailsInJobs(profileName: string) { const jobsProfileName = await driverFirefox.findElement(By.xpath(JobsLocators.emptyInputBoxXpath)); jobsProfileName.sendKeys(profileName); jobsProfileName.sendKeys(Key.ENTER); - const addToTrees = driverFirefox.wait(until.elementLocated(By.xpath(JobsLocators.emptyInputBoxXpath)), WAITTIME); + const addToTrees = await driverFirefox.findElement(By.xpath(JobsLocators.emptyInputBoxXpath)); addToTrees.sendKeys("No"); addToTrees.sendKeys(Key.ENTER); } diff --git a/packages/zowe-explorer/__tests__/__unit__/Profiles.extended.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/Profiles.extended.unit.test.ts index e6a56de030..8b47427c98 100644 --- a/packages/zowe-explorer/__tests__/__unit__/Profiles.extended.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/Profiles.extended.unit.test.ts @@ -40,6 +40,7 @@ import * as path from "path"; import { SettingsConfig } from "../../src/utils/SettingsConfig"; import { ZoweLogger } from "../../src/utils/LoggerUtils"; import { TreeProviders } from "../../src/shared/TreeProviders"; +import { ProfileManagement } from "../../src/utils/ProfileManagement"; jest.mock("child_process"); jest.mock("fs"); @@ -581,6 +582,7 @@ describe("Profiles Unit Tests - Function createZoweSession", () => { jest.spyOn(Gui, "showInputBox").mockResolvedValue("test"); jest.spyOn(Profiles.getInstance(), "createNewConnection").mockResolvedValue("Test"); const refreshSpy = jest.spyOn(Profiles.getInstance(), "refresh").mockImplementation(); + jest.spyOn(ProfileManagement, "handleChangeForAllTrees").mockResolvedValue(true); jest.spyOn(TreeProviders, "providers", "get").mockReturnValue({ ds: { addSingleSession: jest.fn(), mSessionNodes: [...globalMocks.testUSSTree.mSessionNodes], refresh: jest.fn() } as any, uss: { addSingleSession: jest.fn(), mSessionNodes: [...globalMocks.testUSSTree.mSessionNodes], refresh: jest.fn() } as any, @@ -591,6 +593,22 @@ describe("Profiles Unit Tests - Function createZoweSession", () => { expect(spyInfo).toBeCalledWith("New profile created, test."); refreshSpy.mockClear(); spyInfo.mockClear(); + jest.spyOn(Gui, "resolveQuickPick").mockReset(); + }); + + it("Tests that createZoweSession runs successfully and uses the chosenProfile", async () => { + const globalMocks = await createGlobalMocks(); + jest.spyOn(Gui, "createQuickPick").mockReturnValue({ + show: jest.fn(), + hide: jest.fn(), + value: "test", + } as any); + jest.spyOn(Gui, "resolveQuickPick").mockResolvedValueOnce({ label: "test" }); + const spyInfo = jest.spyOn(ZoweLogger, "info"); + jest.spyOn(ProfileManagement, "handleChangeForAllTrees").mockResolvedValue(true); + await expect(Profiles.getInstance().createZoweSession(globalMocks.testUSSTree)).resolves.not.toThrow(); + expect(spyInfo).toBeCalledWith("The profile test has been added to the zowe.uss.history tree."); + spyInfo.mockClear(); }); it("Tests that createZoweSession catches error and log warning", async () => { diff --git a/packages/zowe-explorer/src/Profiles.ts b/packages/zowe-explorer/src/Profiles.ts index c210d2a3f7..30b283eb4c 100644 --- a/packages/zowe-explorer/src/Profiles.ts +++ b/packages/zowe-explorer/src/Profiles.ts @@ -440,7 +440,7 @@ export class Profiles extends ProfilesCache { } ZoweLogger.info(localize("createZoweSession.createNewProfile", "New profile created, {0}.", chosenProfile)); - if (await this.shouldAddForAllTrees(newprofile)) { + if (await ProfileManagement.handleChangeForAllTrees(newprofile, true)) { await zoweFileProvider.addSession(newprofile); } else { await zoweFileProvider.addSession(newprofile, undefined, zoweFileProvider); @@ -451,7 +451,7 @@ export class Profiles extends ProfilesCache { } } else if (chosenProfile) { ZoweLogger.info(localize("createZoweSession.addProfile", "The profile {0} has been added to the {1} tree.", chosenProfile, treeType)); - if (await this.shouldAddForAllTrees(chosenProfile)) { + if (await ProfileManagement.handleChangeForAllTrees(chosenProfile, true)) { await zoweFileProvider.addSession(chosenProfile); } else { await zoweFileProvider.addSession(chosenProfile, undefined, zoweFileProvider); @@ -1896,10 +1896,4 @@ export class Profiles extends ProfilesCache { newConfig.autoStore = false; } } - - private async shouldAddForAllTrees(nodeName: string): Promise { - const [qpAll] = ProfileManagement.getPromptChangeForAllTreesOptions(); - const selection = await ProfileManagement.promptChangeForAllTrees(nodeName, true); - return selection?.label === qpAll.label; - } } diff --git a/packages/zowe-explorer/src/utils/ProfileManagement.ts b/packages/zowe-explorer/src/utils/ProfileManagement.ts index cb1bd78dab..ac325b468a 100644 --- a/packages/zowe-explorer/src/utils/ProfileManagement.ts +++ b/packages/zowe-explorer/src/utils/ProfileManagement.ts @@ -144,7 +144,15 @@ export class ProfileManagement { }; return [qpItemAll, qpItemCurrent]; } - public static async promptChangeForAllTrees(nodeName: string, checkPresence: boolean): Promise { + public static async handleChangeForAllTrees(nodeName: string, checkPresence: boolean): Promise { + const selection = await this.promptChangeForAllTrees(nodeName, checkPresence); + if (!selection) { + return; + } + const [all] = this.getPromptChangeForAllTreesOptions(); + return selection.label === all.label; + } + private static async promptChangeForAllTrees(nodeName: string, checkPresence: boolean): Promise { const [qpItemAll, qpItemCurrent] = this.getPromptChangeForAllTreesOptions(); if (TreeProviders.sessionIsPresentInOtherTrees(nodeName) === checkPresence) { return qpItemCurrent; @@ -289,17 +297,8 @@ export class ProfileManagement { await vscode.commands.executeCommand("zowe.ds.deleteProfile", node); } - private static async handleChangeForAllTrees(node: IZoweTreeNode): Promise { - const selection = await this.promptChangeForAllTrees(node.getLabel().toString(), false); - if (!selection) { - return; - } - const [all] = this.getPromptChangeForAllTreesOptions(); - return selection.label === all.label; - } - private static async handleHideProfiles(node: IZoweTreeNode): Promise { - const shouldHideFromAllTrees = await this.handleChangeForAllTrees(node); + const shouldHideFromAllTrees = await this.handleChangeForAllTrees(node.getLabel().toString(), false); if (shouldHideFromAllTrees === undefined) { Gui.infoMessage(localize("ProfileManagement.handleHideProfiles.cancelled", "Operation Cancelled")); return; From 52c047211669113570291459421bad3cdfe2b7d9 Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Wed, 29 Nov 2023 16:59:49 -0500 Subject: [PATCH 48/76] additional code coverage Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../__theia__/theia/extension.theiaChrome.ts | 5 ++--- .../__theia__/theia/extension.theiaFirefox.ts | 10 ++++----- .../__unit__/dataset/DatasetTree.unit.test.ts | 22 +++++++++++++++++++ 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts index ef47178675..4720cfab9f 100644 --- a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts +++ b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts @@ -325,9 +325,8 @@ export async function addProfileDetails(profileName: string) { await driverChrome.sleep(SHORTSLEEPTIME); const responseTimeout = await driverChrome.findElement(By.xpath(DatasetsLocators.emptyInputBoxXpath)); responseTimeout.sendKeys(Key.ENTER); - const addToAllTrees = await driverChrome.findElement(By.xpath(DatasetsLocators.emptyInputBoxXpath)); - addToAllTrees.sendKeys("No"); - addToAllTrees.sendKeys(Key.ENTER); + responseTimeout.sendKeys("No"); + responseTimeout.sendKeys(Key.ENTER); } export async function clickOnDatasetsPanel() { await driverChrome.findElement(By.id(DatasetsLocators.datasetsPanelId)).click(); diff --git a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts index b8b1844c57..817e0a8f18 100644 --- a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts +++ b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts @@ -72,18 +72,16 @@ export async function addProfileDetailsInUss(profileName: string) { const ussProfileName = await driverFirefox.findElement(By.xpath(UssLocators.emptyInputBoxXpath)); ussProfileName.sendKeys(profileName); ussProfileName.sendKeys(Key.ENTER); - const addToTrees = await driverFirefox.findElement(By.xpath(UssLocators.emptyInputBoxXpath)); - addToTrees.sendKeys("No"); - addToTrees.sendKeys(Key.ENTER); + ussProfileName.sendKeys("No"); + ussProfileName.sendKeys(Key.ENTER); } export async function addProfileDetailsInJobs(profileName: string) { const jobsProfileName = await driverFirefox.findElement(By.xpath(JobsLocators.emptyInputBoxXpath)); jobsProfileName.sendKeys(profileName); jobsProfileName.sendKeys(Key.ENTER); - const addToTrees = await driverFirefox.findElement(By.xpath(JobsLocators.emptyInputBoxXpath)); - addToTrees.sendKeys("No"); - addToTrees.sendKeys(Key.ENTER); + jobsProfileName.sendKeys("No"); + jobsProfileName.sendKeys(Key.ENTER); } export async function getUssDefaultProfilename() { diff --git a/packages/zowe-explorer/__tests__/__unit__/dataset/DatasetTree.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/dataset/DatasetTree.unit.test.ts index 8a340affa0..2c6d67908c 100644 --- a/packages/zowe-explorer/__tests__/__unit__/dataset/DatasetTree.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/dataset/DatasetTree.unit.test.ts @@ -1065,6 +1065,28 @@ describe("USSTree Unit Tests - Function USSTree.addSingleSession()", () => { expect(blockMocks.testTree.mSessionNodes.length).toEqual(2); expect(blockMocks.testTree.mSessionNodes[1].profile.name).toEqual(blockMocks.testProfile.name); }); + + it("should log the error if the error includes the hostname", () => { + createGlobalMocks(); + const blockMocks = createBlockMocks(); + jest.spyOn(ZoweExplorerApiRegister.getMvsApi(blockMocks.testProfile), "getSession").mockImplementationOnce(() => { + throw new Error("test error hostname:sample.com"); + }); + const zoweLoggerErrorSpy = jest.spyOn(ZoweLogger, "error"); + expect(blockMocks.testTree.addSingleSession({ name: "test1234" })); + expect(zoweLoggerErrorSpy).toBeCalledTimes(1); + }); + + it("should call 'errorHandling()' if the error does not include the hostname", () => { + createGlobalMocks(); + const blockMocks = createBlockMocks(); + jest.spyOn(ZoweExplorerApiRegister.getMvsApi(blockMocks.testProfile), "getSession").mockImplementationOnce(() => { + throw new Error("test error"); + }); + const errorHandlingSpy = jest.spyOn(utils, "errorHandling"); + expect(blockMocks.testTree.addSingleSession({ name: "test1234" })); + expect(errorHandlingSpy).toBeCalledTimes(1); + }); }); describe("Dataset Tree Unit Tests - Function addFavorite", () => { From 313bb883f5ca0cd7082a1242befd3b90c1912b1f Mon Sep 17 00:00:00 2001 From: Trae Yelovich Date: Thu, 30 Nov 2023 10:51:46 -0500 Subject: [PATCH 49/76] DS/USS: Fix TypeError when saving w/ new search pattern Signed-off-by: Trae Yelovich --- .../zowe-explorer/src/dataset/DatasetTree.ts | 1 + packages/zowe-explorer/src/dataset/actions.ts | 10 ++++----- packages/zowe-explorer/src/dataset/init.ts | 8 +++++++ packages/zowe-explorer/src/uss/USSTree.ts | 1 + packages/zowe-explorer/src/uss/ZoweUSSNode.ts | 2 ++ packages/zowe-explorer/src/uss/actions.ts | 21 +++++++------------ packages/zowe-explorer/src/uss/init.ts | 8 +++++++ 7 files changed, 32 insertions(+), 19 deletions(-) diff --git a/packages/zowe-explorer/src/dataset/DatasetTree.ts b/packages/zowe-explorer/src/dataset/DatasetTree.ts index bdd7004c75..78f7170e97 100644 --- a/packages/zowe-explorer/src/dataset/DatasetTree.ts +++ b/packages/zowe-explorer/src/dataset/DatasetTree.ts @@ -86,6 +86,7 @@ export class DatasetTree extends ZoweTreeProvider implements IZoweTree; + public openFiles: Record = {}; public constructor() { super( diff --git a/packages/zowe-explorer/src/dataset/actions.ts b/packages/zowe-explorer/src/dataset/actions.ts index 4a89c1e7dc..5cc514a0a1 100644 --- a/packages/zowe-explorer/src/dataset/actions.ts +++ b/packages/zowe-explorer/src/dataset/actions.ts @@ -42,6 +42,7 @@ import { ProfileManagement } from "../utils/ProfileManagement"; // Set up localization import * as nls from "vscode-nls"; import { resolveFileConflict } from "../shared/actions"; +import { TreeProviders } from "../shared/TreeProviders"; nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone, @@ -524,6 +525,7 @@ export async function openPS( node.setEtag(response.apiResponse.etag); } statusMsg.dispose(); + TreeProviders.ds.openFiles[documentFilePath] = this; const document = await vscode.workspace.openTextDocument(getDocumentFilePath(label, node)); await api.Gui.showTextDocument(document, { preview: node.wasDoubleClicked != null ? !node.wasDoubleClicked : shouldPreview }); // discard ongoing action to allow new requests on this node @@ -1646,7 +1648,7 @@ export async function saveFile(doc: vscode.TextDocument, datasetProvider: api.IZ } else { return false; } - }); + }) ?? TreeProviders.ds.openFiles[doc.uri.fsPath]; // define upload options const uploadOptions: IUploadOptions = { @@ -1668,10 +1670,8 @@ export async function saveFile(doc: vscode.TextDocument, datasetProvider: api.IZ if (uploadResponse.success) { api.Gui.setStatusBarMessage(uploadResponse.commandResponse, globals.STATUS_BAR_TIMEOUT_MS); // set local etag with the new etag from the updated file on mainframe - if (node) { - node.setEtag(uploadResponse.apiResponse[0].etag); - setFileSaved(true); - } + node?.setEtag(uploadResponse.apiResponse[0].etag); + setFileSaved(true); } else if (!uploadResponse.success && uploadResponse.commandResponse.includes("Rest API failure with HTTP(S) status 412")) { resolveFileConflict(node, prof, doc, fileLabel, label); } else { diff --git a/packages/zowe-explorer/src/dataset/init.ts b/packages/zowe-explorer/src/dataset/init.ts index 6325a88557..d1646f962d 100644 --- a/packages/zowe-explorer/src/dataset/init.ts +++ b/packages/zowe-explorer/src/dataset/init.ts @@ -22,6 +22,7 @@ import { getSelectedNodeList } from "../shared/utils"; import { initSubscribers } from "../shared/init"; import { ZoweLogger } from "../utils/LoggerUtils"; import { TreeViewUtils } from "../utils/TreeViewUtils"; +import { TreeProviders } from "../shared/TreeProviders"; export async function initDatasetProvider(context: vscode.ExtensionContext): Promise { ZoweLogger.trace("dataset.init.initDatasetProvider called."); @@ -215,6 +216,13 @@ export async function initDatasetProvider(context: vscode.ExtensionContext): Pro await datasetProvider.onDidChangeConfiguration(e); }) ); + context.subscriptions.push( + vscode.workspace.onDidCloseTextDocument((doc) => { + if (doc.uri.fsPath.includes(globals.DS_DIR)) { + TreeProviders.ds.openFiles[doc.uri.fsPath] = null; + } + }) + ); initSubscribers(context, datasetProvider); return datasetProvider; diff --git a/packages/zowe-explorer/src/uss/USSTree.ts b/packages/zowe-explorer/src/uss/USSTree.ts index ce76ec0e31..4940d0c0c7 100644 --- a/packages/zowe-explorer/src/uss/USSTree.ts +++ b/packages/zowe-explorer/src/uss/USSTree.ts @@ -65,6 +65,7 @@ export class USSTree extends ZoweTreeProvider implements IZoweTree; public copying: Promise; + public openFiles: Record = {}; public constructor() { super( diff --git a/packages/zowe-explorer/src/uss/ZoweUSSNode.ts b/packages/zowe-explorer/src/uss/ZoweUSSNode.ts index d45252e6a7..09f7002b8c 100644 --- a/packages/zowe-explorer/src/uss/ZoweUSSNode.ts +++ b/packages/zowe-explorer/src/uss/ZoweUSSNode.ts @@ -25,6 +25,7 @@ import { closeOpenedTextFile } from "../utils/workspace"; import * as nls from "vscode-nls"; import { UssFileTree, UssFileType, UssFileUtils } from "./FileStructure"; import { ZoweLogger } from "../utils/LoggerUtils"; +import { TreeProviders } from "../shared/TreeProviders"; // Set up localization nls.config({ @@ -531,6 +532,7 @@ export class ZoweUSSNode extends ZoweTreeNode implements IZoweUSSTreeNode { ussFileProvider.addFileHistory(`[${this.getProfile().name}]: ${this.fullPath}`); ussFileProvider.getTreeView().reveal(this, { select: true, focus: true, expand: false }); + TreeProviders.uss.openFiles[documentFilePath] = this; await this.initializeFileOpening(documentFilePath, shouldPreview); } } catch (err) { diff --git a/packages/zowe-explorer/src/uss/actions.ts b/packages/zowe-explorer/src/uss/actions.ts index 0618ab58a4..b304b5031d 100644 --- a/packages/zowe-explorer/src/uss/actions.ts +++ b/packages/zowe-explorer/src/uss/actions.ts @@ -14,7 +14,7 @@ import { imperative, IZosFilesResponse } from "@zowe/cli"; import * as fs from "fs"; import * as globals from "../globals"; import * as path from "path"; -import { concatChildNodes, uploadContent, getSelectedNodeList, getDefaultUri, compareFileContent } from "../shared/utils"; +import { concatChildNodes, uploadContent, getSelectedNodeList, getDefaultUri } from "../shared/utils"; import { errorHandling } from "../utils/ProfilesUtils"; import { Gui, ValidProfileEnum, IZoweTree, IZoweUSSTreeNode } from "@zowe/zowe-explorer-api"; import { Profiles } from "../Profiles"; @@ -30,6 +30,7 @@ import { UssFileTree, UssFileType } from "./FileStructure"; import { ZoweLogger } from "../utils/LoggerUtils"; import { AttributeView } from "./AttributeView"; import { resolveFileConflict } from "../shared/actions"; +import { TreeProviders } from "../shared/TreeProviders"; // Set up localization nls.config({ @@ -305,23 +306,17 @@ export async function saveUSSFile(doc: vscode.TextDocument, ussFileProvider: IZo } // Get specific node based on label and parent tree (session / favorites) const nodes: IZoweUSSTreeNode[] = concatChildNodes(sesNode ? [sesNode] : ussFileProvider.mSessionNodes); - const node = nodes.find((zNode) => { + const node: IZoweUSSTreeNode = nodes.find((zNode) => { if (contextually.isText(zNode)) { return zNode.fullPath.trim() === remote; } else { return false; } - }); + }) ?? TreeProviders.uss.openFiles[doc.uri.fsPath]; // define upload options - let etagToUpload: string; - let returnEtag: boolean; - if (node) { - etagToUpload = node.getEtag(); - if (etagToUpload) { - returnEtag = true; - } - } + const etagToUpload = node?.getEtag(); + const returnEtag = etagToUpload != null; const prof = node?.getProfile() ?? profile; try { @@ -338,9 +333,7 @@ export async function saveUSSFile(doc: vscode.TextDocument, ussFileProvider: IZo if (uploadResponse.success) { Gui.setStatusBarMessage(uploadResponse.commandResponse, globals.STATUS_BAR_TIMEOUT_MS); // set local etag with the new etag from the updated file on mainframe - if (node) { - node.setEtag(uploadResponse.apiResponse.etag); - } + node?.setEtag(uploadResponse.apiResponse.etag); setFileSaved(true); // this part never runs! zowe.Upload.fileToUSSFile doesn't return success: false, it just throws the error which is caught below!!!!! } else { diff --git a/packages/zowe-explorer/src/uss/init.ts b/packages/zowe-explorer/src/uss/init.ts index 496b6b455d..799a5eb16e 100644 --- a/packages/zowe-explorer/src/uss/init.ts +++ b/packages/zowe-explorer/src/uss/init.ts @@ -21,6 +21,7 @@ import { USSTree, createUSSTree } from "./USSTree"; import { initSubscribers } from "../shared/init"; import { ZoweLogger } from "../utils/LoggerUtils"; import { TreeViewUtils } from "../utils/TreeViewUtils"; +import { TreeProviders } from "../shared/TreeProviders"; export async function initUSSProvider(context: vscode.ExtensionContext): Promise { ZoweLogger.trace("init.initUSSProvider called."); @@ -196,6 +197,13 @@ export async function initUSSProvider(context: vscode.ExtensionContext): Promise await ussFileProvider.onDidChangeConfiguration(e); }) ); + context.subscriptions.push( + vscode.workspace.onDidCloseTextDocument((doc) => { + if (doc.uri.fsPath.includes(globals.USS_DIR)) { + TreeProviders.uss.openFiles[doc.uri.fsPath] = null; + } + }) + ); initSubscribers(context, ussFileProvider); return ussFileProvider; From ef92b97aa663ee8ded68343f2fdb12439632842b Mon Sep 17 00:00:00 2001 From: Santhoshi Boyina Date: Thu, 30 Nov 2023 21:27:55 +0530 Subject: [PATCH 50/76] Addressed comments Signed-off-by: Santhoshi Boyina --- packages/zowe-explorer-api/src/tree/IZoweTreeNode.ts | 8 ++++++++ .../__tests__/__unit__/job/ZosJobsProvider.unit.test.ts | 4 ++-- .../i18n/sample/src/dataset/DatasetTree.i18n.json | 2 +- .../i18n/sample/src/job/ZosJobsProvider.i18n.json | 1 + .../zowe-explorer/i18n/sample/src/job/utils.i18n.json | 2 +- packages/zowe-explorer/src/dataset/DatasetTree.ts | 2 +- packages/zowe-explorer/src/job/ZosJobsProvider.ts | 8 +++++--- packages/zowe-explorer/src/job/utils.ts | 2 +- 8 files changed, 20 insertions(+), 9 deletions(-) diff --git a/packages/zowe-explorer-api/src/tree/IZoweTreeNode.ts b/packages/zowe-explorer-api/src/tree/IZoweTreeNode.ts index 4f731b8c14..0c6c102379 100644 --- a/packages/zowe-explorer-api/src/tree/IZoweTreeNode.ts +++ b/packages/zowe-explorer-api/src/tree/IZoweTreeNode.ts @@ -345,6 +345,14 @@ export interface IZoweJobTreeNode extends IZoweTreeNode { * Returns whether the job node is a filtered search */ filtered?: boolean; + /** + * Filter method for this job's children + */ + filter: string; + /** + * Returns the actual jobs children over the filtered child nodes + */ + actualJobs?: IZoweJobTreeNode[]; /** * Retrieves child nodes of this IZoweJobTreeNode * diff --git a/packages/zowe-explorer/__tests__/__unit__/job/ZosJobsProvider.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/job/ZosJobsProvider.unit.test.ts index 5e7fda1b6d..f5609d4288 100644 --- a/packages/zowe-explorer/__tests__/__unit__/job/ZosJobsProvider.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/job/ZosJobsProvider.unit.test.ts @@ -171,7 +171,6 @@ async function createGlobalMocks() { configurable: true, }); - Object.defineProperty(Gui, "infoMessage", { value: jest.fn(), configurable: true }); Object.defineProperty(vscode.window, "createTreeView", { value: globalMocks.createTreeView, configurable: true }); Object.defineProperty(vscode.window, "showQuickPick", { value: globalMocks.mockShowQuickPick, configurable: true }); Object.defineProperty(vscode, "ConfigurationTarget", { value: globalMocks.enums, configurable: true }); @@ -1064,8 +1063,9 @@ describe("ZosJobsProvider Unit Test - Filter Jobs", () => { it("To show showInformationMessage", async () => { const testTree = new ZosJobsProvider(); node1.collapsibleState = vscode.TreeItemCollapsibleState.Collapsed; + const infoMessageSpy = jest.spyOn(Gui, "infoMessage"); await testTree.filterJobsDialog(node1); - expect(mocked(Gui.infoMessage)).toHaveBeenCalled(); + expect(infoMessageSpy).toHaveBeenCalled(); }); it("To filter jobs based on a combination of JobName, JobId and Return code", async () => { diff --git a/packages/zowe-explorer/i18n/sample/src/dataset/DatasetTree.i18n.json b/packages/zowe-explorer/i18n/sample/src/dataset/DatasetTree.i18n.json index 61d6e5e457..8c690ed9a6 100644 --- a/packages/zowe-explorer/i18n/sample/src/dataset/DatasetTree.i18n.json +++ b/packages/zowe-explorer/i18n/sample/src/dataset/DatasetTree.i18n.json @@ -33,7 +33,7 @@ "sort.selectDirection": "Select a sorting direction", "sort.updated": "$(check) Sorting updated for {0}", "filter.description": "Filter: {0}", - "ds.clearProfileFilter": "$(clear-all) Clear filter for profile", + "filter.clearForProfile": "$(clear-all) Clear filter for profile", "ds.clearPdsFilter": "$(clear-all) Clear filter for PDS", "ds.selectFilterOpt": "Set a filter for {0}", "filter.cleared": "$(check) Filter cleared for {0}", diff --git a/packages/zowe-explorer/i18n/sample/src/job/ZosJobsProvider.i18n.json b/packages/zowe-explorer/i18n/sample/src/job/ZosJobsProvider.i18n.json index bb9c7efcde..3736c8ad89 100644 --- a/packages/zowe-explorer/i18n/sample/src/job/ZosJobsProvider.i18n.json +++ b/packages/zowe-explorer/i18n/sample/src/job/ZosJobsProvider.i18n.json @@ -26,6 +26,7 @@ "filter.description": "Filter: {0}", "filterJobs.message": "Use the search button to display jobs", "filterJobs.placeholder": "Set a filter...", + "filter.clearForProfile": "$(clear-all) Clear filter for profile", "filter.cleared": "$(check) Filter cleared for {0}", "filterJobs.prompt.message": "Enter local filter...", "filter.updated": "$(check) Filter updated for {0}", diff --git a/packages/zowe-explorer/i18n/sample/src/job/utils.i18n.json b/packages/zowe-explorer/i18n/sample/src/job/utils.i18n.json index 8964356ce5..881449efdf 100644 --- a/packages/zowe-explorer/i18n/sample/src/job/utils.i18n.json +++ b/packages/zowe-explorer/i18n/sample/src/job/utils.i18n.json @@ -5,5 +5,5 @@ "jobs.sortByReturnCode": "$(symbol-numeric) Return Code", "setSortDirection": "$(fold) Sort Direction", "filterJobs.quickpick.message": "Go to Local Filtering", - "filterJobs.clearProfileFilter": "$(clear-all) Clear filter for profile" + "filter.clearForProfile": "$(clear-all) Clear filter for profile" } diff --git a/packages/zowe-explorer/src/dataset/DatasetTree.ts b/packages/zowe-explorer/src/dataset/DatasetTree.ts index bdd7004c75..c0dc04635c 100644 --- a/packages/zowe-explorer/src/dataset/DatasetTree.ts +++ b/packages/zowe-explorer/src/dataset/DatasetTree.ts @@ -1487,7 +1487,7 @@ export class DatasetTree extends ZoweTreeProvider implements IZoweTree { diff --git a/packages/zowe-explorer/src/job/utils.ts b/packages/zowe-explorer/src/job/utils.ts index 84157e52cd..a90bd1614b 100644 --- a/packages/zowe-explorer/src/job/utils.ts +++ b/packages/zowe-explorer/src/job/utils.ts @@ -39,7 +39,7 @@ export const JOB_SORT_KEYS: Record { From 8b252cf9e72db1fcfe46de944ead1882dfce160a Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Thu, 30 Nov 2023 11:02:04 -0500 Subject: [PATCH 51/76] more code coverage Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../__theia__/theia/extension.theiaChrome.ts | 6 ++-- .../utils/ProfileManagement.unit.test.ts | 30 +++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts index 4720cfab9f..b8638d7c29 100644 --- a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts +++ b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts @@ -325,8 +325,10 @@ export async function addProfileDetails(profileName: string) { await driverChrome.sleep(SHORTSLEEPTIME); const responseTimeout = await driverChrome.findElement(By.xpath(DatasetsLocators.emptyInputBoxXpath)); responseTimeout.sendKeys(Key.ENTER); - responseTimeout.sendKeys("No"); - responseTimeout.sendKeys(Key.ENTER); + await driverChrome.sleep(SHORTSLEEPTIME); + const addToAllTrees = await driverChrome.findElement(By.xpath(DatasetsLocators.emptyInputBoxXpath)); + addToAllTrees.sendKeys("No"); + addToAllTrees.sendKeys(Key.ENTER); } export async function clickOnDatasetsPanel() { await driverChrome.findElement(By.id(DatasetsLocators.datasetsPanelId)).click(); diff --git a/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts index 8d9d247fea..fffe7a124a 100644 --- a/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/utils/ProfileManagement.unit.test.ts @@ -372,4 +372,34 @@ describe("ProfileManagement unit tests", () => { expect(warnSpy).toBeCalledWith(thrownError); }); }); + + describe("promptChangeForAllTrees unit tests", () => { + beforeEach(() => { + jest.resetAllMocks(); + jest.clearAllMocks(); + jest.restoreAllMocks(); + }); + + it("should prompt for applying change to all trees", async () => { + jest.spyOn(TreeProviders, "sessionIsPresentInOtherTrees").mockReturnValue(false); + const expectedResult = { label: "test", description: "test" } as vscode.QuickPickItem; + const createQuickPickSpy = jest.spyOn(Gui, "createQuickPick"); + const resolveQuickPickSpy = jest.spyOn(Gui, "resolveQuickPick"); + const showSpy = jest.fn(); + const hideSpy = jest.fn(); + createQuickPickSpy.mockReturnValue({ + placeholder: "", + items: [], + activeItems: [], + show: showSpy, + hide: hideSpy, + } as any); + resolveQuickPickSpy.mockResolvedValue(expectedResult); + await expect(ProfileManagement["promptChangeForAllTrees"]("test", true)).resolves.toEqual(expectedResult); + expect(createQuickPickSpy).toBeCalledTimes(1); + expect(resolveQuickPickSpy).toBeCalledTimes(1); + expect(showSpy).toBeCalledTimes(1); + expect(hideSpy).toBeCalledTimes(1); + }); + }); }); From 18d662312840443ecabf9439ad7ba15a413001fd Mon Sep 17 00:00:00 2001 From: Trae Yelovich Date: Thu, 30 Nov 2023 13:04:55 -0500 Subject: [PATCH 52/76] saving: Fix broken tests from openFiles, remove ? on vars where possible Signed-off-by: Trae Yelovich --- packages/zowe-explorer-api/CHANGELOG.md | 1 + .../zowe-explorer-api/src/tree/IZoweTree.ts | 5 ++++ packages/zowe-explorer/CHANGELOG.md | 1 + .../__mocks__/mockCreators/datasets.ts | 6 +++++ .../__mocks__/mockCreators/shared.ts | 5 ++-- .../__mocks__/mockCreators/uss.ts | 7 +++++ packages/zowe-explorer/__mocks__/vscode.ts | 1 + packages/zowe-explorer/src/dataset/actions.ts | 27 ++++++++++--------- packages/zowe-explorer/src/dataset/init.ts | 2 +- packages/zowe-explorer/src/uss/ZoweUSSNode.ts | 6 +++-- packages/zowe-explorer/src/uss/actions.ts | 15 ++++++----- packages/zowe-explorer/src/uss/init.ts | 2 +- 12 files changed, 53 insertions(+), 25 deletions(-) diff --git a/packages/zowe-explorer-api/CHANGELOG.md b/packages/zowe-explorer-api/CHANGELOG.md index 4133e271c3..3f791b31a6 100644 --- a/packages/zowe-explorer-api/CHANGELOG.md +++ b/packages/zowe-explorer-api/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to the "zowe-explorer-api" extension will be documented in t ### New features and enhancements - Added new optional boolean parameter `hideFromAllTrees` to `IZoweTree.deleteSession` for specifying whether to hide from all trees or current tree. [#2567](https://github.com/zowe/vscode-extension-for-zowe/issues/2567) +- Added new optional record `openFiles` to `IZoweTree` to track opened files under a specific tree view. [#2597](https://github.com/zowe/vscode-extension-for-zowe/issues/2597) ### Bug fixes diff --git a/packages/zowe-explorer-api/src/tree/IZoweTree.ts b/packages/zowe-explorer-api/src/tree/IZoweTree.ts index 55ec8d8b0a..77fd3bcb72 100644 --- a/packages/zowe-explorer-api/src/tree/IZoweTree.ts +++ b/packages/zowe-explorer-api/src/tree/IZoweTree.ts @@ -59,6 +59,11 @@ export interface IZoweTree extends vscode.TreeDataProvider { */ copying?: Promise; + /** + * A record of open files from this tree. + */ + openFiles?: Record; + /** * Adds a session to the container * @param sessionName diff --git a/packages/zowe-explorer/CHANGELOG.md b/packages/zowe-explorer/CHANGELOG.md index d24f981698..9019eb2f87 100644 --- a/packages/zowe-explorer/CHANGELOG.md +++ b/packages/zowe-explorer/CHANGELOG.md @@ -13,6 +13,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen ### Bug fixes - Fixed dataset allocation issue when secondary space (or other numeric values that did not exists in the dataset-template) where specified [#2591](https://github.com/zowe/vscode-extension-for-zowe/issues/2591) +- Fixed issue where an opened USS file or data set could not be saved once a user changes their search pattern in the Side Bar. [#2597](https://github.com/zowe/vscode-extension-for-zowe/issues/2597) ## `2.12.2` diff --git a/packages/zowe-explorer/__mocks__/mockCreators/datasets.ts b/packages/zowe-explorer/__mocks__/mockCreators/datasets.ts index 41ee8758f2..f871d3dc48 100644 --- a/packages/zowe-explorer/__mocks__/mockCreators/datasets.ts +++ b/packages/zowe-explorer/__mocks__/mockCreators/datasets.ts @@ -15,6 +15,7 @@ import { imperative } from "@zowe/cli"; import * as globals from "../../src/globals"; import { removeNodeFromArray } from "./shared"; import { PersistenceSchemaEnum } from "@zowe/zowe-explorer-api"; +import { TreeProviders } from "../../src/shared/TreeProviders"; export function createDatasetSessionNode(session: imperative.Session, profile: imperative.IProfileLoaded) { const datasetNode = new ZoweDatasetNode("sestest", vscode.TreeItemCollapsibleState.Expanded, null, session, undefined, undefined, profile); @@ -95,6 +96,11 @@ export function createDatasetTree(sessionNode: ZoweDatasetNode, treeView: any, f return testDatasetTree; } testDatasetTree.mSessionNodes.push(favoritesNode); + TreeProviders.initializeProviders(null as any, { + ds: async (context) => testDatasetTree as any, + uss: async (context) => null as any, + job: async (context) => null as any, + }); return testDatasetTree; } diff --git a/packages/zowe-explorer/__mocks__/mockCreators/shared.ts b/packages/zowe-explorer/__mocks__/mockCreators/shared.ts index d61f013411..4805a31786 100644 --- a/packages/zowe-explorer/__mocks__/mockCreators/shared.ts +++ b/packages/zowe-explorer/__mocks__/mockCreators/shared.ts @@ -285,9 +285,10 @@ export function createTreeView(selection?): vscode.TreeView { } export function createTextDocument(name: string, sessionNode?: ZoweDatasetNode | ZoweUSSNode): vscode.TextDocument { + const fileName = sessionNode ? `/${sessionNode.label}/${name}` : name; return { - fileName: sessionNode ? `/${sessionNode.label}/${name}` : name, - uri: null, + fileName, + uri: vscode.Uri.parse(fileName), isUntitled: null, languageId: null, version: null, diff --git a/packages/zowe-explorer/__mocks__/mockCreators/uss.ts b/packages/zowe-explorer/__mocks__/mockCreators/uss.ts index 1d5c327c06..8fa895379a 100644 --- a/packages/zowe-explorer/__mocks__/mockCreators/uss.ts +++ b/packages/zowe-explorer/__mocks__/mockCreators/uss.ts @@ -18,6 +18,7 @@ import { getIconByNode } from "../../src/generators/icons"; import { removeNodeFromArray } from "./shared"; import { USSTree } from "../../src/uss/USSTree"; import { PersistenceSchemaEnum } from "@zowe/zowe-explorer-api"; +import { TreeProviders } from "../../src/shared/TreeProviders"; export function createUSSTree(favoriteNodes: ZoweUSSNode[], sessionNodes: ZoweUSSNode[], treeView?: vscode.TreeView): USSTree { const newTree = new USSTree(); @@ -46,6 +47,12 @@ export function createUSSTree(favoriteNodes: ZoweUSSNode[], sessionNodes: ZoweUS newTree.addSearchHistory = jest.fn(); newTree.getFileHistory = jest.fn(); + TreeProviders.initializeProviders(null as any, { + ds: async (context) => null as any, + uss: async (context) => newTree, + job: async (context) => null as any, + }); + return newTree; } diff --git a/packages/zowe-explorer/__mocks__/vscode.ts b/packages/zowe-explorer/__mocks__/vscode.ts index 5cc8a04263..717bff5ec4 100644 --- a/packages/zowe-explorer/__mocks__/vscode.ts +++ b/packages/zowe-explorer/__mocks__/vscode.ts @@ -584,6 +584,7 @@ export class EventEmitter { */ export namespace workspace { export function onDidSaveTextDocument(listener: (e: T) => any, thisArgs?: any, disposables?: Disposable[]) {} + export function onDidCloseTextDocument(listener: (e: T) => any, thisArgs?: any, disposables?: Disposable[]) {} export function getConfiguration(configuration: string) { return { diff --git a/packages/zowe-explorer/src/dataset/actions.ts b/packages/zowe-explorer/src/dataset/actions.ts index 487ae5f4bd..7f63e3a028 100644 --- a/packages/zowe-explorer/src/dataset/actions.ts +++ b/packages/zowe-explorer/src/dataset/actions.ts @@ -448,7 +448,7 @@ export async function createMember(parent: api.IZoweDatasetTreeNode, datasetProv export async function openPS( node: api.IZoweDatasetTreeNode, previewMember: boolean, - datasetProvider?: api.IZoweTree + datasetProvider: api.IZoweTree ): Promise { ZoweLogger.trace("dataset.actions.openPS called."); if (datasetProvider) { @@ -525,7 +525,9 @@ export async function openPS( node.setEtag(response.apiResponse.etag); } statusMsg.dispose(); - TreeProviders.ds.openFiles[documentFilePath] = this; + if (datasetProvider.openFiles) { + datasetProvider.openFiles[documentFilePath] = this; + } const document = await vscode.workspace.openTextDocument(getDocumentFilePath(label, node)); await api.Gui.showTextDocument(document, { preview: node.wasDoubleClicked != null ? !node.wasDoubleClicked : shouldPreview }); // discard ongoing action to allow new requests on this node @@ -1639,16 +1641,17 @@ export async function saveFile(doc: vscode.TextDocument, datasetProvider: api.IZ } // Get specific node based on label and parent tree (session / favorites) const nodes: api.IZoweNodeType[] = concatChildNodes(sesNode ? [sesNode] : datasetProvider.mSessionNodes); - const node: api.IZoweDatasetTreeNode = nodes.find((zNode) => { - if (contextually.isDsMember(zNode)) { - const zNodeDetails = dsUtils.getProfileAndDataSetName(zNode); - return `${zNodeDetails.profileName}(${zNodeDetails.dataSetName})` === `${label}`; - } else if (contextually.isDs(zNode) || contextually.isDsSession(zNode)) { - return zNode.label.toString().trim() === label; - } else { - return false; - } - }) ?? TreeProviders.ds.openFiles[doc.uri.fsPath]; + const node: api.IZoweDatasetTreeNode = + nodes.find((zNode) => { + if (contextually.isDsMember(zNode)) { + const zNodeDetails = dsUtils.getProfileAndDataSetName(zNode); + return `${zNodeDetails.profileName}(${zNodeDetails.dataSetName})` === `${label}`; + } else if (contextually.isDs(zNode) || contextually.isDsSession(zNode)) { + return zNode.label.toString().trim() === label; + } else { + return false; + } + }) ?? datasetProvider.openFiles?.[doc.uri.fsPath]; // define upload options const uploadOptions: IUploadOptions = { diff --git a/packages/zowe-explorer/src/dataset/init.ts b/packages/zowe-explorer/src/dataset/init.ts index d1646f962d..a9300c4264 100644 --- a/packages/zowe-explorer/src/dataset/init.ts +++ b/packages/zowe-explorer/src/dataset/init.ts @@ -218,7 +218,7 @@ export async function initDatasetProvider(context: vscode.ExtensionContext): Pro ); context.subscriptions.push( vscode.workspace.onDidCloseTextDocument((doc) => { - if (doc.uri.fsPath.includes(globals.DS_DIR)) { + if (TreeProviders.ds.openFiles && doc.uri.fsPath.includes(globals.DS_DIR)) { TreeProviders.ds.openFiles[doc.uri.fsPath] = null; } }) diff --git a/packages/zowe-explorer/src/uss/ZoweUSSNode.ts b/packages/zowe-explorer/src/uss/ZoweUSSNode.ts index 09f7002b8c..f90c12a24a 100644 --- a/packages/zowe-explorer/src/uss/ZoweUSSNode.ts +++ b/packages/zowe-explorer/src/uss/ZoweUSSNode.ts @@ -474,7 +474,7 @@ export class ZoweUSSNode extends ZoweTreeNode implements IZoweUSSTreeNode { * * @param {IZoweTreeNode} node */ - public async openUSS(download: boolean, previewFile: boolean, ussFileProvider?: IZoweTree): Promise { + public async openUSS(download: boolean, previewFile: boolean, ussFileProvider: IZoweTree): Promise { ZoweLogger.trace("ZoweUSSNode.openUSS called."); await ussFileProvider.checkCurrentProfile(this); @@ -532,7 +532,9 @@ export class ZoweUSSNode extends ZoweTreeNode implements IZoweUSSTreeNode { ussFileProvider.addFileHistory(`[${this.getProfile().name}]: ${this.fullPath}`); ussFileProvider.getTreeView().reveal(this, { select: true, focus: true, expand: false }); - TreeProviders.uss.openFiles[documentFilePath] = this; + if (ussFileProvider.openFiles) { + ussFileProvider.openFiles[documentFilePath] = this; + } await this.initializeFileOpening(documentFilePath, shouldPreview); } } catch (err) { diff --git a/packages/zowe-explorer/src/uss/actions.ts b/packages/zowe-explorer/src/uss/actions.ts index b304b5031d..89aa667b68 100644 --- a/packages/zowe-explorer/src/uss/actions.ts +++ b/packages/zowe-explorer/src/uss/actions.ts @@ -306,13 +306,14 @@ export async function saveUSSFile(doc: vscode.TextDocument, ussFileProvider: IZo } // Get specific node based on label and parent tree (session / favorites) const nodes: IZoweUSSTreeNode[] = concatChildNodes(sesNode ? [sesNode] : ussFileProvider.mSessionNodes); - const node: IZoweUSSTreeNode = nodes.find((zNode) => { - if (contextually.isText(zNode)) { - return zNode.fullPath.trim() === remote; - } else { - return false; - } - }) ?? TreeProviders.uss.openFiles[doc.uri.fsPath]; + const node: IZoweUSSTreeNode = + nodes.find((zNode) => { + if (contextually.isText(zNode)) { + return zNode.fullPath.trim() === remote; + } else { + return false; + } + }) ?? ussFileProvider.openFiles?.[doc.uri.fsPath]; // define upload options const etagToUpload = node?.getEtag(); diff --git a/packages/zowe-explorer/src/uss/init.ts b/packages/zowe-explorer/src/uss/init.ts index 799a5eb16e..1a3e756d78 100644 --- a/packages/zowe-explorer/src/uss/init.ts +++ b/packages/zowe-explorer/src/uss/init.ts @@ -199,7 +199,7 @@ export async function initUSSProvider(context: vscode.ExtensionContext): Promise ); context.subscriptions.push( vscode.workspace.onDidCloseTextDocument((doc) => { - if (doc.uri.fsPath.includes(globals.USS_DIR)) { + if (TreeProviders.uss.openFiles && doc.uri.fsPath.includes(globals.USS_DIR)) { TreeProviders.uss.openFiles[doc.uri.fsPath] = null; } }) From a1f248f9308610869062267f9fcb2bd869a8c69b Mon Sep 17 00:00:00 2001 From: Billie Simmons <49491949+JillieBeanSim@users.noreply.github.com> Date: Thu, 30 Nov 2023 13:59:47 -0500 Subject: [PATCH 53/76] fix build errors Signed-off-by: Billie Simmons <49491949+JillieBeanSim@users.noreply.github.com> --- packages/zowe-explorer-api/src/tree/IZoweTreeNode.ts | 10 ++-------- .../zowe-explorer/src/abstract/ZoweTreeProvider.ts | 2 +- packages/zowe-explorer/src/dataset/actions.ts | 6 +++--- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/packages/zowe-explorer-api/src/tree/IZoweTreeNode.ts b/packages/zowe-explorer-api/src/tree/IZoweTreeNode.ts index 0c6c102379..3b3e03cc8a 100644 --- a/packages/zowe-explorer-api/src/tree/IZoweTreeNode.ts +++ b/packages/zowe-explorer-api/src/tree/IZoweTreeNode.ts @@ -345,14 +345,8 @@ export interface IZoweJobTreeNode extends IZoweTreeNode { * Returns whether the job node is a filtered search */ filtered?: boolean; - /** - * Filter method for this job's children - */ - filter: string; - /** - * Returns the actual jobs children over the filtered child nodes - */ - actualJobs?: IZoweJobTreeNode[]; + filter?: string; + actualJobs?: IZoweTreeNode[]; /** * Retrieves child nodes of this IZoweJobTreeNode * diff --git a/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts b/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts index 9dca5d0a65..dbf3242cdf 100644 --- a/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts +++ b/packages/zowe-explorer/src/abstract/ZoweTreeProvider.ts @@ -101,7 +101,7 @@ export class ZoweTreeProvider { * Called whenever the tree needs to be refreshed, and fires the data change event * */ - public refreshElement(element: IZoweDatasetTreeNode): void { + public refreshElement(element: IZoweTreeNode): void { ZoweLogger.trace("ZoweTreeProvider.refreshElement called."); element.dirty = true; this.mOnDidChangeTreeData.fire(element); diff --git a/packages/zowe-explorer/src/dataset/actions.ts b/packages/zowe-explorer/src/dataset/actions.ts index 4a89c1e7dc..69445ae984 100644 --- a/packages/zowe-explorer/src/dataset/actions.ts +++ b/packages/zowe-explorer/src/dataset/actions.ts @@ -1636,8 +1636,8 @@ export async function saveFile(doc: vscode.TextDocument, datasetProvider: api.IZ await errorHandling(err, sesName); } // Get specific node based on label and parent tree (session / favorites) - const nodes: api.IZoweNodeType[] = concatChildNodes(sesNode ? [sesNode] : datasetProvider.mSessionNodes); - const node: api.IZoweDatasetTreeNode = nodes.find((zNode) => { + const nodes = concatChildNodes(sesNode ? [sesNode] : datasetProvider.mSessionNodes); + const node = nodes.find((zNode) => { if (contextually.isDsMember(zNode)) { const zNodeDetails = dsUtils.getProfileAndDataSetName(zNode); return `${zNodeDetails.profileName}(${zNodeDetails.dataSetName})` === `${label}`; @@ -1646,7 +1646,7 @@ export async function saveFile(doc: vscode.TextDocument, datasetProvider: api.IZ } else { return false; } - }); + }) as api.IZoweDatasetTreeNode; // define upload options const uploadOptions: IUploadOptions = { From 6c25b891c48aa8b7b012eda2c8d7279369f34908 Mon Sep 17 00:00:00 2001 From: Trae Yelovich Date: Thu, 30 Nov 2023 14:03:13 -0500 Subject: [PATCH 54/76] Jobs: add and remove spool files from openFiles record Signed-off-by: Trae Yelovich --- .../__mocks__/mockCreators/datasets.ts | 5 --- .../__mocks__/mockCreators/jobs.ts | 1 + .../__mocks__/mockCreators/uss.ts | 6 --- packages/zowe-explorer/__mocks__/vscode.ts | 4 ++ .../__unit__/job/actions.unit.test.ts | 37 +++++++++++-------- .../__tests__/__unit__/job/init.unit.test.ts | 4 +- .../zowe-explorer/src/job/ZosJobsProvider.ts | 1 + packages/zowe-explorer/src/job/ZoweJobNode.ts | 2 +- packages/zowe-explorer/src/job/actions.ts | 11 ++++-- packages/zowe-explorer/src/job/init.ts | 14 +++++-- 10 files changed, 49 insertions(+), 36 deletions(-) diff --git a/packages/zowe-explorer/__mocks__/mockCreators/datasets.ts b/packages/zowe-explorer/__mocks__/mockCreators/datasets.ts index f871d3dc48..728c2218bb 100644 --- a/packages/zowe-explorer/__mocks__/mockCreators/datasets.ts +++ b/packages/zowe-explorer/__mocks__/mockCreators/datasets.ts @@ -96,11 +96,6 @@ export function createDatasetTree(sessionNode: ZoweDatasetNode, treeView: any, f return testDatasetTree; } testDatasetTree.mSessionNodes.push(favoritesNode); - TreeProviders.initializeProviders(null as any, { - ds: async (context) => testDatasetTree as any, - uss: async (context) => null as any, - job: async (context) => null as any, - }); return testDatasetTree; } diff --git a/packages/zowe-explorer/__mocks__/mockCreators/jobs.ts b/packages/zowe-explorer/__mocks__/mockCreators/jobs.ts index d223f5951f..0a0fa6b7f2 100644 --- a/packages/zowe-explorer/__mocks__/mockCreators/jobs.ts +++ b/packages/zowe-explorer/__mocks__/mockCreators/jobs.ts @@ -105,6 +105,7 @@ export function createJobsTree(session: imperative.Session, iJob: IJob, profile: getSession: jest.fn(), delete: jest.fn(), setItem: jest.fn(), + openFiles: {}, }; testJobsTree.mSessionNodes = []; testJobsTree.mSessionNodes.push(jobNode); diff --git a/packages/zowe-explorer/__mocks__/mockCreators/uss.ts b/packages/zowe-explorer/__mocks__/mockCreators/uss.ts index 8fa895379a..f37eacaf74 100644 --- a/packages/zowe-explorer/__mocks__/mockCreators/uss.ts +++ b/packages/zowe-explorer/__mocks__/mockCreators/uss.ts @@ -47,12 +47,6 @@ export function createUSSTree(favoriteNodes: ZoweUSSNode[], sessionNodes: ZoweUS newTree.addSearchHistory = jest.fn(); newTree.getFileHistory = jest.fn(); - TreeProviders.initializeProviders(null as any, { - ds: async (context) => null as any, - uss: async (context) => newTree, - job: async (context) => null as any, - }); - return newTree; } diff --git a/packages/zowe-explorer/__mocks__/vscode.ts b/packages/zowe-explorer/__mocks__/vscode.ts index 717bff5ec4..36d30b6634 100644 --- a/packages/zowe-explorer/__mocks__/vscode.ts +++ b/packages/zowe-explorer/__mocks__/vscode.ts @@ -279,6 +279,10 @@ export namespace window { return Promise.resolve(""); } + export function showTextDocument(document: TextDocument, column?: ViewColumn, preserveFocus?: boolean): any { + return undefined; + } + export function showErrorMessage(message: string, ...items: string[]): undefined { return undefined; } diff --git a/packages/zowe-explorer/__tests__/__unit__/job/actions.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/job/actions.unit.test.ts index f645da00b8..fc0d6e8e1e 100644 --- a/packages/zowe-explorer/__tests__/__unit__/job/actions.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/job/actions.unit.test.ts @@ -43,6 +43,7 @@ import { ZoweLogger } from "../../../src/utils/LoggerUtils"; import { SpoolFile } from "../../../src/SpoolProvider"; import { ZosJobsProvider } from "../../../src/job/ZosJobsProvider"; import { ProfileManagement } from "../../../src/utils/ProfileManagement"; +import { TreeProviders } from "../../../src/shared/TreeProviders"; const activeTextEditorDocument = jest.fn(); @@ -107,7 +108,8 @@ function createGlobalMocks() { Object.defineProperty(zowe.GetJobs, "getStatusForJob", { value: jest.fn(), configurable: true }); Object.defineProperty(zowe.GetJobs, "getSpoolContentById", { value: jest.fn(), configurable: true }); Object.defineProperty(vscode.workspace, "openTextDocument", { value: jest.fn(), configurable: true }); - Object.defineProperty(vscode.window, "showTextDocument", { value: jest.fn(), configurable: true }); + jest.spyOn(Gui, "showTextDocument"); + jest.spyOn(vscode.window, "showTextDocument"); Object.defineProperty(zowe, "ZosmfSession", { value: jest.fn(), configurable: true }); Object.defineProperty(zowe.ZosmfSession, "createSessCfgFromArgs", { value: jest.fn(), configurable: true }); Object.defineProperty(zowe, "DownloadJobs", { value: jest.fn(), configurable: true }); @@ -413,7 +415,7 @@ describe("Jobs Actions Unit Tests - Function downloadJcl", () => { await jobActions.downloadJcl(node); expect(mocked(zowe.GetJobs.getJclForJob)).toBeCalled(); expect(mocked(vscode.workspace.openTextDocument)).toBeCalled(); - expect(mocked(vscode.window.showTextDocument)).toBeCalled(); + expect(mocked(Gui.showTextDocument)).toBeCalled(); }); it("Checking failed attempt to download Job JCL", async () => { createGlobalMocks(); @@ -830,7 +832,7 @@ describe("Jobs Actions Unit Tests - Function submitMember", () => { }); describe("Jobs Actions Unit Tests - Function getSpoolContent", () => { - function createBlockMocks() { + async function createBlockMocks() { const session = createISessionWithoutCredentials(); const iJob = createIJobObject(); const iJobFile = createIJobFile(); @@ -860,6 +862,11 @@ describe("Jobs Actions Unit Tests - Function getSpoolContent", () => { toJSON: jest.fn(), }; bindJesApi(jesApi); + await TreeProviders.initializeProviders(null as any, { + ds: async (ctx) => null as any, + uss: async (ctx) => null as any, + job: async (ctx) => testJobTree, + }); return { session, @@ -877,23 +884,21 @@ describe("Jobs Actions Unit Tests - Function getSpoolContent", () => { it("should call showTextDocument with encoded uri", async () => { createGlobalMocks(); - const blockMocks = createBlockMocks(); + const blockMocks = await createBlockMocks(); const session = "sessionName"; const spoolFile = blockMocks.iJobFile; - const anyTimestamp = Date.now(); mocked(SpoolProvider.encodeJobFile).mockReturnValueOnce(blockMocks.mockUri); mocked(Profiles.getInstance).mockReturnValue(blockMocks.profileInstance); - await jobActions.getSpoolContent(session, spoolFile, anyTimestamp); + await jobActions.getSpoolContent(session, { spool: spoolFile } as any); - expect(mocked(vscode.window.showTextDocument)).toBeCalledWith(blockMocks.mockUri, { preview: false }); + expect(mocked(Gui.showTextDocument)).toBeCalledWith(blockMocks.mockUri, { preview: false }); }); it("should call showTextDocument with encoded uri with unverified profile", async () => { createGlobalMocks(); - const blockMocks = createBlockMocks(); + const blockMocks = await createBlockMocks(); const session = "sessionName"; const spoolFile = blockMocks.iJobFile; - const anyTimestamp = Date.now(); Object.defineProperty(Profiles, "getInstance", { value: jest.fn(() => { return { @@ -908,13 +913,13 @@ describe("Jobs Actions Unit Tests - Function getSpoolContent", () => { mocked(SpoolProvider.encodeJobFile).mockReturnValueOnce(blockMocks.mockUri); mocked(Profiles.getInstance).mockReturnValue(blockMocks.profileInstance); - await jobActions.getSpoolContent(session, spoolFile, anyTimestamp); + await jobActions.getSpoolContent(session, { spool: spoolFile } as any); - expect(mocked(vscode.window.showTextDocument)).toBeCalledWith(blockMocks.mockUri, { preview: false }); + expect(mocked(Gui.showTextDocument)).toBeCalledWith(blockMocks.mockUri, { preview: false }); }); it("should show error message for non existing profile", async () => { createGlobalMocks(); - const blockMocks = createBlockMocks(); + const blockMocks = await createBlockMocks(); const session = "sessionName"; const spoolFile = blockMocks.iJobFile; const anyTimestamp = Date.now(); @@ -923,14 +928,14 @@ describe("Jobs Actions Unit Tests - Function getSpoolContent", () => { throw new Error("Test"); }); - await jobActions.getSpoolContent(session, spoolFile, anyTimestamp); + await jobActions.getSpoolContent(session, { spool: spoolFile } as any); expect(mocked(vscode.window.showTextDocument)).not.toBeCalled(); expect(mocked(Gui.errorMessage)).toBeCalledWith("Error: Test"); }); it("should show an error message in case document cannot be shown for some reason", async () => { createGlobalMocks(); - const blockMocks = createBlockMocks(); + const blockMocks = await createBlockMocks(); const session = "sessionName"; const spoolFile = blockMocks.iJobFile; const anyTimestamp = Date.now(); @@ -940,13 +945,13 @@ describe("Jobs Actions Unit Tests - Function getSpoolContent", () => { throw new Error("Test"); }); - await jobActions.getSpoolContent(session, spoolFile, anyTimestamp); + await jobActions.getSpoolContent(session, { spool: spoolFile } as any); expect(mocked(Gui.errorMessage)).toBeCalledWith("Error: Test"); }); it("should fetch the spool content successfully", async () => { createGlobalMocks(); - const blockMocks = createBlockMocks(); + const blockMocks = await createBlockMocks(); const testNode = new Job( "undefined:test - testJob", vscode.TreeItemCollapsibleState.None, diff --git a/packages/zowe-explorer/__tests__/__unit__/job/init.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/job/init.unit.test.ts index 09b7fa8ad0..c508c77171 100644 --- a/packages/zowe-explorer/__tests__/__unit__/job/init.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/job/init.unit.test.ts @@ -58,8 +58,8 @@ describe("Test src/jobs/extension", () => { const commands: IJestIt[] = [ { name: "zowe.jobs.zosJobsOpenspool", - parm: [test._, test.value, test._], - mock: [{ spy: jest.spyOn(jobActions, "getSpoolContent"), arg: [test._, test.value, test._] }], + parm: [test._, test.value], + mock: [{ spy: jest.spyOn(jobActions, "getSpoolContent"), arg: [test._, test.value] }], }, { name: "zowe.jobs.deleteJob", diff --git a/packages/zowe-explorer/src/job/ZosJobsProvider.ts b/packages/zowe-explorer/src/job/ZosJobsProvider.ts index 4346b4abab..5201f095d5 100644 --- a/packages/zowe-explorer/src/job/ZosJobsProvider.ts +++ b/packages/zowe-explorer/src/job/ZosJobsProvider.ts @@ -84,6 +84,7 @@ export class ZosJobsProvider extends ZoweTreeProvider implements IZoweTree = {}; public JOB_PROPERTIES = [ { diff --git a/packages/zowe-explorer/src/job/ZoweJobNode.ts b/packages/zowe-explorer/src/job/ZoweJobNode.ts index 0ac960be2a..5dd1c788b4 100644 --- a/packages/zowe-explorer/src/job/ZoweJobNode.ts +++ b/packages/zowe-explorer/src/job/ZoweJobNode.ts @@ -177,7 +177,7 @@ export class Job extends ZoweTreeNode implements IZoweJobTreeNode { spoolNode.command = { command: "zowe.jobs.zosJobsOpenspool", title: "", - arguments: [sessionName, spool, refreshTimestamp], + arguments: [sessionName, spoolNode], }; elementChildren[newLabel] = spoolNode; } diff --git a/packages/zowe-explorer/src/job/actions.ts b/packages/zowe-explorer/src/job/actions.ts index d689e5a93a..863dfaf65f 100644 --- a/packages/zowe-explorer/src/job/actions.ts +++ b/packages/zowe-explorer/src/job/actions.ts @@ -23,6 +23,7 @@ import { SORT_DIRS, getDefaultUri } from "../shared/utils"; import { ZosJobsProvider } from "./ZosJobsProvider"; import { JOB_SORT_OPTS } from "./utils"; import * as globals from "../globals"; +import { TreeProviders } from "../shared/TreeProviders"; // Set up localization nls.config({ @@ -108,7 +109,7 @@ export async function downloadSingleSpool(nodes: IZoweJobTreeNode[], binary?: bo * @param spool The IJobFile to get the spool content for * @param refreshTimestamp The timestamp of the last job node refresh */ -export async function getSpoolContent(session: string, spool: zowe.IJobFile, refreshTimestamp: number): Promise { +export async function getSpoolContent(session: string, spoolNode: Spool): Promise { ZoweLogger.trace("job.actions.getSpoolContent called."); const profiles = Profiles.getInstance(); let zosmfProfile: zowe.imperative.IProfileLoaded; @@ -120,17 +121,21 @@ export async function getSpoolContent(session: string, spool: zowe.IJobFile, ref } const statusMsg = Gui.setStatusBarMessage(localize("jobActions.openSpoolFile", "$(sync~spin) Opening spool file...", this.label as string)); - const uri = encodeJobFile(session, spool); + const uri = encodeJobFile(session, spoolNode.spool); try { const spoolFile = SpoolProvider.files[uri.path]; if (spoolFile) { // Fetch any changes to the spool file if it exists in the SpoolProvider await spoolFile.fetchContent(); } + if (TreeProviders.job.openFiles) { + TreeProviders.job.openFiles[uri.path] = spoolNode; + } await Gui.showTextDocument(uri, { preview: false }); } catch (error) { const isTextDocActive = - vscode.window.activeTextEditor && vscode.window.activeTextEditor.document.uri?.path === `${spool.jobname}.${spool.jobid}.${spool.ddname}`; + vscode.window.activeTextEditor && + vscode.window.activeTextEditor.document.uri?.path === `${spoolNode.spool.jobname}.${spoolNode.spool.jobid}.${spoolNode.spool.ddname}`; statusMsg.dispose(); if (isTextDocActive && String(error.message).includes("Failed to show text document")) { diff --git a/packages/zowe-explorer/src/job/init.ts b/packages/zowe-explorer/src/job/init.ts index 0a334b4613..250387cad5 100644 --- a/packages/zowe-explorer/src/job/init.ts +++ b/packages/zowe-explorer/src/job/init.ts @@ -21,6 +21,7 @@ import { Job } from "./ZoweJobNode"; import { getSelectedNodeList } from "../shared/utils"; import { initSubscribers } from "../shared/init"; import { ZoweLogger } from "../utils/LoggerUtils"; +import { TreeProviders } from "../shared/TreeProviders"; export async function initJobsProvider(context: vscode.ExtensionContext): Promise { ZoweLogger.trace("job.init.initJobsProvider called."); @@ -30,9 +31,7 @@ export async function initJobsProvider(context: vscode.ExtensionContext): Promis } context.subscriptions.push( - vscode.commands.registerCommand("zowe.jobs.zosJobsOpenspool", (session, spool, refreshTimestamp) => - jobActions.getSpoolContent(session, spool, refreshTimestamp) - ) + vscode.commands.registerCommand("zowe.jobs.zosJobsOpenspool", (session, spoolNode) => jobActions.getSpoolContent(session, spoolNode)) ); context.subscriptions.push( vscode.commands.registerCommand("zowe.jobs.deleteJob", async (job, jobs) => { @@ -172,6 +171,15 @@ export async function initJobsProvider(context: vscode.ExtensionContext): Promis }) ); context.subscriptions.push(vscode.commands.registerCommand("zowe.jobs.sortBy", async (job) => jobActions.sortJobs(job, jobsProvider))); + + context.subscriptions.push( + vscode.workspace.onDidCloseTextDocument((doc) => { + if (doc.uri.scheme === "zosspool") { + TreeProviders.job.openFiles[doc.uri.path] = null; + } + }) + ); + initSubscribers(context, jobsProvider); return jobsProvider; } From c387ad65c00bac01342094f228e59e4d5a0d0cf3 Mon Sep 17 00:00:00 2001 From: Trae Yelovich Date: Thu, 30 Nov 2023 14:04:26 -0500 Subject: [PATCH 55/76] chore: remove unused imports Signed-off-by: Trae Yelovich --- packages/zowe-explorer/__mocks__/mockCreators/datasets.ts | 1 - packages/zowe-explorer/__mocks__/mockCreators/uss.ts | 1 - packages/zowe-explorer/src/dataset/actions.ts | 2 +- packages/zowe-explorer/src/uss/ZoweUSSNode.ts | 1 - packages/zowe-explorer/src/uss/actions.ts | 1 - 5 files changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/zowe-explorer/__mocks__/mockCreators/datasets.ts b/packages/zowe-explorer/__mocks__/mockCreators/datasets.ts index 728c2218bb..41ee8758f2 100644 --- a/packages/zowe-explorer/__mocks__/mockCreators/datasets.ts +++ b/packages/zowe-explorer/__mocks__/mockCreators/datasets.ts @@ -15,7 +15,6 @@ import { imperative } from "@zowe/cli"; import * as globals from "../../src/globals"; import { removeNodeFromArray } from "./shared"; import { PersistenceSchemaEnum } from "@zowe/zowe-explorer-api"; -import { TreeProviders } from "../../src/shared/TreeProviders"; export function createDatasetSessionNode(session: imperative.Session, profile: imperative.IProfileLoaded) { const datasetNode = new ZoweDatasetNode("sestest", vscode.TreeItemCollapsibleState.Expanded, null, session, undefined, undefined, profile); diff --git a/packages/zowe-explorer/__mocks__/mockCreators/uss.ts b/packages/zowe-explorer/__mocks__/mockCreators/uss.ts index f37eacaf74..1d5c327c06 100644 --- a/packages/zowe-explorer/__mocks__/mockCreators/uss.ts +++ b/packages/zowe-explorer/__mocks__/mockCreators/uss.ts @@ -18,7 +18,6 @@ import { getIconByNode } from "../../src/generators/icons"; import { removeNodeFromArray } from "./shared"; import { USSTree } from "../../src/uss/USSTree"; import { PersistenceSchemaEnum } from "@zowe/zowe-explorer-api"; -import { TreeProviders } from "../../src/shared/TreeProviders"; export function createUSSTree(favoriteNodes: ZoweUSSNode[], sessionNodes: ZoweUSSNode[], treeView?: vscode.TreeView): USSTree { const newTree = new USSTree(); diff --git a/packages/zowe-explorer/src/dataset/actions.ts b/packages/zowe-explorer/src/dataset/actions.ts index 7f63e3a028..5bf47c77a1 100644 --- a/packages/zowe-explorer/src/dataset/actions.ts +++ b/packages/zowe-explorer/src/dataset/actions.ts @@ -42,7 +42,7 @@ import { ProfileManagement } from "../utils/ProfileManagement"; // Set up localization import * as nls from "vscode-nls"; import { resolveFileConflict } from "../shared/actions"; -import { TreeProviders } from "../shared/TreeProviders"; + nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone, diff --git a/packages/zowe-explorer/src/uss/ZoweUSSNode.ts b/packages/zowe-explorer/src/uss/ZoweUSSNode.ts index f90c12a24a..98072b1254 100644 --- a/packages/zowe-explorer/src/uss/ZoweUSSNode.ts +++ b/packages/zowe-explorer/src/uss/ZoweUSSNode.ts @@ -25,7 +25,6 @@ import { closeOpenedTextFile } from "../utils/workspace"; import * as nls from "vscode-nls"; import { UssFileTree, UssFileType, UssFileUtils } from "./FileStructure"; import { ZoweLogger } from "../utils/LoggerUtils"; -import { TreeProviders } from "../shared/TreeProviders"; // Set up localization nls.config({ diff --git a/packages/zowe-explorer/src/uss/actions.ts b/packages/zowe-explorer/src/uss/actions.ts index 89aa667b68..c142392c09 100644 --- a/packages/zowe-explorer/src/uss/actions.ts +++ b/packages/zowe-explorer/src/uss/actions.ts @@ -30,7 +30,6 @@ import { UssFileTree, UssFileType } from "./FileStructure"; import { ZoweLogger } from "../utils/LoggerUtils"; import { AttributeView } from "./AttributeView"; import { resolveFileConflict } from "../shared/actions"; -import { TreeProviders } from "../shared/TreeProviders"; // Set up localization nls.config({ From 3a04a7ea3644289ae0745c4a45c4d32c5efab464 Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Thu, 30 Nov 2023 14:47:12 -0500 Subject: [PATCH 56/76] attempt of fixing broken theia check Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../__theia__/theia/extension.theiaFirefox.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts index 817e0a8f18..1542605d6d 100644 --- a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts +++ b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts @@ -14,6 +14,7 @@ import { Builder, By, Key, until } from "selenium-webdriver"; import * as firefox from "selenium-webdriver/firefox"; import { TheiaLocator, DatasetsLocators, UssLocators, JobsLocators } from "./Locators"; +const SHORTSLEEPTIME = 2000; const WAITTIME = 30000; let driverFirefox: any; @@ -72,16 +73,20 @@ export async function addProfileDetailsInUss(profileName: string) { const ussProfileName = await driverFirefox.findElement(By.xpath(UssLocators.emptyInputBoxXpath)); ussProfileName.sendKeys(profileName); ussProfileName.sendKeys(Key.ENTER); - ussProfileName.sendKeys("No"); - ussProfileName.sendKeys(Key.ENTER); + await driverFirefox.sleep(SHORTSLEEPTIME); + const addToAllTrees = await driverFirefox.findElement(By.xpath(JobsLocators.emptyInputBoxXpath)); + addToAllTrees.sendKeys("No"); + addToAllTrees.sendKeys(Key.ENTER); } export async function addProfileDetailsInJobs(profileName: string) { const jobsProfileName = await driverFirefox.findElement(By.xpath(JobsLocators.emptyInputBoxXpath)); jobsProfileName.sendKeys(profileName); jobsProfileName.sendKeys(Key.ENTER); - jobsProfileName.sendKeys("No"); - jobsProfileName.sendKeys(Key.ENTER); + await driverFirefox.sleep(SHORTSLEEPTIME); + const addToAllTrees = await driverFirefox.findElement(By.xpath(JobsLocators.emptyInputBoxXpath)); + addToAllTrees.sendKeys("No"); + addToAllTrees.sendKeys(Key.ENTER); } export async function getUssDefaultProfilename() { From 8c20cffd44f064d00f8d44fe44968a4150025f18 Mon Sep 17 00:00:00 2001 From: Trae Yelovich Date: Thu, 30 Nov 2023 14:51:22 -0500 Subject: [PATCH 57/76] openFiles: Remove code duplication, add removeFromOpenFiles coverage Signed-off-by: Trae Yelovich --- .../__tests__/__unit__/shared/utils.unit.test.ts | 15 +++++++++++++++ packages/zowe-explorer/src/dataset/init.ts | 6 +++--- packages/zowe-explorer/src/job/init.ts | 4 ++-- packages/zowe-explorer/src/shared/utils.ts | 8 +++++++- packages/zowe-explorer/src/uss/init.ts | 6 +++--- 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__unit__/shared/utils.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/shared/utils.unit.test.ts index 0689703674..9afe55465f 100644 --- a/packages/zowe-explorer/__tests__/__unit__/shared/utils.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/shared/utils.unit.test.ts @@ -610,3 +610,18 @@ describe("Shared utils unit tests - function sortTreeItems", () => { ]); }); }); + +describe("Shared utils unit tests - function removeFromOpenFiles", () => { + const someTree = { openFiles: {} }; + + it("sets a file entry to null in the openFiles record", () => { + sharedUtils.removeFromOpenFiles(someTree as any, "/a/doc/path"); + expect(someTree.openFiles["/a/doc/path"]).toBeNull(); + }); + + it("does nothing if openFiles is not defined", () => { + someTree.openFiles = undefined as any; + sharedUtils.removeFromOpenFiles(someTree as any, "/a/doc/path"); + expect(someTree.openFiles).toBeUndefined(); + }); +}); diff --git a/packages/zowe-explorer/src/dataset/init.ts b/packages/zowe-explorer/src/dataset/init.ts index a9300c4264..5f53a1fe22 100644 --- a/packages/zowe-explorer/src/dataset/init.ts +++ b/packages/zowe-explorer/src/dataset/init.ts @@ -18,7 +18,7 @@ import { Profiles } from "../Profiles"; import { DatasetTree, createDatasetTree } from "./DatasetTree"; import { ZoweDatasetNode } from "./ZoweDatasetNode"; import * as contextuals from "../shared/context"; -import { getSelectedNodeList } from "../shared/utils"; +import { getSelectedNodeList, removeFromOpenFiles } from "../shared/utils"; import { initSubscribers } from "../shared/init"; import { ZoweLogger } from "../utils/LoggerUtils"; import { TreeViewUtils } from "../utils/TreeViewUtils"; @@ -218,8 +218,8 @@ export async function initDatasetProvider(context: vscode.ExtensionContext): Pro ); context.subscriptions.push( vscode.workspace.onDidCloseTextDocument((doc) => { - if (TreeProviders.ds.openFiles && doc.uri.fsPath.includes(globals.DS_DIR)) { - TreeProviders.ds.openFiles[doc.uri.fsPath] = null; + if (doc.uri.fsPath.includes(globals.DS_DIR)) { + removeFromOpenFiles(TreeProviders.ds, doc.uri.fsPath); } }) ); diff --git a/packages/zowe-explorer/src/job/init.ts b/packages/zowe-explorer/src/job/init.ts index 250387cad5..864612bd5c 100644 --- a/packages/zowe-explorer/src/job/init.ts +++ b/packages/zowe-explorer/src/job/init.ts @@ -18,7 +18,7 @@ import { Profiles } from "../Profiles"; import { ZosJobsProvider, createJobsTree } from "./ZosJobsProvider"; import * as contextuals from "../shared/context"; import { Job } from "./ZoweJobNode"; -import { getSelectedNodeList } from "../shared/utils"; +import { getSelectedNodeList, removeFromOpenFiles } from "../shared/utils"; import { initSubscribers } from "../shared/init"; import { ZoweLogger } from "../utils/LoggerUtils"; import { TreeProviders } from "../shared/TreeProviders"; @@ -175,7 +175,7 @@ export async function initJobsProvider(context: vscode.ExtensionContext): Promis context.subscriptions.push( vscode.workspace.onDidCloseTextDocument((doc) => { if (doc.uri.scheme === "zosspool") { - TreeProviders.job.openFiles[doc.uri.path] = null; + removeFromOpenFiles(TreeProviders.job, doc.uri.path); } }) ); diff --git a/packages/zowe-explorer/src/shared/utils.ts b/packages/zowe-explorer/src/shared/utils.ts index 7f548f3b41..1037022b65 100644 --- a/packages/zowe-explorer/src/shared/utils.ts +++ b/packages/zowe-explorer/src/shared/utils.ts @@ -16,7 +16,7 @@ import * as vscode from "vscode"; import * as path from "path"; import * as globals from "../globals"; import * as os from "os"; -import { Gui, IZoweTreeNode, IZoweNodeType, IZoweDatasetTreeNode, IZoweUSSTreeNode, IZoweJobTreeNode } from "@zowe/zowe-explorer-api"; +import { Gui, IZoweTreeNode, IZoweNodeType, IZoweDatasetTreeNode, IZoweUSSTreeNode, IZoweJobTreeNode, IZoweTree } from "@zowe/zowe-explorer-api"; import { ZoweExplorerApiRegister } from "../ZoweExplorerApiRegister"; import * as nls from "vscode-nls"; import { IZosFilesResponse, imperative } from "@zowe/cli"; @@ -413,3 +413,9 @@ export async function compareFileContent( node.setEtag(downloadEtag); } } + +export function removeFromOpenFiles(treeProvider: IZoweTree, docPath: string): void { + if (treeProvider.openFiles) { + treeProvider.openFiles[docPath] = null; + } +} diff --git a/packages/zowe-explorer/src/uss/init.ts b/packages/zowe-explorer/src/uss/init.ts index 1a3e756d78..e8795ee65a 100644 --- a/packages/zowe-explorer/src/uss/init.ts +++ b/packages/zowe-explorer/src/uss/init.ts @@ -16,7 +16,7 @@ import * as refreshActions from "../shared/refresh"; import { IZoweUSSTreeNode, IZoweTreeNode } from "@zowe/zowe-explorer-api"; import { Profiles } from "../Profiles"; import * as contextuals from "../shared/context"; -import { getSelectedNodeList } from "../shared/utils"; +import { getSelectedNodeList, removeFromOpenFiles } from "../shared/utils"; import { USSTree, createUSSTree } from "./USSTree"; import { initSubscribers } from "../shared/init"; import { ZoweLogger } from "../utils/LoggerUtils"; @@ -199,8 +199,8 @@ export async function initUSSProvider(context: vscode.ExtensionContext): Promise ); context.subscriptions.push( vscode.workspace.onDidCloseTextDocument((doc) => { - if (TreeProviders.uss.openFiles && doc.uri.fsPath.includes(globals.USS_DIR)) { - TreeProviders.uss.openFiles[doc.uri.fsPath] = null; + if (doc.uri.fsPath.includes(globals.USS_DIR)) { + removeFromOpenFiles(TreeProviders.uss, doc.uri.fsPath); } }) ); From 51111105d072ca36a30d8d6f565f08dc46ac1e01 Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Thu, 30 Nov 2023 14:59:38 -0500 Subject: [PATCH 58/76] fix for broken theia check Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../__tests__/__theia__/theia/extension.theiaFirefox.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts index 1542605d6d..99990cdace 100644 --- a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts +++ b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts @@ -83,10 +83,6 @@ export async function addProfileDetailsInJobs(profileName: string) { const jobsProfileName = await driverFirefox.findElement(By.xpath(JobsLocators.emptyInputBoxXpath)); jobsProfileName.sendKeys(profileName); jobsProfileName.sendKeys(Key.ENTER); - await driverFirefox.sleep(SHORTSLEEPTIME); - const addToAllTrees = await driverFirefox.findElement(By.xpath(JobsLocators.emptyInputBoxXpath)); - addToAllTrees.sendKeys("No"); - addToAllTrees.sendKeys(Key.ENTER); } export async function getUssDefaultProfilename() { From 61aea01d2359b8fcbc0a77e16a5778f40ad08c6d Mon Sep 17 00:00:00 2001 From: Trae Yelovich Date: Thu, 30 Nov 2023 15:15:21 -0500 Subject: [PATCH 59/76] Integration: fix openPS calls Signed-off-by: Trae Yelovich --- .../__integration__/extension.integration.test.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__integration__/extension.integration.test.ts b/packages/zowe-explorer/__tests__/__integration__/extension.integration.test.ts index a27d8263e6..3a876f5025 100644 --- a/packages/zowe-explorer/__tests__/__integration__/extension.integration.test.ts +++ b/packages/zowe-explorer/__tests__/__integration__/extension.integration.test.ts @@ -332,7 +332,7 @@ describe("Extension Integration Tests", async () => { it("should display an error message when openPS is passed an invalid node", async () => { const node = new ZoweDatasetNode(pattern + ".GARBAGE", vscode.TreeItemCollapsibleState.None, sessionNode, null); const errorMessageStub = sandbox.spy(vscode.window, "showErrorMessage"); - await expect(dsActions.openPS(node, true)).to.eventually.be.rejectedWith(Error); + await expect(dsActions.openPS(node, true, testTree)).to.eventually.be.rejectedWith(Error); const called = errorMessageStub.called; expect(called).to.equal(true); @@ -346,7 +346,7 @@ describe("Extension Integration Tests", async () => { profiles[1].dirty = true; const children = await profiles[1].getChildren(); children[1].dirty = true; - await dsActions.openPS(children[1], true); + await dsActions.openPS(children[1], true, testTree); const changedData = "PS Upload Test"; @@ -359,7 +359,7 @@ describe("Extension Integration Tests", async () => { await dsActions.saveFile(doc, testTree); // Download file - await dsActions.openPS(children[1], true); + await dsActions.openPS(children[1], true, testTree); expect(doc.getText().trim()).to.deep.equal("PS Upload Test"); @@ -377,7 +377,7 @@ describe("Extension Integration Tests", async () => { // Test for member under PO const childrenMembers = await testTree.getChildren(children[0]); - await dsActions.openPS(childrenMembers[0], true); + await dsActions.openPS(childrenMembers[0], true, testTree); const changedData2 = "PO Member Upload Test"; @@ -393,7 +393,7 @@ describe("Extension Integration Tests", async () => { await dsActions.saveFile(doc2, testTree); // Download file - await dsActions.openPS(childrenMembers[0], true); + await dsActions.openPS(childrenMembers[0], true, testTree); expect(doc2.getText().trim()).to.deep.equal("PO Member Upload Test"); From 213be2bd55f06d2654f9109125b93267a461ede7 Mon Sep 17 00:00:00 2001 From: Billie Simmons <49491949+JillieBeanSim@users.noreply.github.com> Date: Thu, 30 Nov 2023 15:30:09 -0500 Subject: [PATCH 60/76] address codesmell and changelog Signed-off-by: Billie Simmons <49491949+JillieBeanSim@users.noreply.github.com> --- packages/zowe-explorer-api/CHANGELOG.md | 1 + packages/zowe-explorer-api/src/tree/IZoweTreeNode.ts | 6 ++++++ packages/zowe-explorer/src/job/ZosJobsProvider.ts | 1 - 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/zowe-explorer-api/CHANGELOG.md b/packages/zowe-explorer-api/CHANGELOG.md index 4133e271c3..00a33e5612 100644 --- a/packages/zowe-explorer-api/CHANGELOG.md +++ b/packages/zowe-explorer-api/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to the "zowe-explorer-api" extension will be documented in t ### New features and enhancements - Added new optional boolean parameter `hideFromAllTrees` to `IZoweTree.deleteSession` for specifying whether to hide from all trees or current tree. [#2567](https://github.com/zowe/vscode-extension-for-zowe/issues/2567) +- Added optional `filter` and `actualJobs` variables to `IZoweJobTreeNode` to track local filter search. ### Bug fixes diff --git a/packages/zowe-explorer-api/src/tree/IZoweTreeNode.ts b/packages/zowe-explorer-api/src/tree/IZoweTreeNode.ts index 3b3e03cc8a..ba6331a183 100644 --- a/packages/zowe-explorer-api/src/tree/IZoweTreeNode.ts +++ b/packages/zowe-explorer-api/src/tree/IZoweTreeNode.ts @@ -345,7 +345,13 @@ export interface IZoweJobTreeNode extends IZoweTreeNode { * Returns whether the job node is a filtered search */ filtered?: boolean; + /** + * Filter method for this job search + */ filter?: string; + /** + * Array of original filter search results job's children + */ actualJobs?: IZoweTreeNode[]; /** * Retrieves child nodes of this IZoweJobTreeNode diff --git a/packages/zowe-explorer/src/job/ZosJobsProvider.ts b/packages/zowe-explorer/src/job/ZosJobsProvider.ts index 7b3275f3d6..2a41d67779 100644 --- a/packages/zowe-explorer/src/job/ZosJobsProvider.ts +++ b/packages/zowe-explorer/src/job/ZosJobsProvider.ts @@ -1203,7 +1203,6 @@ export class ZosJobsProvider extends ZoweTreeProvider implements IZoweTree Date: Thu, 30 Nov 2023 15:34:52 -0500 Subject: [PATCH 61/76] fix location of ze changelog Signed-off-by: Billie Simmons <49491949+JillieBeanSim@users.noreply.github.com> --- packages/zowe-explorer/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zowe-explorer/CHANGELOG.md b/packages/zowe-explorer/CHANGELOG.md index d24f981698..194eb0110f 100644 --- a/packages/zowe-explorer/CHANGELOG.md +++ b/packages/zowe-explorer/CHANGELOG.md @@ -9,6 +9,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen - Added support for hiding a Zowe profile across all trees [#2567](https://github.com/zowe/vscode-extension-for-zowe/issues/2567) - Added support for enabling/disabling validation for a Zowe profile across all trees [#2570](https://github.com/zowe/vscode-extension-for-zowe/issues/2570) - Added Display confirmation dialog when submitting local JCL. [#2061](https://github.com/zowe/vscode-extension-for-zowe/issues/2061) +- Added "Sort Jobs" feature in Jobs tree view: accessible via sort icon or right-clicking on session node. [#2257](https://github.com/zowe/vscode-extension-for-zowe/issues/2257) ### Bug fixes @@ -36,7 +37,6 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen ### New features and enhancements -- Added "Sort Jobs" feature in Jobs tree view: accessible via sort icon or right-clicking on session node. [#2257](https://github.com/zowe/vscode-extension-for-zowe/issues/2257) - Introduce a new user interface for managing profiles via right-click action "Manage Profile". - Added new edit feature on `Edit Attributes` view for changing file tags on USS. [#2113](https://github.com/zowe/vscode-extension-for-zowe/issues/2113) - Added new API {ZE Extender MetaData} to allow extenders to have the metadata of registered extenders to aid in team configuration file creation from a view that isn't Zowe Explorer's. [#2394](https://github.com/zowe/vscode-extension-for-zowe/issues/2394) From 0163ee18585ca70df8caf1e38a372c6e9a79bfd5 Mon Sep 17 00:00:00 2001 From: Trae Yelovich Date: Thu, 30 Nov 2023 15:36:56 -0500 Subject: [PATCH 62/76] rename fn: removeFromOpenFiles -> updateOpenFiles Signed-off-by: Trae Yelovich --- .../__tests__/__unit__/shared/utils.unit.test.ts | 13 +++++++++---- packages/zowe-explorer/src/dataset/actions.ts | 5 ++--- packages/zowe-explorer/src/dataset/init.ts | 4 ++-- packages/zowe-explorer/src/job/actions.ts | 6 ++---- packages/zowe-explorer/src/job/init.ts | 4 ++-- packages/zowe-explorer/src/shared/utils.ts | 4 ++-- packages/zowe-explorer/src/uss/ZoweUSSNode.ts | 5 ++--- packages/zowe-explorer/src/uss/init.ts | 4 ++-- 8 files changed, 23 insertions(+), 22 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__unit__/shared/utils.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/shared/utils.unit.test.ts index 9afe55465f..d11e1832b6 100644 --- a/packages/zowe-explorer/__tests__/__unit__/shared/utils.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/shared/utils.unit.test.ts @@ -29,7 +29,7 @@ import { Job } from "../../../src/job/ZoweJobNode"; import { ZoweExplorerApiRegister } from "../../../src/ZoweExplorerApiRegister"; import { Profiles } from "../../../src/Profiles"; import * as utils from "../../../src/utils/ProfilesUtils"; -import { ProfilesCache } from "@zowe/zowe-explorer-api"; +import { IZoweTreeNode, ProfilesCache } from "@zowe/zowe-explorer-api"; import { ZoweLogger } from "../../../src/utils/LoggerUtils"; jest.mock("path"); @@ -611,17 +611,22 @@ describe("Shared utils unit tests - function sortTreeItems", () => { }); }); -describe("Shared utils unit tests - function removeFromOpenFiles", () => { +describe("Shared utils unit tests - function updateOpenFiles", () => { const someTree = { openFiles: {} }; it("sets a file entry to null in the openFiles record", () => { - sharedUtils.removeFromOpenFiles(someTree as any, "/a/doc/path"); + sharedUtils.updateOpenFiles(someTree as any, "/a/doc/path", null); expect(someTree.openFiles["/a/doc/path"]).toBeNull(); }); + it("sets a file entry to a valid node in the openFiles record", () => { + sharedUtils.updateOpenFiles(someTree as any, "/a/doc/path", { label: "testLabel" } as IZoweTreeNode); + expect(someTree.openFiles["/a/doc/path"].label).toBe("testLabel"); + }); + it("does nothing if openFiles is not defined", () => { someTree.openFiles = undefined as any; - sharedUtils.removeFromOpenFiles(someTree as any, "/a/doc/path"); + sharedUtils.updateOpenFiles(someTree as any, "/a/doc/path", null); expect(someTree.openFiles).toBeUndefined(); }); }); diff --git a/packages/zowe-explorer/src/dataset/actions.ts b/packages/zowe-explorer/src/dataset/actions.ts index 5bf47c77a1..e7b113ebe0 100644 --- a/packages/zowe-explorer/src/dataset/actions.ts +++ b/packages/zowe-explorer/src/dataset/actions.ts @@ -26,6 +26,7 @@ import { JOB_SUBMIT_DIALOG_OPTS, getDefaultUri, uploadContent, + updateOpenFiles, } from "../shared/utils"; import { ZoweExplorerApiRegister } from "../ZoweExplorerApiRegister"; import { Profiles } from "../Profiles"; @@ -525,9 +526,7 @@ export async function openPS( node.setEtag(response.apiResponse.etag); } statusMsg.dispose(); - if (datasetProvider.openFiles) { - datasetProvider.openFiles[documentFilePath] = this; - } + updateOpenFiles(datasetProvider, documentFilePath, this); const document = await vscode.workspace.openTextDocument(getDocumentFilePath(label, node)); await api.Gui.showTextDocument(document, { preview: node.wasDoubleClicked != null ? !node.wasDoubleClicked : shouldPreview }); // discard ongoing action to allow new requests on this node diff --git a/packages/zowe-explorer/src/dataset/init.ts b/packages/zowe-explorer/src/dataset/init.ts index 5f53a1fe22..3446115f2a 100644 --- a/packages/zowe-explorer/src/dataset/init.ts +++ b/packages/zowe-explorer/src/dataset/init.ts @@ -18,7 +18,7 @@ import { Profiles } from "../Profiles"; import { DatasetTree, createDatasetTree } from "./DatasetTree"; import { ZoweDatasetNode } from "./ZoweDatasetNode"; import * as contextuals from "../shared/context"; -import { getSelectedNodeList, removeFromOpenFiles } from "../shared/utils"; +import { getSelectedNodeList, updateOpenFiles } from "../shared/utils"; import { initSubscribers } from "../shared/init"; import { ZoweLogger } from "../utils/LoggerUtils"; import { TreeViewUtils } from "../utils/TreeViewUtils"; @@ -219,7 +219,7 @@ export async function initDatasetProvider(context: vscode.ExtensionContext): Pro context.subscriptions.push( vscode.workspace.onDidCloseTextDocument((doc) => { if (doc.uri.fsPath.includes(globals.DS_DIR)) { - removeFromOpenFiles(TreeProviders.ds, doc.uri.fsPath); + updateOpenFiles(TreeProviders.ds, doc.uri.fsPath, null); } }) ); diff --git a/packages/zowe-explorer/src/job/actions.ts b/packages/zowe-explorer/src/job/actions.ts index 863dfaf65f..f688929bce 100644 --- a/packages/zowe-explorer/src/job/actions.ts +++ b/packages/zowe-explorer/src/job/actions.ts @@ -19,7 +19,7 @@ import { Job, Spool } from "./ZoweJobNode"; import * as nls from "vscode-nls"; import SpoolProvider, { encodeJobFile, getSpoolFiles, matchSpool } from "../SpoolProvider"; import { ZoweLogger } from "../utils/LoggerUtils"; -import { SORT_DIRS, getDefaultUri } from "../shared/utils"; +import { SORT_DIRS, getDefaultUri, updateOpenFiles } from "../shared/utils"; import { ZosJobsProvider } from "./ZosJobsProvider"; import { JOB_SORT_OPTS } from "./utils"; import * as globals from "../globals"; @@ -128,9 +128,7 @@ export async function getSpoolContent(session: string, spoolNode: Spool): Promis // Fetch any changes to the spool file if it exists in the SpoolProvider await spoolFile.fetchContent(); } - if (TreeProviders.job.openFiles) { - TreeProviders.job.openFiles[uri.path] = spoolNode; - } + updateOpenFiles(TreeProviders.job, uri.path, spoolNode); await Gui.showTextDocument(uri, { preview: false }); } catch (error) { const isTextDocActive = diff --git a/packages/zowe-explorer/src/job/init.ts b/packages/zowe-explorer/src/job/init.ts index 864612bd5c..97a90777a0 100644 --- a/packages/zowe-explorer/src/job/init.ts +++ b/packages/zowe-explorer/src/job/init.ts @@ -18,7 +18,7 @@ import { Profiles } from "../Profiles"; import { ZosJobsProvider, createJobsTree } from "./ZosJobsProvider"; import * as contextuals from "../shared/context"; import { Job } from "./ZoweJobNode"; -import { getSelectedNodeList, removeFromOpenFiles } from "../shared/utils"; +import { getSelectedNodeList, updateOpenFiles } from "../shared/utils"; import { initSubscribers } from "../shared/init"; import { ZoweLogger } from "../utils/LoggerUtils"; import { TreeProviders } from "../shared/TreeProviders"; @@ -175,7 +175,7 @@ export async function initJobsProvider(context: vscode.ExtensionContext): Promis context.subscriptions.push( vscode.workspace.onDidCloseTextDocument((doc) => { if (doc.uri.scheme === "zosspool") { - removeFromOpenFiles(TreeProviders.job, doc.uri.path); + updateOpenFiles(TreeProviders.job, doc.uri.path, null); } }) ); diff --git a/packages/zowe-explorer/src/shared/utils.ts b/packages/zowe-explorer/src/shared/utils.ts index 1037022b65..2d5eda8169 100644 --- a/packages/zowe-explorer/src/shared/utils.ts +++ b/packages/zowe-explorer/src/shared/utils.ts @@ -414,8 +414,8 @@ export async function compareFileContent( } } -export function removeFromOpenFiles(treeProvider: IZoweTree, docPath: string): void { +export function updateOpenFiles(treeProvider: IZoweTree, docPath: string, value: T | null): void { if (treeProvider.openFiles) { - treeProvider.openFiles[docPath] = null; + treeProvider.openFiles[docPath] = value; } } diff --git a/packages/zowe-explorer/src/uss/ZoweUSSNode.ts b/packages/zowe-explorer/src/uss/ZoweUSSNode.ts index 98072b1254..68725ef2e8 100644 --- a/packages/zowe-explorer/src/uss/ZoweUSSNode.ts +++ b/packages/zowe-explorer/src/uss/ZoweUSSNode.ts @@ -25,6 +25,7 @@ import { closeOpenedTextFile } from "../utils/workspace"; import * as nls from "vscode-nls"; import { UssFileTree, UssFileType, UssFileUtils } from "./FileStructure"; import { ZoweLogger } from "../utils/LoggerUtils"; +import { updateOpenFiles } from "../shared/utils"; // Set up localization nls.config({ @@ -531,9 +532,7 @@ export class ZoweUSSNode extends ZoweTreeNode implements IZoweUSSTreeNode { ussFileProvider.addFileHistory(`[${this.getProfile().name}]: ${this.fullPath}`); ussFileProvider.getTreeView().reveal(this, { select: true, focus: true, expand: false }); - if (ussFileProvider.openFiles) { - ussFileProvider.openFiles[documentFilePath] = this; - } + updateOpenFiles(ussFileProvider, documentFilePath, this); await this.initializeFileOpening(documentFilePath, shouldPreview); } } catch (err) { diff --git a/packages/zowe-explorer/src/uss/init.ts b/packages/zowe-explorer/src/uss/init.ts index e8795ee65a..37446fa08c 100644 --- a/packages/zowe-explorer/src/uss/init.ts +++ b/packages/zowe-explorer/src/uss/init.ts @@ -16,7 +16,7 @@ import * as refreshActions from "../shared/refresh"; import { IZoweUSSTreeNode, IZoweTreeNode } from "@zowe/zowe-explorer-api"; import { Profiles } from "../Profiles"; import * as contextuals from "../shared/context"; -import { getSelectedNodeList, removeFromOpenFiles } from "../shared/utils"; +import { getSelectedNodeList, updateOpenFiles } from "../shared/utils"; import { USSTree, createUSSTree } from "./USSTree"; import { initSubscribers } from "../shared/init"; import { ZoweLogger } from "../utils/LoggerUtils"; @@ -200,7 +200,7 @@ export async function initUSSProvider(context: vscode.ExtensionContext): Promise context.subscriptions.push( vscode.workspace.onDidCloseTextDocument((doc) => { if (doc.uri.fsPath.includes(globals.USS_DIR)) { - removeFromOpenFiles(TreeProviders.uss, doc.uri.fsPath); + updateOpenFiles(TreeProviders.uss, doc.uri.fsPath, null); } }) ); From 3efd109f03096e72ade6a39fd0c4ef8437856ab0 Mon Sep 17 00:00:00 2001 From: Santhoshi Boyina Date: Fri, 1 Dec 2023 02:24:45 +0530 Subject: [PATCH 63/76] updated ze changelog file Signed-off-by: Santhoshi Boyina --- packages/zowe-explorer/CHANGELOG.md | 1 + packages/zowe-explorer/src/job/ZosJobsProvider.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/zowe-explorer/CHANGELOG.md b/packages/zowe-explorer/CHANGELOG.md index 194eb0110f..309f54b0b3 100644 --- a/packages/zowe-explorer/CHANGELOG.md +++ b/packages/zowe-explorer/CHANGELOG.md @@ -10,6 +10,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen - Added support for enabling/disabling validation for a Zowe profile across all trees [#2570](https://github.com/zowe/vscode-extension-for-zowe/issues/2570) - Added Display confirmation dialog when submitting local JCL. [#2061](https://github.com/zowe/vscode-extension-for-zowe/issues/2061) - Added "Sort Jobs" feature in Jobs tree view: accessible via sort icon or right-clicking on session node. [#2257](https://github.com/zowe/vscode-extension-for-zowe/issues/2257) +- 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) ### Bug fixes diff --git a/packages/zowe-explorer/src/job/ZosJobsProvider.ts b/packages/zowe-explorer/src/job/ZosJobsProvider.ts index 2a41d67779..879933fa82 100644 --- a/packages/zowe-explorer/src/job/ZosJobsProvider.ts +++ b/packages/zowe-explorer/src/job/ZosJobsProvider.ts @@ -1203,7 +1203,7 @@ export class ZosJobsProvider extends ZoweTreeProvider implements IZoweTree { From c0bee327ec8ff3dfbf109c7d73d5a593d2e64fee Mon Sep 17 00:00:00 2001 From: Santhoshi Boyina Date: Fri, 1 Dec 2023 18:40:05 +0530 Subject: [PATCH 64/76] Fix for expand causing local filter to disappear Signed-off-by: Santhoshi Boyina --- packages/zowe-explorer/src/job/ZoweJobNode.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/zowe-explorer/src/job/ZoweJobNode.ts b/packages/zowe-explorer/src/job/ZoweJobNode.ts index 0ac960be2a..1e6d1c890f 100644 --- a/packages/zowe-explorer/src/job/ZoweJobNode.ts +++ b/packages/zowe-explorer/src/job/ZoweJobNode.ts @@ -110,6 +110,9 @@ export class Job extends ZoweTreeNode implements IZoweJobTreeNode { public async getChildren(): Promise { const thisSessionNode = this.getSessionNode(); ZoweLogger.trace(`ZoweJobNode.getChildren called for ${String(thisSessionNode.label)}.`); + if (this !== undefined && this.filter !== undefined) { + return this.children; + } if (contextually.isSession(this) && !this.filtered && !contextually.isFavorite(this)) { return [ new Job( @@ -126,7 +129,7 @@ export class Job extends ZoweTreeNode implements IZoweJobTreeNode { if (!this.dirty) { return this.children; } - + console.log("after updating", this); const elementChildren: Record = {}; if (contextually.isJob(this)) { // Fetch spool files under job node @@ -185,7 +188,7 @@ export class Job extends ZoweTreeNode implements IZoweJobTreeNode { } else { // Fetch jobs under session node const jobs = await this.getJobs(this._owner, this._prefix, this._searchId, this._jobStatus); - + console.log("after updating", this); if (jobs.length === 0) { const noJobsNode = new Job( localize("getChildren.noJobs", "No jobs found"), @@ -199,7 +202,6 @@ export class Job extends ZoweTreeNode implements IZoweJobTreeNode { noJobsNode.iconPath = null; return [noJobsNode]; } - jobs.forEach((job) => { let nodeTitle: string; if (job.retcode) { @@ -240,7 +242,7 @@ export class Job extends ZoweTreeNode implements IZoweJobTreeNode { .filter((ch) => Object.values(elementChildren).find((recordCh) => recordCh.label === ch.label) != null) .sort(Job.sortJobs(sortMethod)); this.dirty = false; - + console.log("after updating", this); return this.children; } @@ -270,6 +272,7 @@ export class Job extends ZoweTreeNode implements IZoweJobTreeNode { } public getSessionNode(): IZoweJobTreeNode { + console.log("ZoweJobNode.getSessionNode called."); ZoweLogger.trace("ZoweJobNode.getSessionNode called."); return this.getParent() ? this.getParent().getSessionNode() : this; } From 96c194519494be59c71085be8edab264b4eca51b Mon Sep 17 00:00:00 2001 From: Santhoshi Boyina Date: Fri, 1 Dec 2023 21:13:07 +0530 Subject: [PATCH 65/76] Fix code smell and lint error Signed-off-by: Santhoshi Boyina --- packages/zowe-explorer/src/job/ZoweJobNode.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/zowe-explorer/src/job/ZoweJobNode.ts b/packages/zowe-explorer/src/job/ZoweJobNode.ts index 1e6d1c890f..b378aea522 100644 --- a/packages/zowe-explorer/src/job/ZoweJobNode.ts +++ b/packages/zowe-explorer/src/job/ZoweJobNode.ts @@ -110,7 +110,7 @@ export class Job extends ZoweTreeNode implements IZoweJobTreeNode { public async getChildren(): Promise { const thisSessionNode = this.getSessionNode(); ZoweLogger.trace(`ZoweJobNode.getChildren called for ${String(thisSessionNode.label)}.`); - if (this !== undefined && this.filter !== undefined) { + if (this?.filter !== undefined) { return this.children; } if (contextually.isSession(this) && !this.filtered && !contextually.isFavorite(this)) { @@ -129,7 +129,6 @@ export class Job extends ZoweTreeNode implements IZoweJobTreeNode { if (!this.dirty) { return this.children; } - console.log("after updating", this); const elementChildren: Record = {}; if (contextually.isJob(this)) { // Fetch spool files under job node @@ -188,7 +187,6 @@ export class Job extends ZoweTreeNode implements IZoweJobTreeNode { } else { // Fetch jobs under session node const jobs = await this.getJobs(this._owner, this._prefix, this._searchId, this._jobStatus); - console.log("after updating", this); if (jobs.length === 0) { const noJobsNode = new Job( localize("getChildren.noJobs", "No jobs found"), @@ -242,7 +240,6 @@ export class Job extends ZoweTreeNode implements IZoweJobTreeNode { .filter((ch) => Object.values(elementChildren).find((recordCh) => recordCh.label === ch.label) != null) .sort(Job.sortJobs(sortMethod)); this.dirty = false; - console.log("after updating", this); return this.children; } @@ -272,7 +269,6 @@ export class Job extends ZoweTreeNode implements IZoweJobTreeNode { } public getSessionNode(): IZoweJobTreeNode { - console.log("ZoweJobNode.getSessionNode called."); ZoweLogger.trace("ZoweJobNode.getSessionNode called."); return this.getParent() ? this.getParent().getSessionNode() : this; } From 32a0e6dc8fc4344e4c6b206ee04ef66f6df13b9a Mon Sep 17 00:00:00 2001 From: Trae Yelovich Date: Fri, 1 Dec 2023 09:56:06 -0500 Subject: [PATCH 66/76] tests: Bump patch coverage, move to static methods in providers Signed-off-by: Trae Yelovich --- .../__unit__/dataset/DatasetTree.unit.test.ts | 11 +++++++++++ .../__tests__/__unit__/dataset/init.unit.test.ts | 6 ++++++ .../__tests__/__unit__/extension.unit.test.ts | 3 +++ .../__unit__/job/ZosJobsProvider.unit.test.ts | 12 ++++++++++++ .../__tests__/__unit__/job/init.unit.test.ts | 6 ++++++ .../__tests__/__unit__/uss/USSTree.unit.test.ts | 16 ++++++++++++++++ .../__tests__/__unit__/uss/init.unit.test.ts | 6 ++++++ .../zowe-explorer/src/dataset/DatasetTree.ts | 14 +++++++++++++- packages/zowe-explorer/src/dataset/actions.ts | 4 ++-- packages/zowe-explorer/src/dataset/init.ts | 11 ++--------- .../zowe-explorer/src/job/ZosJobsProvider.ts | 14 +++++++++++++- packages/zowe-explorer/src/job/init.ts | 11 ++--------- packages/zowe-explorer/src/uss/USSTree.ts | 14 +++++++++++++- packages/zowe-explorer/src/uss/init.ts | 11 ++--------- 14 files changed, 107 insertions(+), 32 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__unit__/dataset/DatasetTree.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/dataset/DatasetTree.unit.test.ts index 09f6d5a132..d1b67f6ed7 100644 --- a/packages/zowe-explorer/__tests__/__unit__/dataset/DatasetTree.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/dataset/DatasetTree.unit.test.ts @@ -52,6 +52,7 @@ import { SettingsConfig } from "../../../src/utils/SettingsConfig"; import * as sharedActions from "../../../src/shared/actions"; import { ZoweLogger } from "../../../src/utils/LoggerUtils"; import { TreeProviders } from "../../../src/shared/TreeProviders"; +import { join } from "path"; jest.mock("fs"); jest.mock("util"); @@ -3069,4 +3070,14 @@ describe("Dataset Tree Unit Tests - Sorting and Filtering operations", () => { expect(tree.getFavorites()).toEqual(["test1", "test2", "test3"]); }); }); + + describe("onDidCloseTextDocument", () => { + it("sets the entry in openFiles record to null if Data Set URI is valid", () => { + const doc = { uri: { fsPath: join(globals.DS_DIR, "lpar", "SOME.PS") } } as vscode.TextDocument; + + jest.spyOn(TreeProviders, "ds", "get").mockReturnValue(tree); + DatasetTree.onDidCloseTextDocument(doc); + expect(tree.openFiles[doc.uri.fsPath]).toBeNull(); + }); + }); }); diff --git a/packages/zowe-explorer/__tests__/__unit__/dataset/init.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/dataset/init.unit.test.ts index 86d1595754..896b06301a 100644 --- a/packages/zowe-explorer/__tests__/__unit__/dataset/init.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/dataset/init.unit.test.ts @@ -43,6 +43,7 @@ describe("Test src/dataset/extension", () => { ssoLogin: jest.fn(), ssoLogout: jest.fn(), onDidChangeConfiguration: jest.fn(), + onDidCloseTextDocument: jest.fn(), getTreeView: jest.fn(), refreshElement: jest.fn(), sortPdsMembersDialog: jest.fn(), @@ -281,6 +282,7 @@ describe("Test src/dataset/extension", () => { spyCreateDatasetTree.mockResolvedValue(dsProvider as any); spyOnSubscriptions(commands); + jest.spyOn(vscode.workspace, "onDidCloseTextDocument").mockImplementation(dsProvider.onDidCloseTextDocument); await initDatasetProvider(test.context); }); beforeEach(() => { @@ -297,5 +299,9 @@ describe("Test src/dataset/extension", () => { const myProvider = await initDatasetProvider({} as any); expect(myProvider).toBe(null); }); + + it("should register onDidCloseTextDocument event listener from DatasetTree", () => { + expect(dsProvider.onDidCloseTextDocument).toHaveBeenCalledWith(dsTree.DatasetTree.onDidCloseTextDocument); + }); }); }); diff --git a/packages/zowe-explorer/__tests__/__unit__/extension.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/extension.unit.test.ts index 6b2b6ccc80..d5a61a888c 100644 --- a/packages/zowe-explorer/__tests__/__unit__/extension.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/extension.unit.test.ts @@ -49,6 +49,7 @@ async function createGlobalMocks() { mockCreateTreeView: jest.fn().mockReturnValue({ onDidCollapseElement: jest.fn() }), mockExecuteCommand: jest.fn(), mockRegisterCommand: jest.fn(), + mockOnDidCloseTextDocument: jest.fn(), mockOnDidSaveTextDocument: jest.fn(), mockOnDidChangeSelection: jest.fn(), mockOnDidChangeConfiguration: jest.fn(), @@ -384,6 +385,8 @@ async function createGlobalMocks() { Object.defineProperty(globals.LOG, "error", { value: jest.fn(), configurable: true }); Object.defineProperty(globals.LOG, "debug", { value: jest.fn(), configurable: true }); + jest.spyOn(vscode.workspace, "onDidCloseTextDocument").mockImplementation(globalMocks.onDidCloseTextDocument); + // Create a mocked extension context const mockExtensionCreator = jest.fn( () => diff --git a/packages/zowe-explorer/__tests__/__unit__/job/ZosJobsProvider.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/job/ZosJobsProvider.unit.test.ts index 00d7bd60bb..be29f9f88d 100644 --- a/packages/zowe-explorer/__tests__/__unit__/job/ZosJobsProvider.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/job/ZosJobsProvider.unit.test.ts @@ -35,6 +35,7 @@ import { jobStringValidator } from "../../../src/shared/utils"; import { ZoweLogger } from "../../../src/utils/LoggerUtils"; import { Poller } from "@zowe/zowe-explorer-api/src/utils"; import { SettingsConfig } from "../../../src/utils/SettingsConfig"; +import { TreeProviders } from "../../../src/shared/TreeProviders"; async function createGlobalMocks() { const globalMocks = { @@ -973,3 +974,14 @@ describe("getFavorites", () => { expect(tree.getFavorites()).toEqual(["test1", "test2", "test3"]); }); }); + +describe("onDidCloseTextDocument", () => { + it("sets the entry in openFiles record to null if Spool URI is valid", () => { + const doc = { uri: { scheme: "zosspool", path: "JOB12345.SPOOL1.SYSOUT" } } as vscode.TextDocument; + const tree = new ZosJobsProvider(); + + jest.spyOn(TreeProviders, "job", "get").mockReturnValue(tree); + ZosJobsProvider.onDidCloseTextDocument(doc); + expect(tree.openFiles[doc.uri.path]).toBeNull(); + }); +}); diff --git a/packages/zowe-explorer/__tests__/__unit__/job/init.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/job/init.unit.test.ts index c508c77171..6ae8b496be 100644 --- a/packages/zowe-explorer/__tests__/__unit__/job/init.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/job/init.unit.test.ts @@ -52,6 +52,7 @@ describe("Test src/jobs/extension", () => { ssoLogin: jest.fn(), ssoLogout: jest.fn(), onDidChangeConfiguration: jest.fn(), + onDidCloseTextDocument: jest.fn(), pollData: jest.fn(), refreshElement: jest.fn(), }; @@ -237,6 +238,7 @@ describe("Test src/jobs/extension", () => { spyCreateJobsTree.mockResolvedValue(jobsProvider as any); spyOnSubscriptions(commands); + jest.spyOn(vscode.workspace, "onDidCloseTextDocument").mockImplementation(jobsProvider.onDidCloseTextDocument); await initJobsProvider(test.context); }); beforeEach(() => { @@ -253,5 +255,9 @@ describe("Test src/jobs/extension", () => { const myProvider = await initJobsProvider({} as any); expect(myProvider).toBe(null); }); + + it("should register onDidCloseTextDocument event listener from ZosJobsProvider", () => { + expect(jobsProvider.onDidCloseTextDocument).toHaveBeenCalledWith(jobTree.ZosJobsProvider.onDidCloseTextDocument); + }); }); }); diff --git a/packages/zowe-explorer/__tests__/__unit__/uss/USSTree.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/uss/USSTree.unit.test.ts index 27acebaffc..0cd811c337 100644 --- a/packages/zowe-explorer/__tests__/__unit__/uss/USSTree.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/uss/USSTree.unit.test.ts @@ -34,6 +34,7 @@ import * as workspaceUtils from "../../../src/utils/workspace"; import { createUssApi, bindUssApi } from "../../../__mocks__/mockCreators/api"; import { ZoweLogger } from "../../../src/utils/LoggerUtils"; import { TreeProviders } from "../../../src/shared/TreeProviders"; +import { join } from "path"; async function createGlobalMocks() { const globalMocks = { @@ -1754,4 +1755,19 @@ describe("USSTree Unit Tests - Function USSTree.editSession()", () => { expect(globalMocks.testTree.getFavorites()).toEqual(["test1", "test2", "test3"]); }); }); + + describe("onDidCloseTextDocument", () => { + it("sets the entry in openFiles record to null if USS URI is valid", async () => { + const globalMocks = await createGlobalMocks(); + const tree = globalMocks.testTree as unknown as any; + Object.defineProperty(globals, "USS_DIR", { + value: join("some", "fspath", "_U_"), + }); + const doc = { uri: { fsPath: join(globals.USS_DIR, "lpar", "someFile.txt") } } as vscode.TextDocument; + + jest.spyOn(TreeProviders, "uss", "get").mockReturnValue(tree); + USSTree.onDidCloseTextDocument(doc); + expect(tree.openFiles[doc.uri.fsPath]).toBeNull(); + }); + }); }); diff --git a/packages/zowe-explorer/__tests__/__unit__/uss/init.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/uss/init.unit.test.ts index 99d10a9001..4ff80b0189 100644 --- a/packages/zowe-explorer/__tests__/__unit__/uss/init.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/uss/init.unit.test.ts @@ -43,6 +43,7 @@ describe("Test src/dataset/extension", () => { ssoLogin: jest.fn(), ssoLogout: jest.fn(), onDidChangeConfiguration: jest.fn(), + onDidCloseTextDocument: jest.fn(), getTreeView: jest.fn().mockReturnValue({ reveal: jest.fn(), }), @@ -224,6 +225,7 @@ describe("Test src/dataset/extension", () => { spyCreateUssTree.mockResolvedValue(ussFileProvider as any); spyOnSubscriptions(commands); + jest.spyOn(vscode.workspace, "onDidCloseTextDocument").mockImplementation(ussFileProvider.onDidCloseTextDocument); await initUSSProvider(test.context); }); beforeEach(() => { @@ -240,5 +242,9 @@ describe("Test src/dataset/extension", () => { const myProvider = await initUSSProvider({} as any); expect(myProvider).toBe(null); }); + + it("should register onDidCloseTextDocument event listener from USSTree", () => { + expect(ussFileProvider.onDidCloseTextDocument).toHaveBeenCalledWith(ussTree.USSTree.onDidCloseTextDocument); + }); }); }); diff --git a/packages/zowe-explorer/src/dataset/DatasetTree.ts b/packages/zowe-explorer/src/dataset/DatasetTree.ts index 78f7170e97..830fd55019 100644 --- a/packages/zowe-explorer/src/dataset/DatasetTree.ts +++ b/packages/zowe-explorer/src/dataset/DatasetTree.ts @@ -32,7 +32,7 @@ import { import { Profiles } from "../Profiles"; import { ZoweExplorerApiRegister } from "../ZoweExplorerApiRegister"; import { FilterDescriptor, FilterItem, errorHandling, syncSessionNode } from "../utils/ProfilesUtils"; -import { sortTreeItems, getAppName, getDocumentFilePath, SORT_DIRS } from "../shared/utils"; +import { sortTreeItems, getAppName, getDocumentFilePath, SORT_DIRS, updateOpenFiles } from "../shared/utils"; import { ZoweTreeProvider } from "../abstract/ZoweTreeProvider"; import { ZoweDatasetNode } from "./ZoweDatasetNode"; import { getIconById, getIconByNode, IconId, IIconItem } from "../generators/icons"; @@ -46,6 +46,7 @@ import { DATASET_FILTER_OPTS, DATASET_SORT_OPTS, validateDataSetName, validateMe import { SettingsConfig } from "../utils/SettingsConfig"; import { ZoweLogger } from "../utils/LoggerUtils"; import { TreeViewUtils } from "../utils/TreeViewUtils"; +import { TreeProviders } from "../shared/TreeProviders"; // Set up localization nls.config({ @@ -1540,4 +1541,15 @@ export class DatasetTree extends ZoweTreeProvider implements IZoweTree { if (contextually.isDsMember(zNode)) { diff --git a/packages/zowe-explorer/src/dataset/init.ts b/packages/zowe-explorer/src/dataset/init.ts index 3446115f2a..fa1722014a 100644 --- a/packages/zowe-explorer/src/dataset/init.ts +++ b/packages/zowe-explorer/src/dataset/init.ts @@ -18,11 +18,10 @@ import { Profiles } from "../Profiles"; import { DatasetTree, createDatasetTree } from "./DatasetTree"; import { ZoweDatasetNode } from "./ZoweDatasetNode"; import * as contextuals from "../shared/context"; -import { getSelectedNodeList, updateOpenFiles } from "../shared/utils"; +import { getSelectedNodeList } from "../shared/utils"; import { initSubscribers } from "../shared/init"; import { ZoweLogger } from "../utils/LoggerUtils"; import { TreeViewUtils } from "../utils/TreeViewUtils"; -import { TreeProviders } from "../shared/TreeProviders"; export async function initDatasetProvider(context: vscode.ExtensionContext): Promise { ZoweLogger.trace("dataset.init.initDatasetProvider called."); @@ -216,13 +215,7 @@ export async function initDatasetProvider(context: vscode.ExtensionContext): Pro await datasetProvider.onDidChangeConfiguration(e); }) ); - context.subscriptions.push( - vscode.workspace.onDidCloseTextDocument((doc) => { - if (doc.uri.fsPath.includes(globals.DS_DIR)) { - updateOpenFiles(TreeProviders.ds, doc.uri.fsPath, null); - } - }) - ); + context.subscriptions.push(vscode.workspace.onDidCloseTextDocument(DatasetTree.onDidCloseTextDocument)); initSubscribers(context, datasetProvider); return datasetProvider; diff --git a/packages/zowe-explorer/src/job/ZosJobsProvider.ts b/packages/zowe-explorer/src/job/ZosJobsProvider.ts index 5201f095d5..56891dc764 100644 --- a/packages/zowe-explorer/src/job/ZosJobsProvider.ts +++ b/packages/zowe-explorer/src/job/ZosJobsProvider.ts @@ -17,7 +17,7 @@ import { FilterItem, errorHandling } from "../utils/ProfilesUtils"; import { Profiles } from "../Profiles"; import { ZoweExplorerApiRegister } from "../ZoweExplorerApiRegister"; import { Job, Spool } from "./ZoweJobNode"; -import { getAppName, sortTreeItems, jobStringValidator } from "../shared/utils"; +import { getAppName, sortTreeItems, jobStringValidator, updateOpenFiles } from "../shared/utils"; import { ZoweTreeProvider } from "../abstract/ZoweTreeProvider"; import { getIconByNode } from "../generators/icons"; import * as contextually from "../shared/context"; @@ -29,6 +29,7 @@ import SpoolProvider, { encodeJobFile } from "../SpoolProvider"; import { Poller } from "@zowe/zowe-explorer-api/src/utils"; import { PollDecorator } from "../utils/DecorationProviders"; import { TreeViewUtils } from "../utils/TreeViewUtils"; +import { TreeProviders } from "../shared/TreeProviders"; // Set up localization nls.config({ @@ -1159,6 +1160,17 @@ export class ZosJobsProvider extends ZoweTreeProvider implements IZoweTree { ZoweLogger.trace("job.init.initJobsProvider called."); @@ -172,13 +171,7 @@ export async function initJobsProvider(context: vscode.ExtensionContext): Promis ); context.subscriptions.push(vscode.commands.registerCommand("zowe.jobs.sortBy", async (job) => jobActions.sortJobs(job, jobsProvider))); - context.subscriptions.push( - vscode.workspace.onDidCloseTextDocument((doc) => { - if (doc.uri.scheme === "zosspool") { - updateOpenFiles(TreeProviders.job, doc.uri.path, null); - } - }) - ); + context.subscriptions.push(vscode.workspace.onDidCloseTextDocument(ZosJobsProvider.onDidCloseTextDocument)); initSubscribers(context, jobsProvider); return jobsProvider; diff --git a/packages/zowe-explorer/src/uss/USSTree.ts b/packages/zowe-explorer/src/uss/USSTree.ts index 4940d0c0c7..ea58756148 100644 --- a/packages/zowe-explorer/src/uss/USSTree.ts +++ b/packages/zowe-explorer/src/uss/USSTree.ts @@ -14,7 +14,7 @@ import * as globals from "../globals"; import * as path from "path"; import { imperative } from "@zowe/cli"; import { FilterItem, FilterDescriptor, errorHandling, syncSessionNode } from "../utils/ProfilesUtils"; -import { sortTreeItems, getAppName, checkIfChildPath } from "../shared/utils"; +import { sortTreeItems, getAppName, checkIfChildPath, updateOpenFiles } from "../shared/utils"; import { Gui, IZoweTree, IZoweUSSTreeNode, NodeInteraction, ValidProfileEnum, PersistenceSchemaEnum } from "@zowe/zowe-explorer-api"; import { Profiles } from "../Profiles"; import { ZoweExplorerApiRegister } from "../ZoweExplorerApiRegister"; @@ -28,6 +28,7 @@ import { resetValidationSettings } from "../shared/actions"; import { SettingsConfig } from "../utils/SettingsConfig"; import { ZoweLogger } from "../utils/LoggerUtils"; import { TreeViewUtils } from "../utils/TreeViewUtils"; +import { TreeProviders } from "../shared/TreeProviders"; // Set up localization nls.config({ @@ -979,4 +980,15 @@ export class USSTree extends ZoweTreeProvider implements IZoweTree { ZoweLogger.trace("init.initUSSProvider called."); @@ -197,13 +196,7 @@ export async function initUSSProvider(context: vscode.ExtensionContext): Promise await ussFileProvider.onDidChangeConfiguration(e); }) ); - context.subscriptions.push( - vscode.workspace.onDidCloseTextDocument((doc) => { - if (doc.uri.fsPath.includes(globals.USS_DIR)) { - updateOpenFiles(TreeProviders.uss, doc.uri.fsPath, null); - } - }) - ); + context.subscriptions.push(vscode.workspace.onDidCloseTextDocument(USSTree.onDidCloseTextDocument)); initSubscribers(context, ussFileProvider); return ussFileProvider; From 1555e1bd33ffa3fd953a4c91598d2191e27f77d3 Mon Sep 17 00:00:00 2001 From: Santhoshi Boyina Date: Fri, 1 Dec 2023 22:18:48 +0530 Subject: [PATCH 67/76] Improved code coverage Signed-off-by: Santhoshi Boyina --- .../__unit__/job/ZosJobsProvider.unit.test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/zowe-explorer/__tests__/__unit__/job/ZosJobsProvider.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/job/ZosJobsProvider.unit.test.ts index f5609d4288..e18f5ae0b6 100644 --- a/packages/zowe-explorer/__tests__/__unit__/job/ZosJobsProvider.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/job/ZosJobsProvider.unit.test.ts @@ -1081,4 +1081,18 @@ describe("ZosJobsProvider Unit Test - Filter Jobs", () => { expect(filterJobsSpy).toHaveBeenCalled(); expect(filterJobsSpy).toBeCalledWith(node1); }); + + it("To check Clear filter for profile", async () => { + const testTree = new ZosJobsProvider(); + node1.collapsibleState = vscode.TreeItemCollapsibleState.Expanded; + node1.children = [node2, node3]; + const createInputBoxSpy = jest.spyOn(vscode.window, "createInputBox"); + mockInputBox.value = "ZOWEUSR2(JOB05037) - CC 0000"; + createInputBoxSpy.mockReturnValue(mockInputBox); + globalMocks.mockShowQuickPick.mockReturnValueOnce("$(clear-all) Clear filter for profile"); + const filterJobsSpy = jest.spyOn(testTree, "filterJobsDialog"); + await testTree.filterJobsDialog(node1); + expect(filterJobsSpy).toHaveBeenCalled(); + expect(filterJobsSpy).toBeCalledWith(node1); + }); }); From 3cac29de85c2732b10fc99b2b33a6614d8904a3c Mon Sep 17 00:00:00 2001 From: Trae Yelovich Date: Mon, 4 Dec 2023 09:45:46 -0500 Subject: [PATCH 68/76] chore: fix build error after merge, fix failing test Signed-off-by: Trae Yelovich --- .../__tests__/__unit__/job/ZosJobsProvider.unit.test.ts | 3 ++- packages/zowe-explorer/src/dataset/actions.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__unit__/job/ZosJobsProvider.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/job/ZosJobsProvider.unit.test.ts index d887bb70ad..84def24236 100644 --- a/packages/zowe-explorer/__tests__/__unit__/job/ZosJobsProvider.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/job/ZosJobsProvider.unit.test.ts @@ -1098,8 +1098,9 @@ describe("ZosJobsProvider Unit Test - Filter Jobs", () => { }); describe("onDidCloseTextDocument", () => { - it("sets the entry in openFiles record to null if Spool URI is valid", () => { + it("sets the entry in openFiles record to null if Spool URI is valid", async () => { const doc = { uri: { scheme: "zosspool", path: "JOB12345.SPOOL1.SYSOUT" } } as vscode.TextDocument; + await createGlobalMocks(); const tree = new ZosJobsProvider(); jest.spyOn(TreeProviders, "job", "get").mockReturnValue(tree); diff --git a/packages/zowe-explorer/src/dataset/actions.ts b/packages/zowe-explorer/src/dataset/actions.ts index 14f4dab816..89d1cbdb02 100644 --- a/packages/zowe-explorer/src/dataset/actions.ts +++ b/packages/zowe-explorer/src/dataset/actions.ts @@ -1639,7 +1639,7 @@ export async function saveFile(doc: vscode.TextDocument, datasetProvider: api.IZ await errorHandling(err, sesName); } // Get specific node based on label and parent tree (session / favorites) - const nodes: api.IZoweDatasetTreeNode[] = concatChildNodes(sesNode ? [sesNode] : datasetProvider.mSessionNodes); + const nodes = concatChildNodes(sesNode ? [sesNode] : datasetProvider.mSessionNodes); const node: api.IZoweDatasetTreeNode = nodes.find((zNode) => { if (contextually.isDsMember(zNode)) { From b1e040b62006d663db988904218c2ce04c37cdae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Dec 2023 01:37:36 +0000 Subject: [PATCH 69/76] Bump vite in /samples/vue-webview-sample/webviews/vue-sample Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.4.9 to 4.4.12. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v4.4.12/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v4.4.12/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- .../vue-webview-sample/webviews/vue-sample/package.json | 2 +- samples/vue-webview-sample/webviews/vue-sample/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/samples/vue-webview-sample/webviews/vue-sample/package.json b/samples/vue-webview-sample/webviews/vue-sample/package.json index 86de4c29d0..08c17a707f 100644 --- a/samples/vue-webview-sample/webviews/vue-sample/package.json +++ b/samples/vue-webview-sample/webviews/vue-sample/package.json @@ -15,7 +15,7 @@ "devDependencies": { "@vitejs/plugin-vue": "^4.2.3", "typescript": "^5.0.2", - "vite": "^4.4.9", + "vite": "^4.4.12", "vue-tsc": "^1.8.8" } } diff --git a/samples/vue-webview-sample/webviews/vue-sample/yarn.lock b/samples/vue-webview-sample/webviews/vue-sample/yarn.lock index af86b44273..3e098d550c 100644 --- a/samples/vue-webview-sample/webviews/vue-sample/yarn.lock +++ b/samples/vue-webview-sample/webviews/vue-sample/yarn.lock @@ -399,10 +399,10 @@ typescript@^5.0.2: resolved "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz#02f8ac202b6dad2c0dd5e0913745b47a37998274" integrity sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA== -vite@^4.4.9: - version "4.4.9" - resolved "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz#1402423f1a2f8d66fd8d15e351127c7236d29d3d" - integrity sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA== +vite@^4.4.12: + version "4.4.12" + resolved "https://registry.npmjs.org/vite/-/vite-4.4.12.tgz#e9c355d5a0d8a47afa46cb4bad10820da333da5c" + integrity sha512-KtPlUbWfxzGVul8Nut8Gw2Qe8sBzWY+8QVc5SL8iRFnpnrcoCaNlzO40c1R6hPmcdTwIPEDkq0Y9+27a5tVbdQ== dependencies: esbuild "^0.18.10" postcss "^8.4.27" From 35eb02b1cf51e9f1ecbb24853d5fffe5033544d6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Dec 2023 01:51:37 +0000 Subject: [PATCH 70/76] Bump vite from 4.4.9 to 4.4.12 Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.4.9 to 4.4.12. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v4.4.12/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v4.4.12/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5f32b42838..427c49fa5e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11642,9 +11642,9 @@ vite-plugin-checker@^0.6.2: vscode-uri "^3.0.2" vite@^4.4.9: - version "4.4.9" - resolved "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz" - integrity sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA== + version "4.4.12" + resolved "https://registry.npmjs.org/vite/-/vite-4.4.12.tgz#e9c355d5a0d8a47afa46cb4bad10820da333da5c" + integrity sha512-KtPlUbWfxzGVul8Nut8Gw2Qe8sBzWY+8QVc5SL8iRFnpnrcoCaNlzO40c1R6hPmcdTwIPEDkq0Y9+27a5tVbdQ== dependencies: esbuild "^0.18.10" postcss "^8.4.27" From 71c6ab5d2ba8c4a8e9b0e7712508667fc3cbe33e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Dec 2023 02:20:02 +0000 Subject: [PATCH 71/76] Bump vite from 4.4.9 to 4.4.12 in /packages/zowe-explorer/src/webviews Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.4.9 to 4.4.12. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v4.4.12/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v4.4.12/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- packages/zowe-explorer/src/webviews/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zowe-explorer/src/webviews/package.json b/packages/zowe-explorer/src/webviews/package.json index 894ac5f089..f470472c5f 100644 --- a/packages/zowe-explorer/src/webviews/package.json +++ b/packages/zowe-explorer/src/webviews/package.json @@ -29,7 +29,7 @@ "@types/lodash.isequal": "^4.5.6", "@vscode/codicons": "^0.0.33", "typescript": "^4.5.3", - "vite": "^4.4.9", + "vite": "^4.4.12", "vite-plugin-checker": "^0.6.2" } } From b0fac15e2f4f50381fa394790b012bedc2cbf555 Mon Sep 17 00:00:00 2001 From: Billie Simmons <49491949+JillieBeanSim@users.noreply.github.com> Date: Fri, 8 Dec 2023 08:49:54 -0500 Subject: [PATCH 72/76] prepare release Signed-off-by: Billie Simmons <49491949+JillieBeanSim@users.noreply.github.com> --- lerna.json | 2 +- packages/eslint-plugin-zowe-explorer/CHANGELOG.md | 4 ---- packages/zowe-explorer-api/CHANGELOG.md | 2 -- packages/zowe-explorer-ftp-extension/CHANGELOG.md | 4 ---- yarn.lock | 8 ++++---- 5 files changed, 5 insertions(+), 15 deletions(-) diff --git a/lerna.json b/lerna.json index be5de7fc16..d4ea16df53 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.13.0-SNAPSHOT", + "version": "2.13.0", "command": { "version": { "forcePublish": true, diff --git a/packages/eslint-plugin-zowe-explorer/CHANGELOG.md b/packages/eslint-plugin-zowe-explorer/CHANGELOG.md index 0f96394fc8..8a6ba3f75c 100644 --- a/packages/eslint-plugin-zowe-explorer/CHANGELOG.md +++ b/packages/eslint-plugin-zowe-explorer/CHANGELOG.md @@ -2,10 +2,6 @@ All notable changes to the "eslint-plugin-zowe-explorer" package will be documen ## TBD Release -### New features and enhancements - -### Bug fixes - ## `2.12.2` ## `2.12.1` diff --git a/packages/zowe-explorer-api/CHANGELOG.md b/packages/zowe-explorer-api/CHANGELOG.md index ca90a57178..cd3bf8dfa5 100644 --- a/packages/zowe-explorer-api/CHANGELOG.md +++ b/packages/zowe-explorer-api/CHANGELOG.md @@ -11,8 +11,6 @@ All notable changes to the "zowe-explorer-api" extension will be documented in t - Added optional `filter` and `actualJobs` variables to `IZoweJobTreeNode` to track local filter search. - Added new optional record `openFiles` to `IZoweTree` to track opened files under a specific tree view. [#2597](https://github.com/zowe/vscode-extension-for-zowe/issues/2597) -### Bug fixes - ## `2.12.2` ## `2.12.1` diff --git a/packages/zowe-explorer-ftp-extension/CHANGELOG.md b/packages/zowe-explorer-ftp-extension/CHANGELOG.md index 48696bd600..6632db43ef 100644 --- a/packages/zowe-explorer-ftp-extension/CHANGELOG.md +++ b/packages/zowe-explorer-ftp-extension/CHANGELOG.md @@ -2,10 +2,6 @@ All notable changes to the "zowe-explorer-ftp-extension" extension will be docum ## TBD Release -### New features and enhancements - -### Bug fixes - ## `2.12.2` ## `2.12.1` diff --git a/yarn.lock b/yarn.lock index 427c49fa5e..417487a991 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11641,10 +11641,10 @@ vite-plugin-checker@^0.6.2: vscode-languageserver-textdocument "^1.0.1" vscode-uri "^3.0.2" -vite@^4.4.9: - version "4.4.12" - resolved "https://registry.npmjs.org/vite/-/vite-4.4.12.tgz#e9c355d5a0d8a47afa46cb4bad10820da333da5c" - integrity sha512-KtPlUbWfxzGVul8Nut8Gw2Qe8sBzWY+8QVc5SL8iRFnpnrcoCaNlzO40c1R6hPmcdTwIPEDkq0Y9+27a5tVbdQ== +vite@^4.4.12: + version "4.5.1" + resolved "https://registry.npmjs.org/vite/-/vite-4.5.1.tgz#3370986e1ed5dbabbf35a6c2e1fb1e18555b968a" + integrity sha512-AXXFaAJ8yebyqzoNB9fu2pHoo/nWX+xZlaRwoeYUxEqBO+Zj4msE5G+BhGBll9lYEKv9Hfks52PAF2X7qDYXQA== dependencies: esbuild "^0.18.10" postcss "^8.4.27" From 2b504edeb27f7b587da60588eaf6591a958e61b3 Mon Sep 17 00:00:00 2001 From: zowe-robot Date: Tue, 12 Dec 2023 16:09:50 +0000 Subject: [PATCH 73/76] Bump version to 2.13.0 [ci skip] Signed-off-by: zowe-robot --- packages/eslint-plugin-zowe-explorer/CHANGELOG.md | 2 +- packages/eslint-plugin-zowe-explorer/package.json | 2 +- packages/zowe-explorer-api/CHANGELOG.md | 2 +- packages/zowe-explorer-api/package.json | 2 +- packages/zowe-explorer-ftp-extension/CHANGELOG.md | 2 +- packages/zowe-explorer-ftp-extension/package.json | 4 ++-- packages/zowe-explorer/CHANGELOG.md | 2 +- packages/zowe-explorer/package.json | 6 +++--- packages/zowe-explorer/src/webviews/package.json | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/eslint-plugin-zowe-explorer/CHANGELOG.md b/packages/eslint-plugin-zowe-explorer/CHANGELOG.md index 8a6ba3f75c..33b024c812 100644 --- a/packages/eslint-plugin-zowe-explorer/CHANGELOG.md +++ b/packages/eslint-plugin-zowe-explorer/CHANGELOG.md @@ -1,6 +1,6 @@ All notable changes to the "eslint-plugin-zowe-explorer" package will be documented in this file. -## TBD Release +## `2.13.0` ## `2.12.2` diff --git a/packages/eslint-plugin-zowe-explorer/package.json b/packages/eslint-plugin-zowe-explorer/package.json index 7d9500aee8..a118a4a34e 100644 --- a/packages/eslint-plugin-zowe-explorer/package.json +++ b/packages/eslint-plugin-zowe-explorer/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-zowe-explorer", - "version": "2.13.0-SNAPSHOT", + "version": "2.13.0", "description": "Custom ESLint Rules for ZOWE Explorer", "keywords": [ "eslint", diff --git a/packages/zowe-explorer-api/CHANGELOG.md b/packages/zowe-explorer-api/CHANGELOG.md index cd3bf8dfa5..66ba71f571 100644 --- a/packages/zowe-explorer-api/CHANGELOG.md +++ b/packages/zowe-explorer-api/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to the "zowe-explorer-api" extension will be documented in this file. -## TBD Release +## `2.13.0` ### New features and enhancements diff --git a/packages/zowe-explorer-api/package.json b/packages/zowe-explorer-api/package.json index e2be0fa376..3dea1a20e5 100644 --- a/packages/zowe-explorer-api/package.json +++ b/packages/zowe-explorer-api/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zowe-explorer-api", - "version": "2.13.0-SNAPSHOT", + "version": "2.13.0", "description": "Extensibility API for Zowe Explorer.", "publisher": "Zowe", "author": "Zowe", diff --git a/packages/zowe-explorer-ftp-extension/CHANGELOG.md b/packages/zowe-explorer-ftp-extension/CHANGELOG.md index 6632db43ef..68f81f57b6 100644 --- a/packages/zowe-explorer-ftp-extension/CHANGELOG.md +++ b/packages/zowe-explorer-ftp-extension/CHANGELOG.md @@ -1,6 +1,6 @@ All notable changes to the "zowe-explorer-ftp-extension" extension will be documented in this file. -## TBD Release +## `2.13.0` ## `2.12.2` diff --git a/packages/zowe-explorer-ftp-extension/package.json b/packages/zowe-explorer-ftp-extension/package.json index 2bb7410c46..d53ccefbc9 100644 --- a/packages/zowe-explorer-ftp-extension/package.json +++ b/packages/zowe-explorer-ftp-extension/package.json @@ -5,7 +5,7 @@ "author": "Zowe", "license": "EPL-2.0", "description": "Adds zFTP support to Zowe Explorer demonstrating how to extend the Zowe Explorer using its extensibility API.", - "version": "2.13.0-SNAPSHOT", + "version": "2.13.0", "icon": "resources/zowe-ftp-color.png", "repository": { "url": "https://github.com/zowe/vscode-extension-for-zowe" @@ -48,7 +48,7 @@ }, "dependencies": { "@zowe/zos-ftp-for-zowe-cli": "2.1.2", - "@zowe/zowe-explorer-api": "2.13.0-SNAPSHOT", + "@zowe/zowe-explorer-api": "2.13.0", "tmp": "0.2.1" }, "devDependencies": { diff --git a/packages/zowe-explorer/CHANGELOG.md b/packages/zowe-explorer/CHANGELOG.md index f90033235d..5a7f68a73d 100644 --- a/packages/zowe-explorer/CHANGELOG.md +++ b/packages/zowe-explorer/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documented in this file. -## TBD Release +## `2.13.0` ### New features and enhancements diff --git a/packages/zowe-explorer/package.json b/packages/zowe-explorer/package.json index f9f02c027c..c2baea2275 100644 --- a/packages/zowe-explorer/package.json +++ b/packages/zowe-explorer/package.json @@ -2,7 +2,7 @@ "name": "vscode-extension-for-zowe", "displayName": "%displayName%", "description": "%description%", - "version": "2.13.0-SNAPSHOT", + "version": "2.13.0", "publisher": "Zowe", "author": "Zowe", "license": "EPL-2.0", @@ -1985,7 +1985,7 @@ "copy-webpack-plugin": "^6.4.1", "cross-env": "^5.2.0", "del": "^4.1.1", - "eslint-plugin-zowe-explorer": "2.13.0-SNAPSHOT", + "eslint-plugin-zowe-explorer": "2.13.0", "event-stream": "^4.0.1", "expect": "^24.8.0", "geckodriver": "^1.19.1", @@ -2011,7 +2011,7 @@ }, "dependencies": { "@zowe/secrets-for-zowe-sdk": "7.18.6", - "@zowe/zowe-explorer-api": "2.13.0-SNAPSHOT", + "@zowe/zowe-explorer-api": "2.13.0", "dayjs": "^1.11.10", "fs-extra": "8.0.1", "isbinaryfile": "4.0.4", diff --git a/packages/zowe-explorer/src/webviews/package.json b/packages/zowe-explorer/src/webviews/package.json index f470472c5f..9f8bb99de8 100644 --- a/packages/zowe-explorer/src/webviews/package.json +++ b/packages/zowe-explorer/src/webviews/package.json @@ -2,7 +2,7 @@ "name": "webviews", "private": true, "type": "module", - "version": "2.13.0-SNAPSHOT", + "version": "2.13.0", "main": "index.js", "license": "EPL-2.0", "scripts": { From b2c62f4b8913fbecf8c1ca4c6da6de9916aec68d Mon Sep 17 00:00:00 2001 From: zowe-robot Date: Tue, 12 Dec 2023 16:11:40 +0000 Subject: [PATCH 74/76] Bump version to 2.14.0-SNAPSHOT [ci skip] Signed-off-by: zowe-robot --- lerna.json | 2 +- packages/eslint-plugin-zowe-explorer/CHANGELOG.md | 6 ++++++ packages/eslint-plugin-zowe-explorer/package.json | 2 +- packages/zowe-explorer-api/CHANGELOG.md | 6 ++++++ packages/zowe-explorer-api/package.json | 2 +- packages/zowe-explorer-ftp-extension/CHANGELOG.md | 6 ++++++ packages/zowe-explorer-ftp-extension/package.json | 4 ++-- packages/zowe-explorer/CHANGELOG.md | 6 ++++++ packages/zowe-explorer/package.json | 6 +++--- packages/zowe-explorer/src/webviews/package.json | 2 +- 10 files changed, 33 insertions(+), 9 deletions(-) diff --git a/lerna.json b/lerna.json index d4ea16df53..bfbc8f0828 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.13.0", + "version": "2.14.0-SNAPSHOT", "command": { "version": { "forcePublish": true, diff --git a/packages/eslint-plugin-zowe-explorer/CHANGELOG.md b/packages/eslint-plugin-zowe-explorer/CHANGELOG.md index 33b024c812..3b0c868643 100644 --- a/packages/eslint-plugin-zowe-explorer/CHANGELOG.md +++ b/packages/eslint-plugin-zowe-explorer/CHANGELOG.md @@ -1,5 +1,11 @@ All notable changes to the "eslint-plugin-zowe-explorer" package will be documented in this file. +## TBD Release + +### New features and enhancements + +### Bug fixes + ## `2.13.0` ## `2.12.2` diff --git a/packages/eslint-plugin-zowe-explorer/package.json b/packages/eslint-plugin-zowe-explorer/package.json index a118a4a34e..561fb56684 100644 --- a/packages/eslint-plugin-zowe-explorer/package.json +++ b/packages/eslint-plugin-zowe-explorer/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-zowe-explorer", - "version": "2.13.0", + "version": "2.14.0-SNAPSHOT", "description": "Custom ESLint Rules for ZOWE Explorer", "keywords": [ "eslint", diff --git a/packages/zowe-explorer-api/CHANGELOG.md b/packages/zowe-explorer-api/CHANGELOG.md index 66ba71f571..690464fe4d 100644 --- a/packages/zowe-explorer-api/CHANGELOG.md +++ b/packages/zowe-explorer-api/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to the "zowe-explorer-api" extension will be documented in this file. +## TBD Release + +### New features and enhancements + +### Bug fixes + ## `2.13.0` ### New features and enhancements diff --git a/packages/zowe-explorer-api/package.json b/packages/zowe-explorer-api/package.json index 3dea1a20e5..0d218be3a3 100644 --- a/packages/zowe-explorer-api/package.json +++ b/packages/zowe-explorer-api/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zowe-explorer-api", - "version": "2.13.0", + "version": "2.14.0-SNAPSHOT", "description": "Extensibility API for Zowe Explorer.", "publisher": "Zowe", "author": "Zowe", diff --git a/packages/zowe-explorer-ftp-extension/CHANGELOG.md b/packages/zowe-explorer-ftp-extension/CHANGELOG.md index 68f81f57b6..77956dae56 100644 --- a/packages/zowe-explorer-ftp-extension/CHANGELOG.md +++ b/packages/zowe-explorer-ftp-extension/CHANGELOG.md @@ -1,5 +1,11 @@ All notable changes to the "zowe-explorer-ftp-extension" extension will be documented in this file. +## TBD Release + +### New features and enhancements + +### Bug fixes + ## `2.13.0` ## `2.12.2` diff --git a/packages/zowe-explorer-ftp-extension/package.json b/packages/zowe-explorer-ftp-extension/package.json index d53ccefbc9..a002488d4a 100644 --- a/packages/zowe-explorer-ftp-extension/package.json +++ b/packages/zowe-explorer-ftp-extension/package.json @@ -5,7 +5,7 @@ "author": "Zowe", "license": "EPL-2.0", "description": "Adds zFTP support to Zowe Explorer demonstrating how to extend the Zowe Explorer using its extensibility API.", - "version": "2.13.0", + "version": "2.14.0-SNAPSHOT", "icon": "resources/zowe-ftp-color.png", "repository": { "url": "https://github.com/zowe/vscode-extension-for-zowe" @@ -48,7 +48,7 @@ }, "dependencies": { "@zowe/zos-ftp-for-zowe-cli": "2.1.2", - "@zowe/zowe-explorer-api": "2.13.0", + "@zowe/zowe-explorer-api": "2.14.0-SNAPSHOT", "tmp": "0.2.1" }, "devDependencies": { diff --git a/packages/zowe-explorer/CHANGELOG.md b/packages/zowe-explorer/CHANGELOG.md index 5a7f68a73d..5ddb999031 100644 --- a/packages/zowe-explorer/CHANGELOG.md +++ b/packages/zowe-explorer/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documented in this file. +## TBD Release + +### New features and enhancements + +### Bug fixes + ## `2.13.0` ### New features and enhancements diff --git a/packages/zowe-explorer/package.json b/packages/zowe-explorer/package.json index c2baea2275..6c8edf6005 100644 --- a/packages/zowe-explorer/package.json +++ b/packages/zowe-explorer/package.json @@ -2,7 +2,7 @@ "name": "vscode-extension-for-zowe", "displayName": "%displayName%", "description": "%description%", - "version": "2.13.0", + "version": "2.14.0-SNAPSHOT", "publisher": "Zowe", "author": "Zowe", "license": "EPL-2.0", @@ -1985,7 +1985,7 @@ "copy-webpack-plugin": "^6.4.1", "cross-env": "^5.2.0", "del": "^4.1.1", - "eslint-plugin-zowe-explorer": "2.13.0", + "eslint-plugin-zowe-explorer": "2.14.0-SNAPSHOT", "event-stream": "^4.0.1", "expect": "^24.8.0", "geckodriver": "^1.19.1", @@ -2011,7 +2011,7 @@ }, "dependencies": { "@zowe/secrets-for-zowe-sdk": "7.18.6", - "@zowe/zowe-explorer-api": "2.13.0", + "@zowe/zowe-explorer-api": "2.14.0-SNAPSHOT", "dayjs": "^1.11.10", "fs-extra": "8.0.1", "isbinaryfile": "4.0.4", diff --git a/packages/zowe-explorer/src/webviews/package.json b/packages/zowe-explorer/src/webviews/package.json index 9f8bb99de8..f6b58c4d16 100644 --- a/packages/zowe-explorer/src/webviews/package.json +++ b/packages/zowe-explorer/src/webviews/package.json @@ -2,7 +2,7 @@ "name": "webviews", "private": true, "type": "module", - "version": "2.13.0", + "version": "2.14.0-SNAPSHOT", "main": "index.js", "license": "EPL-2.0", "scripts": { From 81732370363e6507f253b00964e79e9f4d032811 Mon Sep 17 00:00:00 2001 From: Trae Yelovich Date: Wed, 20 Dec 2023 11:06:53 -0500 Subject: [PATCH 75/76] Fix typo for TSC structure link Signed-off-by: Trae Yelovich --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 73ac5cdf11..f785c0a0ee 100644 --- a/README.md +++ b/README.md @@ -106,4 +106,4 @@ Check out more about using Zowe Explorer and Zowe on [Medium](https://medium.com Zowe Explorer is a component of the Zowe Open Mainframe Project, part of the Linux Foundation. -To learn more about how Zowe is structured and governed, see the [Technical Steering Committee Strucutre and Governance documentation](https://github.com/zowe/community/blob/master/Technical-Steering-Committee/tsc-governance.md). +To learn more about how Zowe is structured and governed, see the [Technical Steering Committee Structure and Governance documentation](https://github.com/zowe/community/blob/master/Technical-Steering-Committee/tsc-governance.md). From 3c63c416e76d26559ab8ef1844588995e9135a6d Mon Sep 17 00:00:00 2001 From: Trae Yelovich Date: Wed, 20 Dec 2023 11:18:17 -0500 Subject: [PATCH 76/76] fix: change 2.14.1 references to 2.13.1 Signed-off-by: Trae Yelovich --- lerna.json | 2 +- packages/eslint-plugin-zowe-explorer/package.json | 2 +- packages/zowe-explorer-api/package.json | 2 +- packages/zowe-explorer-ftp-extension/package.json | 4 ++-- packages/zowe-explorer/package.json | 6 +++--- packages/zowe-explorer/src/webviews/package.json | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lerna.json b/lerna.json index 80b71b20a5..8d7e39f66b 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.14.1-SNAPSHOT", + "version": "2.13.1-SNAPSHOT", "command": { "version": { "forcePublish": true, diff --git a/packages/eslint-plugin-zowe-explorer/package.json b/packages/eslint-plugin-zowe-explorer/package.json index 3a99eda0a7..cb27cdf6f7 100644 --- a/packages/eslint-plugin-zowe-explorer/package.json +++ b/packages/eslint-plugin-zowe-explorer/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-zowe-explorer", - "version": "2.14.1-SNAPSHOT", + "version": "2.13.1-SNAPSHOT", "description": "Custom ESLint Rules for ZOWE Explorer", "keywords": [ "eslint", diff --git a/packages/zowe-explorer-api/package.json b/packages/zowe-explorer-api/package.json index cb9165ded5..1ff0d09da9 100644 --- a/packages/zowe-explorer-api/package.json +++ b/packages/zowe-explorer-api/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zowe-explorer-api", - "version": "2.14.1-SNAPSHOT", + "version": "2.13.1-SNAPSHOT", "description": "Extensibility API for Zowe Explorer.", "publisher": "Zowe", "author": "Zowe", diff --git a/packages/zowe-explorer-ftp-extension/package.json b/packages/zowe-explorer-ftp-extension/package.json index 07ff06385e..68aa8c520a 100644 --- a/packages/zowe-explorer-ftp-extension/package.json +++ b/packages/zowe-explorer-ftp-extension/package.json @@ -5,7 +5,7 @@ "author": "Zowe", "license": "EPL-2.0", "description": "Adds zFTP support to Zowe Explorer demonstrating how to extend the Zowe Explorer using its extensibility API.", - "version": "2.14.1-SNAPSHOT", + "version": "2.13.1-SNAPSHOT", "icon": "resources/zowe-ftp-color.png", "repository": { "url": "https://github.com/zowe/vscode-extension-for-zowe" @@ -48,7 +48,7 @@ }, "dependencies": { "@zowe/zos-ftp-for-zowe-cli": "2.1.2", - "@zowe/zowe-explorer-api": "2.14.1-SNAPSHOT", + "@zowe/zowe-explorer-api": "2.13.1-SNAPSHOT", "tmp": "0.2.1" }, "devDependencies": { diff --git a/packages/zowe-explorer/package.json b/packages/zowe-explorer/package.json index dc9a348892..b7ec03e33e 100644 --- a/packages/zowe-explorer/package.json +++ b/packages/zowe-explorer/package.json @@ -2,7 +2,7 @@ "name": "vscode-extension-for-zowe", "displayName": "%displayName%", "description": "%description%", - "version": "2.14.1-SNAPSHOT", + "version": "2.13.1-SNAPSHOT", "publisher": "Zowe", "author": "Zowe", "license": "EPL-2.0", @@ -1985,7 +1985,7 @@ "copy-webpack-plugin": "^6.4.1", "cross-env": "^5.2.0", "del": "^4.1.1", - "eslint-plugin-zowe-explorer": "2.14.1-SNAPSHOT", + "eslint-plugin-zowe-explorer": "2.13.1-SNAPSHOT", "event-stream": "^4.0.1", "expect": "^24.8.0", "geckodriver": "^1.19.1", @@ -2011,7 +2011,7 @@ }, "dependencies": { "@zowe/secrets-for-zowe-sdk": "7.18.6", - "@zowe/zowe-explorer-api": "2.14.1-SNAPSHOT", + "@zowe/zowe-explorer-api": "2.13.1-SNAPSHOT", "dayjs": "^1.11.10", "fs-extra": "8.0.1", "isbinaryfile": "4.0.4", diff --git a/packages/zowe-explorer/src/webviews/package.json b/packages/zowe-explorer/src/webviews/package.json index 47ce2e8cf2..3fae6d3b9c 100644 --- a/packages/zowe-explorer/src/webviews/package.json +++ b/packages/zowe-explorer/src/webviews/package.json @@ -2,7 +2,7 @@ "name": "webviews", "private": true, "type": "module", - "version": "2.14.1-SNAPSHOT", + "version": "2.13.1-SNAPSHOT", "main": "index.js", "license": "EPL-2.0", "scripts": {