1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Use monaco in config map details

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2022-12-26 12:36:20 +03:00
parent 97551bb7f0
commit 8cf12da6f8

View File

@ -10,7 +10,6 @@ import { autorun, makeObservable, observable } from "mobx";
import { disposeOnUnmount, observer } from "mobx-react"; import { disposeOnUnmount, observer } from "mobx-react";
import { DrawerTitle } from "../drawer"; import { DrawerTitle } from "../drawer";
import type { ShowNotification } from "../notifications"; import type { ShowNotification } from "../notifications";
import { Input } from "../input";
import { Button } from "../button"; import { Button } from "../button";
import type { KubeObjectDetailsProps } from "../kube-object-details"; import type { KubeObjectDetailsProps } from "../kube-object-details";
import { ConfigMap } from "../../../common/k8s-api/endpoints"; import { ConfigMap } from "../../../common/k8s-api/endpoints";
@ -21,6 +20,7 @@ import configMapStoreInjectable from "./store.injectable";
import showSuccessNotificationInjectable from "../notifications/show-success-notification.injectable"; import showSuccessNotificationInjectable from "../notifications/show-success-notification.injectable";
import showErrorNotificationInjectable from "../notifications/show-error-notification.injectable"; import showErrorNotificationInjectable from "../notifications/show-error-notification.injectable";
import loggerInjectable from "../../../common/logger.injectable"; import loggerInjectable from "../../../common/logger.injectable";
import { MonacoEditor } from "../monaco-editor";
export interface ConfigMapDetailsProps extends KubeObjectDetailsProps<ConfigMap> { export interface ConfigMapDetailsProps extends KubeObjectDetailsProps<ConfigMap> {
} }
@ -102,16 +102,14 @@ class NonInjectedConfigMapDetails extends React.Component<ConfigMapDetailsProps
data.map(([name, value]) => ( data.map(([name, value]) => (
<div key={name} className="data"> <div key={name} className="data">
<div className="name">{name}</div> <div className="name">{name}</div>
<div className="flex gaps align-flex-start"> <MonacoEditor
<Input id={`config-map-data-${name}`}
multiLine style={{ resize: "vertical", overflow: "hidden" }}
theme="round-black" value={value || ""}
className="box grow"
value={value}
onChange={v => this.data.set(name, v)} onChange={v => this.data.set(name, v)}
setInitialHeight
/> />
</div> </div>
</div>
)) ))
} }
<Button <Button