Skip to content

Commit

Permalink
Merge branch 'main' into Add_type_info_to_session
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Moogk <[email protected]>
  • Loading branch information
petermoogk authored Nov 20, 2024
2 parents cc78331 + 57db6f3 commit b7bdff9
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 8 deletions.
3 changes: 2 additions & 1 deletion packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
- 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)
- 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)
- Allowed 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)
- 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)

### Bug fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,9 +557,9 @@ describe("Shared utils unit tests - function parseFavorites", () => {
describe("Shared utils unit tests - function addToWorkspace", () => {
it("adds a Data Set resource to the workspace", () => {
const datasetNode = new ZoweDatasetNode({
label: "EXAMPLE.DS",
collapsibleState: vscode.TreeItemCollapsibleState.None,
contextOverride: Constants.DS_DS_CONTEXT,
label: "EXAMPLE.PDS",
collapsibleState: vscode.TreeItemCollapsibleState.Collapsed,
contextOverride: Constants.DS_PDS_CONTEXT,
profile: createIProfile(),
});
const updateWorkspaceFoldersMock = jest.spyOn(vscode.workspace, "updateWorkspaceFolders").mockImplementation();
Expand All @@ -580,6 +580,34 @@ describe("Shared utils unit tests - function addToWorkspace", () => {
SharedUtils.addToWorkspace(ussNode, null as any);
expect(updateWorkspaceFoldersMock).toHaveBeenCalledWith(0, null, { uri: ussNode.resourceUri, name: `[sestest] ${ussNode.fullPath}` });
});
it("adds multiple resources to the workspace at once", () => {
const datasetNode1 = new ZoweDatasetNode({
label: "EXAMPLE.PDS1",
collapsibleState: vscode.TreeItemCollapsibleState.Collapsed,
contextOverride: Constants.DS_PDS_CONTEXT,
profile: createIProfile(),
});
const datasetNode2 = new ZoweDatasetNode({
label: "EXAMPLE.PDS2",
collapsibleState: vscode.TreeItemCollapsibleState.Collapsed,
contextOverride: Constants.DS_PDS_CONTEXT,
profile: createIProfile(),
});
const updateWorkspaceFoldersMock = jest.spyOn(vscode.workspace, "updateWorkspaceFolders").mockImplementation();
SharedUtils.addToWorkspace(null as any, [datasetNode1, datasetNode2]);
expect(updateWorkspaceFoldersMock).toHaveBeenCalledWith(
0,
null,
{
uri: datasetNode1.resourceUri,
name: `[sestest] ${datasetNode1.label as string}`,
},
{
uri: datasetNode2.resourceUri,
name: `[sestest] ${datasetNode2.label as string}`,
}
);
});
it("adds a USS session w/ fullPath to the workspace", () => {
const ussNode = new ZoweUSSNode({
label: "sestest",
Expand Down Expand Up @@ -617,9 +645,9 @@ describe("Shared utils unit tests - function addToWorkspace", () => {
});
it("skips adding a resource that's already in the workspace", () => {
const ussNode = new ZoweUSSNode({
label: "textFile.txt",
label: "testFolder",
collapsibleState: vscode.TreeItemCollapsibleState.None,
contextOverride: Constants.USS_TEXT_FILE_CONTEXT,
contextOverride: Constants.USS_DIR_CONTEXT,
profile: createIProfile(),
});
const workspaceFolders = new MockedProperty(vscode.workspace, "workspaceFolders", {
Expand Down
10 changes: 8 additions & 2 deletions packages/zowe-explorer/src/trees/shared/SharedUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@ export class SharedUtils {
): void {
const workspaceFolders = vscode.workspace.workspaceFolders;
const selectedNodes = SharedUtils.getSelectedNodeList(node, nodeList);
const urisToAdd: {
name: string;
uri: vscode.Uri;
}[] = [];
for (const item of selectedNodes) {
let resourceUri = item.resourceUri;
const isSession = SharedContext.isSession(item);
Expand All @@ -327,11 +331,13 @@ export class SharedUtils {
continue;
}

vscode.workspace.updateWorkspaceFolders(workspaceFolders?.length ?? 0, null, {
uri: resourceUri,
urisToAdd.push({
name: `[${item.getProfileName()}] ${SharedContext.isDatasetNode(item) ? (item.label as string) : item.fullPath}`,
uri: resourceUri,
});
}

vscode.workspace.updateWorkspaceFolders(workspaceFolders?.length ?? 0, null, ...urisToAdd);
}

/**
Expand Down

0 comments on commit b7bdff9

Please sign in to comment.