mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
reverting dashboard rendering to webview, part 3
This commit is contained in:
parent
50ab4905dc
commit
4e18c992d8
@ -250,7 +250,6 @@
|
|||||||
"dompurify": "^2.0.11",
|
"dompurify": "^2.0.11",
|
||||||
"electron-builder": "^22.7.0",
|
"electron-builder": "^22.7.0",
|
||||||
"electron-notarize": "^0.3.0",
|
"electron-notarize": "^0.3.0",
|
||||||
"electron-reloader": "^1.0.1",
|
|
||||||
"electron-serve": "^1.0.0",
|
"electron-serve": "^1.0.0",
|
||||||
"file-loader": "^6.0.0",
|
"file-loader": "^6.0.0",
|
||||||
"flex.box": "^3.4.4",
|
"flex.box": "^3.4.4",
|
||||||
|
|||||||
@ -1,6 +1,10 @@
|
|||||||
// App's common configuration for any process (main, renderer, build pipeline, etc.)
|
// App's common configuration for any process (main, renderer, build pipeline, etc.)
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
|
||||||
|
// Temp
|
||||||
|
export const reactAppName = "app_react"
|
||||||
|
export const vueAppName = "app_vue"
|
||||||
|
|
||||||
// Flags
|
// Flags
|
||||||
export const isMac = process.platform === "darwin"
|
export const isMac = process.platform === "darwin"
|
||||||
export const isWindows = process.platform === "win32"
|
export const isWindows = process.platform === "win32"
|
||||||
|
|||||||
@ -180,15 +180,14 @@ export class Cluster implements ClusterInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async k8sRequest(path: string, opts: request.RequestPromiseOptions = {}) {
|
protected async k8sRequest(path: string, opts?: request.RequestPromiseOptions) {
|
||||||
const prefix = apiPrefix.KUBE_BASE;
|
const options = Object.assign({
|
||||||
const url = `http://127.0.0.1:${this.port}${prefix}${path}`;
|
json: true,
|
||||||
opts.json = true;
|
timeout: 10000
|
||||||
opts.timeout = 10000;
|
}, (opts || {}))
|
||||||
opts.headers = Object.assign({}, opts.headers, {
|
if (!options.headers) { options.headers = {} }
|
||||||
host: `${this.id}.localhost:${this.port}`,
|
options.headers.host = `${this.id}.localhost:${this.port}`
|
||||||
});
|
return request(`http://127.0.0.1:${this.port}${apiPrefix.KUBE_BASE}${path}`, options)
|
||||||
return request(url, opts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async getConnectionStatus() {
|
protected async getConnectionStatus() {
|
||||||
|
|||||||
@ -19,7 +19,7 @@ import { getFreePort } from "./port"
|
|||||||
import { mangleProxyEnv } from "./proxy-env"
|
import { mangleProxyEnv } from "./proxy-env"
|
||||||
import { findMainWebContents } from "./webcontents"
|
import { findMainWebContents } from "./webcontents"
|
||||||
import { registerStaticProtocol } from "../common/register-static";
|
import { registerStaticProtocol } from "../common/register-static";
|
||||||
import { isMac } from "../common/vars";
|
import { isMac, vueAppName } from "../common/vars";
|
||||||
|
|
||||||
mangleProxyEnv()
|
mangleProxyEnv()
|
||||||
if (app.commandLine.getSwitchValue("proxy-server") !== "") {
|
if (app.commandLine.getSwitchValue("proxy-server") !== "") {
|
||||||
@ -31,7 +31,7 @@ let windowManager: WindowManager = null;
|
|||||||
let clusterManager: ClusterManager = null;
|
let clusterManager: ClusterManager = null;
|
||||||
|
|
||||||
const vmURL = formatUrl({
|
const vmURL = formatUrl({
|
||||||
pathname: path.join(__dirname, "index.html"),
|
pathname: path.join(__dirname, `${vueAppName}.html`),
|
||||||
protocol: "file",
|
protocol: "file",
|
||||||
slashes: true,
|
slashes: true,
|
||||||
})
|
})
|
||||||
@ -132,8 +132,3 @@ app.on("will-quit", async (event) => {
|
|||||||
if (clusterManager) clusterManager.stop()
|
if (clusterManager) clusterManager.stop()
|
||||||
app.exit(0);
|
app.exit(0);
|
||||||
})
|
})
|
||||||
|
|
||||||
// todo: auto-restart app in dev-mode
|
|
||||||
// if (isDevelopment) {
|
|
||||||
// require('electron-reloader')(module);
|
|
||||||
// }
|
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import { BrowserWindow, shell } from "electron"
|
|||||||
import { PromiseIpc } from "electron-promise-ipc"
|
import { PromiseIpc } from "electron-promise-ipc"
|
||||||
import windowStateKeeper from "electron-window-state"
|
import windowStateKeeper from "electron-window-state"
|
||||||
import { tracker } from "./tracker";
|
import { tracker } from "./tracker";
|
||||||
import { isDevelopment } from "../common/vars";
|
|
||||||
import { getStaticUrl } from "../common/register-static";
|
import { getStaticUrl } from "../common/register-static";
|
||||||
|
|
||||||
export class WindowManager {
|
export class WindowManager {
|
||||||
@ -45,7 +44,6 @@ export class WindowManager {
|
|||||||
backgroundColor: "#1e2124",
|
backgroundColor: "#1e2124",
|
||||||
titleBarStyle: "hidden",
|
titleBarStyle: "hidden",
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
devTools: isDevelopment,
|
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
webviewTag: true
|
webviewTag: true
|
||||||
},
|
},
|
||||||
|
|||||||
@ -7,8 +7,8 @@ export default function (): webpack.Configuration {
|
|||||||
return {
|
return {
|
||||||
context: __dirname,
|
context: __dirname,
|
||||||
target: "electron-main",
|
target: "electron-main",
|
||||||
devtool: "source-map",
|
|
||||||
mode: isProduction ? "production" : "development",
|
mode: isProduction ? "production" : "development",
|
||||||
|
devtool: isProduction ? "source-map" : "cheap-eval-source-map",
|
||||||
cache: isDevelopment,
|
cache: isDevelopment,
|
||||||
entry: {
|
entry: {
|
||||||
main: path.resolve(mainDir, "index.ts"),
|
main: path.resolve(mainDir, "index.ts"),
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
|||||||
import TerserPlugin from "terser-webpack-plugin";
|
import TerserPlugin from "terser-webpack-plugin";
|
||||||
import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin"
|
import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin"
|
||||||
import { VueLoaderPlugin } from "vue-loader"
|
import { VueLoaderPlugin } from "vue-loader"
|
||||||
import { htmlTemplate, isDevelopment, isProduction, outDir, rendererDir, sassCommonVars } from "./src/common/vars";
|
import { htmlTemplate, isDevelopment, isProduction, outDir, reactAppName, rendererDir, sassCommonVars, vueAppName } from "./src/common/vars";
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
webpackConfigReact,
|
webpackConfigReact,
|
||||||
@ -16,11 +16,11 @@ export function webpackConfigReact(): webpack.Configuration {
|
|||||||
return {
|
return {
|
||||||
context: __dirname,
|
context: __dirname,
|
||||||
target: "electron-renderer",
|
target: "electron-renderer",
|
||||||
devtool: "source-map",
|
devtool: isProduction ? "source-map" : "cheap-eval-source-map",
|
||||||
mode: isProduction ? "production" : "development",
|
mode: isProduction ? "production" : "development",
|
||||||
cache: isDevelopment,
|
cache: isDevelopment,
|
||||||
entry: {
|
entry: {
|
||||||
renderer: path.resolve(rendererDir, "components/app.tsx"),
|
[reactAppName]: path.resolve(rendererDir, "components/app.tsx"),
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
path: outDir,
|
path: outDir,
|
||||||
@ -34,7 +34,7 @@ export function webpackConfigReact(): webpack.Configuration {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
optimization: {
|
optimization: {
|
||||||
minimize: false,
|
minimize: isProduction,
|
||||||
minimizer: [
|
minimizer: [
|
||||||
new TerserPlugin({
|
new TerserPlugin({
|
||||||
cache: true,
|
cache: true,
|
||||||
@ -64,7 +64,7 @@ export function webpackConfigReact(): webpack.Configuration {
|
|||||||
{
|
{
|
||||||
loader: "ts-loader",
|
loader: "ts-loader",
|
||||||
options: {
|
options: {
|
||||||
transpileOnly: false, // fixme: enable types resolution with ts-fork-checker
|
transpileOnly: true,
|
||||||
compilerOptions: {
|
compilerOptions: {
|
||||||
// localization support
|
// localization support
|
||||||
// https://lingui.js.org/guides/typescript.html
|
// https://lingui.js.org/guides/typescript.html
|
||||||
@ -111,8 +111,7 @@ export function webpackConfigReact(): webpack.Configuration {
|
|||||||
},
|
},
|
||||||
|
|
||||||
plugins: [
|
plugins: [
|
||||||
// fixme: enable with transpileOnly=true
|
new ForkTsCheckerPlugin(),
|
||||||
// new ForkTsCheckerPlugin(),
|
|
||||||
|
|
||||||
// todo: check if this actually works in mode=production files
|
// todo: check if this actually works in mode=production files
|
||||||
// new webpack.DllReferencePlugin({
|
// new webpack.DllReferencePlugin({
|
||||||
@ -121,6 +120,12 @@ export function webpackConfigReact(): webpack.Configuration {
|
|||||||
// sourceType: libraryTarget,
|
// sourceType: libraryTarget,
|
||||||
// }),
|
// }),
|
||||||
|
|
||||||
|
new HtmlWebpackPlugin({
|
||||||
|
filename: `${reactAppName}.html`,
|
||||||
|
template: htmlTemplate,
|
||||||
|
inject: true,
|
||||||
|
}),
|
||||||
|
|
||||||
new MiniCssExtractPlugin({
|
new MiniCssExtractPlugin({
|
||||||
filename: "[name].css",
|
filename: "[name].css",
|
||||||
}),
|
}),
|
||||||
@ -133,16 +138,15 @@ export function webpackConfigVue(): webpack.Configuration {
|
|||||||
|
|
||||||
config.resolve.extensions.push(".vue");
|
config.resolve.extensions.push(".vue");
|
||||||
|
|
||||||
|
config.entry = {
|
||||||
|
[vueAppName]: path.resolve(rendererDir, "_vue/index.js")
|
||||||
|
}
|
||||||
config.resolve.alias = {
|
config.resolve.alias = {
|
||||||
"@": rendererDir,
|
"@": rendererDir,
|
||||||
"vue$": "vue/dist/vue.esm.js",
|
"vue$": "vue/dist/vue.esm.js",
|
||||||
"vue-router$": "vue-router/dist/vue-router.esm.js",
|
"vue-router$": "vue-router/dist/vue-router.esm.js",
|
||||||
}
|
}
|
||||||
|
|
||||||
config.entry = {
|
|
||||||
renderer_vue: path.resolve(rendererDir, "_vue/index.js")
|
|
||||||
}
|
|
||||||
|
|
||||||
// rules and loaders
|
// rules and loaders
|
||||||
config.module.rules = config.module.rules
|
config.module.rules = config.module.rules
|
||||||
.filter(({ test }: { test: RegExp }) => !test.test(".ts"))
|
.filter(({ test }: { test: RegExp }) => !test.test(".ts"))
|
||||||
@ -189,6 +193,7 @@ export function webpackConfigVue(): webpack.Configuration {
|
|||||||
new ForkTsCheckerPlugin(),
|
new ForkTsCheckerPlugin(),
|
||||||
|
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
|
filename: `${vueAppName}.html`,
|
||||||
template: htmlTemplate,
|
template: htmlTemplate,
|
||||||
inject: true,
|
inject: true,
|
||||||
}),
|
}),
|
||||||
|
|||||||
30
yarn.lock
30
yarn.lock
@ -3521,7 +3521,7 @@ chokidar@^2.1.8:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
fsevents "^1.2.7"
|
fsevents "^1.2.7"
|
||||||
|
|
||||||
chokidar@^3.3.1, chokidar@^3.4.0:
|
chokidar@^3.4.0:
|
||||||
version "3.4.0"
|
version "3.4.0"
|
||||||
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.4.0.tgz#b30611423ce376357c765b9b8f904b9fba3c0be8"
|
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.4.0.tgz#b30611423ce376357c765b9b8f904b9fba3c0be8"
|
||||||
integrity sha512-aXAaho2VJtisB/1fg1+3nlLJqGOuewTzQpd/Tz0yTg2R0e4IGtshYvtjowyEumcBv2z+y4+kc75Mz7j5xJskcQ==
|
integrity sha512-aXAaho2VJtisB/1fg1+3nlLJqGOuewTzQpd/Tz0yTg2R0e4IGtshYvtjowyEumcBv2z+y4+kc75Mz7j5xJskcQ==
|
||||||
@ -4214,13 +4214,6 @@ date-fns@^2.0.1, date-fns@^2.14.0:
|
|||||||
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.14.0.tgz#359a87a265bb34ef2e38f93ecf63ac453f9bc7ba"
|
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.14.0.tgz#359a87a265bb34ef2e38f93ecf63ac453f9bc7ba"
|
||||||
integrity sha512-1zD+68jhFgDIM0rF05rcwYO8cExdNqxjq4xP1QKM60Q45mnO6zaMWB4tOzrIr4M4GSLntsKeE4c9Bdl2jhL/yw==
|
integrity sha512-1zD+68jhFgDIM0rF05rcwYO8cExdNqxjq4xP1QKM60Q45mnO6zaMWB4tOzrIr4M4GSLntsKeE4c9Bdl2jhL/yw==
|
||||||
|
|
||||||
date-time@^3.1.0:
|
|
||||||
version "3.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/date-time/-/date-time-3.1.0.tgz#0d1e934d170579f481ed8df1e2b8ff70ee845e1e"
|
|
||||||
integrity sha512-uqCUKXE5q1PNBXjPqvwhwJf9SwMoAHBgWJ6DcrnS5o+W2JOiIILl0JEdVD8SGujrNS02GGxgwAg2PN2zONgtjg==
|
|
||||||
dependencies:
|
|
||||||
time-zone "^1.0.0"
|
|
||||||
|
|
||||||
de-indent@^1.0.2:
|
de-indent@^1.0.2:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d"
|
resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d"
|
||||||
@ -4628,11 +4621,6 @@ electron-download@^4.1.0, electron-download@^4.1.1:
|
|||||||
semver "^5.4.1"
|
semver "^5.4.1"
|
||||||
sumchecker "^2.0.2"
|
sumchecker "^2.0.2"
|
||||||
|
|
||||||
electron-is-dev@^1.1.0:
|
|
||||||
version "1.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/electron-is-dev/-/electron-is-dev-1.2.0.tgz#2e5cea0a1b3ccf1c86f577cee77363ef55deb05e"
|
|
||||||
integrity sha512-R1oD5gMBPS7PVU8gJwH6CtT0e6VSoD0+SzSnYpNm+dBkcijgA+K7VAMHDfnRq/lkKPZArpzplTW6jfiMYosdzw==
|
|
||||||
|
|
||||||
electron-notarize@^0.3.0:
|
electron-notarize@^0.3.0:
|
||||||
version "0.3.0"
|
version "0.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/electron-notarize/-/electron-notarize-0.3.0.tgz#b93c606306eac558b250c78ff95273ddb9fedf0a"
|
resolved "https://registry.yarnpkg.com/electron-notarize/-/electron-notarize-0.3.0.tgz#b93c606306eac558b250c78ff95273ddb9fedf0a"
|
||||||
@ -4665,17 +4653,6 @@ electron-publish@22.7.0:
|
|||||||
lazy-val "^1.0.4"
|
lazy-val "^1.0.4"
|
||||||
mime "^2.4.5"
|
mime "^2.4.5"
|
||||||
|
|
||||||
electron-reloader@^1.0.1:
|
|
||||||
version "1.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/electron-reloader/-/electron-reloader-1.0.1.tgz#15b193219b6583aedd2c95fa143d9bfc244bfdec"
|
|
||||||
integrity sha512-jVLK4SMvLRI8bWMTLtcyoRcmntTWcDrLUFt5QefgdcgQwN8uKi05SMJ8dW+9yD+PM1ESuyE//poBHVmucV4vUg==
|
|
||||||
dependencies:
|
|
||||||
chalk "^3.0.0"
|
|
||||||
chokidar "^3.3.1"
|
|
||||||
date-time "^3.1.0"
|
|
||||||
electron-is-dev "^1.1.0"
|
|
||||||
find-up "^4.1.0"
|
|
||||||
|
|
||||||
electron-serve@^1.0.0:
|
electron-serve@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/electron-serve/-/electron-serve-1.0.0.tgz#babf2f5022102fa300a841d91e4c2e7048ac4b1f"
|
resolved "https://registry.yarnpkg.com/electron-serve/-/electron-serve-1.0.0.tgz#babf2f5022102fa300a841d91e4c2e7048ac4b1f"
|
||||||
@ -10780,11 +10757,6 @@ through@2, through@^2.3.6:
|
|||||||
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
|
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
|
||||||
integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=
|
integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=
|
||||||
|
|
||||||
time-zone@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/time-zone/-/time-zone-1.0.0.tgz#99c5bf55958966af6d06d83bdf3800dc82faec5d"
|
|
||||||
integrity sha1-mcW/VZWJZq9tBtg73zgA3IL67F0=
|
|
||||||
|
|
||||||
timed-out@^4.0.1:
|
timed-out@^4.0.1:
|
||||||
version "4.0.1"
|
version "4.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f"
|
resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user