Skip to content

Commit

Permalink
Merge pull request #2706 from zowe/Remove-Theia
Browse files Browse the repository at this point in the history
Remove Theia Support
  • Loading branch information
JillieBeanSim authored Feb 20, 2024
2 parents 087a324 + e471eb0 commit 0d69b7c
Show file tree
Hide file tree
Showing 45 changed files with 543 additions and 2,331 deletions.
4 changes: 0 additions & 4 deletions packages/zowe-explorer-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@ All notable changes to the "zowe-explorer-api" extension will be documented in t

- Grouped common methods into singleton classes [#2109](https://github.com/zowe/vscode-extension-for-zowe/issues/2109)

### Bug fixes

## `3.0.0-next.202401241448`

### New features and enhancements

### Bug fixes

- Changed IApiExplorerExtenders.initForZowe `profileTypeConfigurations: imperative.ICommandProfileTypeConfiguration[]` to a required argument to address issues seen after registration of profile type when not passed. [#2575](https://github.com/zowe/vscode-extension-for-zowe/issues/2575)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,30 @@ describe("KeytarApi", () => {
it("should initialize Imperative credential manager", async () => {
isCredsSecuredSpy.mockReturnValueOnce(true);
credMgrInitializeSpy.mockResolvedValueOnce();
await new KeytarApi(undefined as unknown as imperative.Logger).activateKeytar(false, false);
expect(isCredsSecuredSpy).toHaveBeenCalledTimes(1);
expect(credMgrInitializeSpy).toHaveBeenCalledTimes(1);
await new KeytarApi(undefined as unknown as imperative.Logger).activateKeytar(false);
expect(isCredsSecuredSpy).toBeCalledTimes(1);
expect(credMgrInitializeSpy).toBeCalledTimes(1);
});

it("should do nothing if secure credential plugin is not active", async () => {
isCredsSecuredSpy.mockReturnValueOnce(false);
await new KeytarApi(undefined as unknown as imperative.Logger).activateKeytar(false, false);
expect(isCredsSecuredSpy).toHaveBeenCalledTimes(1);
expect(credMgrInitializeSpy).not.toHaveBeenCalled();
await new KeytarApi(undefined as unknown as imperative.Logger).activateKeytar(false);
expect(isCredsSecuredSpy).toBeCalledTimes(1);
expect(credMgrInitializeSpy).not.toBeCalled();
});

it("should do nothing if API has already been initialized", async () => {
isCredsSecuredSpy.mockReturnValueOnce(true);
await new KeytarApi(undefined as unknown as imperative.Logger).activateKeytar(true, false);
expect(isCredsSecuredSpy).toHaveBeenCalledTimes(1);
expect(credMgrInitializeSpy).not.toHaveBeenCalled();
await new KeytarApi(undefined as unknown as imperative.Logger).activateKeytar(true);
expect(isCredsSecuredSpy).toBeCalledTimes(1);
expect(credMgrInitializeSpy).not.toBeCalled();
});

it("should do nothing if Keytar module is missing", async () => {
jest.mock("@zowe/secrets-for-zowe-sdk", () => {});
isCredsSecuredSpy.mockReturnValueOnce(true);
await new KeytarApi(undefined as unknown as imperative.Logger).activateKeytar(false, false);
expect(isCredsSecuredSpy).toHaveBeenCalledTimes(1);
expect(credMgrInitializeSpy).not.toHaveBeenCalled();
await new KeytarApi(undefined as unknown as imperative.Logger).activateKeytar(false);
expect(isCredsSecuredSpy).toBeCalledTimes(1);
expect(credMgrInitializeSpy).not.toBeCalled();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,6 @@ describe("KeytarCredentialManager", () => {
expect(Object.keys((keytar as object)["keyring"]).length).toBe(5);
});

it("should handle CredentialManager in Imperative settings - Theia", () => {
jest.spyOn(fs, "existsSync").mockReturnValueOnce(true);
const readFileSyncSpy = jest.spyOn(fs, "readFileSync").mockReturnValue(
JSON.stringify({
overrides: {
CredentialManager: scsPluginName,
},
})
);
jest.spyOn(process, "cwd").mockReturnValueOnce(__dirname + "/../../../../..");
const keytar = KeytarCredentialManager.getSecurityModules("@zowe/secrets-for-zowe-sdk", true);
expect(keytar).toBeDefined();
expect(loggerWarnSpy).not.toHaveBeenCalled();
expect(readFileSyncSpy).toHaveBeenCalledTimes(1);
expect(Object.keys((keytar as object)["keyring"]).length).toBe(5);
});

it("should handle empty Imperative settings", () => {
jest.spyOn(fs, "existsSync").mockReturnValueOnce(true);
const readFileSyncSpy = jest.spyOn(fs, "readFileSync").mockReturnValue(JSON.stringify({}));
Expand Down
2 changes: 1 addition & 1 deletion packages/zowe-explorer-api/src/security/KeytarApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class KeytarApi {
public constructor(protected log: imperative.Logger) {}

// v1 specific
public async activateKeytar(initialized: boolean, _isTheia: boolean): Promise<void> {
public async activateKeytar(initialized: boolean): Promise<void> {
const log = imperative.Logger.getAppLogger();
const profiles = new ProfilesCache(log, vscode.workspace.workspaceFolders?.[0]?.uri.fsPath);
const isSecure = await profiles.isCredentialsSecured();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class KeytarCredentialManager extends imperative.AbstractCredentialManage
this.preferredService = service;
}

public static getSecurityModules(moduleName: string, isTheia: boolean): NodeModule | undefined {
public static getSecurityModules(moduleName: string): NodeModule | undefined {
let imperativeIsSecure = false;
try {
const fileName = path.join(FileManagement.getZoweDir(), "settings", "imperative.json");
Expand All @@ -89,7 +89,7 @@ export class KeytarCredentialManager extends imperative.AbstractCredentialManage
imperative.Logger.getAppLogger().warn(error as string);
return undefined;
}
return imperativeIsSecure ? getSecurityModules(moduleName, isTheia) : undefined;
return imperativeIsSecure ? getSecurityModules(moduleName) : undefined;
}

/**
Expand Down Expand Up @@ -203,10 +203,10 @@ export class KeytarCredentialManager extends imperative.AbstractCredentialManage
/**
* Imports the necessary security modules
*/
export function getSecurityModules(moduleName: string, isTheia: boolean): NodeModule | undefined {
export function getSecurityModules(moduleName: string): NodeModule | undefined {
const r = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require;
// Workaround for Theia issue (https://github.com/eclipse-theia/theia/issues/4935)
const appRoot = isTheia ? process.cwd() : vscode.env.appRoot;
const appRoot = vscode.env.appRoot;
try {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return r(`${appRoot}/node_modules/${moduleName}`);
Expand Down
2 changes: 0 additions & 2 deletions packages/zowe-explorer-ftp-extension/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ All notable changes to the "zowe-explorer-ftp-extension" extension will be docum
- Adapted to new API changes from grouping of common methods into singleton classes [#2109](https://github.com/zowe/vscode-extension-for-zowe/issues/2109)
- Migrated to webpack v5 [#2214](https://github.com/zowe/vscode-extension-for-zowe/issues/2214)

## Bug fixes

## `3.0.0-next.202401241448`

### Bug fixes
Expand Down
1 change: 1 addition & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen

- **Breaking:** Removed `zowe.uss.binary` and `zowe.uss.text` commands. Use `zowe.uss.openWithEncoding` instead.
- Added UI migration steps on startup for users with v1 profiles to either convert existing v1 profiles to team configuration file or create a new team configuration file. [#2284](https://github.com/zowe/vscode-extension-for-zowe/issues/2284)
- Removal of Theia support. [#2647](https://github.com/zowe/vscode-extension-for-zowe/issues/2647)

### Bug fixes

Expand Down
Loading

0 comments on commit 0d69b7c

Please sign in to comment.