mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix versions not being defined
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
35d90f6e8d
commit
92ec42f712
@ -33,7 +33,7 @@ export class CustomResourceDefinition extends KubeObject {
|
|||||||
};
|
};
|
||||||
scope: "Namespaced" | "Cluster" | string;
|
scope: "Namespaced" | "Cluster" | string;
|
||||||
validation?: any;
|
validation?: any;
|
||||||
versions: {
|
versions?: {
|
||||||
name: string;
|
name: string;
|
||||||
served: boolean;
|
served: boolean;
|
||||||
storage: boolean;
|
storage: boolean;
|
||||||
@ -103,7 +103,7 @@ export class CustomResourceDefinition extends KubeObject {
|
|||||||
|
|
||||||
getVersion() {
|
getVersion() {
|
||||||
// v1 has removed the spec.version property, if it is present it must match the first version
|
// v1 has removed the spec.version property, if it is present it must match the first version
|
||||||
return this.spec.versions[0]?.name ?? this.spec.version;
|
return this.spec.versions?.[0]?.name ?? this.spec.version;
|
||||||
}
|
}
|
||||||
|
|
||||||
isNamespaced() {
|
isNamespaced() {
|
||||||
@ -123,7 +123,7 @@ export class CustomResourceDefinition extends KubeObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getPrinterColumns(ignorePriority = true): AdditionalPrinterColumnsV1[] {
|
getPrinterColumns(ignorePriority = true): AdditionalPrinterColumnsV1[] {
|
||||||
const columns = this.spec.versions.find(a => this.getVersion() == a.name)?.additionalPrinterColumns
|
const columns = this.spec.versions?.find(a => this.getVersion() == a.name)?.additionalPrinterColumns
|
||||||
?? this.spec.additionalPrinterColumns?.map(({ JSONPath, ...rest }) => ({ ...rest, jsonPath: JSONPath })) // map to V1 shape
|
?? this.spec.additionalPrinterColumns?.map(({ JSONPath, ...rest }) => ({ ...rest, jsonPath: JSONPath })) // map to V1 shape
|
||||||
?? [];
|
?? [];
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user