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",
|
||||
"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"
|
||||
|
||||
@ -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}?`
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
@ -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/";
|
||||
|
||||
|
||||
@ -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": "*",
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
]);
|
||||
]));
|
||||
}
|
||||
|
||||
@ -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
|
||||
<div className="flex column gaps">
|
||||
<b>Cluster with Invalid Kubeconfig Detected!</b>
|
||||
<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>
|
||||
<p>Do you want to remove the cluster now?</p>
|
||||
<div className="flex gaps row align-left box grow">
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Lens - The Kubernetes IDE</title>
|
||||
<title>OpenLens - Open Source Kubernetes IDE</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user