Skip to content

Commit

Permalink
Support for copy/paste of MVS files within and cross lpars (#3387)
Browse files Browse the repository at this point in the history
* Copy Seq cross lpars

Signed-off-by: likhithanimma1 <[email protected]>

* Support download of whole PDS

Signed-off-by: likhithanimma1 <[email protected]>

* Fix progress bar

Signed-off-by: likhithanimma1 <[email protected]>

* Improve functionality of copy option in context menu

Signed-off-by: likhithanimma1 <[email protected]>

* Optimization of code

Signed-off-by: likhithanimma1 <[email protected]>

* Complete code optimization

Signed-off-by: likhithanimma1 <[email protected]>

* Remove unwanted code

Signed-off-by: likhithanimma1 <[email protected]>

* Updated test cases

Signed-off-by: likhithanimma1 <[email protected]>

* Increase coverage

Signed-off-by: likhithanimma1 <[email protected]>

* Code coverage for DatasetUtils file

Signed-off-by: likhithanimma1 <[email protected]>

* Changelog Updated

Signed-off-by: likhithanimma1 <[email protected]>

* Run pnpm --filter vscode-extension-for-zowe vscode:prepublish

Signed-off-by: likhithanimma1 <[email protected]>

* Adress fernando's comments

Signed-off-by: likhithanimma1 <[email protected]>

* Remove function from ftp extension

Signed-off-by: likhithanimma1 <[email protected]>

---------

Signed-off-by: likhithanimma1 <[email protected]>
  • Loading branch information
likhithanimma1 authored Jan 27, 2025
1 parent 7d27139 commit 5c58c2e
Show file tree
Hide file tree
Showing 12 changed files with 721 additions and 698 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 @@ -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) {
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
1 change: 1 addition & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,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

0 comments on commit 5c58c2e

Please sign in to comment.