Skip to content
Open
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
716e1bc
feat: command for downloading all members of PDS to local directory
JWaters02 Feb 9, 2025
72877ab
Attempt on tests
JWaters02 Feb 14, 2025
5bb37c1
Merge remote-tracking branch 'JWaters02/main' into feat/download-ds
JWaters02 May 24, 2025
08de650
refactor: smarter attempt at downloadAllMembers
JWaters02 May 24, 2025
ab2535a
store download options in local storage
JWaters02 May 25, 2025
f87c6b5
WIP
JWaters02 Jun 5, 2025
7a9b90f
Merge remote-tracking branch 'origin/main' into feat/download-ds
JWaters02 Aug 15, 2025
42fcb20
wip: downloading
JWaters02 Aug 23, 2025
c4eaeb4
Merge remote-tracking branch 'origin/main' into feat/download-ds
JWaters02 Aug 23, 2025
7ea6ff2
wip: downloading
JWaters02 Aug 23, 2025
8eafadb
wip: downloading
JWaters02 Aug 24, 2025
d230ec0
wip: add downloadDataSet and move common quickpick to helper
JWaters02 Aug 24, 2025
116d596
refactor: reduce code duplication
JWaters02 Aug 24, 2025
2d2b5ac
Merge remote-tracking branch 'origin/main' into feat/download-ds
JWaters02 Aug 30, 2025
fa100fb
feat: download uss files/directories
JWaters02 Aug 30, 2025
5f81fc3
fix: count dir children recursively
JWaters02 Aug 30, 2025
17fc579
Merge remote-tracking branch 'origin/main' into feat/download-ds
JWaters02 Oct 4, 2025
a663383
Merge remote-tracking branch 'origin/main' into feat/download-ds
JWaters02 Oct 8, 2025
9c6c4ed
refactor: fallback to profile encoding
JWaters02 Oct 18, 2025
4a039fc
Merge remote-tracking branch 'origin/main' into feat/download-ds
JWaters02 Oct 18, 2025
ed79831
fix: implement downloadAllDatasets into FtpMvsApi
JWaters02 Oct 18, 2025
a003177
tests: update command count
JWaters02 Oct 18, 2025
11beac6
tests: all tests passing, ready for Download test cases
JWaters02 Oct 18, 2025
5c15080
tests: data set download functions tests
JWaters02 Oct 18, 2025
efb87ef
tests: uss download functions tests
JWaters02 Oct 19, 2025
e8bce59
tests: add USSUtils.unit.test.ts with coverage for existing & new funcs
JWaters02 Oct 19, 2025
e25d90f
tests: USSInit & DatasetInit coverage
JWaters02 Oct 19, 2025
03fa91e
tests: remove unused imports
JWaters02 Oct 19, 2025
a3de6fd
refactor: add downloadDirectory to IUss interface
JWaters02 Oct 19, 2025
cab987b
tests: add mvs/uss download api impl to ftp ext tests
JWaters02 Oct 19, 2025
5da1f2a
wip: add list opts support to uss dir download
JWaters02 Oct 19, 2025
9bf9a9d
refactor: uss dir download options
JWaters02 Oct 19, 2025
10a1ce7
refactor: handle download responses properly
JWaters02 Oct 20, 2025
6f636e2
Merge branch 'feat/download-uss-dir-opts' into feat/download-ds
JWaters02 Oct 20, 2025
a61fa6f
tests: fix tests and add new tests for the changes
JWaters02 Oct 20, 2025
a44a6ba
refactor: change context menu groupings
JWaters02 Oct 20, 2025
1b06aad
chore: prepublish
JWaters02 Oct 20, 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
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,11 @@ describe("ZosmfUssApi", () => {
spy: jest.spyOn(zosfiles.Download, "ussFile"),
args: ["ussPath", fakeProperties],
},
{
name: "downloadDirectory",
spy: jest.spyOn(zosfiles.Download, "ussDir"),
args: ["localPath", fakeProperties],
},
{
name: "putContent",
spy: jest.spyOn(zosfiles.Upload, "fileToUssFile"),
Expand Down Expand Up @@ -513,6 +518,11 @@ describe("ZosmfMvsApi", () => {
spy: jest.spyOn(zosfiles.Download, "dataSet"),
args: ["dsname", fakeProperties],
},
{
name: "downloadAllMembers",
spy: jest.spyOn(zosfiles.Download, "allMembers"),
args: ["dsname", fakeProperties],
},
{
name: "putContents",
spy: jest.spyOn(zosfiles.Upload, "pathToDataSet"),
Expand Down
25 changes: 25 additions & 0 deletions packages/zowe-explorer-api/src/extend/MainframeInteraction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,24 @@ export namespace MainframeInteraction {
*
* @param {string} ussFilePath
* @param {zosfiles.IDownloadOptions} options
* @returns {Promise<zosfiles.IZosFilesResponse>}
*/
getContents(ussFilePath: string, options: zosfiles.IDownloadSingleOptions): Promise<zosfiles.IZosFilesResponse>;

/**
* Download a USS directory to the local file system.
*
* @param {string} ussDirectoryPath The path of the USS directory to download
* @param {zosfiles.IDownloadOptions} fileOptions Download options including local directory path
* @param {zosfiles.IUSSListOptions} listOptions Options for listing files in USS
* @returns {Promise<zosfiles.IZosFilesResponse>}
*/
downloadDirectory(
ussDirectoryPath: string,
fileOptions?: zosfiles.IDownloadOptions,
listOptions?: zosfiles.IUSSListOptions
): Promise<zosfiles.IZosFilesResponse>;

/**
* Uploads a given buffer as the contents of a file on USS.
* @param {Buffer} buffer
Expand Down Expand Up @@ -235,6 +250,16 @@ export namespace MainframeInteraction {
*/
getContents(dataSetName: string, options?: zosfiles.IDownloadSingleOptions): Promise<zosfiles.IZosFilesResponse>;

/**
* Retrieve all members of a partitioned data set and save them to a directory.
*
* @param {string} dataSetName
* @param {string} directoryPath
* @param {zosfiles.IDownloadOptions} [options]
* @returns {Promise<zosfiles.IZosFilesResponse>}
*/
downloadAllMembers(dataSetName: string, options?: zosfiles.IDownloadOptions): Promise<zosfiles.IZosFilesResponse>;

/**
* Uploads a given buffer as the contents of a file to a data set or member.
*
Expand Down
19 changes: 19 additions & 0 deletions packages/zowe-explorer-api/src/profiles/ZoweExplorerZosmfApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,18 @@ import { IDataSetCount } from "../dataset/IDataSetCount";
});
}

public downloadDirectory(
ussDirectoryPath: string,
fileOptions?: zosfiles.IDownloadOptions,
listOptions?: zosfiles.IUSSListOptions
): Promise<zosfiles.IZosFilesResponse> {
return zosfiles.Download.ussDir(this.getSession(), ussDirectoryPath, {
responseTimeout: this.profile?.profile?.responseTimeout,
...fileOptions,
...listOptions,
});
}

public copy(outputPath: string, options?: Omit<object, "request">): Promise<Buffer> {
return zosfiles.Utilities.putUSSPayload(this.getSession(), outputPath, { ...options, request: "copy" });
}
Expand Down Expand Up @@ -260,6 +272,13 @@ import { IDataSetCount } from "../dataset/IDataSetCount";
});
}

public downloadAllMembers(dataSetName: string, options?: zosfiles.IDownloadOptions): Promise<zosfiles.IZosFilesResponse> {
return zosfiles.Download.allMembers(this.getSession(), dataSetName, {
responseTimeout: this.profile?.profile?.responseTimeout,
...options,
});
}

public uploadFromBuffer(buffer: Buffer, dataSetName: string, options?: zosfiles.IUploadOptions): Promise<zosfiles.IZosFilesResponse> {
return zosfiles.Upload.bufferToDataSet(this.getSession(), buffer, dataSetName, {
responseTimeout: this.profile?.profile?.responseTimeout,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,10 @@ export class FtpMvsApi extends AbstractFtpApi implements MainframeInteraction.IM
}
}

public downloadAllMembers(_dataSetName: string, _options?: zosfiles.IDownloadOptions): Promise<zosfiles.IZosFilesResponse> {
throw new ZoweFtpExtensionError("Download all members is not supported in ftp extension.");
}

public hMigrateDataSet(_dataSetName: string): Promise<zosfiles.IZosFilesResponse> {
throw new ZoweFtpExtensionError("Migrate dataset is not supported in ftp extension.");
}
Expand Down
17 changes: 17 additions & 0 deletions packages/zowe-explorer-ftp-extension/src/ZoweExplorerFtpUssApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,23 @@ export class FtpUssApi extends AbstractFtpApi implements MainframeInteraction.IU
}
}

/**
* Download a USS directory to the local file system.
* Currently not supported by FTP extension.
*
* @param ussDirectoryPath The path of the USS directory to download
* @param fileOptions Download options including local directory path
* @param listOptions Options for listing files in USS
* @returns A file response with the results of the download operation.
*/
public downloadDirectory(
_ussDirectoryPath: string,
_fileOptions?: zosfiles.IDownloadOptions,
_listOptions?: zosfiles.IUSSListOptions
): Promise<zosfiles.IZosFilesResponse> {
throw new ZoweFtpExtensionError("Download directory operation is not supported in FTP extension.");
}

/**
* Uploads a USS file from the given buffer.
* @param buffer The buffer containing the contents of the USS file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,8 @@ export class IZosFilesResponse {
*/
public apiResponse?: any;
}

export class ZosFilesUtils {
public static getDirsFromDataSet = jest.fn().mockReturnValue("test/dataset/path");
public static DEFAULT_FILE_EXTENSION = "txt";
}
4 changes: 3 additions & 1 deletion packages/zowe-explorer/__tests__/__mocks__/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1651,7 +1651,9 @@ export interface TextDocument {
export class Uri {
private static _regexp = /^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;
public static file(path: string): Uri {
return Uri.parse(path);
const uri = Uri.parse(path);
uri.fsPath = path;
return uri;
}
public static parse(value: string, _strict?: boolean): Uri {
const match = Uri._regexp.exec(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ async function createGlobalMocks() {
"zowe.ds.filteredDataSetsSearchFor",
"zowe.ds.tableView",
"zowe.ds.listDataSets",
"zowe.ds.downloadAllMembers",
"zowe.ds.downloadMember",
"zowe.ds.downloadDataSet",
"zowe.uss.addSession",
"zowe.uss.refreshAll",
"zowe.uss.refresh",
Expand All @@ -201,6 +204,8 @@ async function createGlobalMocks() {
"zowe.uss.uploadDialog",
"zowe.uss.uploadDialogBinary",
"zowe.uss.uploadDialogWithEncoding",
"zowe.uss.downloadFile",
"zowe.uss.downloadDirectory",
"zowe.uss.copyPath",
"zowe.uss.editFile",
"zowe.uss.editAttributes",
Expand Down
Loading
Loading