mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Use productName from package.json (#2580)
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
013057dc23
commit
d0712b3c32
@ -4,7 +4,7 @@
|
|||||||
"description": "OpenLens - Open Source IDE for Kubernetes",
|
"description": "OpenLens - Open Source IDE for Kubernetes",
|
||||||
"version": "5.0.0-alpha.1",
|
"version": "5.0.0-alpha.1",
|
||||||
"main": "static/build/main.js",
|
"main": "static/build/main.js",
|
||||||
"copyright": "© 2021, OpenLens Authors",
|
"copyright": "© 2021 OpenLens Authors",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "OpenLens Authors"
|
"name": "OpenLens Authors"
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { CatalogCategory, CatalogEntity, CatalogEntityActionContext, CatalogEnti
|
|||||||
import { clusterDisconnectHandler } from "../cluster-ipc";
|
import { clusterDisconnectHandler } from "../cluster-ipc";
|
||||||
import { ClusterStore } from "../cluster-store";
|
import { ClusterStore } from "../cluster-store";
|
||||||
import { requestMain } from "../ipc";
|
import { requestMain } from "../ipc";
|
||||||
|
import { productName } from "../vars";
|
||||||
|
|
||||||
export type KubernetesClusterSpec = {
|
export type KubernetesClusterSpec = {
|
||||||
kubeconfigPath: string;
|
kubeconfigPath: string;
|
||||||
@ -58,7 +59,7 @@ export class KubernetesCluster implements CatalogEntity {
|
|||||||
onlyVisibleForSource: "local",
|
onlyVisibleForSource: "local",
|
||||||
onClick: async () => ClusterStore.getInstance().removeById(this.metadata.uid),
|
onClick: async () => ClusterStore.getInstance().removeById(this.metadata.uid),
|
||||||
confirm: {
|
confirm: {
|
||||||
message: `Remove Kubernetes Cluster "${this.metadata.name} from Lens?`
|
message: `Remove Kubernetes Cluster "${this.metadata.name} from ${productName}?`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@ -11,7 +11,9 @@ export const isSnap = !!process.env.SNAP;
|
|||||||
export const isProduction = process.env.NODE_ENV === "production";
|
export const isProduction = process.env.NODE_ENV === "production";
|
||||||
export const isTestEnv = !!process.env.JEST_WORKER_ID;
|
export const isTestEnv = !!process.env.JEST_WORKER_ID;
|
||||||
export const isDevelopment = !isTestEnv && !isProduction;
|
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 appName = `${packageInfo.productName}${isDevelopment ? "Dev" : ""}`;
|
||||||
export const publicPath = "/build/";
|
export const publicPath = "/build/";
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "@k8slens/extensions",
|
"name": "@k8slens/extensions",
|
||||||
"productName": "Lens extensions",
|
"productName": "OpenLens extensions",
|
||||||
"description": "Lens - The Kubernetes IDE: extensions",
|
"description": "OpenLens - Open Source Kubernetes IDE: extensions",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"copyright": "© 2021, Mirantis, Inc.",
|
"copyright": "© 2021 OpenLens Authors",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "dist/src/extensions/extension-api.js",
|
"main": "dist/src/extensions/extension-api.js",
|
||||||
"types": "dist/src/extensions/extension-api.d.ts",
|
"types": "dist/src/extensions/extension-api.d.ts",
|
||||||
@ -13,8 +13,7 @@
|
|||||||
"dist/**/*.js"
|
"dist/**/*.js"
|
||||||
],
|
],
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Mirantis, Inc.",
|
"name": "OpenLens Authors"
|
||||||
"email": "info@k8slens.dev"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { autoUpdater, UpdateInfo } from "electron-updater";
|
import { autoUpdater, UpdateInfo } from "electron-updater";
|
||||||
import logger from "./logger";
|
import logger from "./logger";
|
||||||
import { isDevelopment, isTestEnv } from "../common/vars";
|
import { isDevelopment, isPublishConfigured, isTestEnv } from "../common/vars";
|
||||||
import { delay } from "../common/utils";
|
import { delay } from "../common/utils";
|
||||||
import { areArgsUpdateAvailableToBackchannel, AutoUpdateLogPrefix, broadcastMessage, onceCorrect, UpdateAvailableChannel, UpdateAvailableToBackchannel } from "../common/ipc";
|
import { areArgsUpdateAvailableToBackchannel, AutoUpdateLogPrefix, broadcastMessage, onceCorrect, UpdateAvailableChannel, UpdateAvailableToBackchannel } from "../common/ipc";
|
||||||
import { once } from "lodash";
|
import { once } from "lodash";
|
||||||
@ -8,6 +8,10 @@ import { app, ipcMain } from "electron";
|
|||||||
|
|
||||||
let installVersion: null | string = null;
|
let installVersion: null | string = null;
|
||||||
|
|
||||||
|
export function isAutoUpdateEnabled() {
|
||||||
|
return autoUpdater.isUpdaterActive() && isPublishConfigured;
|
||||||
|
}
|
||||||
|
|
||||||
function handleAutoUpdateBackChannel(event: Electron.IpcMainEvent, ...[arg]: UpdateAvailableToBackchannel) {
|
function handleAutoUpdateBackChannel(event: Electron.IpcMainEvent, ...[arg]: UpdateAvailableToBackchannel) {
|
||||||
if (arg.doUpdate) {
|
if (arg.doUpdate) {
|
||||||
if (arg.now) {
|
if (arg.now) {
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import "../common/prometheus-providers";
|
|||||||
import * as Mobx from "mobx";
|
import * as Mobx from "mobx";
|
||||||
import * as LensExtensions from "../extensions/core-api";
|
import * as LensExtensions from "../extensions/core-api";
|
||||||
import { app, autoUpdater, ipcMain, dialog, powerMonitor } from "electron";
|
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 path from "path";
|
||||||
import { LensProxy } from "./lens-proxy";
|
import { LensProxy } from "./lens-proxy";
|
||||||
import { WindowManager } from "./window-manager";
|
import { WindowManager } from "./window-manager";
|
||||||
@ -37,12 +37,12 @@ const workingDir = path.join(app.getPath("appData"), appName);
|
|||||||
|
|
||||||
app.setName(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")) {
|
if (app.setAsDefaultProtocolClient("lens")) {
|
||||||
logger.info("📟 succeeded ✅");
|
logger.info("📟 Protocol client register succeeded ✅");
|
||||||
} else {
|
} else {
|
||||||
logger.info("📟 failed ❗");
|
logger.info("📟 Protocol client register failed ❗");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!process.env.CICD) {
|
if (!process.env.CICD) {
|
||||||
@ -86,7 +86,7 @@ app.on("second-instance", (event, argv) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.on("ready", async () => {
|
app.on("ready", async () => {
|
||||||
logger.info(`🚀 Starting Lens from "${workingDir}"`);
|
logger.info(`🚀 Starting ${productName} from "${workingDir}"`);
|
||||||
logger.info("🐚 Syncing shell environment");
|
logger.info("🐚 Syncing shell environment");
|
||||||
await shellSync();
|
await shellSync();
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { app, BrowserWindow, dialog, ipcMain, IpcMainEvent, Menu, MenuItem, MenuItemConstructorOptions, webContents, shell } from "electron";
|
import { app, BrowserWindow, dialog, ipcMain, IpcMainEvent, Menu, MenuItem, MenuItemConstructorOptions, webContents, shell } from "electron";
|
||||||
import { autorun } from "mobx";
|
import { autorun } from "mobx";
|
||||||
import { WindowManager } from "./window-manager";
|
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 { addClusterURL } from "../renderer/components/+add-cluster/add-cluster.route";
|
||||||
import { preferencesURL } from "../renderer/components/+preferences/preferences.route";
|
import { preferencesURL } from "../renderer/components/+preferences/preferences.route";
|
||||||
import { whatsNewURL } from "../renderer/components/+whats-new/whats-new.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}`,
|
title: `${isWindows ? " ".repeat(2) : ""}${appName}`,
|
||||||
type: "info",
|
type: "info",
|
||||||
buttons: ["Close"],
|
buttons: ["Close"],
|
||||||
message: `Lens`,
|
message: productName,
|
||||||
detail: appInfo.join("\r\n")
|
detail: appInfo.join("\r\n")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ export function buildMenu(windowManager: WindowManager) {
|
|||||||
label: app.getName(),
|
label: app.getName(),
|
||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
label: "About Lens",
|
label: `About ${productName}`,
|
||||||
click(menuItem: MenuItem, browserWindow: BrowserWindow) {
|
click(menuItem: MenuItem, browserWindow: BrowserWindow) {
|
||||||
showAbout(browserWindow);
|
showAbout(browserWindow);
|
||||||
}
|
}
|
||||||
@ -220,7 +220,7 @@ export function buildMenu(windowManager: WindowManager) {
|
|||||||
},
|
},
|
||||||
...ignoreOnMac([
|
...ignoreOnMac([
|
||||||
{
|
{
|
||||||
label: "About Lens",
|
label: `About ${productName}`,
|
||||||
click(menuItem: MenuItem, browserWindow: BrowserWindow) {
|
click(menuItem: MenuItem, browserWindow: BrowserWindow) {
|
||||||
showAbout(browserWindow);
|
showAbout(browserWindow);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,11 +3,11 @@ import packageInfo from "../../package.json";
|
|||||||
import { Menu, Tray } from "electron";
|
import { Menu, Tray } from "electron";
|
||||||
import { autorun } from "mobx";
|
import { autorun } from "mobx";
|
||||||
import { showAbout } from "./menu";
|
import { showAbout } from "./menu";
|
||||||
import { checkForUpdates } from "./app-updater";
|
import { checkForUpdates, isAutoUpdateEnabled } from "./app-updater";
|
||||||
import { WindowManager } from "./window-manager";
|
import { WindowManager } from "./window-manager";
|
||||||
import { preferencesURL } from "../renderer/components/+preferences/preferences.route";
|
import { preferencesURL } from "../renderer/components/+preferences/preferences.route";
|
||||||
import logger from "./logger";
|
import logger from "./logger";
|
||||||
import { isDevelopment, isWindows } from "../common/vars";
|
import { isDevelopment, isWindows, productName } from "../common/vars";
|
||||||
import { exitApp } from "./exit-app";
|
import { exitApp } from "./exit-app";
|
||||||
|
|
||||||
const TRAY_LOG_PREFIX = "[TRAY]";
|
const TRAY_LOG_PREFIX = "[TRAY]";
|
||||||
@ -58,9 +58,9 @@ export function initTray(windowManager: WindowManager) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createTrayMenu(windowManager: WindowManager): Menu {
|
function createTrayMenu(windowManager: WindowManager): Menu {
|
||||||
return Menu.buildFromTemplate([
|
const template: Electron.MenuItemConstructorOptions[] = [
|
||||||
{
|
{
|
||||||
label: "Open Lens",
|
label: `Open ${productName}`,
|
||||||
click() {
|
click() {
|
||||||
windowManager
|
windowManager
|
||||||
.ensureMainWindow()
|
.ensureMainWindow()
|
||||||
@ -74,16 +74,22 @@ function createTrayMenu(windowManager: WindowManager): Menu {
|
|||||||
.navigate(preferencesURL())
|
.navigate(preferencesURL())
|
||||||
.catch(error => logger.error(`${TRAY_LOG_PREFIX}: Failed to nativate to Preferences`, { error }));
|
.catch(error => logger.error(`${TRAY_LOG_PREFIX}: Failed to nativate to Preferences`, { error }));
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
{
|
];
|
||||||
|
|
||||||
|
if (isAutoUpdateEnabled()) {
|
||||||
|
template.push({
|
||||||
label: "Check for updates",
|
label: "Check for updates",
|
||||||
click() {
|
click() {
|
||||||
checkForUpdates()
|
checkForUpdates()
|
||||||
.then(() => windowManager.ensureMainWindow());
|
.then(() => windowManager.ensureMainWindow());
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return Menu.buildFromTemplate(template.concat([
|
||||||
{
|
{
|
||||||
label: "About Lens",
|
label: `About ${productName}`,
|
||||||
click() {
|
click() {
|
||||||
windowManager.ensureMainWindow()
|
windowManager.ensureMainWindow()
|
||||||
.then(showAbout)
|
.then(showAbout)
|
||||||
@ -97,5 +103,5 @@ function createTrayMenu(windowManager: WindowManager): Menu {
|
|||||||
exitApp();
|
exitApp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]);
|
]));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { ClusterStore } from "../../common/cluster-store";
|
|||||||
import { InvalidKubeConfigArgs, InvalidKubeconfigChannel } from "../../common/ipc/invalid-kubeconfig";
|
import { InvalidKubeConfigArgs, InvalidKubeconfigChannel } from "../../common/ipc/invalid-kubeconfig";
|
||||||
import { Notifications, notificationsStore } from "../components/notifications";
|
import { Notifications, notificationsStore } from "../components/notifications";
|
||||||
import { Button } from "../components/button";
|
import { Button } from "../components/button";
|
||||||
|
import { productName } from "../../common/vars";
|
||||||
|
|
||||||
export const invalidKubeconfigHandler = {
|
export const invalidKubeconfigHandler = {
|
||||||
source: ipcRenderer,
|
source: ipcRenderer,
|
||||||
@ -24,7 +25,7 @@ function InvalidKubeconfigListener(event: IpcRendererEvent, ...[clusterId]: Inva
|
|||||||
<div className="flex column gaps">
|
<div className="flex column gaps">
|
||||||
<b>Cluster with Invalid Kubeconfig Detected!</b>
|
<b>Cluster with Invalid Kubeconfig Detected!</b>
|
||||||
<p>Cluster <b>{cluster.name}</b> has invalid kubeconfig {contextName} and cannot be displayed.
|
<p>Cluster <b>{cluster.name}</b> has invalid kubeconfig {contextName} and cannot be displayed.
|
||||||
Please fix the <a href="#" onClick={(e) => { e.preventDefault(); shell.showItemInFolder(cluster.kubeConfigPath); }}>kubeconfig</a> manually and restart Lens
|
Please fix the <a href="#" onClick={(e) => { e.preventDefault(); shell.showItemInFolder(cluster.kubeConfigPath); }}>kubeconfig</a> manually and restart {productName}
|
||||||
or remove the cluster.</p>
|
or remove the cluster.</p>
|
||||||
<p>Do you want to remove the cluster now?</p>
|
<p>Do you want to remove the cluster now?</p>
|
||||||
<div className="flex gaps row align-left box grow">
|
<div className="flex gaps row align-left box grow">
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Lens - The Kubernetes IDE</title>
|
<title>OpenLens - Open Source Kubernetes IDE</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user