From 1b7f54f6c8ec80c425e2dbece7cc7177cd0a19d9 Mon Sep 17 00:00:00 2001 From: Billie Simmons <49491949+JillieBeanSim@users.noreply.github.com> Date: Mon, 31 Jan 2022 17:48:08 -0500 Subject: [PATCH 01/11] refresh config wip Signed-off-by: Billie Simmons <49491949+JillieBeanSim@users.noreply.github.com> --- packages/zowe-explorer/src/shared/refresh.ts | 25 ++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/packages/zowe-explorer/src/shared/refresh.ts b/packages/zowe-explorer/src/shared/refresh.ts index fdeb1d8202..6490ddccde 100644 --- a/packages/zowe-explorer/src/shared/refresh.ts +++ b/packages/zowe-explorer/src/shared/refresh.ts @@ -9,15 +9,18 @@ * * */ -import { IZoweTree, IZoweTreeNode, ProfilesCache } from "@zowe/zowe-explorer-api"; +import { IZoweTree, IZoweTreeNode } from "@zowe/zowe-explorer-api"; import { PersistentFilters } from "../PersistentFilters"; import { Profiles } from "../Profiles"; -import { syncSessionNode } from "../utils/ProfilesUtils"; +import { readConfigFromDisk, syncSessionNode } from "../utils/ProfilesUtils"; import { ZoweExplorerApiRegister } from "../ZoweExplorerApiRegister"; import { resetValidationSettings, returnIconState } from "./actions"; import { labelRefresh } from "./utils"; import * as contextually from "../shared/context"; import * as globals from "../globals"; +import { createDatasetTree } from "../dataset/DatasetTree"; +import { createUSSTree } from "../uss/USSTree"; +import { createJobsTree } from "../job/ZosJobsProvider"; /** * View (DATA SETS, JOBS, USS) refresh button @@ -26,6 +29,24 @@ import * as globals from "../globals"; * @param {IZoweTree} treeProvider */ export async function refreshAll(treeProvider: IZoweTree) { + await readConfigFromDisk(); + await Profiles.getInstance().refresh(ZoweExplorerApiRegister.getInstance()); + let repaintTree = true; + treeProvider.mSessionNodes.forEach((node) => { + Profiles.getInstance().allProfiles.forEach((profile) => { + if (node.getLabel().toString() == profile.name) { + repaintTree = false; + } + }); + }); + if (repaintTree) { + // Initialize dataset provider + await createDatasetTree(globals.LOG); + // Initialize uss provider + await createUSSTree(globals.LOG); + // Initialize Jobs provider with the created session and the selected pattern + await createJobsTree(globals.LOG); + } treeProvider.mSessionNodes.forEach(async (sessNode) => { const setting = (await PersistentFilters.getDirectValue( globals.SETTINGS_AUTOMATIC_PROFILE_VALIDATION From d4c16254e76c6da729c3976cc07c305633bc1e48 Mon Sep 17 00:00:00 2001 From: Richelle Anne Craw Date: Thu, 3 Feb 2022 16:42:40 +0100 Subject: [PATCH 02/11] Add refresh for initial config creation Signed-off-by: Richelle Anne Craw --- .../src/profiles/ProfilesCache.ts | 40 ++++++++++--------- packages/zowe-explorer/src/Profiles.ts | 11 ----- packages/zowe-explorer/src/extension.ts | 7 ++-- 3 files changed, 26 insertions(+), 32 deletions(-) diff --git a/packages/zowe-explorer-api/src/profiles/ProfilesCache.ts b/packages/zowe-explorer-api/src/profiles/ProfilesCache.ts index 7d20966c15..fb0fddcb0b 100644 --- a/packages/zowe-explorer-api/src/profiles/ProfilesCache.ts +++ b/packages/zowe-explorer-api/src/profiles/ProfilesCache.ts @@ -361,25 +361,29 @@ export class ProfilesCache { const baseProfile = this.defaultProfileByType.get("base"); const allProfiles: imperative.IProfileLoaded[] = []; this.allTypes.forEach((type) => { - const allProfilesByType: imperative.IProfileLoaded[] = []; - const profByType = this.profilesByType.get(type); - profByType.forEach((profile) => { - if ( - (baseProfile?.profile.host !== profile?.profile.host || - baseProfile?.profile.port !== profile?.profile.port) && - profile?.profile.tokenType == "apimlAuthenticationToken" - ) { - profile.profile.tokenType = undefined; - profile.profile.tokenValue = undefined; - // update default profile of type if changed - if (profile.name === this.defaultProfileByType.get(type).name) { - this.defaultProfileByType.set(type, profile); + try { + const allProfilesByType: imperative.IProfileLoaded[] = []; + const profByType = this.profilesByType.get(type); + profByType.forEach((profile) => { + if ( + (baseProfile?.profile.host !== profile?.profile.host || + baseProfile?.profile.port !== profile?.profile.port) && + profile?.profile.tokenType == "apimlAuthenticationToken" + ) { + profile.profile.tokenType = undefined; + profile.profile.tokenValue = undefined; + // update default profile of type if changed + if (profile.name === this.defaultProfileByType.get(type).name) { + this.defaultProfileByType.set(type, profile); + } } - } - allProfiles.push(profile); - allProfilesByType.push(profile); - }); - this.profilesByType.set(type, allProfilesByType); + allProfiles.push(profile); + allProfilesByType.push(profile); + }); + this.profilesByType.set(type, allProfilesByType); + } catch (error) { + // do nothing, skip if profile type is not included in config file + } }); this.allProfiles = []; this.allProfiles.push(...allProfiles); diff --git a/packages/zowe-explorer/src/Profiles.ts b/packages/zowe-explorer/src/Profiles.ts index 4183f10289..322f2b7f4a 100644 --- a/packages/zowe-explorer/src/Profiles.ts +++ b/packages/zowe-explorer/src/Profiles.ts @@ -660,17 +660,6 @@ export class Profiles extends ProfilesCache { configName = ProfilesCache.getConfigInstance().getTeamConfig().configName; } await this.openConfigFile(path.join(rootPath, configName)); - const reloadButton = localize("createZoweSchema.reload.button", "Reload Window"); - const infoMsg = localize( - "createZoweSchema.reload.infoMessage", - "Team Configuration file created. Location: {0}. \n Please update file and reload your window.", - rootPath - ); - await vscode.window.showInformationMessage(infoMsg, ...[reloadButton]).then(async (selection) => { - if (selection === reloadButton) { - await vscode.commands.executeCommand("workbench.action.reloadWindow"); - } - }); return path.join(rootPath, configName); } catch (err) { vscode.window.showErrorMessage("Error in creating team configuration file: " + err.message); diff --git a/packages/zowe-explorer/src/extension.ts b/packages/zowe-explorer/src/extension.ts index 8a758ba209..aa55a315fa 100644 --- a/packages/zowe-explorer/src/extension.ts +++ b/packages/zowe-explorer/src/extension.ts @@ -230,9 +230,10 @@ export async function activate(context: vscode.ExtensionContext): Promise) { - vscode.commands.registerCommand("zowe.all.config.init", async () => - datasetProvider.createZoweSchema(datasetProvider) - ); + vscode.commands.registerCommand("zowe.all.config.init", async () => { + datasetProvider.createZoweSchema(datasetProvider); + await refreshActions.refreshAll(datasetProvider); + }); vscode.commands.registerCommand("zowe.ds.addSession", async () => datasetProvider.createZoweSession(datasetProvider) ); From 00eef48bea1378715f269e764497700b3132ff88 Mon Sep 17 00:00:00 2001 From: Richelle Anne Craw Date: Mon, 7 Feb 2022 12:11:27 +0100 Subject: [PATCH 03/11] Remove reload message Signed-off-by: Richelle Anne Craw --- packages/zowe-explorer/i18n/sample/src/Profiles.i18n.json | 2 -- packages/zowe-explorer/src/shared/refresh.ts | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/zowe-explorer/i18n/sample/src/Profiles.i18n.json b/packages/zowe-explorer/i18n/sample/src/Profiles.i18n.json index 34c7740529..18f381f9c0 100644 --- a/packages/zowe-explorer/i18n/sample/src/Profiles.i18n.json +++ b/packages/zowe-explorer/i18n/sample/src/Profiles.i18n.json @@ -21,8 +21,6 @@ "createZoweSchema.showQuickPick.global": "Global: in the Zowe home directory ", "createZoweSchema.showQuickPick.project": "Project: in the current working directory", "createZoweSchema.undefined.location": "Operation Cancelled", - "createZoweSchema.reload.button": "Reload Window", - "createZoweSchema.reload.infoMessage": "Team Configuration file created. Location: {0}. \n Please update file and reload your window.", "createNewConnection.profileName": "Profile name was not supplied. Operation Cancelled", "createNewConnection.profileType": "No profile type was chosen. Operation Cancelled", "createNewConnection.zosmfURL": "No valid value for z/OS URL. Operation Cancelled", diff --git a/packages/zowe-explorer/src/shared/refresh.ts b/packages/zowe-explorer/src/shared/refresh.ts index 6490ddccde..435567200d 100644 --- a/packages/zowe-explorer/src/shared/refresh.ts +++ b/packages/zowe-explorer/src/shared/refresh.ts @@ -34,7 +34,7 @@ export async function refreshAll(treeProvider: IZoweTree) { let repaintTree = true; treeProvider.mSessionNodes.forEach((node) => { Profiles.getInstance().allProfiles.forEach((profile) => { - if (node.getLabel().toString() == profile.name) { + if (node.getLabel().toString() === profile.name) { repaintTree = false; } }); From 9184dfdedd556562d73398ae772e397fafadfb33 Mon Sep 17 00:00:00 2001 From: Richelle Anne Craw Date: Mon, 7 Feb 2022 12:16:31 +0100 Subject: [PATCH 04/11] fix merge typo Signed-off-by: Richelle Anne Craw --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 226391918b..dbd6faffcf 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "**/minimist": "^0.2.1", "**/diff": "^3.5.0", "**/log4js": "^6.4.0", - "**/nanoid": "^3.1.31" + "**/nanoid": "^3.1.31", "**/markdown-it": "^12.3.2" }, "scripts": { From 2c4e7f082e3846045eaaad58aca9d2eb917f6dfb Mon Sep 17 00:00:00 2001 From: Richelle Anne Craw Date: Mon, 7 Feb 2022 12:52:33 +0100 Subject: [PATCH 05/11] check only for populated trees Signed-off-by: Richelle Anne Craw --- packages/zowe-explorer/src/shared/refresh.ts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/zowe-explorer/src/shared/refresh.ts b/packages/zowe-explorer/src/shared/refresh.ts index 435567200d..dd8b650e87 100644 --- a/packages/zowe-explorer/src/shared/refresh.ts +++ b/packages/zowe-explorer/src/shared/refresh.ts @@ -32,13 +32,19 @@ export async function refreshAll(treeProvider: IZoweTree) { await readConfigFromDisk(); await Profiles.getInstance().refresh(ZoweExplorerApiRegister.getInstance()); let repaintTree = true; - treeProvider.mSessionNodes.forEach((node) => { - Profiles.getInstance().allProfiles.forEach((profile) => { - if (node.getLabel().toString() === profile.name) { - repaintTree = false; - } - }); - }); + if (treeProvider.mSessionNodes) { + try { + treeProvider.mSessionNodes.forEach((node) => { + Profiles.getInstance().allProfiles.forEach((profile) => { + if (node.getLabel().toString() === profile.name) { + repaintTree = false; + } + }); + }); + } catch (error) { + globals.LOG.error(error); + } + } if (repaintTree) { // Initialize dataset provider await createDatasetTree(globals.LOG); From 32e495e6c018361d6f828853fd1b9bbb893718cf Mon Sep 17 00:00:00 2001 From: Richelle Anne Craw Date: Tue, 8 Feb 2022 13:17:57 +0100 Subject: [PATCH 06/11] validate only if tree has nodes Signed-off-by: Richelle Anne Craw --- packages/zowe-explorer/src/shared/refresh.ts | 46 ++++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/packages/zowe-explorer/src/shared/refresh.ts b/packages/zowe-explorer/src/shared/refresh.ts index dd8b650e87..24ded4752e 100644 --- a/packages/zowe-explorer/src/shared/refresh.ts +++ b/packages/zowe-explorer/src/shared/refresh.ts @@ -41,32 +41,32 @@ export async function refreshAll(treeProvider: IZoweTree) { } }); }); + if (repaintTree) { + // Initialize dataset provider + await createDatasetTree(globals.LOG); + // Initialize uss provider + await createUSSTree(globals.LOG); + // Initialize Jobs provider with the created session and the selected pattern + await createJobsTree(globals.LOG); + } + treeProvider.mSessionNodes.forEach(async (sessNode) => { + const setting = (await PersistentFilters.getDirectValue( + globals.SETTINGS_AUTOMATIC_PROFILE_VALIDATION + )) as boolean; + if (contextually.isSessionNotFav(sessNode)) { + labelRefresh(sessNode); + sessNode.children = []; + sessNode.dirty = true; + resetValidationSettings(sessNode, setting); + returnIconState(sessNode); + await syncSessionNode(Profiles.getInstance())((profileValue) => + ZoweExplorerApiRegister.getCommonApi(profileValue).getSession() + )(sessNode); + } + }); } catch (error) { globals.LOG.error(error); } } - if (repaintTree) { - // Initialize dataset provider - await createDatasetTree(globals.LOG); - // Initialize uss provider - await createUSSTree(globals.LOG); - // Initialize Jobs provider with the created session and the selected pattern - await createJobsTree(globals.LOG); - } - treeProvider.mSessionNodes.forEach(async (sessNode) => { - const setting = (await PersistentFilters.getDirectValue( - globals.SETTINGS_AUTOMATIC_PROFILE_VALIDATION - )) as boolean; - if (contextually.isSessionNotFav(sessNode)) { - labelRefresh(sessNode); - sessNode.children = []; - sessNode.dirty = true; - resetValidationSettings(sessNode, setting); - returnIconState(sessNode); - await syncSessionNode(Profiles.getInstance())((profileValue) => - ZoweExplorerApiRegister.getCommonApi(profileValue).getSession() - )(sessNode); - } - }); treeProvider.refresh(); } From 8171f10f13d670bbb93bea7f91734b53a567aba9 Mon Sep 17 00:00:00 2001 From: Richelle Anne Craw Date: Thu, 10 Feb 2022 16:59:42 +0100 Subject: [PATCH 07/11] Add new log mocks for refresh test Signed-off-by: Richelle Anne Craw --- .../__unit__/shared/refresh.unit.test.ts | 7 +++ packages/zowe-explorer/src/shared/refresh.ts | 55 +++++++++---------- yarn.lock | 38 +------------ 3 files changed, 36 insertions(+), 64 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__unit__/shared/refresh.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/shared/refresh.unit.test.ts index e59e970fda..af7e513cae 100644 --- a/packages/zowe-explorer/__tests__/__unit__/shared/refresh.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/shared/refresh.unit.test.ts @@ -23,11 +23,15 @@ import { createFavoriteUSSNode, createUSSNode, createUSSTree } from "../../../__ import { createIJobObject, createJobsTree } from "../../../__mocks__/mockCreators/jobs"; import * as refreshActions from "../../../src/shared/refresh"; import { createDatasetSessionNode, createDatasetTree } from "../../../__mocks__/mockCreators/datasets"; +import * as globals from "../../../src/globals"; function createGlobalMocks() { const globalMocks = { session: createISessionWithoutCredentials(), createTreeView: jest.fn(), + mockLog: jest.fn(), + mockDebug: jest.fn(), + mockError: jest.fn(), mockGetConfiguration: jest.fn(), mockLoadNamedProfile: jest.fn(), testProfile: createIProfile(), @@ -72,6 +76,9 @@ function createGlobalMocks() { }; }), }); + Object.defineProperty(globals, "LOG", { value: globalMocks.mockLog, configurable: true }); + Object.defineProperty(globals.LOG, "debug", { value: globalMocks.mockDebug, configurable: true }); + Object.defineProperty(globals.LOG, "error", { value: globalMocks.mockError, configurable: true }); return globalMocks; } diff --git a/packages/zowe-explorer/src/shared/refresh.ts b/packages/zowe-explorer/src/shared/refresh.ts index 24ded4752e..6c7516d3cf 100644 --- a/packages/zowe-explorer/src/shared/refresh.ts +++ b/packages/zowe-explorer/src/shared/refresh.ts @@ -33,40 +33,39 @@ export async function refreshAll(treeProvider: IZoweTree) { await Profiles.getInstance().refresh(ZoweExplorerApiRegister.getInstance()); let repaintTree = true; if (treeProvider.mSessionNodes) { - try { - treeProvider.mSessionNodes.forEach((node) => { - Profiles.getInstance().allProfiles.forEach((profile) => { + treeProvider.mSessionNodes.forEach(async (node) => { + const allProfiles = await Profiles.getInstance().allProfiles; + if (allProfiles) { + allProfiles.forEach(async (profile) => { if (node.getLabel().toString() === profile.name) { repaintTree = false; } }); - }); - if (repaintTree) { - // Initialize dataset provider - await createDatasetTree(globals.LOG); - // Initialize uss provider - await createUSSTree(globals.LOG); - // Initialize Jobs provider with the created session and the selected pattern - await createJobsTree(globals.LOG); } - treeProvider.mSessionNodes.forEach(async (sessNode) => { - const setting = (await PersistentFilters.getDirectValue( - globals.SETTINGS_AUTOMATIC_PROFILE_VALIDATION - )) as boolean; - if (contextually.isSessionNotFav(sessNode)) { - labelRefresh(sessNode); - sessNode.children = []; - sessNode.dirty = true; - resetValidationSettings(sessNode, setting); - returnIconState(sessNode); - await syncSessionNode(Profiles.getInstance())((profileValue) => - ZoweExplorerApiRegister.getCommonApi(profileValue).getSession() - )(sessNode); - } - }); - } catch (error) { - globals.LOG.error(error); + }); + if (repaintTree) { + // Initialize dataset provider + await createDatasetTree(globals.LOG); + // Initialize uss provider + await createUSSTree(globals.LOG); + // Initialize Jobs provider with the created session and the selected pattern + await createJobsTree(globals.LOG); } + treeProvider.mSessionNodes.forEach(async (sessNode) => { + const setting = (await PersistentFilters.getDirectValue( + globals.SETTINGS_AUTOMATIC_PROFILE_VALIDATION + )) as boolean; + if (contextually.isSessionNotFav(sessNode)) { + labelRefresh(sessNode); + sessNode.children = []; + sessNode.dirty = true; + resetValidationSettings(sessNode, setting); + returnIconState(sessNode); + await syncSessionNode(Profiles.getInstance())((profileValue) => + ZoweExplorerApiRegister.getCommonApi(profileValue).getSession() + )(sessNode); + } + }); } treeProvider.refresh(); } diff --git a/yarn.lock b/yarn.lock index da081f3633..0335761aa3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4391,11 +4391,6 @@ entities@^2.0.0, entities@~2.1.0: resolved "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz#992d3129cf7df6870b96c57858c249a120f8b8b5" integrity sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w== -entities@~2.0.0: - version "2.0.3" - resolved "https://registry.npmjs.org/entities/-/entities-2.0.3.tgz#5c487e5742ab93c15abb5da22759b8590ec03b7f" - integrity sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ== - err-code@^1.0.0: version "1.1.2" resolved "https://registry.npmjs.org/err-code/-/err-code-1.1.2.tgz#06e0116d3028f6aef4806849eb0ea6a748ae6960" @@ -7839,13 +7834,6 @@ lines-and-columns@^1.1.6: resolved "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= -linkify-it@^2.0.0: - version "2.2.0" - resolved "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz#e3b54697e78bf915c70a38acd78fd09e0058b1cf" - integrity sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw== - dependencies: - uc.micro "^1.0.1" - linkify-it@^3.0.1: version "3.0.2" resolved "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.2.tgz#f55eeb8bc1d3ae754049e124ab3bb56d97797fb8" @@ -8079,7 +8067,7 @@ markdown-it-anchor@^5.2.7: resolved "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-5.3.0.tgz#d549acd64856a8ecd1bea58365ef385effbac744" integrity sha512-/V1MnLL/rgJ3jkMWo84UR+K+jF1cxNG1a+KwqeXqTIJ+jtA8aWSHuigx8lTzauiIjBDbwF3NcWQMotd0Dm39jA== -markdown-it@12.3.2: +markdown-it@12.3.2, markdown-it@8.4.2, markdown-it@^10.0.0, markdown-it@^12.3.2: version "12.3.2" resolved "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz#bf92ac92283fe983fe4de8ff8abfb5ad72cd0c90" integrity sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg== @@ -8090,28 +8078,6 @@ markdown-it@12.3.2: mdurl "^1.0.1" uc.micro "^1.0.5" -markdown-it@8.4.2: - version "8.4.2" - resolved "https://registry.npmjs.org/markdown-it/-/markdown-it-8.4.2.tgz#386f98998dc15a37722aa7722084f4020bdd9b54" - integrity sha512-GcRz3AWTqSUphY3vsUqQSFMbgR38a4Lh3GWlHRh/7MRwz8mcu9n2IO7HOh+bXHrR9kOPDl5RNCaEsrneb+xhHQ== - dependencies: - argparse "^1.0.7" - entities "~1.1.1" - linkify-it "^2.0.0" - mdurl "^1.0.1" - uc.micro "^1.0.5" - -markdown-it@^10.0.0: - version "10.0.0" - resolved "https://registry.npmjs.org/markdown-it/-/markdown-it-10.0.0.tgz#abfc64f141b1722d663402044e43927f1f50a8dc" - integrity sha512-YWOP1j7UbDNz+TumYP1kpwnP0aEa711cJjrAQrzd0UXlbJfc5aAq0F/PZHjiioqDC1NKgvIMX+o+9Bk7yuM2dg== - dependencies: - argparse "^1.0.7" - entities "~2.0.0" - linkify-it "^2.0.0" - mdurl "^1.0.1" - uc.micro "^1.0.5" - markdownlint-cli@^0.16.0: version "0.16.0" resolved "https://registry.npmjs.org/markdownlint-cli/-/markdownlint-cli-0.16.0.tgz#725b3a9140a6d4b65e866f76e6086c0a3f3ee480" @@ -8550,7 +8516,7 @@ nan@^2.14.1, nan@^2.15.0: resolved "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz#3f34a473ff18e15c1b5626b62903b5ad6e665fee" integrity sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ== -nanoid@^3.1.23: +nanoid@^3.1.23, nanoid@^3.1.31: version "3.2.0" resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.2.0.tgz#62667522da6673971cca916a6d3eff3f415ff80c" integrity sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA== From ed90bd26a38fba03ca50da68ae64adbab90abde7 Mon Sep 17 00:00:00 2001 From: Billie Simmons <49491949+JillieBeanSim@users.noreply.github.com> Date: Fri, 11 Feb 2022 13:53:56 -0500 Subject: [PATCH 08/11] fix unit tests Signed-off-by: Billie Simmons <49491949+JillieBeanSim@users.noreply.github.com> --- .../__tests__/__unit__/dataset/dsNodeActions.unit.test.ts | 1 + .../__tests__/__unit__/shared/refresh.unit.test.ts | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/packages/zowe-explorer/__tests__/__unit__/dataset/dsNodeActions.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/dataset/dsNodeActions.unit.test.ts index 5955fd1328..aa361662cd 100644 --- a/packages/zowe-explorer/__tests__/__unit__/dataset/dsNodeActions.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/dataset/dsNodeActions.unit.test.ts @@ -200,6 +200,7 @@ describe("dsNodeActions", () => { Object.defineProperty(vscode.window, "showInformationMessage", { value: showInformationMessage }); Object.defineProperty(vscode.workspace, "getConfiguration", { value: getConfiguration }); Object.defineProperty(zowe.ZosmfSession, "createSessCfgFromArgs", { value: createSessCfgFromArgs }); + Object.defineProperty(refreshActions, "refreshAll", { value: jest.fn() }); beforeEach(() => { showErrorMessage.mockReset(); diff --git a/packages/zowe-explorer/__tests__/__unit__/shared/refresh.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/shared/refresh.unit.test.ts index af7e513cae..73c5a45f11 100644 --- a/packages/zowe-explorer/__tests__/__unit__/shared/refresh.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/shared/refresh.unit.test.ts @@ -32,6 +32,7 @@ function createGlobalMocks() { mockLog: jest.fn(), mockDebug: jest.fn(), mockError: jest.fn(), + mockCreateTreeView: jest.fn(), mockGetConfiguration: jest.fn(), mockLoadNamedProfile: jest.fn(), testProfile: createIProfile(), @@ -61,6 +62,7 @@ function createGlobalMocks() { return globalMocks.testProfile; }), loadNamedProfile: globalMocks.mockLoadNamedProfile, + getDefaultProfile: jest.fn(), }; }), }); @@ -123,6 +125,8 @@ describe("Refresh Unit Tests - Function refreshAll", () => { return newMocks; } + afterAll(() => jest.restoreAllMocks()); + it("Tests that refreshAll() executed successfully with ussTreeProvider passed", async () => { const globalMocks = createGlobalMocks(); const blockMocks = await createBlockMocks(globalMocks); From 8ca767de3509921a4c37baed1f5bf8e28999ae58 Mon Sep 17 00:00:00 2001 From: Richelle Anne Craw Date: Tue, 15 Feb 2022 13:34:11 +0100 Subject: [PATCH 09/11] Add info message after creation of new schema file Signed-off-by: Richelle Anne Craw --- packages/zowe-explorer/i18n/sample/src/Profiles.i18n.json | 1 + packages/zowe-explorer/src/Profiles.ts | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/packages/zowe-explorer/i18n/sample/src/Profiles.i18n.json b/packages/zowe-explorer/i18n/sample/src/Profiles.i18n.json index e11b5827d0..fa29752c2a 100644 --- a/packages/zowe-explorer/i18n/sample/src/Profiles.i18n.json +++ b/packages/zowe-explorer/i18n/sample/src/Profiles.i18n.json @@ -23,6 +23,7 @@ "createZoweSchema.showQuickPick.global": "Global: in the Zowe home directory ", "createZoweSchema.showQuickPick.project": "Project: in the current working directory", "createZoweSchema.undefined.location": "Operation Cancelled", + "createZoweSchema.success.infoMessage": "Team Configuration file created. Location: {0}. \n Please update the file and refresh the views.", "createNewConnection.profileName": "Profile name was not supplied. Operation Cancelled", "createNewConnection.profileType": "No profile type was chosen. Operation Cancelled", "createNewConnection.zosmfURL": "No valid value for z/OS URL. Operation Cancelled", diff --git a/packages/zowe-explorer/src/Profiles.ts b/packages/zowe-explorer/src/Profiles.ts index f555296bcb..db9149b697 100644 --- a/packages/zowe-explorer/src/Profiles.ts +++ b/packages/zowe-explorer/src/Profiles.ts @@ -666,6 +666,13 @@ export class Profiles extends ProfilesCache { configName = ProfilesCache.getConfigInstance().getTeamConfig().configName; } await this.openConfigFile(path.join(rootPath, configName)); + vscode.window.showInformationMessage( + localize( + "createZoweSchema.success.infoMessage", + "Team Configuration file created. Location: {0}. \n Please update the file and refresh the views.", + rootPath + ) + ); return path.join(rootPath, configName); } catch (err) { vscode.window.showErrorMessage("Error in creating team configuration file: " + err.message); From 38a0d95d15c2f37669455d1522b663dd4cf4e160 Mon Sep 17 00:00:00 2001 From: Billie Simmons <49491949+JillieBeanSim@users.noreply.github.com> Date: Tue, 15 Feb 2022 09:05:16 -0500 Subject: [PATCH 10/11] silent reload of ZE Signed-off-by: Billie Simmons <49491949+JillieBeanSim@users.noreply.github.com> --- .../__tests__/__unit__/extension.unit.test.ts | 1 + .../i18n/sample/package.i18n.json | 1 + .../i18n/sample/src/Profiles.i18n.json | 2 + packages/zowe-explorer/package.json | 13 + packages/zowe-explorer/package.nls.json | 1 + packages/zowe-explorer/src/Profiles.ts | 11 + packages/zowe-explorer/src/extension.ts | 669 ++++++++++++------ packages/zowe-explorer/src/globals.ts | 2 +- packages/zowe-explorer/src/shared/refresh.ts | 70 +- 9 files changed, 513 insertions(+), 257 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__unit__/extension.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/extension.unit.test.ts index 3fb725f13c..06146309bf 100644 --- a/packages/zowe-explorer/__tests__/__unit__/extension.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/extension.unit.test.ts @@ -122,6 +122,7 @@ async function createGlobalMocks() { mockExtension: null, appName: vscode.env.appName, expectedCommands: [ + "zowe.extRefresh", "zowe.all.config.init", "zowe.ds.addSession", "zowe.ds.addFavorite", diff --git a/packages/zowe-explorer/i18n/sample/package.i18n.json b/packages/zowe-explorer/i18n/sample/package.i18n.json index dfbf14ef3c..3fa8fc0b91 100644 --- a/packages/zowe-explorer/i18n/sample/package.i18n.json +++ b/packages/zowe-explorer/i18n/sample/package.i18n.json @@ -2,6 +2,7 @@ "displayName": "Zowe Explorer", "description": "VS Code extension, powered by Zowe CLI, that streamlines interaction with mainframe data sets, USS files, and jobs", "viewsContainers.activitybar": "Zowe", + "zowe.extRefresh": "Refresh Zowe Explorer", "zowe.ds.explorer": "Data Sets", "zowe.uss.explorer": "Unix System Services (USS)", "zowe.jobs.explorer": "Jobs", diff --git a/packages/zowe-explorer/i18n/sample/src/Profiles.i18n.json b/packages/zowe-explorer/i18n/sample/src/Profiles.i18n.json index e11b5827d0..19ac0a059a 100644 --- a/packages/zowe-explorer/i18n/sample/src/Profiles.i18n.json +++ b/packages/zowe-explorer/i18n/sample/src/Profiles.i18n.json @@ -23,6 +23,8 @@ "createZoweSchema.showQuickPick.global": "Global: in the Zowe home directory ", "createZoweSchema.showQuickPick.project": "Project: in the current working directory", "createZoweSchema.undefined.location": "Operation Cancelled", + "createZoweSchema.reload.button": "Refresh Zowe Explorer", + "createZoweSchema.reload.infoMessage": "Team Configuration file created. Location: {0}. \n Please update file and refresh Zowe Explorer via button or command palette.", "createNewConnection.profileName": "Profile name was not supplied. Operation Cancelled", "createNewConnection.profileType": "No profile type was chosen. Operation Cancelled", "createNewConnection.zosmfURL": "No valid value for z/OS URL. Operation Cancelled", diff --git a/packages/zowe-explorer/package.json b/packages/zowe-explorer/package.json index 598b86c2af..57f79b22d3 100644 --- a/packages/zowe-explorer/package.json +++ b/packages/zowe-explorer/package.json @@ -78,9 +78,22 @@ "command": "zowe.ds.deleteDataset", "key": "delete", "when": "focusedView == zowe.ds.explorer && listSupportsMultiselect" + }, + { + "command": "zowe.extRefresh", + "key": "alt+z" } ], "commands": [ + { + "command": "zowe.extRefresh", + "title": "%zowe.extRefresh%", + "category": "Zowe Explorer", + "icon": { + "light": "./resources/light/refresh.svg", + "dark": "./resources/dark/refresh.svg" + } + }, { "command": "zowe.ds.disableValidation", "title": "%disableValidation%", diff --git a/packages/zowe-explorer/package.nls.json b/packages/zowe-explorer/package.nls.json index dfbf14ef3c..3fa8fc0b91 100644 --- a/packages/zowe-explorer/package.nls.json +++ b/packages/zowe-explorer/package.nls.json @@ -2,6 +2,7 @@ "displayName": "Zowe Explorer", "description": "VS Code extension, powered by Zowe CLI, that streamlines interaction with mainframe data sets, USS files, and jobs", "viewsContainers.activitybar": "Zowe", + "zowe.extRefresh": "Refresh Zowe Explorer", "zowe.ds.explorer": "Data Sets", "zowe.uss.explorer": "Unix System Services (USS)", "zowe.jobs.explorer": "Jobs", diff --git a/packages/zowe-explorer/src/Profiles.ts b/packages/zowe-explorer/src/Profiles.ts index f555296bcb..4997f185a1 100644 --- a/packages/zowe-explorer/src/Profiles.ts +++ b/packages/zowe-explorer/src/Profiles.ts @@ -666,6 +666,17 @@ export class Profiles extends ProfilesCache { configName = ProfilesCache.getConfigInstance().getTeamConfig().configName; } await this.openConfigFile(path.join(rootPath, configName)); + const reloadButton = localize("createZoweSchema.reload.button", "Refresh Zowe Explorer"); + const infoMsg = localize( + "createZoweSchema.reload.infoMessage", + "Team Configuration file created. Location: {0}. \n Please update file and refresh Zowe Explorer via button or command palette.", + rootPath + ); + await vscode.window.showInformationMessage(infoMsg, ...[reloadButton]).then(async (selection) => { + if (selection === reloadButton) { + await vscode.commands.executeCommand("zowe.extRefresh"); + } + }); return path.join(rootPath, configName); } catch (err) { vscode.window.showErrorMessage("Error in creating team configuration file: " + err.message); diff --git a/packages/zowe-explorer/src/extension.ts b/packages/zowe-explorer/src/extension.ts index aa55a315fa..a4cbf2fb13 100644 --- a/packages/zowe-explorer/src/extension.ts +++ b/packages/zowe-explorer/src/extension.ts @@ -122,6 +122,20 @@ export async function activate(context: vscode.ExtensionContext): Promise { + await deactivate(); + for (const sub of context.subscriptions) { + try { + await sub.dispose(); + } catch (e) { + globals.LOG.error(e); + } + } + await activate(context); + }) + ); const spoolProvider = new SpoolProvider(); const providerRegistration = vscode.Disposable.from( @@ -161,66 +175,84 @@ export async function activate(context: vscode.ExtensionContext): Promise - sharedActions.openRecentMemberPrompt(datasetProvider, ussFileProvider) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.openRecentMember", () => + sharedActions.openRecentMemberPrompt(datasetProvider, ussFileProvider) + ) ); - vscode.commands.registerCommand("zowe.searchInAllLoadedItems", async () => - sharedActions.searchInAllLoadedItems(datasetProvider, ussFileProvider) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.searchInAllLoadedItems", async () => + sharedActions.searchInAllLoadedItems(datasetProvider, ussFileProvider) + ) ); - vscode.workspace.onDidSaveTextDocument(async (savedFile) => { - globals.LOG.debug( - localize( - "onDidSaveTextDocument1", - "File was saved -- determining whether the file is a USS file or Data set.\n Comparing (case insensitive) " - ) + - savedFile.fileName + - localize("onDidSaveTextDocument2", " against directory ") + - globals.DS_DIR + - localize("onDidSaveTextDocument3", "and") + - globals.USS_DIR - ); - if (savedFile.fileName.toUpperCase().indexOf(globals.DS_DIR.toUpperCase()) >= 0) { - globals.LOG.debug(localize("activate.didSaveText.isDataSet", "File is a data set-- saving ")); - await dsActions.saveFile(savedFile, datasetProvider); // TODO MISSED TESTING - } else if (savedFile.fileName.toUpperCase().indexOf(globals.USS_DIR.toUpperCase()) >= 0) { - globals.LOG.debug(localize("activate.didSaveText.isUSSFile", "File is a USS file -- saving")); - await ussActions.saveUSSFile(savedFile, ussFileProvider); // TODO MISSED TESTING - } else { + context.subscriptions.push( + vscode.workspace.onDidSaveTextDocument(async (savedFile) => { globals.LOG.debug( - localize("activate.didSaveText.file", "File ") + + localize( + "onDidSaveTextDocument1", + "File was saved -- determining whether the file is a USS file or Data set.\n Comparing (case insensitive) " + ) + savedFile.fileName + - localize("activate.didSaveText.notDataSet", " is not a data set or USS file ") + localize("onDidSaveTextDocument2", " against directory ") + + globals.DS_DIR + + localize("onDidSaveTextDocument3", "and") + + globals.USS_DIR ); - } - }); + if (savedFile.fileName.toUpperCase().indexOf(globals.DS_DIR.toUpperCase()) >= 0) { + globals.LOG.debug(localize("activate.didSaveText.isDataSet", "File is a data set-- saving ")); + await dsActions.saveFile(savedFile, datasetProvider); // TODO MISSED TESTING + } else if (savedFile.fileName.toUpperCase().indexOf(globals.USS_DIR.toUpperCase()) >= 0) { + globals.LOG.debug(localize("activate.didSaveText.isUSSFile", "File is a USS file -- saving")); + await ussActions.saveUSSFile(savedFile, ussFileProvider); // TODO MISSED TESTING + } else { + globals.LOG.debug( + localize("activate.didSaveText.file", "File ") + + savedFile.fileName + + localize("activate.didSaveText.notDataSet", " is not a data set or USS file ") + ); + } + }) + ); } if (datasetProvider || ussFileProvider || jobsProvider) { - vscode.commands.registerCommand("zowe.ds.deleteProfile", async (node) => - Profiles.getInstance().deleteProfile(datasetProvider, ussFileProvider, jobsProvider, node) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.deleteProfile", async (node) => + Profiles.getInstance().deleteProfile(datasetProvider, ussFileProvider, jobsProvider, node) + ) ); - vscode.commands.registerCommand("zowe.cmd.deleteProfile", async () => - Profiles.getInstance().deleteProfile(datasetProvider, ussFileProvider, jobsProvider) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.cmd.deleteProfile", async () => + Profiles.getInstance().deleteProfile(datasetProvider, ussFileProvider, jobsProvider) + ) ); - vscode.commands.registerCommand("zowe.uss.deleteProfile", async (node) => - Profiles.getInstance().deleteProfile(datasetProvider, ussFileProvider, jobsProvider, node) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.deleteProfile", async (node) => + Profiles.getInstance().deleteProfile(datasetProvider, ussFileProvider, jobsProvider, node) + ) ); - vscode.commands.registerCommand("zowe.jobs.deleteProfile", async (node) => - Profiles.getInstance().deleteProfile(datasetProvider, ussFileProvider, jobsProvider, node) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.jobs.deleteProfile", async (node) => + Profiles.getInstance().deleteProfile(datasetProvider, ussFileProvider, jobsProvider, node) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.issueTsoCmd", async (node?, command?) => { + if (node) { + TsoCommandHandler.getInstance().issueTsoCommand(node.session, command, node); + } else { + TsoCommandHandler.getInstance().issueTsoCommand(); + } + }) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.issueMvsCmd", async (node?, command?) => { + if (node) { + MvsCommandHandler.getInstance().issueMvsCommand(node.session, command, node); + } else { + MvsCommandHandler.getInstance().issueMvsCommand(); + } + }) ); - vscode.commands.registerCommand("zowe.issueTsoCmd", async (node?, command?) => { - if (node) { - TsoCommandHandler.getInstance().issueTsoCommand(node.session, command, node); - } else { - TsoCommandHandler.getInstance().issueTsoCommand(); - } - }); - vscode.commands.registerCommand("zowe.issueMvsCmd", async (node?, command?) => { - if (node) { - MvsCommandHandler.getInstance().issueMvsCommand(node.session, command, node); - } else { - MvsCommandHandler.getInstance().issueMvsCommand(); - } - }); } ZoweExplorerExtender.createInstance(datasetProvider, ussFileProvider, jobsProvider); @@ -230,209 +262,404 @@ export async function activate(context: vscode.ExtensionContext): Promise) { - vscode.commands.registerCommand("zowe.all.config.init", async () => { - datasetProvider.createZoweSchema(datasetProvider); - await refreshActions.refreshAll(datasetProvider); - }); - vscode.commands.registerCommand("zowe.ds.addSession", async () => - datasetProvider.createZoweSession(datasetProvider) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.all.config.init", async () => { + datasetProvider.createZoweSchema(datasetProvider); + }) ); - vscode.commands.registerCommand("zowe.ds.addFavorite", async (node) => datasetProvider.addFavorite(node)); - vscode.commands.registerCommand("zowe.ds.refreshAll", async () => { - await Profiles.getInstance().refresh(ZoweExplorerApiRegister.getInstance()); - await refreshActions.refreshAll(datasetProvider); - }); - vscode.commands.registerCommand("zowe.ds.refreshNode", (node) => dsActions.refreshPS(node)); - vscode.commands.registerCommand("zowe.ds.refreshDataset", (node) => - dsActions.refreshDataset(node, datasetProvider) - ); - vscode.commands.registerCommand("zowe.ds.pattern", (node) => datasetProvider.filterPrompt(node)); - vscode.commands.registerCommand("zowe.ds.editSession", async (node) => - datasetProvider.editSession(node, datasetProvider) - ); - vscode.commands.registerCommand("zowe.ds.ZoweNode.openPS", (node) => dsActions.openPS(node, true, datasetProvider)); - vscode.commands.registerCommand("zowe.ds.createDataset", (node) => dsActions.createFile(node, datasetProvider)); - vscode.commands.registerCommand("zowe.ds.createMember", (node) => dsActions.createMember(node, datasetProvider)); - vscode.commands.registerCommand("zowe.ds.deleteDataset", (node?) => - dsActions.deleteDatasetPrompt(datasetProvider, node) - ); - vscode.commands.registerCommand("zowe.ds.allocateLike", (node) => dsActions.allocateLike(datasetProvider, node)); - vscode.commands.registerCommand("zowe.ds.uploadDialog", (node) => dsActions.uploadDialog(node, datasetProvider)); - vscode.commands.registerCommand("zowe.ds.deleteMember", (node?) => - dsActions.deleteDatasetPrompt(datasetProvider, node) - ); - vscode.commands.registerCommand("zowe.ds.editDataSet", (node) => dsActions.openPS(node, false, datasetProvider)); - vscode.commands.registerCommand("zowe.ds.editMember", (node) => dsActions.openPS(node, false, datasetProvider)); - vscode.commands.registerCommand("zowe.ds.removeSession", async (node) => datasetProvider.deleteSession(node)); - vscode.commands.registerCommand("zowe.ds.removeFavorite", async (node) => datasetProvider.removeFavorite(node)); - vscode.commands.registerCommand("zowe.ds.saveSearch", async (node) => datasetProvider.addFavorite(node)); - vscode.commands.registerCommand("zowe.ds.removeSavedSearch", async (node) => datasetProvider.removeFavorite(node)); - vscode.commands.registerCommand("zowe.ds.removeFavProfile", async (node) => - datasetProvider.removeFavProfile(node.label, true) - ); - vscode.commands.registerCommand("zowe.ds.submitJcl", async () => dsActions.submitJcl(datasetProvider)); - vscode.commands.registerCommand("zowe.ds.submitMember", async (node) => dsActions.submitMember(node)); - vscode.commands.registerCommand("zowe.ds.showDSAttributes", (node) => - dsActions.showDSAttributes(node, datasetProvider) - ); - vscode.commands.registerCommand("zowe.ds.renameDataSet", (node) => datasetProvider.rename(node)); - vscode.commands.registerCommand("zowe.ds.copyMember", (node) => dsActions.copyDataSet(node)); - vscode.commands.registerCommand("zowe.ds.copyDataSet", (node) => dsActions.copyDataSet(node)); - vscode.commands.registerCommand("zowe.ds.pasteMember", (node) => dsActions.pasteMember(node, datasetProvider)); - vscode.commands.registerCommand("zowe.ds.renameDataSetMember", (node) => datasetProvider.rename(node)); - vscode.commands.registerCommand("zowe.ds.hMigrateDataSet", (node) => dsActions.hMigrateDataSet(node)); - vscode.commands.registerCommand("zowe.ds.hRecallDataSet", (node) => dsActions.hRecallDataSet(node)); - vscode.commands.registerCommand("zowe.ds.disableValidation", async (node) => - Profiles.getInstance().disableValidation(node) - ); - vscode.commands.registerCommand("zowe.ds.enableValidation", async (node) => - Profiles.getInstance().enableValidation(node) - ); - vscode.commands.registerCommand("zowe.ds.ssoLogin", async (node: IZoweTreeNode) => datasetProvider.ssoLogin(node)); - vscode.commands.registerCommand("zowe.ds.ssoLogout", async (node: IZoweTreeNode) => - datasetProvider.ssoLogout(node) - ); - vscode.workspace.onDidChangeConfiguration((e) => { - datasetProvider.onDidChangeConfiguration(e); - }); - - initSubscribers(context, datasetProvider); -} - -function initUSSProvider(context: vscode.ExtensionContext, ussFileProvider: IZoweTree) { - vscode.commands.registerCommand("zowe.uss.addFavorite", async (node: IZoweUSSTreeNode) => - ussFileProvider.addFavorite(node) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.addSession", async () => + datasetProvider.createZoweSession(datasetProvider) + ) ); - vscode.commands.registerCommand("zowe.uss.removeFavorite", async (node: IZoweUSSTreeNode) => - ussFileProvider.removeFavorite(node) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.addFavorite", async (node) => datasetProvider.addFavorite(node)) ); - vscode.commands.registerCommand("zowe.uss.addSession", async () => - ussFileProvider.createZoweSession(ussFileProvider) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.refreshAll", async () => { + await Profiles.getInstance().refresh(ZoweExplorerApiRegister.getInstance()); + await refreshActions.refreshAll(datasetProvider); + }) ); - vscode.commands.registerCommand("zowe.uss.refreshAll", async () => { - await Profiles.getInstance().refresh(ZoweExplorerApiRegister.getInstance()); - await refreshActions.refreshAll(ussFileProvider); - }); - vscode.commands.registerCommand("zowe.uss.refreshUSS", (node: IZoweUSSTreeNode) => node.refreshUSS()); - vscode.commands.registerCommand("zowe.uss.refreshUSSInTree", (node: IZoweUSSTreeNode) => - ussActions.refreshUSSInTree(node, ussFileProvider) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.refreshNode", (node) => dsActions.refreshPS(node)) ); - vscode.commands.registerCommand("zowe.uss.refreshDirectory", (node: IZoweUSSTreeNode) => { - ussActions.refreshDirectory(node, ussFileProvider); - }); - vscode.commands.registerCommand("zowe.uss.fullPath", (node: IZoweUSSTreeNode) => - ussFileProvider.filterPrompt(node) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.refreshDataset", (node) => + dsActions.refreshDataset(node, datasetProvider) + ) ); - vscode.commands.registerCommand("zowe.uss.editSession", async (node) => - ussFileProvider.editSession(node, ussFileProvider) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.pattern", (node) => datasetProvider.filterPrompt(node)) ); - vscode.commands.registerCommand("zowe.uss.ZoweUSSNode.open", (node: IZoweUSSTreeNode) => - node.openUSS(false, true, ussFileProvider) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.editSession", async (node) => + datasetProvider.editSession(node, datasetProvider) + ) ); - vscode.commands.registerCommand("zowe.uss.removeSession", async (node: IZoweUSSTreeNode) => - ussFileProvider.deleteSession(node) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.ZoweNode.openPS", (node) => + dsActions.openPS(node, true, datasetProvider) + ) ); - vscode.commands.registerCommand("zowe.uss.createFile", async (node: IZoweUSSTreeNode) => - ussActions.createUSSNode(node, ussFileProvider, "file") + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.createDataset", (node) => dsActions.createFile(node, datasetProvider)) ); - vscode.commands.registerCommand("zowe.uss.createFolder", async (node: IZoweUSSTreeNode) => - ussActions.createUSSNode(node, ussFileProvider, "directory") + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.createMember", (node) => dsActions.createMember(node, datasetProvider)) ); - vscode.commands.registerCommand("zowe.uss.deleteNode", async (node: IZoweUSSTreeNode) => - node.deleteUSSNode(ussFileProvider, node.getUSSDocumentFilePath()) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.deleteDataset", (node?) => + dsActions.deleteDatasetPrompt(datasetProvider, node) + ) ); - vscode.commands.registerCommand("zowe.uss.binary", async (node: IZoweUSSTreeNode) => - ussActions.changeFileType(node, true, ussFileProvider) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.allocateLike", (node) => dsActions.allocateLike(datasetProvider, node)) ); - vscode.commands.registerCommand("zowe.uss.text", async (node: IZoweUSSTreeNode) => - ussActions.changeFileType(node, false, ussFileProvider) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.uploadDialog", (node) => dsActions.uploadDialog(node, datasetProvider)) ); - vscode.commands.registerCommand("zowe.uss.renameNode", async (node: IZoweUSSTreeNode) => - ussFileProvider.rename(node) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.deleteMember", (node?) => + dsActions.deleteDatasetPrompt(datasetProvider, node) + ) ); - vscode.commands.registerCommand("zowe.uss.uploadDialog", async (node: IZoweUSSTreeNode) => - ussActions.uploadDialog(node, ussFileProvider) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.editDataSet", (node) => dsActions.openPS(node, false, datasetProvider)) ); - vscode.commands.registerCommand("zowe.uss.copyPath", async (node: IZoweUSSTreeNode) => ussActions.copyPath(node)); - vscode.commands.registerCommand("zowe.uss.editFile", (node: IZoweUSSTreeNode) => - node.openUSS(false, false, ussFileProvider) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.editMember", (node) => dsActions.openPS(node, false, datasetProvider)) ); - vscode.commands.registerCommand("zowe.uss.saveSearch", async (node: IZoweUSSTreeNode) => - ussFileProvider.saveSearch(node) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.removeSession", async (node) => datasetProvider.deleteSession(node)) ); - vscode.commands.registerCommand("zowe.uss.removeSavedSearch", async (node: IZoweUSSTreeNode) => - ussFileProvider.removeFavorite(node) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.removeFavorite", async (node) => datasetProvider.removeFavorite(node)) ); - vscode.commands.registerCommand("zowe.uss.removeFavProfile", async (node) => - ussFileProvider.removeFavProfile(node.label, true) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.saveSearch", async (node) => datasetProvider.addFavorite(node)) ); - vscode.commands.registerCommand("zowe.uss.disableValidation", async (node) => - Profiles.getInstance().disableValidation(node) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.removeSavedSearch", async (node) => + datasetProvider.removeFavorite(node) + ) ); - vscode.commands.registerCommand("zowe.uss.enableValidation", async (node) => - Profiles.getInstance().enableValidation(node) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.removeFavProfile", async (node) => + datasetProvider.removeFavProfile(node.label, true) + ) ); - vscode.commands.registerCommand("zowe.uss.ssoLogin", async (node: IZoweTreeNode) => ussFileProvider.ssoLogin(node)); - vscode.commands.registerCommand("zowe.uss.ssoLogout", async (node: IZoweTreeNode) => - ussFileProvider.ssoLogout(node) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.submitJcl", async () => dsActions.submitJcl(datasetProvider)) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.submitMember", async (node) => dsActions.submitMember(node)) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.showDSAttributes", (node) => + dsActions.showDSAttributes(node, datasetProvider) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.renameDataSet", (node) => datasetProvider.rename(node)) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.copyMember", (node) => dsActions.copyDataSet(node)) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.copyDataSet", (node) => dsActions.copyDataSet(node)) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.pasteMember", (node) => dsActions.pasteMember(node, datasetProvider)) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.renameDataSetMember", (node) => datasetProvider.rename(node)) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.hMigrateDataSet", (node) => dsActions.hMigrateDataSet(node)) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.hRecallDataSet", (node) => dsActions.hRecallDataSet(node)) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.disableValidation", async (node) => + Profiles.getInstance().disableValidation(node) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.enableValidation", async (node) => + Profiles.getInstance().enableValidation(node) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.ssoLogin", async (node: IZoweTreeNode) => + datasetProvider.ssoLogin(node) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.ds.ssoLogout", async (node: IZoweTreeNode) => + datasetProvider.ssoLogout(node) + ) + ); + context.subscriptions.push( + vscode.workspace.onDidChangeConfiguration((e) => { + datasetProvider.onDidChangeConfiguration(e); + }) + ); + + initSubscribers(context, datasetProvider); +} + +function initUSSProvider(context: vscode.ExtensionContext, ussFileProvider: IZoweTree) { + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.addFavorite", async (node: IZoweUSSTreeNode) => + ussFileProvider.addFavorite(node) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.removeFavorite", async (node: IZoweUSSTreeNode) => + ussFileProvider.removeFavorite(node) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.addSession", async () => + ussFileProvider.createZoweSession(ussFileProvider) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.refreshAll", async () => { + await Profiles.getInstance().refresh(ZoweExplorerApiRegister.getInstance()); + await refreshActions.refreshAll(ussFileProvider); + }) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.refreshUSS", (node: IZoweUSSTreeNode) => node.refreshUSS()) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.refreshUSSInTree", (node: IZoweUSSTreeNode) => + ussActions.refreshUSSInTree(node, ussFileProvider) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.refreshDirectory", (node: IZoweUSSTreeNode) => { + ussActions.refreshDirectory(node, ussFileProvider); + }) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.fullPath", (node: IZoweUSSTreeNode) => + ussFileProvider.filterPrompt(node) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.editSession", async (node) => + ussFileProvider.editSession(node, ussFileProvider) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.ZoweUSSNode.open", (node: IZoweUSSTreeNode) => + node.openUSS(false, true, ussFileProvider) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.removeSession", async (node: IZoweUSSTreeNode) => + ussFileProvider.deleteSession(node) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.createFile", async (node: IZoweUSSTreeNode) => + ussActions.createUSSNode(node, ussFileProvider, "file") + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.createFolder", async (node: IZoweUSSTreeNode) => + ussActions.createUSSNode(node, ussFileProvider, "directory") + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.deleteNode", async (node: IZoweUSSTreeNode) => + node.deleteUSSNode(ussFileProvider, node.getUSSDocumentFilePath()) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.binary", async (node: IZoweUSSTreeNode) => + ussActions.changeFileType(node, true, ussFileProvider) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.text", async (node: IZoweUSSTreeNode) => + ussActions.changeFileType(node, false, ussFileProvider) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.renameNode", async (node: IZoweUSSTreeNode) => + ussFileProvider.rename(node) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.uploadDialog", async (node: IZoweUSSTreeNode) => + ussActions.uploadDialog(node, ussFileProvider) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.copyPath", async (node: IZoweUSSTreeNode) => + ussActions.copyPath(node) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.editFile", (node: IZoweUSSTreeNode) => + node.openUSS(false, false, ussFileProvider) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.saveSearch", async (node: IZoweUSSTreeNode) => + ussFileProvider.saveSearch(node) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.removeSavedSearch", async (node: IZoweUSSTreeNode) => + ussFileProvider.removeFavorite(node) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.removeFavProfile", async (node) => + ussFileProvider.removeFavProfile(node.label, true) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.disableValidation", async (node) => + Profiles.getInstance().disableValidation(node) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.enableValidation", async (node) => + Profiles.getInstance().enableValidation(node) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.ssoLogin", async (node: IZoweTreeNode) => + ussFileProvider.ssoLogin(node) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.uss.ssoLogout", async (node: IZoweTreeNode) => + ussFileProvider.ssoLogout(node) + ) + ); + context.subscriptions.push( + vscode.workspace.onDidChangeConfiguration((e) => { + ussFileProvider.onDidChangeConfiguration(e); + }) ); - vscode.workspace.onDidChangeConfiguration((e) => { - ussFileProvider.onDidChangeConfiguration(e); - }); initSubscribers(context, ussFileProvider); } function initJobsProvider(context: vscode.ExtensionContext, jobsProvider: IZoweTree) { - vscode.commands.registerCommand("zowe.jobs.zosJobsOpenspool", (session, spool, refreshTimestamp) => - jobActions.getSpoolContent(session, spool, refreshTimestamp) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.jobs.zosJobsOpenspool", (session, spool, refreshTimestamp) => + jobActions.getSpoolContent(session, spool, refreshTimestamp) + ) ); - vscode.commands.registerCommand("zowe.jobs.deleteJob", async (job, jobs) => - jobActions.deleteCommand(jobsProvider, job, jobs) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.jobs.deleteJob", async (job, jobs) => + jobActions.deleteCommand(jobsProvider, job, jobs) + ) ); - vscode.commands.registerCommand("zowe.jobs.runModifyCommand", (job) => jobActions.modifyCommand(job)); - vscode.commands.registerCommand("zowe.jobs.runStopCommand", (job) => jobActions.stopCommand(job)); - vscode.commands.registerCommand("zowe.jobs.refreshJobsServer", async (job) => - jobActions.refreshJobsServer(job, jobsProvider) + context.subscriptions.push( + vscode.commands.registerCommand("zowe.jobs.runModifyCommand", (job) => jobActions.modifyCommand(job)) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.jobs.runStopCommand", (job) => jobActions.stopCommand(job)) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.jobs.refreshJobsServer", async (job) => + jobActions.refreshJobsServer(job, jobsProvider) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.jobs.refreshAllJobs", async () => { + await Profiles.getInstance().refresh(ZoweExplorerApiRegister.getInstance()); + await refreshActions.refreshAll(jobsProvider); + }) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.jobs.refreshJob", async (job) => jobActions.refreshJob(job, jobsProvider)) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.jobs.addJobsSession", () => jobsProvider.createZoweSession(jobsProvider)) + ); + 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) => jobsProvider.deleteSession(job)) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.jobs.downloadSpool", (job) => jobActions.downloadSpool(job)) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.jobs.getJobJcl", (job) => jobActions.downloadJcl(job)) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.jobs.setJobSpool", async (session, jobId) => + jobActions.focusOnJob(jobsProvider, session, jobId) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.jobs.search", (node) => jobsProvider.filterPrompt(node)) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.jobs.editSession", async (node) => + jobsProvider.editSession(node, jobsProvider) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.jobs.addFavorite", async (node) => jobsProvider.addFavorite(node)) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.jobs.removeFavorite", async (node) => jobsProvider.removeFavorite(node)) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.jobs.saveSearch", async (node) => jobsProvider.saveSearch(node)) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.jobs.removeSearchFavorite", async (node) => + jobsProvider.removeFavorite(node) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.jobs.removeFavProfile", async (node) => + jobsProvider.removeFavProfile(node.label, true) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.jobs.disableValidation", async (node) => + Profiles.getInstance().disableValidation(node) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.jobs.enableValidation", async (node) => + Profiles.getInstance().enableValidation(node) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.jobs.ssoLogin", async (node: IZoweTreeNode) => + jobsProvider.ssoLogin(node) + ) + ); + context.subscriptions.push( + vscode.commands.registerCommand("zowe.jobs.ssoLogout", async (node: IZoweTreeNode) => + jobsProvider.ssoLogout(node) + ) + ); + context.subscriptions.push( + vscode.workspace.onDidChangeConfiguration((e) => { + jobsProvider.onDidChangeConfiguration(e); + }) ); - vscode.commands.registerCommand("zowe.jobs.refreshAllJobs", async () => { - await Profiles.getInstance().refresh(ZoweExplorerApiRegister.getInstance()); - await refreshActions.refreshAll(jobsProvider); - }); - vscode.commands.registerCommand("zowe.jobs.refreshJob", async (job) => jobActions.refreshJob(job, jobsProvider)); - vscode.commands.registerCommand("zowe.jobs.addJobsSession", () => jobsProvider.createZoweSession(jobsProvider)); - vscode.commands.registerCommand("zowe.jobs.setOwner", (job) => jobActions.setOwner(job, jobsProvider)); - vscode.commands.registerCommand("zowe.jobs.setPrefix", (job) => jobActions.setPrefix(job, jobsProvider)); - vscode.commands.registerCommand("zowe.jobs.removeJobsSession", (job) => jobsProvider.deleteSession(job)); - vscode.commands.registerCommand("zowe.jobs.downloadSpool", (job) => jobActions.downloadSpool(job)); - vscode.commands.registerCommand("zowe.jobs.getJobJcl", (job) => jobActions.downloadJcl(job)); - vscode.commands.registerCommand("zowe.jobs.setJobSpool", async (session, jobId) => - jobActions.focusOnJob(jobsProvider, session, jobId) - ); - vscode.commands.registerCommand("zowe.jobs.search", (node) => jobsProvider.filterPrompt(node)); - vscode.commands.registerCommand("zowe.jobs.editSession", async (node) => - jobsProvider.editSession(node, jobsProvider) - ); - vscode.commands.registerCommand("zowe.jobs.addFavorite", async (node) => jobsProvider.addFavorite(node)); - vscode.commands.registerCommand("zowe.jobs.removeFavorite", async (node) => jobsProvider.removeFavorite(node)); - vscode.commands.registerCommand("zowe.jobs.saveSearch", async (node) => jobsProvider.saveSearch(node)); - vscode.commands.registerCommand("zowe.jobs.removeSearchFavorite", async (node) => - jobsProvider.removeFavorite(node) - ); - vscode.commands.registerCommand("zowe.jobs.removeFavProfile", async (node) => - jobsProvider.removeFavProfile(node.label, true) - ); - vscode.commands.registerCommand("zowe.jobs.disableValidation", async (node) => - Profiles.getInstance().disableValidation(node) - ); - vscode.commands.registerCommand("zowe.jobs.enableValidation", async (node) => - Profiles.getInstance().enableValidation(node) - ); - vscode.commands.registerCommand("zowe.jobs.ssoLogin", async (node: IZoweTreeNode) => jobsProvider.ssoLogin(node)); - vscode.commands.registerCommand("zowe.jobs.ssoLogout", async (node: IZoweTreeNode) => jobsProvider.ssoLogout(node)); - vscode.workspace.onDidChangeConfiguration((e) => { - jobsProvider.onDidChangeConfiguration(e); - }); initSubscribers(context, jobsProvider); } diff --git a/packages/zowe-explorer/src/globals.ts b/packages/zowe-explorer/src/globals.ts index f837c0bf4e..4094ab7070 100644 --- a/packages/zowe-explorer/src/globals.ts +++ b/packages/zowe-explorer/src/globals.ts @@ -32,7 +32,7 @@ export let DS_DIR; export let CONFIG_PATH; // set during activate export let ISTHEIA: boolean = false; // set during activate export let LOG: Logger; -export const COMMAND_COUNT = 96; +export const COMMAND_COUNT = 97; export const MAX_SEARCH_HISTORY = 5; export const MAX_FILE_HISTORY = 10; export const STATUS_BAR_TIMEOUT_MS = 5000; diff --git a/packages/zowe-explorer/src/shared/refresh.ts b/packages/zowe-explorer/src/shared/refresh.ts index 6c7516d3cf..76f36d8f2c 100644 --- a/packages/zowe-explorer/src/shared/refresh.ts +++ b/packages/zowe-explorer/src/shared/refresh.ts @@ -31,41 +31,41 @@ import { createJobsTree } from "../job/ZosJobsProvider"; export async function refreshAll(treeProvider: IZoweTree) { await readConfigFromDisk(); await Profiles.getInstance().refresh(ZoweExplorerApiRegister.getInstance()); - let repaintTree = true; - if (treeProvider.mSessionNodes) { - treeProvider.mSessionNodes.forEach(async (node) => { - const allProfiles = await Profiles.getInstance().allProfiles; - if (allProfiles) { - allProfiles.forEach(async (profile) => { - if (node.getLabel().toString() === profile.name) { - repaintTree = false; - } - }); - } - }); - if (repaintTree) { - // Initialize dataset provider - await createDatasetTree(globals.LOG); - // Initialize uss provider - await createUSSTree(globals.LOG); - // Initialize Jobs provider with the created session and the selected pattern - await createJobsTree(globals.LOG); + // let repaintTree = true; + // if (treeProvider.mSessionNodes) { + // treeProvider.mSessionNodes.forEach(async (node) => { + // const allProfiles = await Profiles.getInstance().allProfiles; + // if (allProfiles) { + // allProfiles.forEach(async (profile) => { + // if (node.getLabel().toString() === profile.name) { + // repaintTree = false; + // } + // }); + // } + // }); + // if (repaintTree) { + // // Initialize dataset provider + // await createDatasetTree(globals.LOG); + // // Initialize uss provider + // await createUSSTree(globals.LOG); + // // Initialize Jobs provider with the created session and the selected pattern + // await createJobsTree(globals.LOG); + // } + treeProvider.mSessionNodes.forEach(async (sessNode) => { + const setting = (await PersistentFilters.getDirectValue( + globals.SETTINGS_AUTOMATIC_PROFILE_VALIDATION + )) as boolean; + if (contextually.isSessionNotFav(sessNode)) { + labelRefresh(sessNode); + sessNode.children = []; + sessNode.dirty = true; + resetValidationSettings(sessNode, setting); + returnIconState(sessNode); + await syncSessionNode(Profiles.getInstance())((profileValue) => + ZoweExplorerApiRegister.getCommonApi(profileValue).getSession() + )(sessNode); } - treeProvider.mSessionNodes.forEach(async (sessNode) => { - const setting = (await PersistentFilters.getDirectValue( - globals.SETTINGS_AUTOMATIC_PROFILE_VALIDATION - )) as boolean; - if (contextually.isSessionNotFav(sessNode)) { - labelRefresh(sessNode); - sessNode.children = []; - sessNode.dirty = true; - resetValidationSettings(sessNode, setting); - returnIconState(sessNode); - await syncSessionNode(Profiles.getInstance())((profileValue) => - ZoweExplorerApiRegister.getCommonApi(profileValue).getSession() - )(sessNode); - } - }); - } + }); + // } treeProvider.refresh(); } From 5e471f92ff7641ce5beef346acb78436eb8f18bb Mon Sep 17 00:00:00 2001 From: Billie Simmons <49491949+JillieBeanSim@users.noreply.github.com> Date: Tue, 15 Feb 2022 09:40:46 -0500 Subject: [PATCH 11/11] remove commented code Signed-off-by: Billie Simmons <49491949+JillieBeanSim@users.noreply.github.com> --- packages/zowe-explorer/src/shared/refresh.ts | 21 -------------------- 1 file changed, 21 deletions(-) diff --git a/packages/zowe-explorer/src/shared/refresh.ts b/packages/zowe-explorer/src/shared/refresh.ts index 76f36d8f2c..a328de29f0 100644 --- a/packages/zowe-explorer/src/shared/refresh.ts +++ b/packages/zowe-explorer/src/shared/refresh.ts @@ -31,26 +31,6 @@ import { createJobsTree } from "../job/ZosJobsProvider"; export async function refreshAll(treeProvider: IZoweTree) { await readConfigFromDisk(); await Profiles.getInstance().refresh(ZoweExplorerApiRegister.getInstance()); - // let repaintTree = true; - // if (treeProvider.mSessionNodes) { - // treeProvider.mSessionNodes.forEach(async (node) => { - // const allProfiles = await Profiles.getInstance().allProfiles; - // if (allProfiles) { - // allProfiles.forEach(async (profile) => { - // if (node.getLabel().toString() === profile.name) { - // repaintTree = false; - // } - // }); - // } - // }); - // if (repaintTree) { - // // Initialize dataset provider - // await createDatasetTree(globals.LOG); - // // Initialize uss provider - // await createUSSTree(globals.LOG); - // // Initialize Jobs provider with the created session and the selected pattern - // await createJobsTree(globals.LOG); - // } treeProvider.mSessionNodes.forEach(async (sessNode) => { const setting = (await PersistentFilters.getDirectValue( globals.SETTINGS_AUTOMATIC_PROFILE_VALIDATION @@ -66,6 +46,5 @@ export async function refreshAll(treeProvider: IZoweTree) { )(sessNode); } }); - // } treeProvider.refresh(); }