Skip to content

Commit

Permalink
Add ability to search Data Sets and PDS contents (#3306)
Browse files Browse the repository at this point in the history
* Add PoC Code

Signed-off-by: Andrew W. Harn <[email protected]>

* Add favorited search node, session node support, l10n, progress bars

Signed-off-by: Andrew W. Harn <[email protected]>

* Clean up implementation a bit

Signed-off-by: Andrew W. Harn <[email protected]>

* Remove debug message

Signed-off-by: Andrew W. Harn <[email protected]>

* Make some suggested changes

Signed-off-by: Andrew W. Harn <[email protected]>

* Update SDKs and optimize code, add prompt

Co-authored-by: Trae Yelovich <[email protected]>
Signed-off-by: Andrew W. Harn <[email protected]>

* Fix broken test

Signed-off-by: Andrew W. Harn <[email protected]>

* Add missing API to unit test

Signed-off-by: Andrew W. Harn <[email protected]>

* Fix tests

Signed-off-by: Andrew W. Harn <[email protected]>

* Refactor and start adding tests

Signed-off-by: Andrew W. Harn <[email protected]>

* Reduce unnecessary repetition of function calls

Signed-off-by: Andrew W. Harn <[email protected]>

* Add tests

Signed-off-by: Andrew W. Harn <[email protected]>

* Remove unnecessary change

Signed-off-by: Andrew W. Harn <[email protected]>

* Fix logic error and add more tests

Signed-off-by: Andrew W. Harn <[email protected]>

* Add comments and tests

Signed-off-by: Andrew W. Harn <[email protected]>

* Additional tests

Signed-off-by: Andrew W. Harn <[email protected]>

* Attempt to increase coverage

Signed-off-by: Andrew W. Harn <[email protected]>

* Update changelogs

Signed-off-by: Andrew W. Harn <[email protected]>

* Try to increase the timeout to 1 minute

Signed-off-by: Andrew W. Harn <[email protected]>

* Add coverage for additional branch of code

Signed-off-by: Andrew W. Harn <[email protected]>

* Add handling for partial responses

Signed-off-by: Andrew W. Harn <[email protected]>

* Update readme

Signed-off-by: Andrew W. Harn <[email protected]>

* Make requested changes

Signed-off-by: Andrew W. Harn <[email protected]>

* Restore old file

Signed-off-by: Andrew W. Harn <[email protected]>

* Update SDKs, use more restrictive type, add abort search and optimize

Signed-off-by: Andrew W. Harn <[email protected]>

* Fix cross-spawn in lockfile.

Signed-off-by: Andrew W. Harn <[email protected]>

* Fix progress bars

Signed-off-by: Andrew W. Harn <[email protected]>

* Update prompt to eliminate extra "No" value, and fix localization of Zowe Resources table items selected count.

Signed-off-by: Andrew W. Harn <[email protected]>

---------

Signed-off-by: Andrew W. Harn <[email protected]>
Co-authored-by: Trae Yelovich <[email protected]>
  • Loading branch information
awharn and traeok authored Nov 26, 2024
1 parent d68621f commit 7f253c1
Show file tree
Hide file tree
Showing 22 changed files with 2,753 additions and 283 deletions.
3 changes: 2 additions & 1 deletion packages/zowe-explorer-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ All notable changes to the "zowe-explorer-api" extension will be documented in t

### New features and enhancements

- - Update Zowe SDKs to `8.8.2` to get the latest enhancements from Imperative. [#3296](https://github.com/zowe/zowe-explorer-vscode/pull/3296)
- Update Zowe SDKs to `8.8.4` to get the latest enhancements from Imperative and the z/OS Files SDK. [#3306](https://github.com/zowe/zowe-explorer-vscode/pull/3306)
- Added new `searchDataSets` API to provide the ability to search all data sets and PDS members that match a pattern for a string. [#3306](https://github.com/zowe/zowe-explorer-vscode/pull/3306)
- Added support for extenders to obtain an updated Session that will includes VS Code proxy settings values if set, `getProfileSessionWithVscProxy`. [#3010](https://github.com/zowe/zowe-explorer-vscode/issues/3010)
- Added support for VS Code proxy settings with zosmf profile types. [#3010](https://github.com/zowe/zowe-explorer-vscode/issues/3010)
- 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,11 @@ describe("ZosmfMvsApi", () => {
spy: jest.spyOn(zosfiles.List, "dataSetsMatchingPattern"),
args: [["SAMPLE.A*", "SAMPLE.B*"], fakeProperties],
},
{
name: "searchDataSets",
spy: jest.spyOn(zosfiles.Search, "dataSets"),
args: [{ pattern: "SAMPLE.A*", searchString: "test", listOptions: { ...fakeProperties }, getOptions: { ...fakeProperties } }],
},
{
name: "copyDataSet",
spy: jest.spyOn(zosfiles.Copy, "dataSet"),
Expand Down
16 changes: 8 additions & 8 deletions packages/zowe-explorer-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
},
"dependencies": {
"@types/vscode": "^1.53.2",
"@zowe/core-for-zowe-sdk": "^8.8.2",
"@zowe/imperative": "^8.8.2",
"@zowe/core-for-zowe-sdk": "^8.8.3",
"@zowe/imperative": "^8.8.3",
"@zowe/secrets-for-zowe-sdk": "^8.1.2",
"@zowe/zos-console-for-zowe-sdk": "^8.8.2",
"@zowe/zos-files-for-zowe-sdk": "^8.8.2",
"@zowe/zos-jobs-for-zowe-sdk": "^8.8.2",
"@zowe/zos-tso-for-zowe-sdk": "^8.8.2",
"@zowe/zos-uss-for-zowe-sdk": "^8.8.2",
"@zowe/zosmf-for-zowe-sdk": "^8.8.2",
"@zowe/zos-console-for-zowe-sdk": "^8.8.3",
"@zowe/zos-files-for-zowe-sdk": "^8.8.4",
"@zowe/zos-jobs-for-zowe-sdk": "^8.8.4",
"@zowe/zos-tso-for-zowe-sdk": "^8.8.3",
"@zowe/zos-uss-for-zowe-sdk": "^8.8.3",
"@zowe/zosmf-for-zowe-sdk": "^8.8.3",
"deep-object-diff": "^1.1.9",
"mustache": "^4.2.0",
"semver": "^7.6.0"
Expand Down
8 changes: 8 additions & 0 deletions packages/zowe-explorer-api/src/extend/MainframeInteraction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,14 @@ export namespace MainframeInteraction {
* @returns {Promise<zosfiles.IZosFilesResponse>}
*/
copyDataSet?(fromDataSetName: string, toDataSetName: string, enq?: string, replace?: boolean): Promise<zosfiles.IZosFilesResponse>;

/**
* Searches dataSets.
*
* @param {zosfiles.ISearchOptions} searchOptions
* @returns {Promise<zosfiles.ISearchResponse>}
*/
searchDataSets?(searchOptions: zosfiles.ISearchOptions): Promise<zosfiles.ISearchResponse>;
}

/**
Expand Down
13 changes: 13 additions & 0 deletions packages/zowe-explorer-api/src/profiles/ZoweExplorerZosmfApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,19 @@ export namespace ZoweExplorerZosmf {
{ "from-dataset": { dsn: fromDataSetName }, enq, replace, responseTimeout: this.profile?.profile?.responseTimeout }
);
}
public searchDataSets(searchOptions: zosfiles.ISearchOptions): Promise<zosfiles.ISearchResponse> {
return zosfiles.Search.dataSets(this.getSession(), {
...searchOptions,
getOptions: {
responseTimeout: this.profile?.profile?.responseTimeout,
...searchOptions.getOptions,
},
listOptions: {
responseTimeout: this.profile?.profile?.responseTimeout,
...searchOptions.listOptions,
},
});
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/zowe-explorer-ftp-extension/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to the "zowe-explorer-ftp-extension" extension will be docum

### New features and enhancements

- Updated Zowe SDKs to `8.8.2` for technical currency. [#3296](https://github.com/zowe/zowe-explorer-vscode/pull/3296)
- Updated Zowe SDKs to `8.8.4` for technical currency. [#3306](https://github.com/zowe/zowe-explorer-vscode/pull/3306)

### Bug fixes

Expand Down
4 changes: 2 additions & 2 deletions packages/zowe-explorer-ftp-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@
"vscode": "^1.79.0"
},
"dependencies": {
"@zowe/zos-files-for-zowe-sdk": "^8.8.2",
"@zowe/zos-files-for-zowe-sdk": "^8.8.4",
"@zowe/zos-ftp-for-zowe-cli": "^3.0.0",
"@zowe/zos-jobs-for-zowe-sdk": "^8.8.2",
"@zowe/zos-jobs-for-zowe-sdk": "^8.8.4",
"@zowe/zowe-explorer-api": "3.1.0-SNAPSHOT",
"tmp": "0.2.3"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen

### New features and enhancements

- Updated Zowe SDKs to `8.8.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)
- 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)
- Implemented more user-friendly error messages for API or network errors within Zowe Explorer. [#3243](https://github.com/zowe/zowe-explorer-vscode/pull/3243)
- Use the "Troubleshoot" option for certain errors to obtain additional context, tips, and resources for how to resolve the errors. [#3243](https://github.com/zowe/zowe-explorer-vscode/pull/3243)
- Updated Zowe SDKs to `8.8.2` for technical currency. [#3296](https://github.com/zowe/zowe-explorer-vscode/pull/3296)
- Easily search for data in filtered data sets and partitioned data sets with the new `Search Filtered Data Sets` and `Search PDS Members` functionality. [#3306](https://github.com/zowe/zowe-explorer-vscode/pull/3306)
- Allow extenders to add context menu actions to a top level node, i.e. data sets, USS, Jobs, by encoding the profile type in the context value. [#3309](https://github.com/zowe/zowe-explorer-vscode/pull/3309)
- You can now add multiple partitioned data sets or USS directories to your workspace at once using the "Add to Workspace" feature. [#3324](https://github.com/zowe/zowe-explorer-vscode/issues/3324)
- Exposed read and write access to local storage keys for Zowe Explorer extenders. [#3180](https://github.com/zowe/zowe-explorer-vscode/issues/3180)
Expand Down
15 changes: 15 additions & 0 deletions packages/zowe-explorer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Review the following use cases and their procedures to understand how to work wi
- [View and access multiple profiles simultaneously](#view-and-access-multiple-profiles-simultaneously): Work with data sets from multiple profiles.
- [Submit a JCL](#submit-a-jcl): You can submit a jcl from a chose data set.
- [Allocate Like](#allocate-like): Create a copy of a chosen data set with the same parameters.
- [Search a Partitioned Data Set](#search-a-partitioned-data-set): Search all of a partitioned data set's members with a string of text.

## Prerequisite tasks

Expand Down Expand Up @@ -434,3 +435,17 @@ As a result, VS Code extensions like Zowe Explorer, Zowe Explorer CICS Extension
![Allocate Like](/docs/images/ZE-allocate.gif?raw=true "Allocate Like")

[Back to sample list](#sample-use-cases)

---

### Search a Partitioned Data Set

1. Navigate to the **Side Bar**
1. Open the **DATA SETS** bar.
1. Right-click a partitioned data set and select the **Search PDS Members** option.
1. When prompted, enter the string to be used for the search.
- A confirmation dialog appears if there is a large number of members to search.
1. A table displays the search results.
- Each search result can be selected to open the member at the location of the search term.

[Back to sample list](#sample-use-cases)
11 changes: 5 additions & 6 deletions packages/zowe-explorer/__tests__/__mocks__/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1307,11 +1307,14 @@ export enum FileSystemProviderErrorCode {

/**
* A type that filesystem providers should use to signal errors.
* A type that will allow Text Document selection.
* A type that will allow positions to be used.
*
* This class has factory methods for common error-cases, like `FileNotFound` when
* a file or folder doesn't exist, use them like so: `throw vscode.FileSystemError.FileNotFound(someUri);`
*/
export const { FileSystemError } = require("jest-mock-vscode").createVSCodeMock(jest);
export const { FileSystemError, Selection, Position } = require("jest-mock-vscode").createVSCodeMock(jest);

/**
* Namespace for dealing with the current workspace. A workspace is the representation
* of the folder that has been opened. There is no workspace when just a file but not a
Expand Down Expand Up @@ -1722,13 +1725,11 @@ export interface Clipboard {
writeText(value: string): Thenable<void>;
}

export class Position {}

export class Range {}

export class WorkspaceEdit {
public delete(uri: Uri, range: Range) {}
public insert(uri: Uri, position: Position, newText: string) {}
public insert(uri: Uri, position: typeof Position, newText: string) {}
}

/**
Expand All @@ -1749,5 +1750,3 @@ export namespace env {
},
};
}

export class Selection {}
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ async function createGlobalMocks() {
"zowe.ds.sortBy",
"zowe.ds.filterBy",
"zowe.ds.copyName",
"zowe.ds.pdsSearchFor",
"zowe.ds.filteredDataSetsSearchFor",
"zowe.uss.addSession",
"zowe.uss.refreshAll",
"zowe.uss.refreshUSS",
Expand Down
Loading

0 comments on commit 7f253c1

Please sign in to comment.