Skip to content

Commit

Permalink
Merge branch 'main' into fix/ftp/upload-member
Browse files Browse the repository at this point in the history
  • Loading branch information
zFernand0 authored Nov 14, 2024
2 parents 2da9caf + f5ca8cc commit bab4dcf
Show file tree
Hide file tree
Showing 10 changed files with 136 additions and 63 deletions.
2 changes: 1 addition & 1 deletion packages/zowe-explorer-api/src/fs/BaseProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ export class BaseProvider {
})
.then(async ({ userResponse }) => {
if (userResponse === "Retry" && opts?.retry?.fn != null) {
await opts.retry.fn(...(opts?.retry.args ?? []));
await opts.retry.fn(...(opts.retry.args ?? []));
}
})
.catch(() => {
Expand Down
2 changes: 2 additions & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
- Reduced the number of MVS API calls performed by `vscode.workspace.fs.readFile` when fetching the contents of a data set entry. [#3278](https://github.com/zowe/zowe-explorer-vscode/issues/3278)
- Fixed an issue to review inconsistent capitalization across translation strings. [#2935](https://github.com/zowe/zowe-explorer-vscode/issues/2935)
- Updated the test for the default credential manager for better compatibility with Cloud-based platforms such as Eclipse Che and Red Hat OpenShift Dev Spaces. [#3297](https://github.com/zowe/zowe-explorer-vscode/pull/3297)
- Fixed an issue where opening a PDS member after renaming an expanded PDS resulted in an error. [#3314](https://github.com/zowe/zowe-explorer-vscode/issues/3314)
- Fixed issue where users were not prompted to enter credentials if a 401 error was encountered when opening files, data sets or spools in the editor. [#3197](https://github.com/zowe/zowe-explorer-vscode/issues/3197)
- Fixed issue where profile credential updates or token changes were not reflected within the filesystem. [#3289](https://github.com/zowe/zowe-explorer-vscode/issues/3289)
- Fixed issue to update the success message when changing authentication from token to basic through the 'Change Authentication' option.

## `3.0.2`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -997,12 +997,14 @@ describe("fetchDataset", () => {
const lookupMock = jest.spyOn(DatasetFSProvider.instance, "lookup").mockImplementation(() => {
throw new Error("unknown fs error");
});
await expect((DatasetFSProvider.instance as any).fetchDataset(testUris.ps, {
isRoot: false,
slashAfterProfilePos: testUris.ps.path.indexOf("/", 1),
profileName: "sestest",
profile: testProfile,
})).rejects.toThrow();
await expect(
(DatasetFSProvider.instance as any).fetchDataset(testUris.ps, {
isRoot: false,
slashAfterProfilePos: testUris.ps.path.indexOf("/", 1),
profileName: "sestest",
profile: testProfile,
})
).rejects.toThrow();
lookupMock.mockRestore();
});
});
Expand Down Expand Up @@ -1134,6 +1136,10 @@ describe("rename", () => {

it("renames a PDS", async () => {
const oldPds = new PdsEntry("USER.DATA.PDS");
oldPds.metadata = new DsEntryMetadata({ profile: testProfile, path: "/USER.DATA.PDS" });
const exampleMember = new DsEntry("TESTMEM", true);
exampleMember.metadata = new DsEntryMetadata({ profile: testProfile, path: "/USER.DATA.PDS/TESTMEM" });
oldPds.entries.set("TESTMEM", exampleMember);
oldPds.metadata = testEntries.pds.metadata;
const mockMvsApi = {
renameDataSet: jest.fn(),
Expand All @@ -1146,6 +1152,7 @@ describe("rename", () => {
.spyOn(DatasetFSProvider.instance as any, "_lookupParentDirectory")
.mockReturnValueOnce({ ...testEntries.session });
await DatasetFSProvider.instance.rename(testUris.pds, testUris.pds.with({ path: "/USER.DATA.PDS2" }), { overwrite: true });
expect(exampleMember.metadata.path).toBe("/USER.DATA.PDS2/TESTMEM");
expect(mockMvsApi.renameDataSet).toHaveBeenCalledWith("USER.DATA.PDS", "USER.DATA.PDS2");
_lookupMock.mockRestore();
mvsApiMock.mockRestore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2456,6 +2456,47 @@ describe("Dataset Tree Unit Tests - Function rename", () => {
expect(refreshElementSpy).toHaveBeenCalledWith(child.getParent());
});

it("Checking function with PDS", async () => {
createGlobalMocks();
const blockMocks = createBlockMocks();
mocked(Profiles.getInstance).mockReturnValue(blockMocks.profileInstance);
mocked(vscode.window.createTreeView).mockReturnValueOnce(blockMocks.treeView);
const testTree = new DatasetTree();
testTree.mSessionNodes.push(blockMocks.datasetSessionNode);
// Create nodes in Session section
const parent = new ZoweDatasetNode({
label: "HLQ.TEST.OLDNAME.NODE",
collapsibleState: vscode.TreeItemCollapsibleState.None,
contextOverride: Constants.DS_PDS_CONTEXT,
parentNode: testTree.mSessionNodes[1],
profile: blockMocks.imperativeProfile,
session: blockMocks.session,
});
const child = new ZoweDatasetNode({
label: "mem1",
collapsibleState: vscode.TreeItemCollapsibleState.None,
contextOverride: Constants.DS_MEMBER_CONTEXT,
parentNode: parent,
});
// Simulate corresponding nodes in favorites
// Push test nodes to respective arrays
parent.children.push(child);
testTree.mSessionNodes[1].children.push(parent);

const refreshElementSpy = jest.spyOn(testTree, "refreshElement");

const renameDataSetSpy = jest.spyOn((DatasetTree as any).prototype, "renameDataSet");

mocked(Gui.showInputBox).mockImplementation((options) => {
return Promise.resolve("HLQ.TEST.NEWNAME.NODE");
});
await testTree.rename(parent);
expect(renameDataSetSpy).toHaveBeenLastCalledWith(parent);
expect(parent.resourceUri?.path).toBe("/sestest/HLQ.TEST.NEWNAME.NODE");
expect(child.resourceUri?.path).toBe("/sestest/HLQ.TEST.NEWNAME.NODE/mem1");
expect(refreshElementSpy).toHaveBeenCalled();
});

it("Checking function with PDS Member given in lowercase", async () => {
createGlobalMocks();
const blockMocks = createBlockMocks();
Expand Down
74 changes: 37 additions & 37 deletions packages/zowe-explorer/l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,42 @@
"Profile auth error": "Profile auth error",
"Profile is not authenticated, please log in to continue": "Profile is not authenticated, please log in to continue",
"Retrieving response from USS list API": "Retrieving response from USS list API",
"The 'move' function is not implemented for this USS API.": "The 'move' function is not implemented for this USS API.",
"Failed to move {0}/File path": {
"message": "Failed to move {0}",
"comment": [
"File path"
]
},
"Profile does not exist for this file.": "Profile does not exist for this file.",
"Saving USS file...": "Saving USS file...",
"Failed to rename {0}/File path": {
"message": "Failed to rename {0}",
"comment": [
"File path"
]
},
"Failed to delete {0}/File name": {
"message": "Failed to delete {0}",
"comment": [
"File name"
]
},
"No error details given": "No error details given",
"Error fetching destination {0} for paste action: {1}/USS pathError message": {
"message": "Error fetching destination {0} for paste action: {1}",
"comment": [
"USS path",
"Error message"
]
},
"Failed to copy {0} to {1}/Source pathDestination path": {
"message": "Failed to copy {0} to {1}",
"comment": [
"Source path",
"Destination path"
]
},
"Downloaded: {0}/Download time": {
"message": "Downloaded: {0}",
"comment": [
Expand Down Expand Up @@ -266,42 +302,6 @@
"initializeUSSFavorites.error.buttonRemove": "initializeUSSFavorites.error.buttonRemove",
"File does not exist. It may have been deleted.": "File does not exist. It may have been deleted.",
"Pulling from Mainframe...": "Pulling from Mainframe...",
"The 'move' function is not implemented for this USS API.": "The 'move' function is not implemented for this USS API.",
"Failed to move {0}/File path": {
"message": "Failed to move {0}",
"comment": [
"File path"
]
},
"Profile does not exist for this file.": "Profile does not exist for this file.",
"Saving USS file...": "Saving USS file...",
"Failed to rename {0}/File path": {
"message": "Failed to rename {0}",
"comment": [
"File path"
]
},
"Failed to delete {0}/File name": {
"message": "Failed to delete {0}",
"comment": [
"File name"
]
},
"No error details given": "No error details given",
"Error fetching destination {0} for paste action: {1}/USS pathError message": {
"message": "Error fetching destination {0} for paste action: {1}",
"comment": [
"USS path",
"Error message"
]
},
"Failed to copy {0} to {1}/Source pathDestination path": {
"message": "Failed to copy {0} to {1}",
"comment": [
"Source path",
"Destination path"
]
},
"{0} location/Node type": {
"message": "{0} location",
"comment": [
Expand Down Expand Up @@ -1039,7 +1039,7 @@
"Cannot switch to token-based authentication for profile {0}.": "Cannot switch to token-based authentication for profile {0}.",
"Login using token-based authentication service was successful for profile {0}.": "Login using token-based authentication service was successful for profile {0}.",
"Unable to switch to token-based authentication for profile {0}.": "Unable to switch to token-based authentication for profile {0}.",
"Login using basic authentication was successful for profile {0}.": "Login using basic authentication was successful for profile {0}.",
"Changing authentication to basic was successful for profile {0}.": "Changing authentication to basic was successful for profile {0}.",
"Unable to switch to basic authentication for profile {0}.": "Unable to switch to basic authentication for profile {0}.",
"Unable to switch authentication for profile {0}.": "Unable to switch authentication for profile {0}.",
"Logout from authentication service was successful for {0}./Service profile name": {
Expand Down
20 changes: 10 additions & 10 deletions packages/zowe-explorer/l10n/poeditor.json
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,15 @@
"Profile auth error": "",
"Profile is not authenticated, please log in to continue": "",
"Retrieving response from USS list API": "",
"The 'move' function is not implemented for this USS API.": "",
"Failed to move {0}": "",
"Profile does not exist for this file.": "",
"Saving USS file...": "",
"Failed to rename {0}": "",
"Failed to delete {0}": "",
"No error details given": "",
"Error fetching destination {0} for paste action: {1}": "",
"Failed to copy {0} to {1}": "",
"Downloaded: {0}": "",
"Encoding: {0}": "",
"Binary": "",
Expand Down Expand Up @@ -560,15 +569,6 @@
"initializeUSSFavorites.error.buttonRemove": "",
"File does not exist. It may have been deleted.": "",
"Pulling from Mainframe...": "",
"The 'move' function is not implemented for this USS API.": "",
"Failed to move {0}": "",
"Profile does not exist for this file.": "",
"Saving USS file...": "",
"Failed to rename {0}": "",
"Failed to delete {0}": "",
"No error details given": "",
"Error fetching destination {0} for paste action: {1}": "",
"Failed to copy {0} to {1}": "",
"{0} location": "",
"Choose a location to create the {0}": "",
"Name of file or directory": "",
Expand Down Expand Up @@ -854,7 +854,7 @@
"Cannot switch to token-based authentication for profile {0}.": "",
"Login using token-based authentication service was successful for profile {0}.": "",
"Unable to switch to token-based authentication for profile {0}.": "",
"Login using basic authentication was successful for profile {0}.": "",
"Changing authentication to basic was successful for profile {0}.": "",
"Unable to switch to basic authentication for profile {0}.": "",
"Unable to switch authentication for profile {0}.": "",
"Logout from authentication service was successful for {0}.": "",
Expand Down
2 changes: 1 addition & 1 deletion packages/zowe-explorer/src/configuration/Profiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ export class Profiles extends ProfilesCache {

if (creds !== undefined) {
const successMsg = vscode.l10n.t(
"Login using basic authentication was successful for profile {0}.",
"Changing authentication to basic was successful for profile {0}.",
typeof profile === "string" ? profile : profile.name
);
ZoweLogger.info(successMsg);
Expand Down
17 changes: 13 additions & 4 deletions packages/zowe-explorer/src/trees/dataset/DatasetFSProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -605,12 +605,12 @@ export class DatasetFSProvider extends BaseProvider implements vscode.FileSystem
comment: ["Data set name"],
}),
apiType: ZoweExplorerApiType.Mvs,
profileType: entry.metadata.profile.type,
profileType: entry.metadata.profile?.type,
retry: {
fn: this.writeFile.bind(this),
args: [uri, content, options],
},
templateArgs: { profileName: entry.metadata.profile.name ?? "" },
templateArgs: { profileName: entry.metadata.profile?.name ?? "" },
});
throw err;
}
Expand Down Expand Up @@ -664,7 +664,7 @@ export class DatasetFSProvider extends BaseProvider implements vscode.FileSystem
comment: ["File path"],
}),
apiType: ZoweExplorerApiType.Mvs,
profileType: entry.metadata.profile.type,
profileType: entry.metadata.profile?.type,
retry: {
fn: this.delete.bind(this),
args: [uri, _options],
Expand Down Expand Up @@ -711,7 +711,7 @@ export class DatasetFSProvider extends BaseProvider implements vscode.FileSystem
comment: ["Data set name"],
}),
apiType: ZoweExplorerApiType.Mvs,
profileType: entry.metadata.profile.type,
profileType: entry.metadata.profile?.type,
retry: {
fn: this.rename.bind(this),
args: [oldUri, newUri, options],
Expand All @@ -730,6 +730,15 @@ export class DatasetFSProvider extends BaseProvider implements vscode.FileSystem
entry.metadata.path = newPath;
parentDir.entries.set(newName, entry);

if (FsDatasetsUtils.isPdsEntry(entry)) {
for (const [_, member] of entry.entries) {
member.metadata.path = path.posix.join(
entry.metadata.path,
member.metadata.path.substring(member.metadata.path.lastIndexOf("/") + 1)
);
}
}

this._fireSoon({ type: vscode.FileChangeType.Deleted, uri: oldUri }, { type: vscode.FileChangeType.Created, uri: newUri });
}
}
14 changes: 14 additions & 0 deletions packages/zowe-explorer/src/trees/dataset/DatasetTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1236,6 +1236,20 @@ export class DatasetTree extends ZoweTreeProvider<IZoweDatasetTreeNode> implemen
node.resourceUri = newUri;
node.label = afterDataSetName;
node.tooltip = afterDataSetName;

if (SharedContext.isPds(node)) {
for (const child of node.children) {
child.resourceUri = child.resourceUri.with({
path: path.posix.join(newUri.path, child.resourceUri.path.substring(child.resourceUri.path.lastIndexOf("/") + 1)),
});
child.command = {
title: "",
command: "vscode.open",
arguments: [child.resourceUri],
};
}
}

this.refreshElement(node.getParent() as IZoweDatasetTreeNode);
this.updateFavorites();
}
Expand Down
8 changes: 4 additions & 4 deletions packages/zowe-explorer/src/trees/uss/UssFSProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,8 @@ export class UssFSProvider extends BaseProvider implements vscode.FileSystemProv
fn: this.writeFile.bind(this),
args: [uri, content, options],
},
profileType: parentDir.metadata.profile.type,
templateArgs: { profileName: parentDir.metadata.profile.name ?? "" },
profileType: parentDir.metadata.profile?.type,
templateArgs: { profileName: parentDir.metadata.profile?.name ?? "" },
});
throw err;
}
Expand Down Expand Up @@ -611,8 +611,8 @@ export class UssFSProvider extends BaseProvider implements vscode.FileSystemProv
args: [uri, _options],
},
apiType: ZoweExplorerApiType.Uss,
profileType: parent.metadata.profile.type,
templateArgs: { profileName: parent.metadata.profile.name ?? "" },
profileType: parent.metadata.profile?.type,
templateArgs: { profileName: parent.metadata.profile?.name ?? "" },
});
throw err;
}
Expand Down

0 comments on commit bab4dcf

Please sign in to comment.