1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Merge pull request #3848 from lensapp/release/v5.2.3

Release v5.2.3
This commit is contained in:
Jari Kolehmainen 2021-09-21 10:54:43 +03:00 committed by GitHub
commit 0485b74cf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 26 additions and 52 deletions

View File

@ -3,7 +3,7 @@
"productName": "OpenLens", "productName": "OpenLens",
"description": "OpenLens - Open Source IDE for Kubernetes", "description": "OpenLens - Open Source IDE for Kubernetes",
"homepage": "https://github.com/lensapp/lens", "homepage": "https://github.com/lensapp/lens",
"version": "5.2.2", "version": "5.2.3",
"main": "static/build/main.js", "main": "static/build/main.js",
"copyright": "© 2021 OpenLens Authors", "copyright": "© 2021 OpenLens Authors",
"license": "MIT", "license": "MIT",

View File

@ -31,7 +31,6 @@ import { IpcRendererNavigationEvents } from "../renderer/navigation/events";
import logger from "./logger"; import logger from "./logger";
import { productName } from "../common/vars"; import { productName } from "../common/vars";
import { LensProxy } from "./lens-proxy"; import { LensProxy } from "./lens-proxy";
import * as path from "path";
function isHideable(window: BrowserWindow | null): boolean { function isHideable(window: BrowserWindow | null): boolean {
return Boolean(window && !window.isDestroyed()); return Boolean(window && !window.isDestroyed());
@ -85,7 +84,6 @@ export class WindowManager extends Singleton {
titleBarStyle: "hiddenInset", titleBarStyle: "hiddenInset",
backgroundColor: "#1e2124", backgroundColor: "#1e2124",
webPreferences: { webPreferences: {
preload: path.join(__static, "build", "preload.js"),
nodeIntegration: true, nodeIntegration: true,
nodeIntegrationInSubFrames: true, nodeIntegrationInSubFrames: true,
enableRemoteModule: true, enableRemoteModule: true,

View File

@ -31,7 +31,7 @@ import { once } from "lodash";
export type EntityFilter = (entity: CatalogEntity) => any; export type EntityFilter = (entity: CatalogEntity) => any;
export class CatalogEntityRegistry { export class CatalogEntityRegistry {
@observable.ref activeEntity: CatalogEntity; @observable protected activeEntityId: string | undefined = undefined;
protected _entities = observable.map<string, CatalogEntity>([], { deep: true }); protected _entities = observable.map<string, CatalogEntity>([], { deep: true });
protected filters = observable.set<EntityFilter>([], { protected filters = observable.set<EntityFilter>([], {
deep: false, deep: false,
@ -46,6 +46,22 @@ export class CatalogEntityRegistry {
makeObservable(this); makeObservable(this);
} }
get activeEntity(): CatalogEntity | null {
return this._entities.get(this.activeEntityId) || null;
}
set activeEntity(raw: CatalogEntity | string | null) {
if (raw) {
const id = typeof raw === "string"
? raw
: raw.getId();
this.activeEntityId = id;
} else {
this.activeEntityId = undefined;
}
}
init() { init() {
ipcRendererOn("catalog:items", (event, items: (CatalogEntityData & CatalogEntityKindData)[]) => { ipcRendererOn("catalog:items", (event, items: (CatalogEntityData & CatalogEntityKindData)[]) => {
this.updateItems(items); this.updateItems(items);

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import React from "react"; import React from "react";
import { observable, makeObservable, reaction } from "mobx"; import { observable, makeObservable } from "mobx";
import { disposeOnUnmount, observer } from "mobx-react"; import { disposeOnUnmount, observer } from "mobx-react";
import { Redirect, Route, Router, Switch } from "react-router"; import { Redirect, Route, Router, Switch } from "react-router";
import { history } from "../navigation"; import { history } from "../navigation";
@ -97,13 +97,7 @@ export class App extends React.Component {
await cluster.whenReady; // cluster.activate() is done at this point await cluster.whenReady; // cluster.activate() is done at this point
const activeEntityDisposer = reaction(() => catalogEntityRegistry.getById(App.clusterId), (entity) => { catalogEntityRegistry.activeEntity = App.clusterId;
if (!entity) {
return;
}
catalogEntityRegistry.activeEntity = entity;
activeEntityDisposer();
}, {fireImmediately: true});
ExtensionLoader.getInstance().loadOnClusterRenderer(); ExtensionLoader.getInstance().loadOnClusterRenderer();
setTimeout(() => { setTimeout(() => {

View File

@ -91,7 +91,7 @@ const defaultProps: Partial<InputProps> = {
export class Input extends React.Component<InputProps, State> { export class Input extends React.Component<InputProps, State> {
static defaultProps = defaultProps as object; static defaultProps = defaultProps as object;
public input: InputElement; public input: InputElement | null = null;
public validators: InputValidator[] = []; public validators: InputValidator[] = [];
public state: State = { public state: State = {
@ -191,7 +191,7 @@ export class Input extends React.Component<InputProps, State> {
} }
} }
this.input.setCustomValidity(errors.length ? errors[0].toString() : ""); this.input?.setCustomValidity(errors.length ? errors[0].toString() : "");
} }
setValidation(errors: React.ReactNode[]) { setValidation(errors: React.ReactNode[]) {

View File

@ -22,7 +22,7 @@
import path from "path"; import path from "path";
import type webpack from "webpack"; import type webpack from "webpack";
import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin"; import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin";
import { isProduction, mainDir, buildDir, isDevelopment, preloadEntrypoint } from "./src/common/vars"; import { isProduction, mainDir, buildDir, isDevelopment } from "./src/common/vars";
import nodeExternals from "webpack-node-externals"; import nodeExternals from "webpack-node-externals";
import ProgressBarPlugin from "progress-bar-webpack-plugin"; import ProgressBarPlugin from "progress-bar-webpack-plugin";
import * as vars from "./src/common/vars"; import * as vars from "./src/common/vars";
@ -68,41 +68,4 @@ configs.push((): webpack.Configuration => {
}; };
}); });
configs.push((): webpack.Configuration => {
console.info("WEBPACK:preload", vars);
return {
context: __dirname,
target: "electron-main",
mode: isProduction ? "production" : "development",
devtool: isProduction ? "source-map" : "cheap-eval-source-map",
cache: isDevelopment,
entry: {
main: path.resolve(preloadEntrypoint),
},
output: {
libraryTarget: "global",
path: buildDir,
filename: "preload.js"
},
resolve: {
extensions: [".json", ".js", ".ts"],
mainFields: ["main"]
},
module: {
rules: [
{
test: /\.node$/,
use: "node-loader"
},
getTSLoader(/\.ts$/)
]
},
plugins: [
new ProgressBarPlugin(),
new ForkTsCheckerPlugin(),
].filter(Boolean)
};
});
export default configs; export default configs;

View File

@ -79,6 +79,9 @@ export function webpackLensRenderer({ showVars = true } = {}): webpack.Configura
".ts", ".tsx", ".ts", ".tsx",
] ]
}, },
externals: {
"node-fetch": "commonjs node-fetch"
},
optimization: { optimization: {
minimize: false minimize: false
}, },