Skip to content

Commit

Permalink
Prepare 3.0.2 patch release (#3247)
Browse files Browse the repository at this point in the history
* Improve process to build l10n bundle without comments (#3191)

Signed-off-by: Timothy Johnson <[email protected]>
Co-authored-by: Billie Simmons <[email protected]>

* Port 3.0.1 missing release changes to main (#3231)

* Fix 401 error when opening PDS members after cred change (#3157)

* Temporarily disable ON_VAULT_CHANGED event to prevent double refresh

Signed-off-by: Timothy Johnson <[email protected]>

* Propagate profile updates to child nodes

Signed-off-by: Timothy Johnson <[email protected]>

* Skip vault change events triggered by ZE

Signed-off-by: Timothy Johnson <[email protected]>

* Update changelog

Signed-off-by: Timothy Johnson <[email protected]>

* fix(tests): Add EventProcessor stub to imperative module mock

Signed-off-by: Trae Yelovich <[email protected]>

* refactor: Move logic into separate functions; tests: add patch coverage

Signed-off-by: Trae Yelovich <[email protected]>

* chore: update ZE API changelog

Signed-off-by: Trae Yelovich <[email protected]>

* ran prepublish

Signed-off-by: Billie Simmons <[email protected]>

* fix: pass processor as function arg instead of bind

Signed-off-by: Trae Yelovich <[email protected]>

* fix(tests): Pass fake event processor to hook function

Signed-off-by: Trae Yelovich <[email protected]>

* Make error handling consistent across all trees

Signed-off-by: Timothy Johnson <[email protected]>

* Move 401 error handling back into node methods

Signed-off-by: Timothy Johnson <[email protected]>

* Update unit tests for error handling and placeholder nodes

Signed-off-by: Timothy Johnson <[email protected]>

* Fix duplicate expand for jobs, clean up logging, update changelog

Signed-off-by: Timothy Johnson <[email protected]>

* Fix log statements in wrong place

Signed-off-by: Timothy Johnson <[email protected]>

* Use contextOverride when building session nodes

Signed-off-by: Timothy Johnson <[email protected]>

* Add tests for memberPattern on ds node

Signed-off-by: Timothy Johnson <[email protected]>

* Add unit test for USS placeholder node

Signed-off-by: Timothy Johnson <[email protected]>

* Fix extra tree refresh on credential update

Signed-off-by: Timothy Johnson <[email protected]>

* Store saved profile contents by URI path

Signed-off-by: Timothy Johnson <[email protected]>

* Fix update creds cancelling and node not refreshing

Signed-off-by: Timothy Johnson <[email protected]>

* Fix failing USS actions test

Signed-off-by: Timothy Johnson <[email protected]>

* Handle scenario of falsy node to refresh

Signed-off-by: Timothy Johnson <[email protected]>

* Add unit test for syncSessionNode

Signed-off-by: Timothy Johnson <[email protected]>

* Don't show placeholder node when there is error

Signed-off-by: Timothy Johnson <[email protected]>

---------

Signed-off-by: Timothy Johnson <[email protected]>
Signed-off-by: Trae Yelovich <[email protected]>
Signed-off-by: Billie Simmons <[email protected]>
Co-authored-by: Trae Yelovich <[email protected]>
Co-authored-by: Billie Simmons <[email protected]>
Co-authored-by: Billie Simmons <[email protected]>
Signed-off-by: zFernand0 <[email protected]>

* resolve FTP getContents bug for MVS and USS (#3200)

Signed-off-by: Trae Yelovich <[email protected]>
Co-authored-by: Fernando Rijo Cedeno <[email protected]>
Signed-off-by: zFernand0 <[email protected]>

* Fix children in tree nodes persisting on error (#3224)

* Fix children in tree nodes persisting on error

Signed-off-by: Timothy Johnson <[email protected]>

* Update unit tests to ensure children don't persist

Signed-off-by: Timothy Johnson <[email protected]>

---------

Signed-off-by: Timothy Johnson <[email protected]>
Signed-off-by: zFernand0 <[email protected]>

* ci: change node versions on lint & deployment workflows (#3228)

Signed-off-by: Trae Yelovich <[email protected]>
Signed-off-by: zFernand0 <[email protected]>

* Prep 3.0.1 (#3202)

* check path instead of file name

Signed-off-by: Billie Simmons <[email protected]>

* add changelog, fix test, run package

Signed-off-by: Billie Simmons <[email protected]>

* To address issue with opening project config in zowe dir

Signed-off-by: Santhoshi Boyina <[email protected]>

* To fix pnpm lint failure

Signed-off-by: Santhoshi Boyina <[email protected]>

* To update CHANGELOG.md file

Signed-off-by: Santhoshi Boyina <[email protected]>

* fix(ZoweDatasetNode): Add contextOverride to PS node

Signed-off-by: Trae Yelovich <[email protected]>

* chore: add PR number to ZE changelog

Signed-off-by: Trae Yelovich <[email protected]>

* fix: Add check for binary in contextOverride

Signed-off-by: Trae Yelovich <[email protected]>

* Update release.config.js for Zowe V3 GA

Signed-off-by: Timothy Johnson <[email protected]>

* chore: missing newline in ZE changelog

Signed-off-by: Trae Yelovich <[email protected]>

* fix(ProfilesUtils): Pass paths to new ProfileInfo instance

Signed-off-by: Trae Yelovich <[email protected]>

* chore: add changelog entry for ZE

Signed-off-by: Trae Yelovich <[email protected]>

* chore: adjust changelog to match v2 port

Signed-off-by: Trae Yelovich <[email protected]>

* tests: Add unit test to verify readProfilesFromDisk behavior

Signed-off-by: Trae Yelovich <[email protected]>

* To revert back logic to open the global config file

Signed-off-by: Santhoshi Boyina <[email protected]>

* chore: update ZE changelog entries

Signed-off-by: Trae Yelovich <[email protected]>

* Remove sample VSCEs and restore carets for SDK deps (#3173)

* Remove sample VSCEs and restore carets for SDK deps

Signed-off-by: Timothy Johnson <[email protected]>

* Update Zowe SDKs to remove prerelease peer deps

Signed-off-by: Timothy Johnson <[email protected]>

* Ignore issueTsoCommand deprecation warning for now

Signed-off-by: Timothy Johnson <[email protected]>

---------

Signed-off-by: Timothy Johnson <[email protected]>
Co-authored-by: Fernando Rijo Cedeno <[email protected]>

* Add Sonar scan properties and remove old system test files (#3194)

Signed-off-by: Timothy Johnson <[email protected]>
Co-authored-by: Trae Yelovich <[email protected]>

* fix: prompt optimizations for create file/dir; address case of skipping prompt (#3189)

* fix: prompt optimizations for create file/dir; fix session case

Signed-off-by: Trae Yelovich <[email protected]>

* chore: update ZE changelog

Signed-off-by: Trae Yelovich <[email protected]>

* fix: resolve failing tests, remove unused isTopLevel parameter

Signed-off-by: Trae Yelovich <[email protected]>

* refactor: remove unused createUSSNodeDialog function

Signed-off-by: Trae Yelovich <[email protected]>

* fix: use path.posix.join when building full path

Signed-off-by: Trae Yelovich <[email protected]>

* tests: add test case for prompting user w/ location

Signed-off-by: Trae Yelovich <[email protected]>

* chore: add additional bugfix to ZE changelog

Signed-off-by: Trae Yelovich <[email protected]>

* tests: add case for dismissing location prompt

Signed-off-by: Trae Yelovich <[email protected]>

* tests: add case for createUSSNode - trailing slashes

Signed-off-by: Trae Yelovich <[email protected]>

* refactor: use isTopLevel earlier in createUSSNode

Signed-off-by: Trae Yelovich <[email protected]>

---------

Signed-off-by: Trae Yelovich <[email protected]>
Co-authored-by: Billie Simmons <[email protected]>

* fix(ds): File extension detection misidentifies types (#3182)

* fix(ds): File extension detection misidentifies types

Signed-off-by: Timothy Johnson <[email protected]>

* Simplify ds extension mapping

Signed-off-by: Timothy Johnson <[email protected]>

---------

Signed-off-by: Timothy Johnson <[email protected]>
Signed-off-by: Billie Simmons <[email protected]>
Co-authored-by: Billie Simmons <[email protected]>

* deps: update lockfile to resolve audit failure (#3195)

Signed-off-by: Trae Yelovich <[email protected]>
Co-authored-by: Timothy Johnson <[email protected]>

* Fix 401 error when opening PDS members after cred change (#3157)

* Temporarily disable ON_VAULT_CHANGED event to prevent double refresh

Signed-off-by: Timothy Johnson <[email protected]>

* Propagate profile updates to child nodes

Signed-off-by: Timothy Johnson <[email protected]>

* Skip vault change events triggered by ZE

Signed-off-by: Timothy Johnson <[email protected]>

* Update changelog

Signed-off-by: Timothy Johnson <[email protected]>

* fix(tests): Add EventProcessor stub to imperative module mock

Signed-off-by: Trae Yelovich <[email protected]>

* refactor: Move logic into separate functions; tests: add patch coverage

Signed-off-by: Trae Yelovich <[email protected]>

* chore: update ZE API changelog

Signed-off-by: Trae Yelovich <[email protected]>

* ran prepublish

Signed-off-by: Billie Simmons <[email protected]>

* fix: pass processor as function arg instead of bind

Signed-off-by: Trae Yelovich <[email protected]>

* fix(tests): Pass fake event processor to hook function

Signed-off-by: Trae Yelovich <[email protected]>

* Make error handling consistent across all trees

Signed-off-by: Timothy Johnson <[email protected]>

* Move 401 error handling back into node methods

Signed-off-by: Timothy Johnson <[email protected]>

* Update unit tests for error handling and placeholder nodes

Signed-off-by: Timothy Johnson <[email protected]>

* Fix duplicate expand for jobs, clean up logging, update changelog

Signed-off-by: Timothy Johnson <[email protected]>

* Fix log statements in wrong place

Signed-off-by: Timothy Johnson <[email protected]>

* Use contextOverride when building session nodes

Signed-off-by: Timothy Johnson <[email protected]>

* Add tests for memberPattern on ds node

Signed-off-by: Timothy Johnson <[email protected]>

* Add unit test for USS placeholder node

Signed-off-by: Timothy Johnson <[email protected]>

* Fix extra tree refresh on credential update

Signed-off-by: Timothy Johnson <[email protected]>

* Store saved profile contents by URI path

Signed-off-by: Timothy Johnson <[email protected]>

* Fix update creds cancelling and node not refreshing

Signed-off-by: Timothy Johnson <[email protected]>

* Fix failing USS actions test

Signed-off-by: Timothy Johnson <[email protected]>

* Handle scenario of falsy node to refresh

Signed-off-by: Timothy Johnson <[email protected]>

* Add unit test for syncSessionNode

Signed-off-by: Timothy Johnson <[email protected]>

* Don't show placeholder node when there is error

Signed-off-by: Timothy Johnson <[email protected]>

---------

Signed-off-by: Timothy Johnson <[email protected]>
Signed-off-by: Trae Yelovich <[email protected]>
Signed-off-by: Billie Simmons <[email protected]>
Co-authored-by: Trae Yelovich <[email protected]>
Co-authored-by: Billie Simmons <[email protected]>
Co-authored-by: Billie Simmons <[email protected]>

* resolve FTP getContents bug for MVS and USS (#3200)

Signed-off-by: Trae Yelovich <[email protected]>
Co-authored-by: Fernando Rijo Cedeno <[email protected]>

* chore: add missing license header

Signed-off-by: zFernand0 <[email protected]>

* patch: update lerna.json in preparation for a release

Signed-off-by: zFernand0 <[email protected]>

* chore: update changelog files

Signed-off-by: zFernand0 <[email protected]>

* chore: update changelog 😋

Signed-off-by: zFernand0 <[email protected]>

* Fix children in tree nodes persisting on error (#3224)

* Fix children in tree nodes persisting on error

Signed-off-by: Timothy Johnson <[email protected]>

* Update unit tests to ensure children don't persist

Signed-off-by: Timothy Johnson <[email protected]>

---------

Signed-off-by: Timothy Johnson <[email protected]>

---------

Signed-off-by: Billie Simmons <[email protected]>
Signed-off-by: SanthoshiBoyina1 <[email protected]>
Signed-off-by: Santhoshi Boyina <[email protected]>
Signed-off-by: Trae Yelovich <[email protected]>
Signed-off-by: Timothy Johnson <[email protected]>
Signed-off-by: Billie Simmons <[email protected]>
Signed-off-by: Fernando Rijo Cedeno <[email protected]>
Signed-off-by: zFernand0 <[email protected]>
Co-authored-by: Billie Simmons <[email protected]>
Co-authored-by: SanthoshiBoyina1 <[email protected]>
Co-authored-by: Santhoshi Boyina <[email protected]>
Co-authored-by: Trae Yelovich <[email protected]>
Co-authored-by: Timothy Johnson <[email protected]>
Co-authored-by: Billie Simmons <[email protected]>

* Bump version to 3.0.1 [ci skip]

Signed-off-by: zowe-robot <[email protected]>
Signed-off-by: zFernand0 <[email protected]>

* Bump version to 3.0.1-SNAPSHOT [ci skip]

Signed-off-by: zowe-robot <[email protected]>
Signed-off-by: zFernand0 <[email protected]>

* chore: add dco remediation paths

Third-Party DCO Remediation Commit for Fernando Rijo Cedeno <[email protected]>

On behalf of Fernando Rijo Cedeno <[email protected]>, I, zFernand0 <[email protected]>, hereby add my Signed-off-by to this commit: 950524f

Signed-off-by: zFernand0 <[email protected]>

* chore: revert version changes after rebase to fix DCO

Signed-off-by: zFernand0 <[email protected]>

* chore: remove duplicate changelog items. thanks @t1m0thyj

Signed-off-by: zFernand0 <[email protected]>

* address comment

Signed-off-by: Billie Simmons <[email protected]>

---------

Signed-off-by: Timothy Johnson <[email protected]>
Signed-off-by: Trae Yelovich <[email protected]>
Signed-off-by: Billie Simmons <[email protected]>
Signed-off-by: zFernand0 <[email protected]>
Signed-off-by: SanthoshiBoyina1 <[email protected]>
Signed-off-by: Santhoshi Boyina <[email protected]>
Signed-off-by: Billie Simmons <[email protected]>
Signed-off-by: Fernando Rijo Cedeno <[email protected]>
Signed-off-by: zowe-robot <[email protected]>
Co-authored-by: Timothy Johnson <[email protected]>
Co-authored-by: Trae Yelovich <[email protected]>
Co-authored-by: Fernando Rijo Cedeno <[email protected]>
Co-authored-by: SanthoshiBoyina1 <[email protected]>
Co-authored-by: Santhoshi Boyina <[email protected]>
Co-authored-by: zowe-robot <[email protected]>
Signed-off-by: Billie Simmons <[email protected]>

* fix(ci): Use `ubuntu-22.04` images to get access to libsecret (#3233)

* ci: use ubuntu-22.04 image for libsecret fix

Signed-off-by: Trae Yelovich <[email protected]>

* ci: update checks for matrix.os

Signed-off-by: Trae Yelovich <[email protected]>

---------

Signed-off-by: Trae Yelovich <[email protected]>

* Removing icon names from translated strings (#3239)

* Removing icon names from translated strings

Signed-off-by: Peter Haumer <[email protected]>

* Changelog updated

Signed-off-by: Peter Haumer <[email protected]>

* Changelog for API package

Signed-off-by: Peter Haumer <[email protected]>

---------

Signed-off-by: Peter Haumer <[email protected]>

* update lerna

Signed-off-by: Billie Simmons <[email protected]>

* ZE Webview Localization (#3162)

* Webview Loc

Signed-off-by: likhithanimma1 <[email protected]>

* Add unit tests and changelog

Signed-off-by: likhithanimma1 <[email protected]>

* Update tests

Signed-off-by: likhithanimma1 <[email protected]>

* Add more test suites

Signed-off-by: likhithanimma1 <[email protected]>

* Address issue seen with edit history

Signed-off-by: likhithanimma1 <[email protected]>

* Edit Attributes permissions localization

Signed-off-by: likhithanimma1 <[email protected]>

* Address table-view No items selected and Page Size localization

Signed-off-by: likhithanimma1 <[email protected]>

* Add changelog

Signed-off-by: likhithanimma1 <[email protected]>

* run package; nls

Signed-off-by: Billie Simmons <[email protected]>

* Add code coverage

Signed-off-by: likhithanimma1 <[email protected]>

---------

Signed-off-by: likhithanimma1 <[email protected]>
Signed-off-by: Billie Simmons <[email protected]>
Co-authored-by: Fernando Rijo Cedeno <[email protected]>
Co-authored-by: Billie Simmons <[email protected]>

* fix: Move v1 conversion prompt into initialization (#3246)

* fix: Move v1 conversion prompt into initialization

Signed-off-by: Trae Yelovich <[email protected]>

* chore: update ZE changelog

Signed-off-by: Trae Yelovich <[email protected]>

* refactor: fix failing tests, move test cases & fn call

Signed-off-by: Trae Yelovich <[email protected]>

* refactor: move migration check before creating profiles instance

Signed-off-by: Trae Yelovich <[email protected]>

* chore: update changelog and l10n

Signed-off-by: Trae Yelovich <[email protected]>

* tests: check for return values in v1ProfileOptions

Signed-off-by: Trae Yelovich <[email protected]>

* run package

Signed-off-by: Billie Simmons <[email protected]>

* chore: address changelog

Signed-off-by: Trae Yelovich <[email protected]>

---------

Signed-off-by: Trae Yelovich <[email protected]>
Signed-off-by: Billie Simmons <[email protected]>
Co-authored-by: Billie Simmons <[email protected]>
Co-authored-by: Billie Simmons <[email protected]>

* refactor(jobs): Update contents of editor during polling / "Pull from Mainframe" (#3249)

* refactor: revert contents in editor for jobs when pulling data

Signed-off-by: Trae Yelovich <[email protected]>

* chore: add ZE changelog entry

Signed-off-by: Trae Yelovich <[email protected]>

* fix: update mtime, size in fetchSpoolAtUri

Signed-off-by: Trae Yelovich <[email protected]>

* tests: resolve failing test cases

Signed-off-by: Trae Yelovich <[email protected]>

* add changelog #

Signed-off-by: Trae Yelovich <[email protected]>

---------

Signed-off-by: Trae Yelovich <[email protected]>
Signed-off-by: Billie Simmons <[email protected]>
Co-authored-by: Billie Simmons <[email protected]>

* address comments for changelogs

Signed-off-by: Billie Simmons <[email protected]>

* fix(uss): Fix encoding of USS file not automatically detected (#3253)

* fix(uss): Fix encoding of USS file not automatically detected

Signed-off-by: Timothy Johnson <[email protected]>

* run pre-publish

Signed-off-by: Billie Simmons <[email protected]>

---------

Signed-off-by: Timothy Johnson <[email protected]>
Signed-off-by: Billie Simmons <[email protected]>
Co-authored-by: Billie Simmons <[email protected]>

* remove extra space in ZE package.json build script

Signed-off-by: Billie Simmons <[email protected]>

* fix: add ProfileInfo.getTeamConfig.exists check to v1 profile prompt (#3256)

Signed-off-by: Trae Yelovich <[email protected]>

---------

Signed-off-by: Timothy Johnson <[email protected]>
Signed-off-by: Trae Yelovich <[email protected]>
Signed-off-by: Billie Simmons <[email protected]>
Signed-off-by: zFernand0 <[email protected]>
Signed-off-by: SanthoshiBoyina1 <[email protected]>
Signed-off-by: Santhoshi Boyina <[email protected]>
Signed-off-by: Billie Simmons <[email protected]>
Signed-off-by: Fernando Rijo Cedeno <[email protected]>
Signed-off-by: zowe-robot <[email protected]>
Signed-off-by: Peter Haumer <[email protected]>
Signed-off-by: likhithanimma1 <[email protected]>
Co-authored-by: Timothy Johnson <[email protected]>
Co-authored-by: Trae Yelovich <[email protected]>
Co-authored-by: Fernando Rijo Cedeno <[email protected]>
Co-authored-by: SanthoshiBoyina1 <[email protected]>
Co-authored-by: Santhoshi Boyina <[email protected]>
Co-authored-by: zowe-robot <[email protected]>
Co-authored-by: Peter Haumer <[email protected]>
Co-authored-by: likhithanimma1 <[email protected]>
  • Loading branch information
9 people authored Oct 17, 2024
1 parent 6e337f4 commit 0fc58f7
Show file tree
Hide file tree
Showing 63 changed files with 993 additions and 485 deletions.
3 changes: 3 additions & 0 deletions .github/dco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
allowRemediationCommits:
individual: true
thirdParty: true
14 changes: 7 additions & 7 deletions .github/workflows/zowe-explorer-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
matrix:
node-version: [18.x, 20.x]
# order operating systems from best to worst
os: [windows-latest, ubuntu-latest, macos-latest]
os: [windows-latest, ubuntu-22.04, macos-latest]

if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && !contains(github.event.head_commit.message, '[ci skip]')

Expand All @@ -51,24 +51,24 @@ jobs:

- name: Unlock Keyring
id: unlock-keyring
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20.x'
if: matrix.os == 'ubuntu-22.04' && matrix.node-version == '20.x'
uses: t1m0thyj/unlock-keyring@v1

- name: Integration tests
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20.x'
if: matrix.os == 'ubuntu-22.04' && matrix.node-version == '20.x'
run: xvfb-run pnpm test:integration --exclude "Activation.feature"
working-directory: packages/zowe-explorer

- name: Upload test results
uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20.x'
if: matrix.os == 'ubuntu-22.04' && matrix.node-version == '20.x'
with:
name: zowe-explorer-results
path: packages/zowe-explorer/results/

- name: Upload API test results
uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20.x'
if: matrix.os == 'ubuntu-22.04' && matrix.node-version == '20.x'
with:
name: zowe-explorer-api-results
path: packages/zowe-explorer-api/results/
Expand All @@ -80,12 +80,12 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Package VSIX
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20.x'
if: matrix.os == 'ubuntu-22.04' && matrix.node-version == '20.x'
run: pnpm package
working-directory: packages/zowe-explorer

- name: Archive VSIX artifact
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20.x'
if: matrix.os == 'ubuntu-22.04' && matrix.node-version == '20.x'
uses: actions/upload-artifact@v4
with:
name: zowe-explorer-vsix
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "3.0.1-SNAPSHOT",
"version": "3.0.2",
"command": {
"version": {
"forcePublish": true,
Expand Down
3 changes: 3 additions & 0 deletions packages/zowe-explorer-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ All notable changes to the "zowe-explorer-api" extension will be documented in t

### New features and enhancements

- Zowe Explorer now includes support for the [VS Code display languages](https://code.visualstudio.com/docs/getstarted/locales) French, German, Japanese, Portuguese, and Spanish. [#3239](https://github.com/zowe/zowe-explorer-vscode/pull/3239)
- Localization of strings within the webviews. [#2983](https://github.com/zowe/zowe-explorer-vscode/issues/2983)

### Bug fixes

## `3.0.1`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import { Table, TableBuilder, WebView } from "../../../../src";
import { env, EventEmitter, Uri, window } from "vscode";
import * as crypto from "crypto";
import { diff } from "deep-object-diff";
import * as fs from "fs";

jest.mock("fs");
function createGlobalMocks() {
const mockPanel = {
dispose: jest.fn(),
Expand All @@ -23,6 +25,10 @@ function createGlobalMocks() {
};
// Mock `vscode.window.createWebviewPanel` to return a usable panel object
const createWebviewPanelMock = jest.spyOn(window, "createWebviewPanel").mockReturnValueOnce(mockPanel as any);
const spyReadFile = jest.fn((path, encoding, callback) => {
callback(null, "file contents");
});
Object.defineProperty(fs, "readFile", { value: spyReadFile, configurable: true });

return {
createWebviewPanelMock,
Expand Down Expand Up @@ -273,6 +279,18 @@ describe("Table.View", () => {
globalMocks.updateWebviewMock.mockRestore();
});

it("should handle the case where 'GET_LOCALIZATION' is the command sent", async () => {
const globalMocks = await createGlobalMocks();
const view = new Table.View(globalMocks.context as any, false, { title: "Table" } as any);
const postMessageSpy = jest.spyOn(view.panel.webview, "postMessage");
await view.onMessageReceived({ command: "GET_LOCALIZATION" });
expect(postMessageSpy).toHaveBeenCalledWith({
command: "GET_LOCALIZATION",
contents: "file contents",
});
globalMocks.updateWebviewMock.mockRestore();
});

it("calls vscode.env.clipboard.writeText when handling the 'copy' command", async () => {
const globalMocks = createGlobalMocks();
const view = new Table.View(globalMocks.context as any, { title: "Table w/ copy" } as any);
Expand Down
6 changes: 3 additions & 3 deletions packages/zowe-explorer-api/src/fs/BaseProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ export class BaseProvider {
}
await vscode.workspace.fs.writeFile(uri.with({ query: "forceUpload=true" }), fsEntry.data);
Gui.setStatusBarMessage(
vscode.l10n.t({
message: "$(check) Overwrite applied for {0}",
`$(check) ${vscode.l10n.t({
message: "Overwrite applied for {0}",
args: [fsEntry.name],
comment: "File name",
}),
})}`,
this.FS_PROVIDER_UI_TIMEOUT
);
fsEntry.conflictData = null;
Expand Down
17 changes: 16 additions & 1 deletion packages/zowe-explorer-api/src/vscode/ui/TableView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { Event, EventEmitter, ExtensionContext, env } from "vscode";
import { randomUUID } from "crypto";
import { diff } from "deep-object-diff";
import { TableMediator } from "./utils/TableMediator";

import * as vscode from "vscode";
import * as fs from "fs";
export namespace Table {
/* The types of supported content for the table and how they are represented in callback functions. */
export type ContentTypes = string | number | boolean | string[];
Expand Down Expand Up @@ -360,6 +361,20 @@ export namespace Table {
case "copy-cell":
await env.clipboard.writeText(message.data.cell);
return;
case "GET_LOCALIZATION": {
const filePath = vscode.l10n.uri?.fsPath + "";
fs.readFile(filePath, "utf8", (err, data) => {
if (err) {
// File doesn't exist, fallback to English strings
return;
}
(this.panel ?? this.view).webview.postMessage({
command: "GET_LOCALIZATION",
contents: data,
});
});
return;
}
default:
break;
}
Expand Down
8 changes: 7 additions & 1 deletion packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen

### New features and enhancements

- Zowe Explorer now includes support for the [VS Code display languages](https://code.visualstudio.com/docs/getstarted/locales) French, German, Japanese, Portuguese, and Spanish. Download the respective language pack and switch. [#3239](https://github.com/zowe/zowe-explorer-vscode/pull/3239)
- Localization of strings within the webviews. [#2983](https://github.com/zowe/zowe-explorer-vscode/issues/2983)

### Bug fixes

- Fixed an issue where the contents of an editor did not update when polling spool content or using the "Pull from Mainframe" action with jobs. [#3249](https://github.com/zowe/zowe-explorer-vscode/pull/3249)
- Fixed an issue where Zowe Explorer sometimes prompted the user to convert V1 profiles when changes were made to a team configuration after initialization. [#3246](https://github.com/zowe/zowe-explorer-vscode/pull/3246)
- Fixed an issue where the encoding of a USS file was not automatically detected when opened for the first time. [#3253](https://github.com/zowe/zowe-explorer-vscode/pull/3253)

## `3.0.1`

### Bug fixes
Expand All @@ -20,7 +27,6 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
- Fixed an issue where the `Create Directory` and `Create File` features would continue processing when the first prompt was dismissed, causing an incorrect URI to be generated. [#3183](https://github.com/zowe/zowe-explorer-vscode/pull/3183)
- Fixed an issue where the `Create Directory` and `Create File` features would incorrectly handle user-specified locations with trailing slashes. [#3183](https://github.com/zowe/zowe-explorer-vscode/pull/3183)
- Fixed an issue where a 401 error could occur when opening PDS members after updating credentials within the same user session. [#3150](https://github.com/zowe/zowe-explorer-vscode/issues/3150)
- Fixed issue where switching from token-based authentication to user/password would cause an error for nested profiles. [#3142](https://github.com/zowe/zowe-explorer-vscode/issues/3142)
- Fixed the "Edit Profile" operation to open the correct files when both global and project team configs are present. [#3125](https://github.com/zowe/zowe-explorer-vscode/issues/3125)

## `3.0.0`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,11 @@ async function createGlobalMocks() {
"zowe.automaticProfileValidation": true,
}),
});
jest.spyOn(ProfilesUtils, "getProfileInfo").mockResolvedValue({
getTeamConfig: jest.fn().mockReturnValue({
exists: jest.fn(),
}),
} as any);
Object.defineProperty(globalMocks.mockProfilesCache, "getProfileInfo", {
value: jest.fn(() => {
return { value: globalMocks.mockProfCacheProfileInfo, configurable: true };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/

import { Disposable, FilePermission, FileType, Uri } from "vscode";
import { Disposable, FilePermission, FileType, Uri, window } from "vscode";
import { FsJobsUtils, FilterEntry, Gui, JobEntry, SpoolEntry, ZoweScheme } from "@zowe/zowe-explorer-api";
import { createIProfile } from "../../../__mocks__/mockCreators/shared";
import { createIJobFile, createIJobObject } from "../../../__mocks__/mockCreators/jobs";
Expand Down Expand Up @@ -91,16 +91,22 @@ describe("refreshSpool", () => {
});

it("calls fetchSpoolAtUri for a valid spool node", async () => {
const node = { resourceUri: testUris.spool, contextValue: "spool" } as any;
const editorListMock = new MockedProperty(window, "visibleTextEditors", {
value: [{ document: { uri: testUris.spool } }],
});
const fetchSpoolAtUriMock = jest.spyOn(JobFSProvider.instance, "fetchSpoolAtUri").mockImplementation();
const disposeMock = jest.fn();
const statusBarMsgMock = jest.spyOn(Gui, "setStatusBarMessage").mockReturnValue({ dispose: disposeMock });
const node = { resourceUri: testUris.spool, contextValue: "spool" } as any;
await JobFSProvider.refreshSpool(node);
expect(statusBarMsgMock).toHaveBeenCalledWith("$(sync~spin) Fetching spool file...");
expect(fetchSpoolAtUriMock).toHaveBeenCalledWith(node.resourceUri);
expect(fetchSpoolAtUriMock).toHaveBeenCalledWith(node.resourceUri, {
document: { uri: { path: "/sestest/TESTJOB(JOB1234) - ACTIVE/JES2.JESMSGLG.2", scheme: "zowe-jobs" } },
});
expect(disposeMock).toHaveBeenCalled();
fetchSpoolAtUriMock.mockRestore();
statusBarMsgMock.mockRestore();
editorListMock[Symbol.dispose]();
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ import { Gui } from "@zowe/zowe-explorer-api";
import { Profiles } from "../../../../src/configuration/Profiles";
import { ZoweLocalStorage } from "../../../../src/tools/ZoweLocalStorage";
import { UssFSProvider } from "../../../../src/trees/uss/UssFSProvider";
import * as fs from "fs";

jest.mock("fs");
async function initializeHistoryViewMock(blockMocks: any, globalMocks: any): Promise<SharedHistoryView> {
return new SharedHistoryView(
{
Expand Down Expand Up @@ -67,7 +69,10 @@ function createGlobalMocks(): any {
},
configurable: true,
});

const spyReadFile = jest.fn((path, encoding, callback) => {
callback(null, "file contents");
});
Object.defineProperty(fs, "readFile", { value: spyReadFile, configurable: true });
return globalMocks;
}

Expand Down Expand Up @@ -278,6 +283,39 @@ describe("HistoryView Unit Tests", () => {
expect(historyView["currentSelection"]).toEqual({ ds: "search", jobs: "search", uss: "search" });
expect(resetEncodingHistorySpy).toHaveBeenCalledTimes(2);
});

it("should handle the case where 'GET_LOCALIZATION' is the command sent", async () => {
const globalMocks = await createGlobalMocks();
const blockMocks = createBlockMocks(globalMocks);
const historyView = await initializeHistoryViewMock(blockMocks, globalMocks);
const postMessageSpy = jest.spyOn(historyView.panel.webview, "postMessage");
await historyView["onDidReceiveMessage"]({ command: "GET_LOCALIZATION" });
expect(postMessageSpy).toHaveBeenCalledWith({
command: "GET_LOCALIZATION",
contents: "file contents",
});
});

it("if this.panel doesn't exist in GET_LOCALIZATION", async () => {
const globalMocks = await createGlobalMocks();
const blockMocks = createBlockMocks(globalMocks);
const historyView = await initializeHistoryViewMock(blockMocks, globalMocks);
historyView.panel = undefined as any;
await historyView["onDidReceiveMessage"]({ command: "GET_LOCALIZATION" });
expect(historyView.panel).toBeUndefined();
});

it("if read file throwing an error in GET_LOCALIZATION", async () => {
const globalMocks = await createGlobalMocks();
const blockMocks = createBlockMocks(globalMocks);
const spyReadFile = jest.fn((path, encoding, callback) => {
callback("error", "file contents");
});
Object.defineProperty(fs, "readFile", { value: spyReadFile, configurable: true });
const historyView = await initializeHistoryViewMock(blockMocks, globalMocks);
await historyView["onDidReceiveMessage"]({ command: "GET_LOCALIZATION" });
expect(spyReadFile).toHaveBeenCalledTimes(1);
});
});

describe("getHistoryData", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,23 @@ describe("Shared utils unit tests - function promptForEncoding", () => {
);
});

it("prompts for encoding for tagged USS binary file", async () => {
const blockMocks = createBlockMocks();
const node = new ZoweUSSNode({
label: "testFile",
collapsibleState: vscode.TreeItemCollapsibleState.None,
session: blockMocks.session,
profile: blockMocks.profile,
parentPath: "/root",
});
node.setEncoding(binaryEncoding);
blockMocks.showQuickPick.mockImplementationOnce(async (items) => items[0]);
const encoding = await SharedUtils.promptForEncoding(node, "binary");
expect(blockMocks.showQuickPick).toHaveBeenCalled();
expect(await blockMocks.showQuickPick.mock.calls[0][0][0]).toEqual({ label: "binary", description: "USS file tag" });
expect(encoding).toEqual({ kind: "binary" });
});

it("prompts for encoding for USS file when profile contains encoding", async () => {
const blockMocks = createBlockMocks();
(blockMocks.profile.profile as any).encoding = "IBM-1047";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ import { ZoweUSSNode } from "../../../../src/trees/uss/ZoweUSSNode";
import { ZoweExplorerApiRegister } from "../../../../src/extending/ZoweExplorerApiRegister";
import { MainframeInteraction } from "../../../../../zowe-explorer-api/src/extend";
import { SharedContext } from "../../../../src/trees/shared/SharedContext";
import * as fs from "fs";

jest.mock("fs");
describe("AttributeView unit tests", () => {
let view: USSAttributeView;
const context = { extensionPath: "some/fake/ext/path" } as unknown as vscode.ExtensionContext;
Expand Down Expand Up @@ -125,4 +127,35 @@ describe("AttributeView unit tests", () => {
updated: false,
});
});

it("handles GET_LOCALIZATION command", async () => {
const spyReadFile = jest.fn((path, encoding, callback) => {
callback(null, "file contents");
});
Object.defineProperty(fs, "readFile", { value: spyReadFile, configurable: true });
await (view as any).onDidReceiveMessage({ command: "GET_LOCALIZATION" });
expect(view.panel.webview.postMessage).toHaveBeenCalledWith({
command: "GET_LOCALIZATION",
contents: "file contents",
});
});

it("if this.panel doesn't exist in GET_LOCALIZATION", async () => {
const spyReadFile = jest.fn((path, encoding, callback) => {
callback(null, "file contents");
});
Object.defineProperty(fs, "readFile", { value: spyReadFile, configurable: true });
view.panel = undefined as any;
await (view as any).onDidReceiveMessage({ command: "GET_LOCALIZATION" });
expect(view.panel).toBeUndefined();
});

it("if read file throwing an error in GET_LOCALIZATION", async () => {
const spyReadFile = jest.fn((path, encoding, callback) => {
callback("error", "file contents");
});
Object.defineProperty(fs, "readFile", { value: spyReadFile, configurable: true });
await (view as any).onDidReceiveMessage({ command: "GET_LOCALIZATION" });
expect(spyReadFile).toHaveBeenCalledTimes(1);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,31 @@ describe("fetchFileAtUri", () => {
expect(fileEntry.data?.byteLength).toBe(exampleData.length);
autoDetectEncodingMock.mockRestore();
});
it("calls getContents to get the data for a file entry with encoding", async () => {
const fileEntry = { ...testEntries.file };
const lookupAsFileMock = jest.spyOn((UssFSProvider as any).prototype, "_lookupAsFile").mockReturnValueOnce(fileEntry);
const exampleData = "hello world!";
const getContentsMock = jest.fn().mockImplementationOnce((filePath, opts) => {
opts.stream.write(exampleData);
return {
apiResponse: {
etag: "123abc",
},
};
});
jest.spyOn(ZoweExplorerApiRegister, "getUssApi")
.mockReturnValueOnce({
getTag: jest.fn().mockResolvedValueOnce("binary"),
} as any)
.mockReturnValueOnce({ getContents: getContentsMock } as any);

await UssFSProvider.instance.fetchFileAtUri(testUris.file);

expect(lookupAsFileMock).toHaveBeenCalledWith(testUris.file);
expect(fileEntry.data?.toString()).toBe(exampleData);
expect(fileEntry.encoding).toEqual({ kind: "binary" });
expect(getContentsMock).toHaveBeenCalledWith("/aFile.txt", expect.objectContaining({ binary: true }));
});
it("assigns conflictData if the 'isConflict' option is specified", async () => {
const fileEntry = { ...testEntries.file };
const lookupAsFileMock = jest.spyOn((UssFSProvider as any).prototype, "_lookupAsFile").mockReturnValueOnce(fileEntry);
Expand Down
Loading

0 comments on commit 0fc58f7

Please sign in to comment.