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

Use entity name if preferences name is empty

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2021-09-08 11:25:48 +03:00
parent 219f2be0a4
commit 8a8edd0450
2 changed files with 4 additions and 2 deletions

View File

@ -42,7 +42,7 @@ export function GeneralSettings({ entity }: EntitySettingViewProps) {
<section>
<div className="flex">
<div className="flex-grow pr-8">
<components.ClusterNameSetting cluster={cluster} />
<components.ClusterNameSetting cluster={cluster} entity={entity as KubernetesCluster} />
</div>
<div>
<components.ClusterIconSetting cluster={cluster} entity={entity as KubernetesCluster} />

View File

@ -26,9 +26,11 @@ import { observable, autorun, makeObservable } from "mobx";
import { observer, disposeOnUnmount } from "mobx-react";
import { SubTitle } from "../../layout/sub-title";
import { isRequired } from "../../input/input_validators";
import type { KubernetesCluster } from "../../../../common/catalog-entities";
interface Props {
cluster: Cluster;
entity: KubernetesCluster;
}
@observer
@ -43,7 +45,7 @@ export class ClusterNameSetting extends React.Component<Props> {
componentDidMount() {
disposeOnUnmount(this,
autorun(() => {
this.name = this.props.cluster.preferences.clusterName;
this.name = this.props.cluster.preferences.clusterName || this.props.entity.metadata.name;
})
);
}