diff --git a/flux-plugin/src/flux-applications/application.tsx b/flux-plugin/src/flux-applications/application.tsx index ad5e282..fee825d 100644 --- a/flux-plugin/src/flux-applications/application.tsx +++ b/flux-plugin/src/flux-applications/application.tsx @@ -43,7 +43,7 @@ function GetResourcesFromInventory(props: { in the format '___'. */ const parsedID = id.split('_'); - const namespace = parsedID[0]; + const namespace = parsedID[0] === '' ? undefined : parsedID[0]; const name = parsedID[1]; const group = parsedID[2]; const kind = parsedID[3]; @@ -55,26 +55,26 @@ function GetResourcesFromInventory(props: { const { namespace, name, group, kind } = parsedID; const resource = K8s.ResourceClasses[kind]; - if (!resource) { return; } - resource.useApiGet( - data => { - // if the resource already exist replace it with the new one which is data otherwise add it - // use uid as the filter - const index = resources.findIndex(it => it.metadata.uid === data.metadata.uid); - if (index !== -1) { - resources[index] = data; - } else { - resources.push(data); - } - setResources([...resources]); - }, - name, - namespace - ); - }); + + resource.useApiGet( + data => { + // if the resource already exist replace it with the new one which is data otherwise add it + // use uid as the filter + const index = resources.findIndex(it => it.metadata.uid === data.metadata.uid); + if (index !== -1) { + resources[index] = data; + } else { + resources.push(data); + } + setResources([...resources]); + }, + name, + namespace + ); + }); return ( - {item.metadata.namespace} + {item?.metadata?.namespace} ) : ( '' @@ -116,7 +116,7 @@ function GetResourcesFromInventory(props: { }, { header: 'Age', - accessorFn: item => , + accessorFn: item => , }, ]} /> @@ -229,7 +229,6 @@ function CustomResourceDetails(props) { function prepareExtraInfo(cr) { const { name: sourceName, type: sourceType } = getSourceNameAndType(cr); let extraInfo = []; - console.log(sourceName, sourceType) if (cr?.jsonData.kind === 'HelmRelease') { extraInfo.push({ name: 'Chart', diff --git a/flux-plugin/src/flux-applications/applicationcustomresource.tsx b/flux-plugin/src/flux-applications/applicationcustomresource.tsx index 4f63b54..2d31fe0 100644 --- a/flux-plugin/src/flux-applications/applicationcustomresource.tsx +++ b/flux-plugin/src/flux-applications/applicationcustomresource.tsx @@ -11,7 +11,6 @@ export default function FluxCustomResource(props: { }) { const { resourceClass, title, type } = props; const [resource] = resourceClass.useList(); - console.log('resource is ', resource); function prepareStatus(item: KubeCRD) { @@ -53,7 +52,6 @@ export default function FluxCustomResource(props: { { header: 'Name', accessorFn: item => { - console.log(item); return (