Update CRD api to use preferred version and implement v1 differences (#718)

* Update CRD api to use preferred version and implement v1 differences

Signed-off-by: Trevor Nichols <trevor@nichols.id.au>

* Fix unit test failure

Signed-off-by: Trevor Nichols <trevor@nichols.id.au>

* Register alternate API base URL if preferred version changes.

Signed-off-by: Trevor Nichols <trevor@nichols.id.au>

* Adjust for validation moving to the version.schema

Signed-off-by: Trevor Nichols <trevor@nichols.id.au>
This commit is contained in:
Trevor Nichols authored and GitHub committed 2020-09-04 09:39:31 +03:00
1 parent 38ba9cd383
commit 26e031fc58
6 files changed
+95 -31

No files matched your search

@@ -102,13 +102,13 @@ export class CRDDetails extends React.Component<Props> {
</TableHead>
{
printerColumns.map((column, index) => {
const { name, type, JSONPath } = column;
const { name, type, jsonPath } = column;
return (
<TableRow key={index}>
<TableCell className="name">{name}</TableCell>
<TableCell className="type">{type}</TableCell>
<TableCell className="json-path">
<Badge label={JSONPath}/>
<Badge label={jsonPath}/>
</TableCell>
</TableRow>
)
@@ -57,7 +57,7 @@ export class CrdResourceDetails extends React.Component<Props> {
<KubeObjectMeta object={object}/>
{extraColumns.map(column => {
const { name } = column;
const value = jsonPath.query(object, column.JSONPath.slice(1));
const value = jsonPath.query(object, (column.jsonPath).slice(1));
return (
<DrawerItem key={name} name={name}>
<CrdColumnValue value={value} />
@@ -57,7 +57,7 @@ export class CrdResources extends React.Component<Props> {
[sortBy.age]: (item: KubeObject) => item.metadata.creationTimestamp,
}
extraColumns.forEach(column => {
sortingCallbacks[column.name] = (item: KubeObject) => jsonPath.query(item, column.JSONPath.slice(1))
sortingCallbacks[column.name] = (item: KubeObject) => jsonPath.query(item, column.jsonPath.slice(1))
})
// todo: merge extra columns and other params to predefined view
const { List } = apiManager.getViews(crd.getResourceApiBase());
@@ -88,9 +88,9 @@ export class CrdResources extends React.Component<Props> {
renderTableContents={(crdInstance: KubeObject) => [
crdInstance.getName(),
isNamespaced && crdInstance.getNs(),
...extraColumns.map(column =>
jsonPath.query(crdInstance, column.JSONPath.slice(1))
),
...extraColumns.map(column => {
return jsonPath.query(crdInstance, (column.jsonPath).slice(1))
}),
crdInstance.getAge(),
]}
renderItemMenu={(item: KubeObject) => {