Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for copy/paste of MVS files within and cross lpars #3387

Merged
merged 22 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d666151
Copy Seq cross lpars
likhithanimma1 Nov 27, 2024
93724b4
Support download of whole PDS
likhithanimma1 Nov 28, 2024
8246e26
Fix progress bar
likhithanimma1 Nov 28, 2024
07fd0b0
Merge remote-tracking branch 'origin/main' into MvsCopyCrossLpar
likhithanimma1 Dec 10, 2024
d56402a
Improve functionality of copy option in context menu
likhithanimma1 Dec 11, 2024
a02d3db
Optimization of code
likhithanimma1 Jan 6, 2025
b9f5cb4
Complete code optimization
likhithanimma1 Jan 7, 2025
5236966
Remove unwanted code
likhithanimma1 Jan 7, 2025
34397b3
Merge remote-tracking branch 'zowe/main' into MvsCopyCrossLpar
likhithanimma1 Jan 9, 2025
9775a4b
Updated test cases
likhithanimma1 Jan 10, 2025
00e21da
Merge branch 'main' into MvsCopyCrossLpar
likhithanimma1 Jan 10, 2025
8eb8f21
Increase coverage
likhithanimma1 Jan 10, 2025
ce768bf
Code coverage for DatasetUtils file
likhithanimma1 Jan 12, 2025
d8edfaa
Changelog Updated
likhithanimma1 Jan 12, 2025
739ad19
Run pnpm --filter vscode-extension-for-zowe vscode:prepublish
likhithanimma1 Jan 13, 2025
16ee193
Merge remote-tracking branch 'zowe/main' into MvsCopyCrossLpar
likhithanimma1 Jan 15, 2025
2b59528
Adress fernando's comments
likhithanimma1 Jan 16, 2025
7196577
Remove function from ftp extension
likhithanimma1 Jan 21, 2025
caa20f9
Merge branch 'main' into MvsCopyCrossLpar
likhithanimma1 Jan 22, 2025
668a35e
Merge branch 'main' into MvsCopyCrossLpar
likhithanimma1 Jan 24, 2025
c226f16
Merge branch 'main' into MvsCopyCrossLpar
likhithanimma1 Jan 26, 2025
a4f7447
Merge branch 'main' into MvsCopyCrossLpar
likhithanimma1 Jan 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/zowe-explorer-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ All notable changes to the "zowe-explorer-api" extension will be documented in t
- 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)
- Added new `copyDataSetCrossLpar` API to provide ability to copy/paste data sets across LPARs. [#3012](https://github.com/zowe/zowe-explorer-vscode/issues/3012)

### Bug fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,13 @@ describe("ZosmfMvsApi", () => {
await zosmfApi.uploadFromBuffer(buf, "SOME.DS(MEMB)");
expect(uploadFileSpy).toHaveBeenCalledWith(zosmfApi.getSession(), buf, "SOME.DS(MEMB)", fakeProperties);
});

it("Test copyDataSetCrossLpar()", async () => {
const copySpy = jest.spyOn(zosfiles.Copy, "dataSetCrossLPAR").mockImplementation();
const zosmfApi = new ZoweExplorerZosmf.MvsApi(loadedProfile);
await zosmfApi.copyDataSetCrossLpar("TO.NAME", "TO.MEMBER", undefined as any, loadedProfile);
expect(copySpy).toHaveBeenCalled();
});
});

describe("ZosmfJesApi", () => {
Expand Down
11 changes: 11 additions & 0 deletions packages/zowe-explorer-api/src/extend/MainframeInteraction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,17 @@ export namespace MainframeInteraction {
* @returns {Promise<zosfiles.ISearchResponse>}
*/
searchDataSets?(searchOptions: zosfiles.ISearchOptions): Promise<zosfiles.ISearchResponse>;

/**
* Copies a dataSet to cross Lpar
*
*/
copyDataSetCrossLpar?(
toDataSetName: string,
toMemberName: string,
options: zosfiles.ICrossLparCopyDatasetOptions,
sourceprofile: imperative.IProfileLoaded
): Promise<zosfiles.IZosFilesResponse>;
}

/**
Expand Down
28 changes: 21 additions & 7 deletions packages/zowe-explorer-api/src/profiles/ZoweExplorerZosmfApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@ export namespace ZoweExplorerZosmf {
}

public getSession(profile?: imperative.IProfileLoaded): imperative.Session {
if (!this.session) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we remove this check, we are already going to call the _getSession and replacing the "existing one"
is that desired, or will that cause some breakage in certain edge cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the check is in place, in the function copyDataSetCrossLpar after generating the sourceSession with the help of this.getSession(sourceprofile) the targetSession will also be generated same as sourceSession with the call this.getSession() which is not the case when u want to paste the copied dataset to different LPAR.

try {
this.session = this._getSession(profile || this.profile);
} catch (error) {
// todo: initialize and use logging
imperative.Logger.getAppLogger().error(error as string);
}
try {
this.session = this._getSession(profile || this.profile);
} catch (error) {
// todo: initialize and use logging
imperative.Logger.getAppLogger().error(error as string);
}
return ProfilesCache.getProfileSessionWithVscProxy(this.session);
}
Expand Down Expand Up @@ -370,6 +368,7 @@ export namespace ZoweExplorerZosmf {
...options,
});
}

public copyDataSet(fromDataSetName: string, toDataSetName: string, enq?: string, replace?: boolean): Promise<zosfiles.IZosFilesResponse> {
return zosfiles.Copy.dataSet(
this.getSession(),
Expand All @@ -390,6 +389,21 @@ export namespace ZoweExplorerZosmf {
},
});
}

public async copyDataSetCrossLpar(
toDataSetName: string,
toMemberName: string,
options: zosfiles.ICrossLparCopyDatasetOptions,
sourceprofile: imperative.IProfileLoaded
): Promise<zosfiles.IZosFilesResponse> {
return zosfiles.Copy.dataSetCrossLPAR(
this.getSession(sourceprofile),
{ dsn: toDataSetName, member: toMemberName },
options,
{},
this.getSession()
);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,15 @@
throw new ZoweFtpExtensionError("Copy dataset is not supported in ftp extension.");
}

public copyDataSetCrossLpar(

Check warning on line 306 in packages/zowe-explorer-ftp-extension/src/ZoweExplorerFtpMvsApi.ts

View check run for this annotation

Codecov / codecov/patch

packages/zowe-explorer-ftp-extension/src/ZoweExplorerFtpMvsApi.ts#L306

Added line #L306 was not covered by tests
zFernand0 marked this conversation as resolved.
Show resolved Hide resolved
toDataSetName: string,
toMemberName: string,
options: zosfiles.ICrossLparCopyDatasetOptions,
sourceprofile: imperative.IProfileLoaded

Check warning on line 310 in packages/zowe-explorer-ftp-extension/src/ZoweExplorerFtpMvsApi.ts

View check run for this annotation

Codecov / codecov/patch

packages/zowe-explorer-ftp-extension/src/ZoweExplorerFtpMvsApi.ts#L310

Added line #L310 was not covered by tests
): Promise<zosfiles.IZosFilesResponse> {
throw new ZoweFtpExtensionError("Copy dataset cross lpar is not supported in ftp extension.");

Check warning on line 312 in packages/zowe-explorer-ftp-extension/src/ZoweExplorerFtpMvsApi.ts

View check run for this annotation

Codecov / codecov/patch

packages/zowe-explorer-ftp-extension/src/ZoweExplorerFtpMvsApi.ts#L312

Added line #L312 was not covered by tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What can we expect with an extender that works with this on day 1 and a user tries but their extension wasn't updated like we see the zFTP extension? Should a check be done in ZE making this statement like we do for other new APIs/functionality?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JillieBeanSim Removed it from ftp as the ZE functionality already has the check in place for it.

}

public async renameDataSet(currentDataSetName: string, newDataSetName: string): Promise<zosfiles.IZosFilesResponse> {
const result = this.getDefaultResponse();
let connection;
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 @@ -24,6 +24,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
- Exposed read and write access to local storage keys for Zowe Explorer extenders. [#3180](https://github.com/zowe/zowe-explorer-vscode/issues/3180)
- Added `Open with Encoding` to the context menu of Job Spool files. [#1941](https://github.com/zowe/zowe-explorer-vscode/issues/1941)
- Added Time Started, Time Ended, and Time Submitted job properties to the Jobs table view. [#3055](https://github.com/zowe/zowe-explorer-vscode/issues/3055)
- Implemented copy/paste functionality of data sets within and across LPARs. [#3012](https://github.com/zowe/zowe-explorer-vscode/issues/3012)

### Bug fixes

Expand Down
Loading
Loading