Merge remote-tracking branch 'origin/master' into eliminate-gst-from-app-paths

This commit is contained in:
Janne Savolainen committed 2022-01-14 07:59:42 +02:00
commit 00f6d6bc1f
8 files changed
+29 -86

No files matched your search

-22
View File
@@ -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 { Redirect, Route, Router, Switch } from "react-router";
import { history } from "../../navigation";
import { NotFound } from "../../components/+404";
import { UserManagement } from "../../components/+user-management/user-management";
import { ConfirmDialog } from "../../components/confirm-dialog";
import { ClusterOverview } from "../../components/+cluster/cluster-overview";
@@ -170,7 +169,13 @@ class NonInjectedClusterFrame extends React.Component<Dependencies> {
{this.renderExtensionTabLayoutRoutes()}
{this.renderExtensionRoutes()}
<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>
</MainLayout>
<Notifications/>
@@ -48,31 +48,18 @@ export class PortForwardStore extends ItemStore<PortForwardItem> {
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");
// add the disabled ones
await Promise.all(
savedPortForwards
.filter((pf) => pf.status === "Disabled")
.map(this.add),
);
await Promise.all(savedPortForwards.filter(pf => pf.status === "Disabled").map(this.add));
// add the active ones and check if they started successfully
const results = await Promise.allSettled(
savedPortForwards
.filter((pf) => pf.status === "Active")
.map(this.add),
);
// 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(savedPortForwards.filter(pf => !pf.status || pf.status === "Active").map(this.add));
for (const result of results) {
if (
result.status === "rejected" ||
result.value.status === "Disabled"
) {
notifyErrorPortForwarding(
"One or more port-forwards could not be started",
);
if (result.status === "rejected" || result.value.status === "Disabled") {
notifyErrorPortForwarding("One or more port-forwards could not be started");
return;
}