diff --git a/package.json b/package.json index a8c98624af..f9b538cf91 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "OpenLens - Open Source IDE for Kubernetes", "version": "5.0.0-alpha.1", "main": "static/build/main.js", - "copyright": "© 2021, OpenLens Authors", + "copyright": "© 2021 OpenLens Authors", "license": "MIT", "author": { "name": "OpenLens Authors" diff --git a/src/common/catalog-entities/kubernetes-cluster.ts b/src/common/catalog-entities/kubernetes-cluster.ts index 1071dc6794..b4b4c6aa5a 100644 --- a/src/common/catalog-entities/kubernetes-cluster.ts +++ b/src/common/catalog-entities/kubernetes-cluster.ts @@ -5,6 +5,7 @@ import { CatalogCategory, CatalogEntity, CatalogEntityActionContext, CatalogEnti import { clusterDisconnectHandler } from "../cluster-ipc"; import { ClusterStore } from "../cluster-store"; import { requestMain } from "../ipc"; +import { productName } from "../vars"; export type KubernetesClusterSpec = { kubeconfigPath: string; @@ -58,7 +59,7 @@ export class KubernetesCluster implements CatalogEntity { onlyVisibleForSource: "local", onClick: async () => ClusterStore.getInstance().removeById(this.metadata.uid), confirm: { - message: `Remove Kubernetes Cluster "${this.metadata.name} from Lens?` + message: `Remove Kubernetes Cluster "${this.metadata.name} from ${productName}?` } }, ]; diff --git a/src/common/vars.ts b/src/common/vars.ts index 396a1077c5..e30c050a02 100644 --- a/src/common/vars.ts +++ b/src/common/vars.ts @@ -11,7 +11,9 @@ export const isSnap = !!process.env.SNAP; export const isProduction = process.env.NODE_ENV === "production"; export const isTestEnv = !!process.env.JEST_WORKER_ID; export const isDevelopment = !isTestEnv && !isProduction; +export const isPublishConfigured = Object.keys(packageInfo.build).includes("publish"); +export const productName = packageInfo.productName; export const appName = `${packageInfo.productName}${isDevelopment ? "Dev" : ""}`; export const publicPath = "/build/"; diff --git a/src/extensions/npm/extensions/package.json b/src/extensions/npm/extensions/package.json index 77fcc25a11..6857b12dda 100644 --- a/src/extensions/npm/extensions/package.json +++ b/src/extensions/npm/extensions/package.json @@ -1,9 +1,9 @@ { "name": "@k8slens/extensions", - "productName": "Lens extensions", - "description": "Lens - The Kubernetes IDE: extensions", + "productName": "OpenLens extensions", + "description": "OpenLens - Open Source Kubernetes IDE: extensions", "version": "0.0.0", - "copyright": "© 2021, Mirantis, Inc.", + "copyright": "© 2021 OpenLens Authors", "license": "MIT", "main": "dist/src/extensions/extension-api.js", "types": "dist/src/extensions/extension-api.d.ts", @@ -13,8 +13,7 @@ "dist/**/*.js" ], "author": { - "name": "Mirantis, Inc.", - "email": "info@k8slens.dev" + "name": "OpenLens Authors" }, "dependencies": { "@types/node": "*", diff --git a/src/main/app-updater.ts b/src/main/app-updater.ts index 8f31df8b57..77ae2bff18 100644 --- a/src/main/app-updater.ts +++ b/src/main/app-updater.ts @@ -1,6 +1,6 @@ import { autoUpdater, UpdateInfo } from "electron-updater"; import logger from "./logger"; -import { isDevelopment, isTestEnv } from "../common/vars"; +import { isDevelopment, isPublishConfigured, isTestEnv } from "../common/vars"; import { delay } from "../common/utils"; import { areArgsUpdateAvailableToBackchannel, AutoUpdateLogPrefix, broadcastMessage, onceCorrect, UpdateAvailableChannel, UpdateAvailableToBackchannel } from "../common/ipc"; import { once } from "lodash"; @@ -8,6 +8,10 @@ import { app, ipcMain } from "electron"; let installVersion: null | string = null; +export function isAutoUpdateEnabled() { + return autoUpdater.isUpdaterActive() && isPublishConfigured; +} + function handleAutoUpdateBackChannel(event: Electron.IpcMainEvent, ...[arg]: UpdateAvailableToBackchannel) { if (arg.doUpdate) { if (arg.now) { diff --git a/src/main/index.ts b/src/main/index.ts index 000678b617..b1868ad29d 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -5,7 +5,7 @@ import "../common/prometheus-providers"; import * as Mobx from "mobx"; import * as LensExtensions from "../extensions/core-api"; import { app, autoUpdater, ipcMain, dialog, powerMonitor } from "electron"; -import { appName, isMac } from "../common/vars"; +import { appName, isMac, productName } from "../common/vars"; import path from "path"; import { LensProxy } from "./lens-proxy"; import { WindowManager } from "./window-manager"; @@ -37,12 +37,12 @@ const workingDir = path.join(app.getPath("appData"), appName); app.setName(appName); -logger.info("📟 Setting Lens as protocol client for lens://"); +logger.info(`📟 Setting ${productName} as protocol client for lens://`); if (app.setAsDefaultProtocolClient("lens")) { - logger.info("📟 succeeded ✅"); + logger.info("📟 Protocol client register succeeded ✅"); } else { - logger.info("📟 failed ❗"); + logger.info("📟 Protocol client register failed ❗"); } if (!process.env.CICD) { @@ -86,7 +86,7 @@ app.on("second-instance", (event, argv) => { }); app.on("ready", async () => { - logger.info(`🚀 Starting Lens from "${workingDir}"`); + logger.info(`🚀 Starting ${productName} from "${workingDir}"`); logger.info("🐚 Syncing shell environment"); await shellSync(); diff --git a/src/main/menu.ts b/src/main/menu.ts index 49d4cfdb92..842f95efae 100644 --- a/src/main/menu.ts +++ b/src/main/menu.ts @@ -1,7 +1,7 @@ import { app, BrowserWindow, dialog, ipcMain, IpcMainEvent, Menu, MenuItem, MenuItemConstructorOptions, webContents, shell } from "electron"; import { autorun } from "mobx"; import { WindowManager } from "./window-manager"; -import { appName, isMac, isWindows, isTestEnv, docsUrl, supportUrl } from "../common/vars"; +import { appName, isMac, isWindows, isTestEnv, docsUrl, supportUrl, productName } from "../common/vars"; import { addClusterURL } from "../renderer/components/+add-cluster/add-cluster.route"; import { preferencesURL } from "../renderer/components/+preferences/preferences.route"; import { whatsNewURL } from "../renderer/components/+whats-new/whats-new.route"; @@ -34,7 +34,7 @@ export function showAbout(browserWindow: BrowserWindow) { title: `${isWindows ? " ".repeat(2) : ""}${appName}`, type: "info", buttons: ["Close"], - message: `Lens`, + message: productName, detail: appInfo.join("\r\n") }); } @@ -55,7 +55,7 @@ export function buildMenu(windowManager: WindowManager) { label: app.getName(), submenu: [ { - label: "About Lens", + label: `About ${productName}`, click(menuItem: MenuItem, browserWindow: BrowserWindow) { showAbout(browserWindow); } @@ -220,7 +220,7 @@ export function buildMenu(windowManager: WindowManager) { }, ...ignoreOnMac([ { - label: "About Lens", + label: `About ${productName}`, click(menuItem: MenuItem, browserWindow: BrowserWindow) { showAbout(browserWindow); } diff --git a/src/main/tray.ts b/src/main/tray.ts index a15fa845d3..21ad116c6d 100644 --- a/src/main/tray.ts +++ b/src/main/tray.ts @@ -3,11 +3,11 @@ import packageInfo from "../../package.json"; import { Menu, Tray } from "electron"; import { autorun } from "mobx"; import { showAbout } from "./menu"; -import { checkForUpdates } from "./app-updater"; +import { checkForUpdates, isAutoUpdateEnabled } from "./app-updater"; import { WindowManager } from "./window-manager"; import { preferencesURL } from "../renderer/components/+preferences/preferences.route"; import logger from "./logger"; -import { isDevelopment, isWindows } from "../common/vars"; +import { isDevelopment, isWindows, productName } from "../common/vars"; import { exitApp } from "./exit-app"; const TRAY_LOG_PREFIX = "[TRAY]"; @@ -58,9 +58,9 @@ export function initTray(windowManager: WindowManager) { } function createTrayMenu(windowManager: WindowManager): Menu { - return Menu.buildFromTemplate([ + const template: Electron.MenuItemConstructorOptions[] = [ { - label: "Open Lens", + label: `Open ${productName}`, click() { windowManager .ensureMainWindow() @@ -74,16 +74,22 @@ function createTrayMenu(windowManager: WindowManager): Menu { .navigate(preferencesURL()) .catch(error => logger.error(`${TRAY_LOG_PREFIX}: Failed to nativate to Preferences`, { error })); }, - }, - { + } + ]; + + if (isAutoUpdateEnabled()) { + template.push({ label: "Check for updates", click() { checkForUpdates() .then(() => windowManager.ensureMainWindow()); }, - }, + }); + } + + return Menu.buildFromTemplate(template.concat([ { - label: "About Lens", + label: `About ${productName}`, click() { windowManager.ensureMainWindow() .then(showAbout) @@ -97,5 +103,5 @@ function createTrayMenu(windowManager: WindowManager): Menu { exitApp(); } } - ]); + ])); } diff --git a/src/renderer/ipc/invalid-kubeconfig-handler.tsx b/src/renderer/ipc/invalid-kubeconfig-handler.tsx index 82dc866a4e..0f1e12d070 100644 --- a/src/renderer/ipc/invalid-kubeconfig-handler.tsx +++ b/src/renderer/ipc/invalid-kubeconfig-handler.tsx @@ -4,6 +4,7 @@ import { ClusterStore } from "../../common/cluster-store"; import { InvalidKubeConfigArgs, InvalidKubeconfigChannel } from "../../common/ipc/invalid-kubeconfig"; import { Notifications, notificationsStore } from "../components/notifications"; import { Button } from "../components/button"; +import { productName } from "../../common/vars"; export const invalidKubeconfigHandler = { source: ipcRenderer, @@ -24,7 +25,7 @@ function InvalidKubeconfigListener(event: IpcRendererEvent, ...[clusterId]: Inva
Cluster with Invalid Kubeconfig Detected!

Cluster {cluster.name} has invalid kubeconfig {contextName} and cannot be displayed. - Please fix the { e.preventDefault(); shell.showItemInFolder(cluster.kubeConfigPath); }}>kubeconfig manually and restart Lens + Please fix the { e.preventDefault(); shell.showItemInFolder(cluster.kubeConfigPath); }}>kubeconfig manually and restart {productName} or remove the cluster.

Do you want to remove the cluster now?

diff --git a/src/renderer/template.html b/src/renderer/template.html index 82e137d046..71440e5645 100755 --- a/src/renderer/template.html +++ b/src/renderer/template.html @@ -2,11 +2,11 @@ - Lens - The Kubernetes IDE + OpenLens - Open Source Kubernetes IDE
- \ No newline at end of file +