diff --git a/packages/core/src/common/vars/application-information-fake.injectable.testing-env.ts b/packages/core/src/common/vars/application-information-fake.injectable.testing-env.ts index c881c4c8ca..1fd988b817 100644 --- a/packages/core/src/common/vars/application-information-fake.injectable.testing-env.ts +++ b/packages/core/src/common/vars/application-information-fake.injectable.testing-env.ts @@ -24,6 +24,7 @@ export const applicationInformationFakeInjectable = getInjectable({ welcomeRoute: "/welcome", copyright: "some-copyright-information", description: "some-descriptive-text", + dependencies: {}, }), injectionToken: applicationInformationToken, diff --git a/packages/core/src/features/application-menu/main/menu-items/special-menu-for-mac-application/show-about-application/about-bundled-extensions.injectable.ts b/packages/core/src/features/application-menu/main/menu-items/special-menu-for-mac-application/show-about-application/about-bundled-extensions.injectable.ts index 449ce5f4a8..e12922c340 100644 --- a/packages/core/src/features/application-menu/main/menu-items/special-menu-for-mac-application/show-about-application/about-bundled-extensions.injectable.ts +++ b/packages/core/src/features/application-menu/main/menu-items/special-menu-for-mac-application/show-about-application/about-bundled-extensions.injectable.ts @@ -2,22 +2,34 @@ * Copyright (c) OpenLens Authors. All rights reserved. * Licensed under MIT License. See LICENSE in root directory for more information. */ +import { applicationInformationToken } from "@k8slens/application"; import { getInjectable } from "@ogre-tools/injectable"; import { bundledExtensionInjectionToken } from "../../../../../../common/library"; +import { object } from "../../../../../../common/utils"; import buildSemanticVersionInjectable from "../../../../../../common/vars/build-semantic-version.injectable"; -const aboutBundledExtensionsInjectable = getInjectable({ - id: "about-bundled-extensions", +const specificVersionsInjectable = getInjectable({ + id: "specific-versions", instantiate: (di) => { const buildSemanticVersion = di.inject(buildSemanticVersionInjectable); const bundledExtensions = di.injectMany(bundledExtensionInjectionToken); + const applicationInformation = di.inject(applicationInformationToken); if (buildSemanticVersion.get().prerelease[0] === "latest") { return []; } - return bundledExtensions.map(ext => `${ext.manifest.name}: ${ext.manifest.version}`); + const corePackageVersions = object.entries(applicationInformation.dependencies) + .filter(([name]) => name.startsWith("@k8slens/")) + .map(([name, version]) => `${name}: ${version}`); + const bundledExtensionVersions = bundledExtensions + .map(ext => `${ext.manifest.name}: ${ext.manifest.version}`); + + return [ + ...corePackageVersions, + ...bundledExtensionVersions, + ]; }, }); -export default aboutBundledExtensionsInjectable; +export default specificVersionsInjectable; diff --git a/packages/core/src/features/application-menu/main/menu-items/special-menu-for-mac-application/show-about-application/show-about.injectable.ts b/packages/core/src/features/application-menu/main/menu-items/special-menu-for-mac-application/show-about-application/show-about.injectable.ts index 8bc78ae8c3..309b0b2af7 100644 --- a/packages/core/src/features/application-menu/main/menu-items/special-menu-for-mac-application/show-about-application/show-about.injectable.ts +++ b/packages/core/src/features/application-menu/main/menu-items/special-menu-for-mac-application/show-about-application/show-about.injectable.ts @@ -10,7 +10,7 @@ import productNameInjectable from "../../../../../../common/vars/product-name.in import buildVersionInjectable from "../../../../../../main/vars/build-version/build-version.injectable"; import extensionApiVersionInjectable from "../../../../../../common/vars/extension-api-version.injectable"; import applicationCopyrightInjectable from "../../../../../../common/vars/application-copyright.injectable"; -import aboutBundledExtensionsInjectable from "./about-bundled-extensions.injectable"; +import specificVersionsInjectable from "./about-bundled-extensions.injectable"; const showAboutInjectable = getInjectable({ id: "show-about", @@ -23,7 +23,7 @@ const showAboutInjectable = getInjectable({ const appName = di.inject(appNameInjectable); const productName = di.inject(productNameInjectable); const applicationCopyright = di.inject(applicationCopyrightInjectable); - const aboutBundledExtensions = di.inject(aboutBundledExtensionsInjectable); + const specificVersions = di.inject(specificVersionsInjectable); return () => { const appInfo = [ @@ -32,14 +32,26 @@ const showAboutInjectable = getInjectable({ `Electron: ${process.versions.electron}`, `Chrome: ${process.versions.chrome}`, `Node: ${process.versions.node}`, - ...aboutBundledExtensions, applicationCopyright, ]; + if (specificVersions.length > 0) { + appInfo.push( + "", + "", + ...specificVersions, + ); + } + showMessagePopup( `${isWindows ? " ".repeat(2) : ""}${appName}`, productName, appInfo.join("\r\n"), + { + textWidth: specificVersions.length > 0 + ? 300 + : undefined, + }, ); }; }, diff --git a/packages/core/src/main/electron-app/features/show-message-popup.injectable.ts b/packages/core/src/main/electron-app/features/show-message-popup.injectable.ts index 7ad2f53c6f..fb9f4ab871 100644 --- a/packages/core/src/main/electron-app/features/show-message-popup.injectable.ts +++ b/packages/core/src/main/electron-app/features/show-message-popup.injectable.ts @@ -5,7 +5,11 @@ import { getInjectable } from "@ogre-tools/injectable"; import electronDialogInjectable from "./electron-dialog.injectable"; -export type ShowMessagePopup = (title: string, message: string, detail: string) => void; +export interface ShowMessagePopupOptions { + textWidth?: number; +} + +export type ShowMessagePopup = (title: string, message: string, detail: string, options?: ShowMessagePopupOptions) => void; const showMessagePopupInjectable = getInjectable({ id: "show-message-popup", @@ -13,13 +17,14 @@ const showMessagePopupInjectable = getInjectable({ instantiate: (di): ShowMessagePopup => { const dialog = di.inject(electronDialogInjectable); - return async (title, message, detail) => { + return async (title, message, detail, options = {}) => { await dialog.showMessageBox({ title, message, detail, type: "info", buttons: ["Close"], + ...options, }); }; }, diff --git a/packages/open-lens/src/common/application-information.injectable.ts b/packages/open-lens/src/common/application-information.injectable.ts index 49e95f4bdc..55efe94023 100644 --- a/packages/open-lens/src/common/application-information.injectable.ts +++ b/packages/open-lens/src/common/application-information.injectable.ts @@ -8,12 +8,9 @@ import { applicationInformationToken } from "@k8slens/application"; const applicationInformationInjectable = getInjectable({ id: "application-information", - injectionToken: applicationInformationToken, - instantiate: () => { const { version, - config: { bundledHelmVersion, bundledKubectlVersion, @@ -22,12 +19,12 @@ const applicationInformationInjectable = getInjectable({ sentryDsn, welcomeRoute, }, - productName, build, copyright, description, name, + dependencies, } = packageJson; return { @@ -43,9 +40,11 @@ const applicationInformationInjectable = getInjectable({ contentSecurityPolicy, welcomeRoute, updatingIsEnabled: (build as any)?.publish?.length > 0, + dependencies, }; }, causesSideEffects: true, + injectionToken: applicationInformationToken, }); export default applicationInformationInjectable; diff --git a/packages/technical-features/application/src/application-information-token.ts b/packages/technical-features/application/src/application-information-token.ts index 2f724044c1..c2035d45a3 100644 --- a/packages/technical-features/application/src/application-information-token.ts +++ b/packages/technical-features/application/src/application-information-token.ts @@ -17,6 +17,7 @@ export type ApplicationInformation = { contentSecurityPolicy: string, welcomeRoute: string, updatingIsEnabled: boolean; + dependencies: Partial>; } export const applicationInformationToken = getInjectionToken({