From 810a0f8dd1dd83e5a212330769887290f645cd49 Mon Sep 17 00:00:00 2001 From: Iku-turso Date: Wed, 30 Nov 2022 15:12:45 +0200 Subject: [PATCH] Release 6.2.4 (#6676) * Release 6.2.4 Signed-off-by: Iku-turso * Bump electron from 19.1.7 to 19.1.8 (#6664) Bumps [electron](https://github.com/electron/electron) from 19.1.7 to 19.1.8. - [Release notes](https://github.com/electron/electron/releases) - [Changelog](https://github.com/electron/electron/blob/main/docs/breaking-changes.md) - [Commits](https://github.com/electron/electron/compare/v19.1.7...v19.1.8) --- updated-dependencies: - dependency-name: electron dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix extensions using "application" as magic string for preference tab (#6666) Signed-off-by: Iku-turso Signed-off-by: Iku-turso * Make preferences from extensions using tabs "application" and "telemetry" appear as last (#6674) Signed-off-by: Iku-turso Signed-off-by: Iku-turso Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 4 +- ...-to-application-preferences.test.tsx.snap} | 1409 +++++++++++++++++ ...ation-to-application-preferences.test.tsx} | 68 + ...trator-for-preference-items.injectable.tsx | 14 +- yarn.lock | 8 +- 5 files changed, 1493 insertions(+), 10 deletions(-) rename src/features/preferences/__snapshots__/{navigation-to-application-preferences.test.ts.snap => navigation-to-application-preferences.test.tsx.snap} (54%) rename src/features/preferences/{navigation-to-application-preferences.test.ts => navigation-to-application-preferences.test.tsx} (57%) diff --git a/package.json b/package.json index ccb93f01d6..873923cabf 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "productName": "OpenLens", "description": "OpenLens - Open Source IDE for Kubernetes", "homepage": "https://github.com/lensapp/lens", - "version": "6.2.3", + "version": "6.2.4", "main": "static/build/main.js", "copyright": "© 2022 OpenLens Authors", "license": "MIT", @@ -375,7 +375,7 @@ "css-loader": "^6.7.1", "deepdash": "^5.3.9", "dompurify": "^2.4.1", - "electron": "^19.1.7", + "electron": "^19.1.8", "electron-builder": "^23.6.0", "electron-notarize": "^0.3.0", "esbuild": "^0.15.14", diff --git a/src/features/preferences/__snapshots__/navigation-to-application-preferences.test.ts.snap b/src/features/preferences/__snapshots__/navigation-to-application-preferences.test.tsx.snap similarity index 54% rename from src/features/preferences/__snapshots__/navigation-to-application-preferences.test.ts.snap rename to src/features/preferences/__snapshots__/navigation-to-application-preferences.test.tsx.snap index fc951ae75a..dfc4a1355d 100644 --- a/src/features/preferences/__snapshots__/navigation-to-application-preferences.test.ts.snap +++ b/src/features/preferences/__snapshots__/navigation-to-application-preferences.test.tsx.snap @@ -1,5 +1,1414 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`preferences - navigation to application preferences given in preferences, when rendered renders 1`] = ` +
+
+
+
+
+ + + home + + +
+
+
+ + + arrow_back + + +
+
+
+ + + arrow_forward + + +
+
+
+
+
+
+
+ +
+
+
+

+ Application +

+
+
+
+ Theme + +
+
+ + +
+
+
+ Select... +
+
+ +
+
+
+ + +
+
+
+
+
+
+
+
+
+ Extension Install Registry + +
+
+ + +
+
+
+ Select... +
+
+ +
+
+
+ + +
+
+
+

+ This setting is to change the registry URL for installing extensions by name. + If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your + + .npmrc + + file or in the input below. +

+
+ +
+
+
+
+
+
+
+
+ Start-up + +
+ +
+
+
+
+
+
+ Update Channel + +
+
+ + +
+
+
+ Stable +
+
+ +
+
+
+ + +
+
+
+
+
+
+
+
+
+ Locale Timezone + +
+
+ + +
+
+
+ Select... +
+
+ +
+
+
+ + +
+
+
+
+
+
+
+
+
+
+
+ + + close + + +
+ +
+
+
+
+
+
+
+
+
+ + + arrow_left + + +
+
+ 0 +
+
+ + + arrow_right + + +
+
+
+
+
+
+
+
+
+`; + +exports[`preferences - navigation to application preferences given in preferences, when rendered when extension with application preference items gets enabled renders 1`] = ` +
+
+
+
+
+ + + home + + +
+
+
+ + + arrow_back + + +
+
+
+ + + arrow_forward + + +
+
+
+
+
+
+
+ +
+
+
+

+ Application +

+
+
+
+ Theme + +
+
+ + +
+
+
+ Select... +
+
+ +
+
+
+ + +
+
+
+
+
+
+
+
+
+ Extension Install Registry + +
+
+ + +
+
+
+ Select... +
+
+ +
+
+
+ + +
+
+
+

+ This setting is to change the registry URL for installing extensions by name. + If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your + + .npmrc + + file or in the input below. +

+
+ +
+
+
+
+
+
+
+
+ Start-up + +
+ +
+
+
+
+
+
+ Update Channel + +
+
+ + +
+
+
+ Stable +
+
+ +
+
+
+ + +
+
+
+
+
+
+
+
+
+ Locale Timezone + +
+
+ + +
+
+
+ Select... +
+
+ +
+
+
+ + +
+
+
+
+
+
+
+
+
+ Some application-preference item + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + close + + +
+ +
+
+
+
+
+
+
+
+
+ + + arrow_left + + +
+
+ 0 +
+
+ + + arrow_right + + +
+
+
+
+
+
+
+
+
+`; + exports[`preferences - navigation to application preferences given in some child page of preferences, when rendered renders 1`] = `
{ let builder: ApplicationBuilder; @@ -16,6 +18,53 @@ describe("preferences - navigation to application preferences", () => { builder = getApplicationBuilder(); }); + describe("given in preferences, when rendered", () => { + let rendered: RenderResult; + let discover: Discover; + + beforeEach(async () => { + builder.beforeWindowStart(() => { + builder.preferences.navigate(); + }); + + rendered = await builder.render(); + + discover = discoverFor(() => rendered); + }); + + it("renders", () => { + expect(rendered.container).toMatchSnapshot(); + }); + + it("shows application preferences", () => { + const { discovered } = discover.querySingleElement( + "preference-page", + "application-page", + ); + + expect(discovered).not.toBeNull(); + }); + + describe("when extension with application preference items gets enabled", () => { + beforeEach(() => { + builder.extensions.enable( + extensionStubWithApplicationPreferenceItems, + ); + }); + + it("renders", () => { + expect(rendered.container).toMatchSnapshot(); + }); + + it("shows preference items of the extension as last", () => { + const { attributeValues } = + discover.queryAllElements("preference-item"); + + expect(attributeValues.at(-1)).toBe("preference-item-for-extension-some-test-extension-name-item-some-application-preference-item-id"); + }); + }); + }); + describe("given in some child page of preferences, when rendered", () => { let rendered: RenderResult; let discover: Discover; @@ -85,3 +134,22 @@ describe("preferences - navigation to application preferences", () => { }); }); +const extensionStubWithApplicationPreferenceItems: FakeExtensionOptions = { + id: "some-test-extension-id", + name: "some-test-extension-name", + + rendererOptions: { + appPreferences: [ + { + title: "Some application-preference item", + id: "some-application-preference-item-id", + showInPreferencesTab: "application", + + components: { + Hint: () =>
, + Input: () =>
, + }, + }, + ], + }, +}; diff --git a/src/features/preferences/renderer/compliance-for-legacy-extension-api/registrator-for-preference-items.injectable.tsx b/src/features/preferences/renderer/compliance-for-legacy-extension-api/registrator-for-preference-items.injectable.tsx index 6a79f96c37..c69ee37e80 100644 --- a/src/features/preferences/renderer/compliance-for-legacy-extension-api/registrator-for-preference-items.injectable.tsx +++ b/src/features/preferences/renderer/compliance-for-legacy-extension-api/registrator-for-preference-items.injectable.tsx @@ -113,6 +113,12 @@ const registratorForPreferenceItemsInjectable = getInjectable({ const items = extension.appPreferences.map((registration, i) => { const itemId = `${commonId}-item-${registration.id ?? i}`; + const itemIsInSpecialTab = + registration.showInPreferencesTab && + ["telemetry", "application"].includes( + registration.showInPreferencesTab, + ); + return getInjectable({ id: itemId, @@ -120,14 +126,14 @@ const registratorForPreferenceItemsInjectable = getInjectable({ kind: "block" as const, id: itemId, - // Note: Legacy extensions considered telemetry as magic string, and so does this code + // Note: Legacy extensions considered telemetry and application as magic strings, and so does this code parentId: registration.showInPreferencesTab - ? registration.showInPreferencesTab === "telemetry" - ? "telemetry-page" + ? itemIsInSpecialTab + ? `${registration.showInPreferencesTab}-page` : `${commonId}-additional-page-${registration.showInPreferencesTab}` : primaryPageId, - orderNumber: i * 10, + orderNumber: i * 10 + (itemIsInSpecialTab ? 1000 : 0), Component: () => ( diff --git a/yarn.lock b/yarn.lock index b49e980a7c..e23ddf8522 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5100,10 +5100,10 @@ electron-window-state@^5.0.3: jsonfile "^4.0.0" mkdirp "^0.5.1" -electron@^19.1.7: - version "19.1.7" - resolved "https://registry.yarnpkg.com/electron/-/electron-19.1.7.tgz#35036a510d9ca943d271e1d1a12463547ed5cd12" - integrity sha512-U5rCktIm/EeRjfg/9QFo29jzvZVV2z8Xw7r2NdGTpljmjd+7kySHvUHthO2hk8HETILJivL4+R5lF9zxcJ2J9w== +electron@^19.1.8: + version "19.1.8" + resolved "https://registry.yarnpkg.com/electron/-/electron-19.1.8.tgz#3ce19c270ca86d05bbf0df5ceeaea2d23edc7083" + integrity sha512-UfPQdFjgKI0xCm1V5sV3iAVOs0kCwAE91xWzV5tI7ij14yOkxTdXp9BqTzFaSbQYLYxn6q1BUUe1nlzjJjzAnw== dependencies: "@electron/get" "^1.14.1" "@types/node" "^16.11.26"