mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
commit
0485b74cf0
@ -3,7 +3,7 @@
|
||||
"productName": "OpenLens",
|
||||
"description": "OpenLens - Open Source IDE for Kubernetes",
|
||||
"homepage": "https://github.com/lensapp/lens",
|
||||
"version": "5.2.2",
|
||||
"version": "5.2.3",
|
||||
"main": "static/build/main.js",
|
||||
"copyright": "© 2021 OpenLens Authors",
|
||||
"license": "MIT",
|
||||
|
||||
@ -31,7 +31,6 @@ import { IpcRendererNavigationEvents } from "../renderer/navigation/events";
|
||||
import logger from "./logger";
|
||||
import { productName } from "../common/vars";
|
||||
import { LensProxy } from "./lens-proxy";
|
||||
import * as path from "path";
|
||||
|
||||
function isHideable(window: BrowserWindow | null): boolean {
|
||||
return Boolean(window && !window.isDestroyed());
|
||||
@ -85,7 +84,6 @@ export class WindowManager extends Singleton {
|
||||
titleBarStyle: "hiddenInset",
|
||||
backgroundColor: "#1e2124",
|
||||
webPreferences: {
|
||||
preload: path.join(__static, "build", "preload.js"),
|
||||
nodeIntegration: true,
|
||||
nodeIntegrationInSubFrames: true,
|
||||
enableRemoteModule: true,
|
||||
|
||||
@ -31,7 +31,7 @@ import { once } from "lodash";
|
||||
export type EntityFilter = (entity: CatalogEntity) => any;
|
||||
|
||||
export class CatalogEntityRegistry {
|
||||
@observable.ref activeEntity: CatalogEntity;
|
||||
@observable protected activeEntityId: string | undefined = undefined;
|
||||
protected _entities = observable.map<string, CatalogEntity>([], { deep: true });
|
||||
protected filters = observable.set<EntityFilter>([], {
|
||||
deep: false,
|
||||
@ -46,6 +46,22 @@ export class CatalogEntityRegistry {
|
||||
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() {
|
||||
ipcRendererOn("catalog:items", (event, items: (CatalogEntityData & CatalogEntityKindData)[]) => {
|
||||
this.updateItems(items);
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
import React from "react";
|
||||
import { observable, makeObservable, reaction } from "mobx";
|
||||
import { observable, makeObservable } from "mobx";
|
||||
import { disposeOnUnmount, observer } from "mobx-react";
|
||||
import { Redirect, Route, Router, Switch } from "react-router";
|
||||
import { history } from "../navigation";
|
||||
@ -97,13 +97,7 @@ export class App extends React.Component {
|
||||
|
||||
await cluster.whenReady; // cluster.activate() is done at this point
|
||||
|
||||
const activeEntityDisposer = reaction(() => catalogEntityRegistry.getById(App.clusterId), (entity) => {
|
||||
if (!entity) {
|
||||
return;
|
||||
}
|
||||
catalogEntityRegistry.activeEntity = entity;
|
||||
activeEntityDisposer();
|
||||
}, {fireImmediately: true});
|
||||
catalogEntityRegistry.activeEntity = App.clusterId;
|
||||
|
||||
ExtensionLoader.getInstance().loadOnClusterRenderer();
|
||||
setTimeout(() => {
|
||||
|
||||
@ -91,7 +91,7 @@ const defaultProps: Partial<InputProps> = {
|
||||
export class Input extends React.Component<InputProps, State> {
|
||||
static defaultProps = defaultProps as object;
|
||||
|
||||
public input: InputElement;
|
||||
public input: InputElement | null = null;
|
||||
public validators: InputValidator[] = [];
|
||||
|
||||
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[]) {
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
import path from "path";
|
||||
import type webpack from "webpack";
|
||||
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 ProgressBarPlugin from "progress-bar-webpack-plugin";
|
||||
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;
|
||||
|
||||
@ -79,6 +79,9 @@ export function webpackLensRenderer({ showVars = true } = {}): webpack.Configura
|
||||
".ts", ".tsx",
|
||||
]
|
||||
},
|
||||
externals: {
|
||||
"node-fetch": "commonjs node-fetch"
|
||||
},
|
||||
optimization: {
|
||||
minimize: false
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user