mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Merge remote-tracking branch 'origin/master' into eliminate-gst-from-app-paths
This commit is contained in:
commit
00f6d6bc1f
@ -239,8 +239,9 @@ export abstract class KubeObjectStore<T extends KubeObject> extends ItemStore<T>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
async loadAll({ namespaces = this.context.contextNamespaces, merge = true, reqInit, onLoadFailure }: KubeObjectStoreLoadAllParams = {}): Promise<void | T[]> {
|
async loadAll({ namespaces, merge = true, reqInit, onLoadFailure }: KubeObjectStoreLoadAllParams = {}): Promise<void | T[]> {
|
||||||
await this.contextReady;
|
await this.contextReady;
|
||||||
|
namespaces ??= this.context.contextNamespaces;
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -135,10 +135,7 @@ class PageRegistry extends BaseRegistry<PageRegistration, RegisteredPage> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (notAStringValue && !(parse || stringify)) {
|
if (notAStringValue && !(parse || stringify)) {
|
||||||
throw new Error(
|
throw new Error(`PageRegistry: param's "${paramName}" initialization has failed: paramInit.parse() and paramInit.stringify() are required for non string | string[] "defaultValue"`);
|
||||||
`PageRegistry: param's "${paramName}" initialization has failed:
|
|
||||||
paramInit.parse() and paramInit.stringify() are required for non string | string[] "defaultValue"`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
paramInit.defaultValue = value;
|
paramInit.defaultValue = value;
|
||||||
|
|||||||
@ -26,6 +26,9 @@ import logTabStoreInjectable from "../../renderer/components/dock/log-tab-store/
|
|||||||
import { asLegacyGlobalSingletonForExtensionApi } from "../as-legacy-globals-for-extension-api/as-legacy-global-singleton-for-extension-api";
|
import { asLegacyGlobalSingletonForExtensionApi } from "../as-legacy-globals-for-extension-api/as-legacy-global-singleton-for-extension-api";
|
||||||
import { TerminalStore as TerminalStoreClass } from "../../renderer/components/dock/terminal-store/terminal.store";
|
import { TerminalStore as TerminalStoreClass } from "../../renderer/components/dock/terminal-store/terminal.store";
|
||||||
|
|
||||||
|
import commandOverlayInjectable from "../../renderer/components/command-palette/command-overlay.injectable";
|
||||||
|
import { asLegacyGlobalObjectForExtensionApi } from "../as-legacy-globals-for-extension-api/as-legacy-global-object-for-extension-api";
|
||||||
|
|
||||||
// layouts
|
// layouts
|
||||||
export * from "../../renderer/components/layout/main-layout";
|
export * from "../../renderer/components/layout/main-layout";
|
||||||
export * from "../../renderer/components/layout/setting-layout";
|
export * from "../../renderer/components/layout/setting-layout";
|
||||||
@ -43,7 +46,7 @@ export * from "../../renderer/components/switch";
|
|||||||
export * from "../../renderer/components/input/input";
|
export * from "../../renderer/components/input/input";
|
||||||
|
|
||||||
// command-overlay
|
// command-overlay
|
||||||
export { CommandOverlay } from "../../renderer/components/command-palette";
|
export const CommandOverlay = asLegacyGlobalObjectForExtensionApi(commandOverlayInjectable);
|
||||||
|
|
||||||
// other components
|
// other components
|
||||||
export * from "../../renderer/components/icon";
|
export * from "../../renderer/components/icon";
|
||||||
|
|||||||
@ -33,6 +33,7 @@ import { defaultPackageMirror, packageMirrors } from "../../common/user-store/pr
|
|||||||
import got from "got/dist/source";
|
import got from "got/dist/source";
|
||||||
import { promisify } from "util";
|
import { promisify } from "util";
|
||||||
import stream from "stream";
|
import stream from "stream";
|
||||||
|
import { noop } from "../renderer/utils";
|
||||||
|
|
||||||
const bundledVersion = getBundledKubectlVersion();
|
const bundledVersion = getBundledKubectlVersion();
|
||||||
const kubectlMap: Map<string, string> = new Map([
|
const kubectlMap: Map<string, string> = new Map([
|
||||||
@ -314,8 +315,14 @@ export class Kubectl {
|
|||||||
const fileWriteStream = fs.createWriteStream(this.path, { mode: 0o755 });
|
const fileWriteStream = fs.createWriteStream(this.path, { mode: 0o755 });
|
||||||
const pipeline = promisify(stream.pipeline);
|
const pipeline = promisify(stream.pipeline);
|
||||||
|
|
||||||
|
try {
|
||||||
await pipeline(downloadStream, fileWriteStream);
|
await pipeline(downloadStream, fileWriteStream);
|
||||||
|
await fs.promises.chmod(this.path, 0o755);
|
||||||
logger.debug("kubectl binary download finished");
|
logger.debug("kubectl binary download finished");
|
||||||
|
} catch (error) {
|
||||||
|
await fs.promises.unlink(this.path).catch(noop);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async writeInitScripts() {
|
protected async writeInitScripts() {
|
||||||
|
|||||||
@ -1,22 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2021 OpenLens Authors
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
* this software and associated documentation files (the "Software"), to deal in
|
|
||||||
* the Software without restriction, including without limitation the rights to
|
|
||||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
||||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
* subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
||||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
||||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export * from "./not-found";
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2021 OpenLens Authors
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
* this software and associated documentation files (the "Software"), to deal in
|
|
||||||
* the Software without restriction, including without limitation the rights to
|
|
||||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
||||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
* subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
||||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
||||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import React from "react";
|
|
||||||
import { TabLayout } from "../layout/tab-layout";
|
|
||||||
|
|
||||||
export class NotFound extends React.Component {
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<TabLayout className="NotFound" contentClass="flex">
|
|
||||||
<p className="box center">
|
|
||||||
Page not found
|
|
||||||
</p>
|
|
||||||
</TabLayout>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -23,7 +23,6 @@ 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";
|
||||||
import { NotFound } from "../../components/+404";
|
|
||||||
import { UserManagement } from "../../components/+user-management/user-management";
|
import { UserManagement } from "../../components/+user-management/user-management";
|
||||||
import { ConfirmDialog } from "../../components/confirm-dialog";
|
import { ConfirmDialog } from "../../components/confirm-dialog";
|
||||||
import { ClusterOverview } from "../../components/+cluster/cluster-overview";
|
import { ClusterOverview } from "../../components/+cluster/cluster-overview";
|
||||||
@ -170,7 +169,13 @@ class NonInjectedClusterFrame extends React.Component<Dependencies> {
|
|||||||
{this.renderExtensionTabLayoutRoutes()}
|
{this.renderExtensionTabLayoutRoutes()}
|
||||||
{this.renderExtensionRoutes()}
|
{this.renderExtensionRoutes()}
|
||||||
<Redirect exact from="/" to={this.startUrl}/>
|
<Redirect exact from="/" to={this.startUrl}/>
|
||||||
<Route component={NotFound}/>
|
|
||||||
|
<Route render={({ location }) => {
|
||||||
|
Notifications.error(`Unknown location ${location.pathname}, redirecting to main page.`);
|
||||||
|
|
||||||
|
return <Redirect to={this.startUrl} />;
|
||||||
|
}} />
|
||||||
|
|
||||||
</Switch>
|
</Switch>
|
||||||
</MainLayout>
|
</MainLayout>
|
||||||
<Notifications/>
|
<Notifications/>
|
||||||
|
|||||||
@ -48,31 +48,18 @@ export class PortForwardStore extends ItemStore<PortForwardItem> {
|
|||||||
|
|
||||||
const savedPortForwards = this.dependencies.storage.get(); // undefined on first load
|
const savedPortForwards = this.dependencies.storage.get(); // undefined on first load
|
||||||
|
|
||||||
if (Array.isArray(savedPortForwards)) {
|
if (Array.isArray(savedPortForwards) && savedPortForwards.length > 0) {
|
||||||
logger.info("[PORT-FORWARD-STORE] starting saved port-forwards");
|
logger.info("[PORT-FORWARD-STORE] starting saved port-forwards");
|
||||||
|
|
||||||
// add the disabled ones
|
// add the disabled ones
|
||||||
await Promise.all(
|
await Promise.all(savedPortForwards.filter(pf => pf.status === "Disabled").map(this.add));
|
||||||
savedPortForwards
|
|
||||||
.filter((pf) => pf.status === "Disabled")
|
|
||||||
.map(this.add),
|
|
||||||
);
|
|
||||||
|
|
||||||
// add the active ones and check if they started successfully
|
// add the active ones (assume active if the status is undefined, for backward compatibility) and check if they started successfully
|
||||||
const results = await Promise.allSettled(
|
const results = await Promise.allSettled(savedPortForwards.filter(pf => !pf.status || pf.status === "Active").map(this.add));
|
||||||
savedPortForwards
|
|
||||||
.filter((pf) => pf.status === "Active")
|
|
||||||
.map(this.add),
|
|
||||||
);
|
|
||||||
|
|
||||||
for (const result of results) {
|
for (const result of results) {
|
||||||
if (
|
if (result.status === "rejected" || result.value.status === "Disabled") {
|
||||||
result.status === "rejected" ||
|
notifyErrorPortForwarding("One or more port-forwards could not be started");
|
||||||
result.value.status === "Disabled"
|
|
||||||
) {
|
|
||||||
notifyErrorPortForwarding(
|
|
||||||
"One or more port-forwards could not be started",
|
|
||||||
);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user