fix types
This commit is contained in:
committed by
moustafab
parent
61a552fac6
commit
99fffed216
@@ -30,6 +30,15 @@ const schema = yup.object<Partial<ComponentEntityV1alpha1>>({
|
||||
lifecycle: yup.string().required().min(1),
|
||||
owner: yup.string().required().min(1),
|
||||
implementsApis: yup.array(yup.string().required()).notRequired(),
|
||||
kubernetes: yup
|
||||
.object<any>({
|
||||
selector: yup
|
||||
.object<any>({
|
||||
matchLabels: yup.object<any>().required(),
|
||||
})
|
||||
.required(),
|
||||
})
|
||||
.notRequired(),
|
||||
})
|
||||
.required(),
|
||||
});
|
||||
@@ -42,6 +51,13 @@ export interface ComponentEntityV1alpha1 extends Entity {
|
||||
lifecycle: string;
|
||||
owner: string;
|
||||
implementsApis?: string[];
|
||||
kubernetes?: {
|
||||
selector: {
|
||||
matchLabels: {
|
||||
[key: string]: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
TabbedCard,
|
||||
useApi,
|
||||
} from '@backstage/core';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { ComponentEntityV1alpha1, Entity } from '@backstage/catalog-model';
|
||||
import { kubernetesApiRef } from '../../api/types';
|
||||
import {
|
||||
AuthRequestBody,
|
||||
@@ -137,11 +137,13 @@ export const KubernetesContent = ({ entity }: KubernetesContentProps) => {
|
||||
},
|
||||
};
|
||||
|
||||
const componentEntity = entity as ComponentEntityV1alpha1;
|
||||
if (
|
||||
entity.spec.kubernetes &&
|
||||
(entity.spec.kubernetes.selector as V1LabelSelector)
|
||||
componentEntity.spec &&
|
||||
componentEntity.spec.kubernetes &&
|
||||
(componentEntity.spec.kubernetes.selector as V1LabelSelector)
|
||||
) {
|
||||
labelSelector = entity.spec.kubernetes.selector;
|
||||
labelSelector = componentEntity.spec.kubernetes.selector;
|
||||
}
|
||||
|
||||
// TODO: Add validation on contents/format of requestBody
|
||||
|
||||
Reference in New Issue
Block a user