Skip to content

Commit

Permalink
Merge branch 'main' into fix/warn-before-ds-rename
Browse files Browse the repository at this point in the history
Signed-off-by: Trae Yelovich <[email protected]>
  • Loading branch information
traeok committed Nov 21, 2024
2 parents 2d79f50 + 66f4592 commit a529d1c
Show file tree
Hide file tree
Showing 41 changed files with 520 additions and 78 deletions.
2 changes: 2 additions & 0 deletions packages/eslint-plugin-zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ All notable changes to the "eslint-plugin-zowe-explorer" package will be documen

### Bug fixes

## `3.0.3`

## `3.0.2`

## `3.0.1`
Expand Down
13 changes: 13 additions & 0 deletions packages/zowe-explorer-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,24 @@ All notable changes to the "zowe-explorer-api" extension will be documented in t

### New features and enhancements

- Added optional `getLocalStorage` function to the `IApiExplorerExtender` interface to expose local storage access to Zowe Explorer extenders. [#3180](https://github.com/zowe/zowe-explorer-vscode/issues/3180)

### Bug fixes

## `3.0.3`

### New features and enhancements

- Update Zowe SDKs to `8.8.2` to get the latest enhancements from Imperative. [#3296](https://github.com/zowe/zowe-explorer-vscode/pull/3296)

### Bug fixes

- Fixed an issue to review inconsistent capitalization across translation strings. [#2935](https://github.com/zowe/zowe-explorer-vscode/issues/2935)

## `3.0.3`

### Bug fixes

- Fixed an issue where the `responseTimeout` profile property was ignored for z/OSMF MVS and USS API calls. [#3225](https://github.com/zowe/zowe-explorer-vscode/issues/3225)
- Fixed an issue where the assignment of the `profile` property in `ZoweTreeNode.setProfileToChoice` caused references to that object to break elsewhere. [#3289](https://github.com/zowe/zowe-explorer-vscode/issues/3289)

Expand Down
8 changes: 8 additions & 0 deletions packages/zowe-explorer-api/src/extend/IApiExplorerExtender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import * as imperative from "@zowe/imperative";
import { ProfilesCache } from "../profiles/ProfilesCache";
import { ErrorCorrelator } from "../utils/ErrorCorrelator";
import { ILocalStorageAccess } from "./ILocalStorageAccess";

/**
* This interface can be used by other VS Code Extensions to access an alternative
Expand Down Expand Up @@ -53,4 +54,11 @@ export interface IApiExplorerExtender {
* provide tips or additional resources for errors.
*/
getErrorCorrelator?(): ErrorCorrelator;

/**
* Allows extenders to access Zowe Explorer's local storage values. Retrieve a list of
* readable and writable keys by calling the `getReadableKeys, getWritableKeys` functions
* on the returned instance.
*/
getLocalStorage?(): ILocalStorageAccess;
}
38 changes: 38 additions & 0 deletions packages/zowe-explorer-api/src/extend/ILocalStorageAccess.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/

export interface ILocalStorageAccess {
/**
* @returns The list of readable keys from the access facility
*/
getReadableKeys(): string[];

/**
* @returns The list of writable keys from the access facility
*/
getWritableKeys(): string[];

/**
* Retrieve the value from local storage for the given key.
* @param key A readable key
* @returns The value if it exists in local storage, or `undefined` otherwise
* @throws If the extender does not have appropriate read permissions for the given key
*/
getValue<T>(key: string): T;

/**
* Set a value in local storage for the given key.
* @param key A writable key
* @param value The new value for the given key to set in local storage
* @throws If the extender does not have appropriate write permissions for the given key
*/
setValue<T>(key: string, value: T): Thenable<void>;
}
1 change: 1 addition & 0 deletions packages/zowe-explorer-api/src/extend/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
*/

export * from "./IApiExplorerExtender";
export * from "./ILocalStorageAccess";
export * from "./IRegisterClient";
export * from "./MainframeInteraction";
6 changes: 6 additions & 0 deletions packages/zowe-explorer-ftp-extension/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to the "zowe-explorer-ftp-extension" extension will be docum

### New features and enhancements

- Updated Zowe SDKs to `8.8.2` for technical currency. [#3296](https://github.com/zowe/zowe-explorer-vscode/pull/3296)

### Bug fixes

## `3.0.3`

### Bug fixes

- Fixed issue where the MVS API `putContents` function did not support PDS members when the member was not specified in the data set name. [#3305](https://github.com/zowe/zowe-explorer-vscode/issues/3305)
Expand Down
26 changes: 13 additions & 13 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,25 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen

### New features and enhancements

### Bug fixes

- Fixed an issue during initialization where the error dialog shown for a broken team configuration file was missing the "Show Config" action. [#3322](https://github.com/zowe/zowe-explorer-vscode/pull/3322)
- Fixed an issue where renaming a data set with unsaved changes did not cancel the rename operation. Now, when renaming a data set with unsaved changes, you are prompted to resolve them before continuing. [#3326](https://github.com/zowe/zowe-explorer-vscode/pull/3326)

## `3.0.3`

### New features and enhancements

- Update Zowe SDKs to `8.2.0` to get the latest enhancements from Imperative.
- Added expired JSON web token detection for profiles in each tree view (Data Sets, USS, Jobs). When a user performs a search on a profile, they are prompted to log in if their token expired. [#3175](https://github.com/zowe/zowe-explorer-vscode/issues/3175)
- Add a data set or USS resource to a virtual workspace with the new "Add to Workspace" context menu option. [#3265](https://github.com/zowe/zowe-explorer-vscode/issues/3265)
- Power users and developers can now build links to efficiently open mainframe resources in Zowe Explorer. Use the **Copy External Link** option in the context menu to get the URL for a data set or USS resource, or create a link in the format `vscode://Zowe.vscode-extension-for-zowe?<ZoweResourceUri>`. For more information on building resource URIs, see the [FileSystemProvider wiki article](https://github.com/zowe/zowe-explorer-vscode/wiki/FileSystemProvider#file-paths-vs-uris). [#3271](https://github.com/zowe/zowe-explorer-vscode/pull/3271)
- Implemented more user-friendly error messages for API or network errors within Zowe Explorer. [#3243](https://github.com/zowe/zowe-explorer-vscode/pull/3243)
- Use the "Troubleshoot" option for certain errors to obtain additional context, tips, and resources for how to resolve the errors. [#3243](https://github.com/zowe/zowe-explorer-vscode/pull/3243)
- Updated Zowe SDKs to `8.8.2` for technical currency. [#3296](https://github.com/zowe/zowe-explorer-vscode/pull/3296)
- Allow extenders to add context menu actions to a top level node, i.e. data sets, USS, Jobs, by encoding the profile type in the context value. [#3309](https://github.com/zowe/zowe-explorer-vscode/pull/3309)
- You can now add multiple partitioned data sets or USS directories to your workspace at once using the "Add to Workspace" feature. [#3324](https://github.com/zowe/zowe-explorer-vscode/issues/3324)
- Exposed read and write access to local storage keys for Zowe Explorer extenders. [#3180](https://github.com/zowe/zowe-explorer-vscode/issues/3180)

### Bug fixes

- Fixed an issue during initialization where the error dialog shown for a broken team configuration file was missing the "Show Config" action. [#3322](https://github.com/zowe/zowe-explorer-vscode/pull/3322)
- Fixed an issue where editing a team config file or updating secrets in the OS credential vault could trigger multiple events for a single action. [#3296](https://github.com/zowe/zowe-explorer-vscode/pull/3296)
- Fixed an issue where opening a PDS member after renaming an expanded PDS resulted in an error. [#3314](https://github.com/zowe/zowe-explorer-vscode/issues/3314)
- Fixed issue where persistent settings defined at the workspace level were migrated into global storage rather than workspace-specific storage. [#3180](https://github.com/zowe/zowe-explorer-vscode/issues/3180)
- Fixed an issue where renaming a data set with unsaved changes did not cancel the rename operation. Now, when renaming a data set with unsaved changes, you are prompted to resolve them before continuing. [#3326](https://github.com/zowe/zowe-explorer-vscode/pull/3326)

## `3.0.3`

### Bug fixes

Expand All @@ -34,13 +37,10 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
- Reduced the number of MVS API calls performed by `vscode.workspace.fs.readFile` when fetching the contents of a data set entry. [#3278](https://github.com/zowe/zowe-explorer-vscode/issues/3278)
- Fixed an issue to review inconsistent capitalization across translation strings. [#2935](https://github.com/zowe/zowe-explorer-vscode/issues/2935)
- Updated the test for the default credential manager for better compatibility with Cloud-based platforms such as Eclipse Che and Red Hat OpenShift Dev Spaces. [#3297](https://github.com/zowe/zowe-explorer-vscode/pull/3297)
- Fixed an issue where opening a PDS member after renaming an expanded PDS resulted in an error. [#3314](https://github.com/zowe/zowe-explorer-vscode/issues/3314)
- Fixed issue where users were not prompted to enter credentials if a 401 error was encountered when opening files, data sets or spools in the editor. [#3197](https://github.com/zowe/zowe-explorer-vscode/issues/3197)
- Fixed issue where profile credential updates or token changes were not reflected within the filesystem. [#3289](https://github.com/zowe/zowe-explorer-vscode/issues/3289)
- Fixed issue to update the success message when changing authentication from token to basic through the 'Change Authentication' option. [#3316](https://github.com/zowe/zowe-explorer-vscode/pull/3316)
- Fixed an issue where fetching a USS file using `UssFSProvider.stat()` with a `fetch=true` query would cause Zowe Explorer to get stuck in an infinite loop. [#3321](https://github.com/zowe/zowe-explorer-vscode/pull/3321)
- Fixed an issue where editing a team config file or updating secrets in the OS credential vault could trigger multiple events for a single action. [#3296](https://github.com/zowe/zowe-explorer-vscode/pull/3296)
- Updated Zowe SDKs to `8.8.2` for technical currency. [#3296](https://github.com/zowe/zowe-explorer-vscode/pull/3296)

## `3.0.2`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe("mvsCommandActions unit testing", () => {
};
}),
});
Object.defineProperty(ZoweLocalStorage, "storage", {
Object.defineProperty(ZoweLocalStorage, "globalState", {
value: {
get: () => ({ persistence: true, favorites: [], history: [], sessions: ["zosmf"], searchHistory: [], fileHistory: [] }),
update: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe("TsoCommandHandler unit testing", () => {
};
}),
});
Object.defineProperty(ZoweLocalStorage, "storage", {
Object.defineProperty(ZoweLocalStorage, "globalState", {
value: {
get: () => ({ persistence: true, favorites: [], history: [], sessions: ["zosmf"], searchHistory: [], fileHistory: [] }),
update: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe("UnixCommand Actions Unit Testing", () => {
}),
});

Object.defineProperty(ZoweLocalStorage, "storage", {
Object.defineProperty(ZoweLocalStorage, "globalState", {
value: {
get: () => ({ persistence: true, favorites: [], history: [], sessions: ["zosmf"], searchHistory: [], fileHistory: [] }),
update: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function createGlobalMocks(): { [key: string]: any } {
configurable: true,
});

Object.defineProperty(ZoweLocalStorage, "storage", {
Object.defineProperty(ZoweLocalStorage, "globalState", {
value: {
get: jest.fn(() => ({ persistence: true })),
update: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { SettingsConfig } from "../../../src/configuration/SettingsConfig";
describe("SettingsConfig Unit Tests", () => {
beforeEach(() => {
Object.defineProperty(ZoweLogger, "trace", { value: jest.fn(), configurable: true });
Object.defineProperty(ZoweLocalStorage, "storage", {
Object.defineProperty(ZoweLocalStorage, "globalState", {
value: {
get: () => ({
persistence: true,
Expand Down Expand Up @@ -209,4 +209,58 @@ describe("SettingsConfig Unit Tests", () => {
expect(migrateToLocalStorageSpy).toHaveBeenCalledTimes(1);
});
});

describe("function migrateSettingsAtLevel", () => {
function getBlockMocks() {
const configurationsMock = jest.spyOn(SettingsConfig as any, "configurations", "get");
const setDirectValueMock = jest.spyOn(SettingsConfig, "setDirectValue").mockImplementation();
const setValueMock = jest.spyOn(ZoweLocalStorage, "setValue").mockImplementation();
jest.spyOn(SettingsConfig, "setMigratedDsTemplates").mockImplementation();

return {
configurationsMock,
setDirectValueMock,
setValueMock,
};
}

it("migrates workspace-level settings from settings config", async () => {
const blockMocks = getBlockMocks();
blockMocks.configurationsMock.mockReturnValue({
inspect: () => ({
globalValue: undefined,
workspaceValue: 123,
}),
});
await (SettingsConfig as any).migrateSettingsAtLevel(vscode.ConfigurationTarget.Workspace);
for (const [_, value, setInWorkspace] of blockMocks.setValueMock.mock.calls) {
expect(value).toBe(123);
expect(setInWorkspace).toBe(true);
}
for (const [_, value, target] of blockMocks.setDirectValueMock.mock.calls) {
expect(value).toEqual(undefined);
expect(target).toBe(vscode.ConfigurationTarget.Workspace);
}
});

it("migrates global-level settings from settings config", async () => {
const blockMocks = getBlockMocks();
blockMocks.configurationsMock.mockReturnValue({
inspect: () => ({
globalValue: 123,
workspaceValue: undefined,
}),
});
await (SettingsConfig as any).migrateSettingsAtLevel(vscode.ConfigurationTarget.Global);

for (const [_, value, setInWorkspace] of blockMocks.setValueMock.mock.calls) {
expect(value).toBe(123);
expect(setInWorkspace).toBe(false);
}
for (const [_, value, target] of blockMocks.setDirectValueMock.mock.calls) {
expect(value).toEqual(undefined);
expect(target).toBe(vscode.ConfigurationTarget.Global);
}
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { createUSSSessionNode, createUSSTree } from "../../__mocks__/mockCreator
import { createJobsTree, createIJobObject } from "../../__mocks__/mockCreators/jobs";
import { SettingsConfig } from "../../../src/configuration/SettingsConfig";
import { ZoweExplorerExtender } from "../../../src/extending/ZoweExplorerExtender";
import { ZoweLocalStorage } from "../../../src/tools/ZoweLocalStorage";
import { LocalStorageAccess, ZoweLocalStorage } from "../../../src/tools/ZoweLocalStorage";
import { ZoweLogger } from "../../../src/tools/ZoweLogger";
import { UssFSProvider } from "../../../src/trees/uss/UssFSProvider";
import { ProfilesUtils } from "../../../src/utils/ProfilesUtils";
Expand Down Expand Up @@ -71,7 +71,7 @@ describe("ZoweExplorerExtender unit tests", () => {
value: newMocks.mockTextDocument,
configurable: true,
});
Object.defineProperty(ZoweLocalStorage, "storage", {
Object.defineProperty(ZoweLocalStorage, "globalState", {
value: {
get: () => ({ persistence: true, favorites: [], history: [], sessions: ["zosmf"], searchHistory: [], fileHistory: [] }),
update: jest.fn(),
Expand Down Expand Up @@ -324,4 +324,11 @@ describe("ZoweExplorerExtender unit tests", () => {
expect(blockMocks.instTest.getErrorCorrelator()).toBe(ErrorCorrelator.getInstance());
});
});

describe("getLocalStorage", () => {
it("returns the singleton instance of LocalStorageAccess", () => {
const blockMocks = createBlockMocks();
expect(blockMocks.instTest.getLocalStorage()).toBe(LocalStorageAccess);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ async function createGlobalMocks() {
value: jest.fn(),
configurable: true,
});
Object.defineProperty(ZoweLocalStorage, "storage", {
Object.defineProperty(ZoweLocalStorage, "globalState", {
value: {
get: () => ({ persistence: true, favorites: [], history: [], sessions: ["zosmf"], searchHistory: [], fileHistory: [] }),
update: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("Checking icon generator's basics", () => {
const createTreeView = jest.fn().mockReturnValue({ onDidCollapseElement: jest.fn() });

Object.defineProperty(vscode.window, "createTreeView", { value: createTreeView });
Object.defineProperty(ZoweLocalStorage, "storage", {
Object.defineProperty(ZoweLocalStorage, "globalState", {
value: {
get: () => ({ persistence: true, favorites: [], history: [], sessions: ["zosmf"], searchHistory: [], fileHistory: [] }),
update: jest.fn(),
Expand Down
Loading

0 comments on commit a529d1c

Please sign in to comment.