Skip to content

Commit

Permalink
Merge pull request #1650 from zowe/refresh-all-config
Browse files Browse the repository at this point in the history
[next] Refresh all config
  • Loading branch information
JillieBeanSim committed Feb 17, 2022
2 parents 4b58778 + 0fb6757 commit 47684df
Show file tree
Hide file tree
Showing 13 changed files with 492 additions and 263 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
"**/minimist": "^0.2.1",
"**/diff": "^3.5.0",
"**/log4js": "^6.4.0",
"**/nanoid": "^3.1.31",
"**/markdown-it": "^12.3.2",
"**/simple-get": "^4.0.1"
},
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@ 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(),
mockCreateTreeView: jest.fn(),
mockGetConfiguration: jest.fn(),
mockLoadNamedProfile: jest.fn(),
testProfile: createIProfile(),
Expand Down Expand Up @@ -57,6 +62,7 @@ function createGlobalMocks() {
return globalMocks.testProfile;
}),
loadNamedProfile: globalMocks.mockLoadNamedProfile,
getDefaultProfile: jest.fn(),
};
}),
});
Expand All @@ -72,6 +78,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;
}
Expand Down Expand Up @@ -116,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);
Expand Down
1 change: 1 addition & 0 deletions packages/zowe-explorer/i18n/sample/package.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions packages/zowe-explorer/i18n/sample/src/Profiles.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +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": "Reload Window",
"createZoweSchema.reload.infoMessage": "Team Configuration file created. Location: {0}. \n Please update file and reload your window.",
"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",
Expand Down
13 changes: 13 additions & 0 deletions packages/zowe-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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%",
Expand Down
1 change: 1 addition & 0 deletions packages/zowe-explorer/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions packages/zowe-explorer/src/Profiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -666,15 +666,15 @@ 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 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 reload your window.",
"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("workbench.action.reloadWindow");
await vscode.commands.executeCommand("zowe.extRefresh");
}
});
return path.join(rootPath, configName);
Expand Down
Loading

0 comments on commit 47684df

Please sign in to comment.