Skip to content

Commit

Permalink
Merge branch 'main' into MvsCopyCrossLpar
Browse files Browse the repository at this point in the history
  • Loading branch information
likhithanimma1 authored Jan 10, 2025
2 parents 9775a4b + baade3a commit 00e21da
Show file tree
Hide file tree
Showing 41 changed files with 1,474 additions and 891 deletions.
1 change: 1 addition & 0 deletions packages/zowe-explorer-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ All notable changes to the "zowe-explorer-api" extension will be documented in t
- 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)
- Added optional `setEncoding`, `getEncoding`, and `getEncodingInMap` functions to the `IZoweJobTreeNode` interface. [#3361](https://github.com/zowe/zowe-explorer-vscode/pull/3361)
- Added an `AuthHandler` class with functions for locking/unlocking profiles, prompting for credentials and SSO login support. Extenders can now lock profiles after an authentication error, ensuring that an invalid profile is not used asynchronously until the error is resolved. [#3329](https://github.com/zowe/zowe-explorer-vscode/issues/3329)
- Added individual user settings for MVS, TSO, and Unix commands. [#3079](https://github.com/zowe/zowe-explorer-vscode/pull/3079)

### Bug fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,17 @@ async function expectUnixCommandApiWithSshSession<T>(
sshobj: zosuss.SshSession
): Promise<void> {
spy.mockClear().mockResolvedValue(undefined);
spy.mockImplementation((sshobject: zosuss.SshSession, command: string, cwd: string, callback: (data: string) => void) => {
callback("test");
});
spy.mockImplementation(
(_sshobject: zosuss.SshSession, _command: string, _cwd: string, callback: (data: string) => void, _cleanStdout?: boolean) => {
callback("test");
}
);
const spywhenpathnotspecified = jest.spyOn(zosuss.Shell, "executeSsh");
spywhenpathnotspecified.mockImplementation((sshobject: zosuss.SshSession, command: string, callback: (data: string) => void) => {
callback("test");
});
spywhenpathnotspecified.mockImplementation(
(_sshobject: zosuss.SshSession, _command: string, callback: (data: string) => void, _cleanStdout?: boolean) => {
callback("test");
}
);
await apiInstance[name as string](sshobj, ...args, true, () => {});
await apiInstance[name as string](sshobj, ...args, false, () => {});
expect(spy).toHaveBeenCalled();
Expand Down Expand Up @@ -671,6 +675,12 @@ describe("ZosmfCommandApi", () => {
args: ["command", { account: "ACCT#" }],
transform: (args) => [args[1].account, ...args],
},
{
name: "issueTsoCommandWithParms",
spy: jest.spyOn(zostso.IssueTso, "issueTsoCmd"),
args: ["command", { account: "ACCT#" }, true],
transform: () => ["command", { addressSpaceOptions: { account: "ACCT#" } }],
},
{
name: "issueMvsCommand",
spy: jest.spyOn(zosconsole.IssueCommand, "issue"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ export namespace MainframeInteraction {
* @returns {Promise<zostso.IIssueResponse>}
* @memberof ICommand
*/
issueTsoCommandWithParms?(command: string, parms?: zostso.IStartTsoParms): Promise<zostso.IIssueResponse>;
issueTsoCommandWithParms?(command: string, parms?: zostso.IStartTsoParms, useNewTsoApis?: boolean): Promise<zostso.IIssueResponse>;

/**
* Issues a MVS Command and returns a Console Command API response.
Expand Down
8 changes: 0 additions & 8 deletions packages/zowe-explorer-api/src/profiles/AuthHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@ export class AuthHandler {
vsCodeOpts: { modal: true },
});
if (userResp === message && (await params.authMethods.ssoLogin(null, profileName))) {
// SSO login was successful, propagate new profile properties to other tree providers
if (typeof profile !== "string") {
ZoweVsCodeExtension.onProfileUpdatedEmitter.fire(profile);
}
// Unlock profile so it can be used again
AuthHandler.unlockProfile(profileName, true);
return true;
Expand All @@ -126,10 +122,6 @@ export class AuthHandler {
});

if (creds != null) {
// New creds were set, propagate new profile properties to other tree providers.
if (typeof profile !== "string") {
ZoweVsCodeExtension.onProfileUpdatedEmitter.fire(profile);
}
// Unlock profile so it can be used again
AuthHandler.unlockProfile(profileName, true);
return true;
Expand Down
4 changes: 3 additions & 1 deletion packages/zowe-explorer-api/src/profiles/UserSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@ export enum PersistenceSchemaEnum {
Dataset = "zowe.ds.history",
USS = "zowe.uss.history",
Job = "zowe.jobs.history",
Commands = "zowe.commands.history",
MvsCommands = "zowe.commands.mvs.history",
TsoCommands = "zowe.commands.tso.history",
UssCommands = "zowe.commands.uss.history",
}
29 changes: 22 additions & 7 deletions packages/zowe-explorer-api/src/profiles/ZoweExplorerZosmfApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,11 @@ export namespace ZoweExplorerZosmf {
* An implementation of the Zowe Explorer Command API interface for zOSMF.
*/
export class CommandApi extends CommonApi implements MainframeInteraction.ICommand {
public issueTsoCommandWithParms(command: string, parms: zostso.IStartTsoParms): Promise<zostso.IIssueResponse> {
public issueTsoCommandWithParms(command: string, parms: zostso.IStartTsoParms, useNewTsoApis?: boolean): Promise<zostso.IIssueResponse> {
if (useNewTsoApis) {
return zostso.IssueTso.issueTsoCmd(this.getSession(), command, { addressSpaceOptions: parms });
}

// eslint-disable-next-line deprecation/deprecation
return zostso.IssueTso.issueTsoCommand(this.getSession(), parms.account, command, parms);
}
Expand All @@ -478,13 +482,24 @@ export namespace ZoweExplorerZosmf {
public async issueUnixCommand(command: string, cwd: string, sshSession: zosuss.SshSession): Promise<string> {
let stdout = "";
if (cwd) {
await zosuss.Shell.executeSshCwd(sshSession, command, '"' + cwd + '"', (data: string) => {
stdout += data;
});
await zosuss.Shell.executeSshCwd(
sshSession,
command,
'"' + cwd + '"',
(data: string) => {
stdout += data;
},
true
);
} else {
await zosuss.Shell.executeSsh(sshSession, command, (data: string) => {
stdout += data;
});
await zosuss.Shell.executeSsh(
sshSession,
command,
(data: string) => {
stdout += data;
},
true
);
}
return stdout;
}
Expand Down
5 changes: 3 additions & 2 deletions packages/zowe-explorer-api/src/tree/ZoweTreeNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,10 @@ export class ZoweTreeNode extends vscode.TreeItem {
/**
* Sets the imperative.IProfileLoaded profile for this node to the one chosen in parameters.
*
* @param {imperative.IProfileLoaded} The profile you will set the node to use
* @param {imperative.IProfileLoaded} aProfile The profile you will set the node to use
* @param {BaseProfider} _fsProvider An unused FS Provider
*/
public setProfileToChoice(aProfile: imperative.IProfileLoaded, fsProvider?: BaseProvider): void {
public setProfileToChoice(aProfile: imperative.IProfileLoaded, _fsProvider?: BaseProvider): void {
// Don't reassign profile if its already defined, as we want to keep the reference valid for other nodes and filesystems
this.profile = Object.assign(this.profile ?? {}, aProfile);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export class ZoweVsCodeExtension {
await profInfo.updateProperty({ ...upd, property: "password", value: creds[1], setSecure });
}
await cache.updateCachedProfile(loadProfile, undefined, apiRegister);
ZoweVsCodeExtension.onProfileUpdatedEmitter.fire(loadProfile);

return loadProfile;
}
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

- Updated Zowe SDKs to `8.10.4` for technical currency. [#3306](https://github.com/zowe/zowe-explorer-vscode/pull/3306)
- 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)
- Added integrated terminals for z/OS Unix, TSO, and MVS commands which can be enabled via the `Zowe › Commands: Use Integrated Terminals` setting. [#3079](https://github.com/zowe/zowe-explorer-vscode/pull/3079)
- 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)
- Adopted support for VS Code proxy settings with zosmf profile types. [#3010](https://github.com/zowe/zowe-explorer-vscode/issues/3010)
Expand Down
11 changes: 10 additions & 1 deletion packages/zowe-explorer/__tests__/__mocks__/@zowe/imperative.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export interface ICommandArguments {
export interface IImperativeError {
msg: string;
errorCode?: number;
causeErrors?: any;
additionalDetails?: string;
}

Expand Down Expand Up @@ -236,13 +237,20 @@ export class ConfigUtils {
}
export class ImperativeError extends Error {
private msg: string;
constructor(public mDetails: IImperativeError) {
public causeErrors: any;
public additionalDetails: any;
constructor(private mDetails: IImperativeError) {
super();
this.msg = mDetails.msg;
this.causeErrors = this.mDetails.causeErrors;
this.additionalDetails = this.mDetails.additionalDetails;
}
public get message() {
return this.msg;
}
public get details() {
return this.mDetails;
}
}

export class ProfInfoErr extends ImperativeError {
Expand Down Expand Up @@ -359,6 +367,7 @@ export class TextUtils {
public static prettyJson(object: any, options?: any, color?: boolean, append?: string): string {
return JSON.stringify(object);
}
public static chalk = jest.requireActual("chalk");
}

export namespace SessConstants {
Expand Down
Loading

0 comments on commit 00e21da

Please sign in to comment.