diff --git a/src/renderer/components/+network-port-forwards/index.ts b/src/renderer/components/+network-port-forwards/index.ts index 73091cfc84..2b0c81f833 100644 --- a/src/renderer/components/+network-port-forwards/index.ts +++ b/src/renderer/components/+network-port-forwards/index.ts @@ -20,4 +20,3 @@ */ export * from "./port-forwards"; -export * from "./port-forward-details"; diff --git a/src/renderer/components/+network-port-forwards/port-forward-details.scss b/src/renderer/components/+network-port-forwards/port-forward-details.scss deleted file mode 100644 index 8a0fec0992..0000000000 --- a/src/renderer/components/+network-port-forwards/port-forward-details.scss +++ /dev/null @@ -1,26 +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. - */ - -.PortForwardDetails { - .SubTitle { - text-transform: none - } -} \ No newline at end of file diff --git a/src/renderer/components/+network-port-forwards/port-forward-details.tsx b/src/renderer/components/+network-port-forwards/port-forward-details.tsx deleted file mode 100644 index 8979a201c1..0000000000 --- a/src/renderer/components/+network-port-forwards/port-forward-details.tsx +++ /dev/null @@ -1,41 +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 "./port-forward-details.scss"; - -import React from "react"; -import { observer } from "mobx-react"; -import type { PortForwardItem } from "../../port-forward"; - -interface Props { - portForward: PortForwardItem; - hideDetails(): void; -} - -@observer -export class PortForwardDetails extends React.Component { - render() { - return ( -
-
- ); - } -} diff --git a/src/renderer/components/+network-port-forwards/port-forwards.tsx b/src/renderer/components/+network-port-forwards/port-forwards.tsx index c5123156de..f026fb7e20 100644 --- a/src/renderer/components/+network-port-forwards/port-forwards.tsx +++ b/src/renderer/components/+network-port-forwards/port-forwards.tsx @@ -23,12 +23,8 @@ import "./port-forwards.scss"; import React from "react"; import { disposeOnUnmount, observer } from "mobx-react"; -import type { RouteComponentProps } from "react-router-dom"; import { ItemListLayout } from "../item-object-list/item-list-layout"; import { PortForwardItem, portForwardStore } from "../../port-forward"; -import { PortForwardsRouteParams, portForwardsURL } from "../../../common/routes"; -import { navigation } from "../../navigation"; -import { PortForwardDetails } from "./port-forward-details"; import { PortForwardMenu } from "./port-forward-menu"; enum columnId { @@ -39,11 +35,8 @@ enum columnId { forwardPort = "forwardPort", } -interface Props extends RouteComponentProps { -} - @observer -export class PortForwards extends React.Component { +export class PortForwards extends React.Component { componentDidMount() { disposeOnUnmount(this, [ @@ -51,26 +44,6 @@ export class PortForwards extends React.Component { ]); } - get selectedPortForward() { - const { match: { params: { forwardport } } } = this.props; - - return portForwardStore.items.find(pf => { - return pf.getForwardPort() == forwardport; - }); - } - - showDetails = (item: PortForwardItem) => { - navigation.push(portForwardsURL({ - params: { - forwardport: item.getForwardPort(), - } - })); - }; - - hideDetails = () => { - navigation.push(portForwardsURL()); - }; - renderRemoveDialogMessage(selectedItems: PortForwardItem[]) { const forwardPorts = selectedItems.map(item => item.getForwardPort()).join(", "); @@ -123,12 +96,6 @@ export class PortForwards extends React.Component { customizeRemoveDialog={selectedItems => ({ message: this.renderRemoveDialogMessage(selectedItems) })} - detailsItem={this.selectedPortForward} - onDetails={this.showDetails} - /> - ); diff --git a/src/renderer/port-forward/port-forward.store.ts b/src/renderer/port-forward/port-forward.store.ts index 3336b8802b..a6f43eaf14 100644 --- a/src/renderer/port-forward/port-forward.store.ts +++ b/src/renderer/port-forward/port-forward.store.ts @@ -136,11 +136,11 @@ export async function addPortForward(portForward: ForwardedPort): Promise(`/pods/${portForward.namespace}/${portForward.kind}/${portForward.name}/port-forward/${portForward.port}/${portForward.forwardPort}`, {}); - if (response?.port != +portForward.forwardPort) { - logger.info(`specified ${portForward.forwardPort} got ${response.port}`); + if (response?.port && response.port != +portForward.forwardPort) { + logger.warn(`specified ${portForward.forwardPort} got ${response.port}`); } } catch (error) { - logger.error(error); + logger.warn(error); // don't care, caller must check } portForwardStore.reset(); @@ -153,7 +153,7 @@ export async function getPortForward(portForward: ForwardedPort): Promise(`/pods/${portForward.namespace}/${portForward.kind}/${portForward.name}/port-forward/${portForward.port}/${portForward.forwardPort}`, {}); } catch (error) { - logger.error(error); + logger.warn(error); // don't care, caller must check } return response?.port; @@ -167,7 +167,7 @@ export async function modifyPortForward(portForward: ForwardedPort, desiredPort: portForward.forwardPort = desiredPort.toString(); port = await addPortForward(portForward); } catch (error) { - logger.error(error); + logger.warn(error); // don't care, caller must check } portForwardStore.reset(); @@ -180,7 +180,7 @@ export async function removePortForward(portForward: ForwardedPort) { await apiBase.del(`/pods/${portForward.namespace}/${portForward.kind}/${portForward.name}/port-forward/${portForward.port}/${portForward.forwardPort}`, {}); await waitUntilFree(+portForward.forwardPort, 200, 1000); } catch (error) { - logger.error(error); + logger.warn(error); // don't care, caller must check } portForwardStore.reset(); } @@ -191,7 +191,7 @@ export async function getPortForwards(): Promise { return response.portForwards; } catch (error) { - logger.error(error); + logger.warn(error); // don't care, caller must check return []; }