1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/renderer/components/dock/edit-resource/view.tsx
Sebastian Malton 24e8861a1a
Release/v6.0.2 alpha.0 (#6116)
* Fix create release PR to cherry-pick commits

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix create release PR to cherry-pick commits

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* release v6.0.2-alpha.0

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix Badges being too small when scrollable and not expandable (#5987)

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Remove Tabs hover line width transition (#6020)

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Fix distribution detector erroneously depending on previous metadata (#6023)

Signed-off-by: Sebastian Malton <sebastian@malton.name>

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Override @astronautlabs/jsonpath's underscore version (#6044)

* Override @astronautlabs/jsonpath's underscore version

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Remove use of buggy 'yarn check'

Signed-off-by: Sebastian Malton <sebastian@malton.name>

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Don't error out if we can't find resources from helm in our cluster, and handle "blank" output from kubectl gracefully. (#6039)

* Use official node-fetch 2.x (#6049)

* Fix UI for scaling ReplicaSets (#6052)

* Use color-scheme: auto on all iframes (#6074)

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Use abort-controller package to fix typing issues (#6077)

* Use default export to fix issue with package lying with types (#6081)

Signed-off-by: Sebastian Malton <sebastian@malton.name>

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Switch ubuntu CI to ubuntu-20.04 (#6078)

Signed-off-by: Sebastian Malton <sebastian@malton.name>

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix <Select/> text overflow below baseline (#6085)

* Fix: do not crop <Select/> single value

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Fix: do not crop namespace selector placeholder

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Align working dir input height with others

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Linter fix

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Prevent massed remounting of dock tabs when dock height changes (#6104)

* Update injectable to make withInjectables have authentic React reconciliation

Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Make some dock tabs have primitive props to have them React reconcile properly

Currently tab objects that are stored in a storage change reference on every change of dock height, making them less usable as React prop for causing involuntary remounting.

Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Fix node conditions column text-align (#6092)

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Make cluster #app component transparent (#6076)

until theme ready

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Fix badge not expanding on click when appropriate (#6029)

* Fix badge not expanding on click when appropriate

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix snapshots

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix snapshots

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Update other snapshots

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Remove unneccessary code

Signed-off-by: Sebastian Malton <sebastian@malton.name>

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Disable fail-fast on the testing CI jobs (#6080)

- There are several reasons why these might fail that are irrelavent to
  the other pipelines. So we should just let them continue

Signed-off-by: Sebastian Malton <sebastian@malton.name>

Signed-off-by: Sebastian Malton <sebastian@malton.name>

Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
Co-authored-by: Alex Andreev <alex.andreev.email@gmail.com>
Co-authored-by: Michael Pearson <mipearson@gmail.com>
Co-authored-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
Co-authored-by: Carlos René Mederos Arias <krlosmederos@gmail.com>
Co-authored-by: Janne Savolainen <janne.savolainen@live.fi>
2022-08-26 15:13:13 -04:00

85 lines
2.7 KiB
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import React from "react";
import { observer } from "mobx-react";
import { Spinner } from "../../spinner";
import { withInjectables } from "@ogre-tools/injectable-react";
import type { EditResourceModel } from "./edit-resource-model/edit-resource-model.injectable";
import editResourceModelInjectable from "./edit-resource-model/edit-resource-model.injectable";
import { EditorPanel } from "../editor-panel";
import { InfoPanel } from "../info-panel";
import { Badge } from "../../badge";
import { Notice } from "../../+extensions/notice";
export interface EditResourceProps {
tabId: string;
}
interface Dependencies {
model: EditResourceModel;
}
const NonInjectedEditResource = observer(
({ model, tabId }: EditResourceProps & Dependencies) => {
return (
<div className="EditResource flex column">
{model.shouldShowErrorAboutNoResource && (
<Notice>
Resource not found
</Notice>
)}
{!model.shouldShowErrorAboutNoResource && (
<>
<InfoPanel
tabId={tabId}
error={model.configuration.error.value.get()}
submit={model.save}
showNotifications={false}
submitLabel="Save"
submittingMessage="Applying..."
submitTestId={`save-edit-resource-from-tab-for-${tabId}`}
submitAndCloseTestId={`save-and-close-edit-resource-from-tab-for-${tabId}`}
cancelTestId={`cancel-edit-resource-from-tab-for-${tabId}`}
submittingTestId={`saving-edit-resource-from-tab-for-${tabId}`}
controls={(
<div className="resource-info flex gaps align-center">
<span>Kind:</span>
<Badge label={model.kind} />
<span>Name:</span>
<Badge label={model.name} />
<span>Namespace:</span>
<Badge label={model.namespace} />
</div>
)}
/>
<EditorPanel
tabId={tabId}
value={model.configuration.value.get()}
onChange={model.configuration.onChange}
onError={model.configuration.error.onChange}
/>
</>
)}
</div>
);
},
);
export const EditResource = withInjectables<Dependencies, EditResourceProps>(
NonInjectedEditResource,
{
getPlaceholder: () => (
<Spinner center data-testid="edit-resource-tab-spinner" />
),
getProps: async (di, props) => ({
model: await di.inject(editResourceModelInjectable, props.tabId),
...props,
}),
},
);