mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix custom resources not having a fallback details component (#3542)
This commit is contained in:
1 parent
a6e91fc34a
commit
77077ef72c
4 files changed
+40
-32
No files matched your search
@@ -33,6 +33,8 @@ import { crdStore } from "../+custom-resources/crd.store";
|
||||
import { KubeObjectMenu } from "./kube-object-menu";
|
||||
import { KubeObjectDetailRegistry } from "../../api/kube-object-detail-registry";
|
||||
import logger from "../../../main/logger";
|
||||
import { CrdResourceDetails } from "../+custom-resources";
|
||||
import { KubeObjectMeta } from "./kube-object-meta";
|
||||
|
||||
/**
|
||||
* Used to store `object.selfLink` to show more info about resource in the details panel.
|
||||
@@ -111,10 +113,6 @@ export class KubeObjectDetails extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
@computed get isCrdInstance() {
|
||||
return !!crdStore.getByObject(this.object);
|
||||
}
|
||||
|
||||
@disposeOnUnmount
|
||||
loader = reaction(() => [
|
||||
this.path,
|
||||
@@ -169,6 +167,23 @@ export class KubeObjectDetails extends React.Component {
|
||||
<item.components.Details object={object} key={`object-details-${index}`} />
|
||||
));
|
||||
|
||||
if (details.length === 0) {
|
||||
const crd = crdStore.getByObject(object);
|
||||
|
||||
/**
|
||||
* This is a fallback so that if a custom resource object doesn't have
|
||||
* any defined details we should try and display at least some details
|
||||
*/
|
||||
if (crd) {
|
||||
details.push(<CrdResourceDetails key={object.getId()} object={object} crd={crd} />);
|
||||
}
|
||||
}
|
||||
|
||||
if (details.length === 0) {
|
||||
// if we still don't have any details to show, just show the standard object metadata
|
||||
details.push(<KubeObjectMeta key={object.getId()} object={object} />);
|
||||
}
|
||||
|
||||
return (
|
||||
<Drawer
|
||||
className="KubeObjectDetails flex column"
|
||||
|
||||
Reference in new issue
Block a user