Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update main branch with changes from 2.15.2 #2812

Merged
merged 62 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from 61 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
d936b57
fix(ProfilesCache): optimize 'checkMergingConfigAllProfiles'
traeok Mar 8, 2024
ac0b1ec
fix(ui): remove separators for old VSCode clients and update test
traeok Mar 8, 2024
bd5e7c8
chore: update changelog
traeok Mar 8, 2024
c94fe76
chore(globals): add comment for ZE_VSC_ENGINE; match version w/ packa…
traeok Mar 8, 2024
9b7ecd5
tests(jobs): Add test case for exiting 'getUserJobsMenuChoice' dialog…
traeok Mar 8, 2024
b2189dd
chore: adjust changelogs
traeok Mar 11, 2024
d509616
Merge branch 'maintenance' into fix/profcache-api-proposal
traeok Mar 11, 2024
ec25ffd
chore: remove 'enabledApiProposals' from ZE package.json
traeok Mar 12, 2024
302c55a
fix: only use context.extension.packageJSON if it exists
traeok Mar 14, 2024
c73ef82
test(LoggerUtils): add test for invalid extension context
traeok Mar 14, 2024
f40a368
refactor: cleanup initializeZoweLogger and fix order
traeok Mar 14, 2024
29c3f63
chore: update Zowe CLI to 7.23.6
traeok Mar 14, 2024
9114c21
feat(logger): Add VS Code version to output
traeok Mar 14, 2024
a21d708
ci: remove Node 14 from version matrix
traeok Mar 14, 2024
5789f2f
chore: update lerna.json for 2.15.1 release
traeok Mar 19, 2024
682b6fa
Merge pull request #2786 from zowe/chore/update-zowe-cli
zFernand0 Mar 19, 2024
4c34d50
Merge branch 'maintenance' into fix/profcache-api-proposal
zFernand0 Mar 19, 2024
67bfed5
Merge pull request #2771 from zowe/fix/profcache-api-proposal
zFernand0 Mar 19, 2024
7721905
Bump version to 2.15.1 [ci skip]
zowe-robot Mar 19, 2024
d9844f8
Bump version to 2.16.0-SNAPSHOT [ci skip]
zowe-robot Mar 19, 2024
669db1a
WIP Warn users about files reopened from previous session
t1m0thyj Feb 29, 2024
5f4a103
Add error message when saving recovered file and node is missing
t1m0thyj Mar 1, 2024
dd41dbb
Cache file etag and encoding in local storage
t1m0thyj Mar 1, 2024
b7736ec
Restore cached nodes from local storage on launch
t1m0thyj Mar 4, 2024
c7857e4
Refactor LocalFileManagement class and fix unit tests
t1m0thyj Mar 4, 2024
9d71729
Add unit tests for findRecoveredFiles
t1m0thyj Mar 4, 2024
071a01c
Add unit tests for LocalFileManagement
t1m0thyj Mar 5, 2024
cd5af17
Don't use /tmp dir in unit tests to make SonarCloud happy
t1m0thyj Mar 5, 2024
1ed59e3
Update changelog and fix paths for recovered nodes
t1m0thyj Mar 5, 2024
47126e5
Fix comparison not working for recovered nodes
t1m0thyj Mar 5, 2024
b667a4d
Update returnEtag value in uploadContent to match next branch
t1m0thyj Mar 6, 2024
1c3bf0b
Don't use file info cache for jobs tree
t1m0thyj Mar 7, 2024
98837eb
Fix updateOpenFiles tests on Windows
t1m0thyj Mar 7, 2024
35d1157
Address PR feedback and try again to fix tests
t1m0thyj Mar 7, 2024
2d2efa2
Remove diagnostic problem when document is closed
t1m0thyj Mar 11, 2024
19c6371
Fix profile updates and premature deletion for recovered nodes
t1m0thyj Mar 12, 2024
8aa05b9
Remove unused import
t1m0thyj Mar 12, 2024
1140b65
Don't remove documents from cache if dirty
t1m0thyj Mar 12, 2024
43bac4d
Fix error handling for saving data sets
t1m0thyj Mar 13, 2024
2e9e115
Fix isDirty check and purge file info cache on graceful exit
t1m0thyj Mar 13, 2024
902860b
Fix changelog after rebase
t1m0thyj Mar 19, 2024
de99b0a
refactor(ProfilesCache): clear `profilesByType` at start of refresh
traeok Mar 20, 2024
9d56547
chore: bump changelog
traeok Mar 20, 2024
1db37a9
test(ProfilesCache): ensure profilesByType is cleared at start of ref…
traeok Mar 20, 2024
c9b45cb
Add utility method to check if closed file is dirty
t1m0thyj Mar 22, 2024
ce52b02
refactor: clear 'defaultProfileByType', update test
traeok Mar 25, 2024
039036a
Merge pull request #2760 from zowe/fix/file-reload-warning
t1m0thyj Mar 25, 2024
aedb77a
Merge branch 'maintenance' into fix/profcache/prof-by-type
traeok Mar 25, 2024
8b033e2
chore: update lerna.json for 2.15.2
traeok Mar 25, 2024
f910d87
Fix premature triggering of document close event
t1m0thyj Mar 25, 2024
c11ee51
WIP Fix session node not found when saving favorites
t1m0thyj Mar 28, 2024
1a848ed
Fix disabled test for ZoweJobNode
t1m0thyj Apr 1, 2024
eb126ff
Update tests to find child nodes
t1m0thyj Apr 1, 2024
143f5d1
Merge pull request #2801 from zowe/fix/doc-close-event
JillieBeanSim Apr 2, 2024
6346758
Merge branch 'maintenance' into fix/profcache/prof-by-type
traeok Apr 2, 2024
e7b703f
Merge pull request #2795 from zowe/fix/profcache/prof-by-type
traeok Apr 2, 2024
ec11ff4
Bump version to 2.15.2 [ci skip]
zowe-robot Apr 2, 2024
08ff814
Bump version to 2.16.0-SNAPSHOT [ci skip]
zowe-robot Apr 2, 2024
e3f1377
Merge branch 'maintenance' into main
t1m0thyj Apr 3, 2024
93c3750
Fix local storage keys and update yarn lock
t1m0thyj Apr 3, 2024
7cf886f
Merge branch 'main' into update-main-2.15.2
t1m0thyj Apr 4, 2024
c150c9d
Merge branch 'main' into update-main-2.15.2
t1m0thyj Apr 9, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/zowe-explorer-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
# Continue to run tests on the other systems if one fails
fail-fast: false
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [16.x, 18.x]
# order operating systems from best to worst
os: [windows-latest, ubuntu-latest, macos-latest]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/zowe-explorer-ftp-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
# Continue to run tests on the other systems if one fails
fail-fast: false
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [16.x, 18.x]
# order operating systems from best to worst
os: [windows-latest, ubuntu-latest, macos-latest]

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"vscode": "^1.53.2"
},
"dependencies": {
"@zowe/cli": "7.23.3",
"@zowe/cli": "7.23.6",
"vscode-nls": "4.1.2"
},
"devDependencies": {
Expand Down
12 changes: 12 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,18 @@ All notable changes to the "eslint-plugin-zowe-explorer" package will be documen

### Bug fixes

## `2.15.2`

### New features and enhancements

### Bug fixes

## `2.15.1`

### New features and enhancements

### Bug fixes

## `2.15.0`

## `2.14.1`
Expand Down
16 changes: 16 additions & 0 deletions packages/zowe-explorer-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@ All notable changes to the "zowe-explorer-api" extension will be documented in t

### Bug fixes

## `2.15.2`

### New features and enhancements

- Added optional method `getDsDocumentFilePath` to `IZoweDatasetTreeNode` interface to make it easier for extenders to get the local file path of a data set node. [#2760](https://github.com/zowe/vscode-extension-for-zowe/pull/2760)

### Bug fixes

- Fixed an issue where the `ProfilesCache` class would retain old service profiles, even if they were removed from the team config. [#2395](https://github.com/zowe/zowe-explorer-vscode/issues/2395)

## `2.15.1`

### Bug fixes

- Fixed TypeError encountered in the `ProfilesCache.checkMergingConfigAllProfiles` function when merging profiles. [#2771](https://github.com/zowe/vscode-extension-for-zowe/pull/2771)

## `2.15.0`

### Bug fixes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,20 @@ describe("ProfilesCache", () => {
expect(profCache.getAllTypes().length).toEqual(0);
expect(mockLogError).toHaveBeenCalledWith(fakeError);
});

it("should clear the profilesByType and defaultProfileByType maps before reloading profiles", async () => {
const profCache = new ProfilesCache({ ...fakeLogger, error: mockLogError } as unknown as zowe.imperative.Logger);
const profInfoMock = jest.spyOn(profCache, "getProfileInfo").mockRejectedValueOnce("some error");
const errorMock = jest.spyOn((profCache as any).log, "error").mockImplementation();
(profCache as any).profilesByType["test-type"] = { name: "someProf" as any };
(profCache as any).defaultProfileByType["test-type"] = { name: "someProf" as any };
await profCache.refresh();
expect((profCache as any).profilesByType.size).toBe(0);
expect((profCache as any).defaultProfileByType.size).toBe(0);
expect(errorMock).toHaveBeenCalledWith("some error");
profInfoMock.mockRestore();
errorMock.mockRestore();
});
});

describe("validateAndParseUrl", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/zowe-explorer-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"dependencies": {
"@types/vscode": "^1.53.2",
"@zowe/cli": "7.23.3",
"@zowe/cli": "7.23.6",
"@zowe/secrets-for-zowe-sdk": "7.18.6",
"handlebars": "^4.7.7",
"semver": "^7.5.3"
Expand Down
36 changes: 8 additions & 28 deletions packages/zowe-explorer-api/src/profiles/ProfilesCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ export class ProfilesCache {
public async refresh(apiRegister?: ZoweExplorerApi.IApiRegisterClient): Promise<void> {
this.allProfiles = [];
this.allTypes = [];
this.profilesByType.clear();
this.defaultProfileByType.clear();
let mProfileInfo: zowe.imperative.ProfileInfo;
try {
mProfileInfo = await this.getProfileInfo();
Expand Down Expand Up @@ -481,40 +483,18 @@ export class ProfilesCache {

// used by refresh to check correct merging of allProfiles
protected checkMergingConfigAllProfiles(): void {
const baseProfile = this.defaultProfileByType.get("base");
const allProfiles: zowe.imperative.IProfileLoaded[] = [];
this.allTypes.forEach((type) => {
try {
const allProfilesByType: zowe.imperative.IProfileLoaded[] = [];
const profByType = this.profilesByType.get(type);
profByType.forEach((profile) => {
if (this.shouldRemoveTokenFromProfile(profile, baseProfile)) {
profile.profile.tokenType = undefined;
profile.profile.tokenValue = undefined;
// update default profile of type if changed
if (profile.name === this.defaultProfileByType.get(type).name) {
this.defaultProfileByType.set(type, profile);
}
}
allProfiles.push(profile);
allProfilesByType.push(profile);
});
this.profilesByType.set(type, allProfilesByType);
} catch (error) {
// do nothing, skip if profile type is not included in config file
this.log.debug(error as string);
}
});
this.allProfiles = [];
this.allProfiles.push(...allProfiles);
for (const profs of this.profilesByType.values()) {
profs.forEach((profile) => {
this.checkMergingConfigSingleProfile(profile);
});
}
}

// check correct merging of a single profile
protected checkMergingConfigSingleProfile(profile: zowe.imperative.IProfileLoaded): zowe.imperative.IProfileLoaded {
const baseProfile = this.defaultProfileByType.get("base");
if (this.shouldRemoveTokenFromProfile(profile, baseProfile)) {
profile.profile.tokenType = undefined;
profile.profile.tokenValue = undefined;
profile.profile.tokenType = profile.profile.tokenValue = undefined;
}
return profile;
}
Expand Down
5 changes: 5 additions & 0 deletions packages/zowe-explorer-api/src/tree/IZoweTreeNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ export interface IZoweDatasetTreeNode extends IZoweTreeNode {
* @param datasetFileProvider the tree provider
*/
openDs?(download: boolean, previewFile: boolean, datasetFileProvider: IZoweTree<IZoweDatasetTreeNode>): Promise<void>;
/**
* Returns the local file path for the ZoweDatasetNode
*
*/
getDsDocumentFilePath?(): string;
/**
* Sets the codepage value for the file
*
Expand Down
12 changes: 12 additions & 0 deletions packages/zowe-explorer-ftp-extension/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ All notable changes to the "zowe-explorer-ftp-extension" extension will be docum

### Bug fixes

## `2.15.2`

### New features and enhancements

### Bug fixes

## `2.15.1`

### New features and enhancements

### Bug fixes

## `2.15.0`

## `2.14.1`
Expand Down
17 changes: 17 additions & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,23 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen

### Bug fixes

## `2.15.2`

### New features and enhancements

### Bug fixes

- Fixed issue where files left open in prior VS Code session cannot be uploaded to mainframe after window is reloaded. [#2758](https://github.com/zowe/vscode-extension-for-zowe/issues/2758)
- Fixed issue where saving changes to favorited data set or USS file could fail. [#2801](https://github.com/zowe/vscode-extension-for-zowe/pull/2801)

## `2.15.1`

### New features and enhancements

### Bug fixes

- Fixed issue where VS Code quick pick separators were used in environments that did not support the feature. [#2771](https://github.com/zowe/vscode-extension-for-zowe/pull/2771)

## `2.15.0`

### New features and enhancements
Expand Down
19 changes: 9 additions & 10 deletions packages/zowe-explorer/__mocks__/mockCreators/uss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ export function createUSSTree(favoriteNodes: ZoweUSSNode[], sessionNodes: ZoweUS

export function createUSSNode(session, profile) {
const parentNode = new ZoweUSSNode({
label: "parentNode",
label: "usstest",
collapsibleState: vscode.TreeItemCollapsibleState.Expanded,
session,
profile,
});
const ussNode = new ZoweUSSNode({
label: "usstest",
label: "testDir",
collapsibleState: vscode.TreeItemCollapsibleState.Expanded,
parentNode,
session,
Expand All @@ -66,7 +66,8 @@ export function createUSSNode(session, profile) {
parentNode.contextValue = globals.USS_SESSION_CONTEXT;
ussNode.contextValue = globals.USS_DIR_CONTEXT;
parentNode.fullPath = "/u/myuser";
ussNode.fullPath = "/u/myuser/usstest";
ussNode.fullPath = "/u/myuser/testDir";
parentNode.children.push(ussNode);
return ussNode;
}

Expand All @@ -88,25 +89,23 @@ export function createUSSSessionNode(session: imperative.Session, profile: imper
return zoweUSSNode;
}

// This is NOT a favorite equivalent of the node created by createdUSSNode.
// This is a favorited textfile node. createUSSNode creates a USS session node.
export function createFavoriteUSSNode(session, profile) {
const parentNode = new ZoweUSSNode({
label: "parentNode",
label: "usstest",
collapsibleState: vscode.TreeItemCollapsibleState.Expanded,
session,
profile,
});
const ussNodeF = new ZoweUSSNode({
label: "usstest",
label: "testDir",
collapsibleState: vscode.TreeItemCollapsibleState.Expanded,
parentNode,
session,
profile,
});
parentNode.contextValue = globals.FAV_PROFILE_CONTEXT;
ussNodeF.contextValue = globals.USS_TEXT_FILE_CONTEXT + globals.FAV_SUFFIX;
ussNodeF.fullPath = "/u/myuser/usstest";
ussNodeF.tooltip = "/u/myuser/usstest";
ussNodeF.contextValue = globals.USS_DIR_CONTEXT + globals.FAV_SUFFIX;
ussNodeF.fullPath = ussNodeF.tooltip = "/u/myuser/testDir";
parentNode.children.push(ussNodeF);
return ussNodeF;
}
17 changes: 17 additions & 0 deletions packages/zowe-explorer/__mocks__/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,8 @@ export namespace workspace {
*/
export let rootPath: string | undefined;

export let textDocuments: string[] = [];

/**
* A workspace folder is one of potentially many roots opened by the editor. All workspace folders
* are equal which means there is no notion of an active or master workspace folder.
Expand Down Expand Up @@ -728,3 +730,18 @@ export namespace env {
},
};
}

export const version = "1.53.2";

export namespace languages {
export function createDiagnosticCollection(name: string): any {}
}

export class Diagnostic {}

export enum DiagnosticSeverity {
Error = 0,
Warning = 1,
Information = 2,
Hint = 3,
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import { TreeProviders } from "../../../src/shared/TreeProviders";
import { join } from "path";
import { mocked } from "../../../__mocks__/mockUtils";
import * as sharedUtils from "../../../src/shared/utils";
import { LocalFileManagement } from "../../../src/utils/LocalFileManagement";

jest.mock("fs");
jest.mock("util");
Expand Down Expand Up @@ -168,6 +169,9 @@ function createGlobalMocks() {
Object.defineProperty(ZoweLogger, "warn", { value: jest.fn(), configurable: true });
Object.defineProperty(ZoweLogger, "info", { value: jest.fn(), configurable: true });
Object.defineProperty(ZoweLogger, "trace", { value: jest.fn(), configurable: true });
jest.spyOn(LocalFileManagement, "storeFileInfo").mockImplementation();
jest.spyOn(LocalFileManagement, "deleteFileInfo").mockImplementation();
jest.spyOn(LocalFileManagement, "removeRecoveredFile").mockImplementation();

return globalMocks;
}
Expand Down Expand Up @@ -3358,11 +3362,11 @@ describe("Dataset Tree Unit Tests - Sorting and Filtering operations", () => {
});

describe("onDidCloseTextDocument", () => {
it("sets the entry in openFiles record to null if Data Set URI is valid", () => {
const doc = { uri: { fsPath: join(globals.DS_DIR, "lpar", "SOME.PS") } } as vscode.TextDocument;
it("sets the entry in openFiles record to null if Data Set URI is valid", async () => {
const doc = { isClosed: true, isDirty: false, uri: { fsPath: join(globals.DS_DIR, "lpar", "SOME.PS") } } as vscode.TextDocument;

jest.spyOn(TreeProviders, "ds", "get").mockReturnValue(tree);
DatasetTree.onDidCloseTextDocument(doc);
await DatasetTree.onDidCloseTextDocument(doc);
expect(tree.openFiles[doc.uri.fsPath]).toBeNull();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import * as fs from "fs";
import * as sharedUtils from "../../../src/shared/utils";
import { Profiles } from "../../../src/Profiles";
import { ZoweLogger } from "../../../src/utils/LoggerUtils";
import { LocalFileManagement } from "../../../src/utils/LocalFileManagement";

// Missing the definition of path module, because I need the original logic for tests
jest.mock("fs");
Expand Down Expand Up @@ -59,6 +60,7 @@ function createGlobalMocks() {
configurable: true,
});
Object.defineProperty(vscode.workspace, "openTextDocument", { value: jest.fn(), configurable: true });
jest.spyOn(LocalFileManagement, "storeFileInfo").mockImplementation();

return newMocks;
}
Expand Down
Loading
Loading