Skip to content

Commit

Permalink
Merge branch 'main' into fix/ftp/create-member
Browse files Browse the repository at this point in the history
Signed-off-by: Billie Simmons <[email protected]>
  • Loading branch information
JillieBeanSim authored Sep 15, 2023
2 parents e6fb21e + 427dd02 commit e071c9d
Show file tree
Hide file tree
Showing 27 changed files with 80 additions and 70 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.11.0-SNAPSHOT",
"version": "2.12.0-SNAPSHOT",
"command": {
"version": {
"forcePublish": true,
Expand Down
6 changes: 6 additions & 0 deletions packages/eslint-plugin-zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ All notable changes to the "eslint-plugin-zowe-explorer" package will be documen

### Bug fixes

## `2.11.0`

### New features and enhancements

### Bug fixes

## `2.10.0`

### New features and enhancements
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-zowe-explorer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-zowe-explorer",
"version": "2.11.0-SNAPSHOT",
"version": "2.12.0-SNAPSHOT",
"description": "Custom ESLint Rules for ZOWE Explorer",
"keywords": [
"eslint",
Expand Down
6 changes: 6 additions & 0 deletions packages/zowe-explorer-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ All notable changes to the "zowe-explorer-api" extension will be documented in t

### New features and enhancements

### Bug fixes

## `2.11.0`

### New features and enhancements

- Added optional `pendingActions` record to `IZoweTreeNode` to allow nodes to track pending promises.
- Added optional `wasDoubleClicked` variable to `IZoweTreeNode` to track whether a node was double-clicked during an action.

Expand Down
2 changes: 1 addition & 1 deletion packages/zowe-explorer-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zowe/zowe-explorer-api",
"version": "2.11.0-SNAPSHOT",
"version": "2.12.0-SNAPSHOT",
"description": "Extensibility API for Zowe Explorer.",
"publisher": "Zowe",
"author": "Zowe",
Expand Down
6 changes: 6 additions & 0 deletions packages/zowe-explorer-ftp-extension/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ All notable changes to the "zowe-explorer-ftp-extension" extension will be docum

- Fixed ECONNRESET error when trying to upload or create an empty data set member. [#2350](https://github.com/zowe/vscode-extension-for-zowe/issues/2350)

## `2.11.0`

### Bug fixes

- Bump `@zowe/zowe-explorer-api` to pick up latest, including `@zowe/secrets-for-zowe-sdk` 7.18.4 to handle install errors gracefully and to allow running without MSVC redistributables.

## `2.10.0`

### New features and enhancements
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 @@ -5,7 +5,7 @@
"author": "Zowe",
"license": "EPL-2.0",
"description": "Adds zFTP support to Zowe Explorer demonstrating how to extend the Zowe Explorer using its extensibility API.",
"version": "2.11.0-SNAPSHOT",
"version": "2.12.0-SNAPSHOT",
"icon": "resources/zowe-ftp-color.png",
"repository": {
"url": "https://github.com/zowe/vscode-extension-for-zowe"
Expand Down Expand Up @@ -48,7 +48,7 @@
},
"dependencies": {
"@zowe/zos-ftp-for-zowe-cli": "2.1.2",
"@zowe/zowe-explorer-api": "2.11.0-SNAPSHOT",
"@zowe/zowe-explorer-api": "2.12.0-SNAPSHOT",
"tmp": "0.2.1"
},
"devDependencies": {
Expand Down
7 changes: 7 additions & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen

### New features and enhancements

### Bug fixes

## `2.11.0`

### New features and enhancements

- Allow deleting migrated datasets [#2447](https://github.com/zowe/vscode-extension-for-zowe/issues/2447)

### Bug fixes
Expand All @@ -16,6 +22,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
- Bump `@zowe/secrets-for-zowe-sdk` to 7.18.4 to handle install errors gracefully and to allow running without MSVC redistributables.
- Fixed issue where data set content does not always appear as soon as the editor is opened. [#2427](https://github.com/zowe/vscode-extension-for-zowe/issues/2427)
- Adjust scope of "Security: Secure Credentials Enabled" setting to `machine-overridable` so it appears again in certain cloud IDEs.
- Fixed issue where disabling "Automatic Profile Validation" caused the search prompts to stop appearing for all tree views. [#2454](https://github.com/zowe/vscode-extension-for-zowe/issues/2454)

## `2.10.0`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,17 +272,6 @@ describe("ZosJobsProvider unit tests - Function getChildren", () => {

expect(elementGetChildrenSpy).toHaveBeenCalledTimes(1);
});
it("Tests that getChildren returns the empty array if status of profile is unverified", async () => {
const globalMocks = await createGlobalMocks();
jest.spyOn(Profiles.getInstance(), "checkCurrentProfile").mockResolvedValueOnce({ status: "unverified" } as any);
const blockMocks = createBlockMocks(globalMocks);
mocked(vscode.window.createTreeView).mockReturnValueOnce(blockMocks.treeView);
const testTree = new ZosJobsProvider();
testTree.mSessionNodes.push(blockMocks.jobSessionNode);
testTree.mSessionNodes[1].dirty = true;

await expect(testTree.getChildren(testTree.mSessionNodes[1])).resolves.toEqual([]);
});
});

describe("ZosJobsProvider unit tests - Function initializeFavChildNodeForProfile", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,7 @@ describe("ZosJobsProvider - getJobs", () => {
value: () => ({
getJobsByParameters: false,
getJobsByOwnerAndPrefix: () => ["test"],
getSession: () => globalMocks.testSession,
}),
});
jest.spyOn(Gui, "warningMessage").mockImplementation();
Expand Down
22 changes: 0 additions & 22 deletions packages/zowe-explorer/__tests__/__unit__/uss/USSTree.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1424,29 +1424,7 @@ describe("USSTree Unit Tests - Function USSTree.getChildren()", () => {

expect(loadProfilesForFavoritesSpy).toHaveBeenCalledWith(log, favProfileNode);
});

it("Testing that getChildren() returns the empty array if the profile has unverified status", async () => {
const globalMocks = await createGlobalMocks();

const testDir = new ZoweUSSNode("aDir", vscode.TreeItemCollapsibleState.Collapsed, globalMocks.testTree.mSessionNodes[1], null, "test");
globalMocks.testTree.mSessionNodes[1].children.push(testDir);
const mockApiResponseItems = {
items: [
{
mode: "d",
mSessionName: "sestest",
name: "aDir",
},
],
};
const mockApiResponseWithItems = createFileResponse(mockApiResponseItems);
globalMocks.withProgress.mockReturnValue(mockApiResponseWithItems);
jest.spyOn(Profiles.getInstance(), "checkCurrentProfile").mockResolvedValueOnce({ status: "unverified" } as any);
const sessChildren = await globalMocks.testTree.getChildren(globalMocks.testTree.mSessionNodes[1]);
expect(sessChildren.length).toEqual(0);
});
});

// Idea is borrowed from: https://github.com/kulshekhar/ts-jest/blob/master/src/util/testing.ts
const mocked = <T extends (...args: any[]) => any>(fn: T): jest.Mock<ReturnType<T>> => fn as any;

Expand Down
3 changes: 1 addition & 2 deletions packages/zowe-explorer/i18n/sample/src/Profiles.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@
"validateProfiles.cancelled": "Validating {0} was cancelled.",
"validateProfiles.error": "Profile validation failed for {0}.",
"ssoAuth.noBase": "This profile does not support token authentication.",
"ssoLogin.error": "Unable to log in with {0}. {1}",
"ssoLogin.unableToLogin": "Unable to log in with {0}. {1}",
"ssoLogin.successful": "Login to authentication service was successful.",
"ssoLogin.error": "Unable to log in with {0}. {1}",
"ssoLogout.successful": "Logout from authentication service was successful for {0}.",
"ssoLogout.error": "Unable to log out with {0}. {1}",
"getConfigLocationPrompt.placeholder.create": "Select the location where the config file will be initialized",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
"getChildren.error.invalidNode": "Invalid node",
"getChildren.responses.error": "The response from Zowe CLI was not successful",
"getChildren.invalidMember": "Cannot access member with control characters in the name: {0}",
"getChildren.noDataset": "No data sets found"
"getChildren.noDataset": "No data sets found",
"getDataSets.error.sessionMissing": "Profile auth error",
"getDataSets.error.additionalDetails": "Profile is not authenticated, please log in to continue"
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
"createMember.member.validation": "Enter valid member name",
"createMember.creating": "Creating new data set member {0}",
"createMember.error": "Unable to create member.",
"dataSet.opening": "$(sync~spin) Opening data set...",
"openPS.error": "Invalid data set or member.",
"openPS.openDataSet": "Opening {0}",
"dataSet.opening": "$(sync~spin) Opening data set...",
"createFile.allocatingNewDataSet": "Attempting to allocate new data set",
"handleUserSelection.qp.prompt": "Click on parameters to change them",
"createFile.inputBox.placeHolder": "Name of Data Set",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
"getChildren.noSpoolFiles": "There are no JES spool messages to display",
"getChildren.noJobs": "No jobs found",
"getJobs.status.not.supported": "Filtering by job status is not yet supported with this profile type. Will show jobs with all statuses.",
"getJobs.error.sessionMissing": "Profile auth error",
"getJobs.error.additionalDetails": "Profile is not authenticated, please log in to continue",
"getChildren.error.response": "Retrieving response from "
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"getChildren.error.invalidNode": "Invalid node",
"getChildren.error.sessionMissing": "Profile auth error",
"getChildren.error.additionalDetails": "Profile is not authenticated, please log in to continue",
"getChildren.responses.error.response": "The response from Zowe CLI was not successful",
"getChildren.error.response": "Retrieving response from ",
"getChildren.responses.open": "Open",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"errorHandling.invalid.host": "Required parameter 'host' must not be blank.",
"errorHandling.invalid.credentials": "Invalid Credentials for profile '{0}'. Please ensure the username and password are valid or this may lead to a lock-out.",
"errorHandling.invalid.token": "Your connection is no longer active. Please log in to an authentication service to restore the connection.",
"errorHandling.invalid.token": "Your connection is no longer active for profile '{0}'. Please log in to an authentication service to restore the connection.",
"errorHandling.authentication.login": "Log in to Authentication Service",
"errorHandling.checkCredentials.button": "Update Credentials",
"errorHandling.checkCredentials.cancelled": "Operation Cancelled",
Expand Down
6 changes: 3 additions & 3 deletions packages/zowe-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-extension-for-zowe",
"displayName": "%displayName%",
"description": "%description%",
"version": "2.11.0-SNAPSHOT",
"version": "2.12.0-SNAPSHOT",
"publisher": "Zowe",
"author": "Zowe",
"license": "EPL-2.0",
Expand Down Expand Up @@ -1966,7 +1966,7 @@
"copy-webpack-plugin": "^6.4.1",
"cross-env": "^5.2.0",
"del": "^4.1.1",
"eslint-plugin-zowe-explorer": "2.11.0-SNAPSHOT",
"eslint-plugin-zowe-explorer": "2.12.0-SNAPSHOT",
"event-stream": "^4.0.1",
"expect": "^24.8.0",
"geckodriver": "^1.19.1",
Expand All @@ -1992,7 +1992,7 @@
},
"dependencies": {
"@zowe/secrets-for-zowe-sdk": "7.18.4",
"@zowe/zowe-explorer-api": "2.11.0-SNAPSHOT",
"@zowe/zowe-explorer-api": "2.12.0-SNAPSHOT",
"fs-extra": "8.0.1",
"isbinaryfile": "4.0.4",
"js-yaml": "3.13.1",
Expand Down
9 changes: 8 additions & 1 deletion packages/zowe-explorer/src/Profiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1244,9 +1244,16 @@ export class Profiles extends ProfilesCache {
* @returns {string[]} an array with the secure properties
*/
public async getSecurePropsForProfile(profileName: string): Promise<string[]> {
if (!profileName) {
return [];
}
if ((await this.getProfileInfo()).usingTeamConfig) {
const config = (await this.getProfileInfo()).getTeamConfig();
return config.api.secure.securePropsForProfile(profileName);
}
const profAttrs = await this.getProfileFromConfig(profileName);
const mergedArgs = (await this.getProfileInfo()).mergeArgsForProfile(profAttrs);
return [...mergedArgs.knownArgs, ...mergedArgs.missingArgs].filter((arg) => arg.secure).map((arg) => arg.argName);
return mergedArgs.knownArgs.filter((arg) => arg.secure).map((arg) => arg.argName);
}

private async loginWithBaseProfile(serviceProfile: zowe.imperative.IProfileLoaded, loginTokenType: string, node?: IZoweNodeType): Promise<void> {
Expand Down
7 changes: 1 addition & 6 deletions packages/zowe-explorer/src/dataset/DatasetTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,6 @@ export class DatasetTree extends ZoweTreeProvider implements IZoweTree<IZoweData
const favsForProfile = this.loadProfilesForFavorites(this.log, element);
return favsForProfile;
}
const validationStatus = await Profiles.getInstance().checkCurrentProfile(element.getProfile());

if (validationStatus.status === "unverified") {
return [];
}
const finalResponse: IZoweDatasetTreeNode[] = [];
let response;
try {
Expand Down Expand Up @@ -890,7 +885,7 @@ export class DatasetTree extends ZoweTreeProvider implements IZoweTree<IZoweData
await this.checkCurrentProfile(node);
let nonFaveNode;

if (Profiles.getInstance().validProfile === ValidProfileEnum.VALID || !contextually.isValidationEnabled(node)) {
if (Profiles.getInstance().validProfile !== ValidProfileEnum.INVALID) {
if (contextually.isSessionNotFav(node)) {
nonFaveNode = node;
if (this.mHistory.getSearchHistory().length > 0) {
Expand Down
7 changes: 7 additions & 0 deletions packages/zowe-explorer/src/dataset/ZoweDatasetNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,13 @@ export class ZoweDatasetNode extends ZoweTreeNode implements IZoweDatasetTreeNod
),
];
const mvsApi = ZoweExplorerApiRegister.getMvsApi(cachedProfile);
if (!mvsApi.getSession(mvsApi?.profile)) {
throw new zowe.imperative.ImperativeError({
msg: localize("getDataSets.error.sessionMissing", "Profile auth error"),
additionalDetails: localize("getDataSets.error.additionalDetails", "Profile is not authenticated, please log in to continue"),
errorCode: `${zowe.imperative.RestConstants.HTTP_STATUS_401}`,
});
}
if (mvsApi.dataSetsMatchingPattern) {
responses.push(await mvsApi.dataSetsMatchingPattern(dsPatterns));
} else {
Expand Down
5 changes: 0 additions & 5 deletions packages/zowe-explorer/src/job/ZosJobsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,6 @@ export class ZosJobsProvider extends ZoweTreeProvider implements IZoweTree<IZowe
const favsForProfile = this.loadProfilesForFavorites(this.log, element);
return favsForProfile;
}
const validationStatus = await Profiles.getInstance().checkCurrentProfile(element.getProfile());

if (validationStatus.status === "unverified") {
return [];
}
return element.getChildren();
}
return this.mSessionNodes;
Expand Down
7 changes: 7 additions & 0 deletions packages/zowe-explorer/src/job/ZoweJobNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,13 @@ export class Job extends ZoweTreeNode implements IZoweJobTreeNode {
if (this.searchId.length > 0) {
jobsInternal.push(await ZoweExplorerApiRegister.getJesApi(cachedProfile).getJob(searchId));
} else {
if (!ZoweExplorerApiRegister.getJesApi(cachedProfile).getSession(cachedProfile)) {
throw new zowe.imperative.ImperativeError({
msg: localize("getJobs.error.sessionMissing", "Profile auth error"),
additionalDetails: localize("getJobs.error.additionalDetails", "Profile is not authenticated, please log in to continue"),
errorCode: `${zowe.imperative.RestConstants.HTTP_STATUS_401}`,
});
}
if (ZoweExplorerApiRegister.getJesApi(cachedProfile).getJobsByParameters) {
jobsInternal = await ZoweExplorerApiRegister.getJesApi(cachedProfile).getJobsByParameters({
owner,
Expand Down
6 changes: 1 addition & 5 deletions packages/zowe-explorer/src/uss/USSTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,6 @@ export class USSTree extends ZoweTreeProvider implements IZoweTree<IZoweUSSTreeN
const favsForProfile = await this.loadProfilesForFavorites(this.log, element);
return favsForProfile;
}
const validationStatus = await Profiles.getInstance().checkCurrentProfile(element.getProfile());
if (validationStatus.status === "unverified") {
return [];
}
return element.getChildren();
}
return this.mSessionNodes;
Expand Down Expand Up @@ -567,7 +563,7 @@ export class USSTree extends ZoweTreeProvider implements IZoweTree<IZoweUSSTreeN
ZoweLogger.debug(localize("filterPrompt.log.debug.promptUSSPath", "Prompting the user for a USS path"));
}
await this.checkCurrentProfile(node);
if (Profiles.getInstance().validProfile === ValidProfileEnum.VALID || !contextually.isValidationEnabled(node)) {
if (Profiles.getInstance().validProfile !== ValidProfileEnum.INVALID) {
let sessionNode;
let remotepath: string;
if (contextually.isSessionNotFav(node)) {
Expand Down
7 changes: 7 additions & 0 deletions packages/zowe-explorer/src/uss/ZoweUSSNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ export class ZoweUSSNode extends ZoweTreeNode implements IZoweUSSTreeNode {
const sessNode = this.getSessionNode();
try {
const cachedProfile = Profiles.getInstance().loadNamedProfile(this.getProfileName());
if (!ZoweExplorerApiRegister.getUssApi(cachedProfile).getSession(cachedProfile)) {
throw new imperative.ImperativeError({
msg: localize("getChildren.error.sessionMissing", "Profile auth error"),
additionalDetails: localize("getChildren.error.additionalDetails", "Profile is not authenticated, please log in to continue"),
errorCode: `${imperative.RestConstants.HTTP_STATUS_401}`,
});
}
response = await ZoweExplorerApiRegister.getUssApi(cachedProfile).fileList(this.fullPath);

// Throws reject if the Zowe command does not throw an error but does not succeed
Expand Down
10 changes: 4 additions & 6 deletions packages/zowe-explorer/src/utils/ProfilesUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ export async function errorHandling(errorDetails: Error | string, label?: string
);
const errToken = localize(
"errorHandling.invalid.token",
"Your connection is no longer active. Please log in to an authentication service to restore the connection."
"Your connection is no longer active for profile '{0}'. Please log in to an authentication service to restore the connection.",
label
);
if (label.includes("[")) {
label = label.substring(0, label.indexOf(" [")).trim();
Expand Down Expand Up @@ -138,13 +139,10 @@ export function isTheia(): boolean {
*/
export async function isUsingTokenAuth(profileName: string): Promise<boolean> {
const baseProfile = Profiles.getInstance().getDefaultProfile("base");
const isUsingZosmf = (await Profiles.getInstance().getLoadedProfConfig(profileName)).type === "zosmf";
const secureProfileProps = await Profiles.getInstance().getSecurePropsForProfile(profileName);
const secureBaseProfileProps = await Profiles.getInstance().getSecurePropsForProfile(baseProfile?.name);
if (isUsingZosmf && baseProfile) {
return secureProfileProps.includes("tokenValue") || secureBaseProfileProps.includes("tokenValue");
}
return secureProfileProps.includes("tokenValue");
const profileUsesBasicAuth = secureProfileProps.includes("user") && secureProfileProps.includes("password");
return (secureProfileProps.includes("tokenValue") || secureBaseProfileProps.includes("tokenValue")) && !profileUsesBasicAuth;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "edit-attributes",
"private": true,
"type": "module",
"version": "2.10.0-SNAPSHOT",
"version": "2.12.0-SNAPSHOT",
"main": "index.js",
"license": "EPL-2.0",
"scripts": {
Expand Down

0 comments on commit e071c9d

Please sign in to comment.