@@ -2,13 +2,13 @@ import * as React from 'react';
22import { RouteComponentProps } from 'react-router' ;
33import ExternalLink from 'src/components/utils/ExternalLink/ExternalLink' ;
44
5- // import { getReferenceForModel } from 'src/components/utils/useClusterVersion';
65import { ApplicationKind , ApplicationSource } from '@gitops/models/ApplicationModel' ;
6+ import { GitIcon } from '@gitops/utils/components/Icons/GitIcon' ;
7+ import { HelmIcon } from '@gitops/utils/components/Icons/HelmIcon' ;
8+ import { OciIcon } from '@gitops/utils/components/Icons/OciIcon' ;
79import { ArgoServer , getArgoServer } from '@gitops/utils/gitops' ;
810import { t } from '@gitops/utils/hooks/useGitOpsTranslation' ;
911import { repoUrl , revisionUrl } from '@gitops/utils/urls' ;
10- import gitImage from '@images/git.png' ;
11- import helmImage from '@images/helm.png' ;
1212import { useK8sModel } from '@openshift-console/dynamic-plugin-sdk' ;
1313import {
1414 EmptyState ,
@@ -23,7 +23,7 @@ import DataViewTable, {
2323 DataViewTh ,
2424 DataViewTr ,
2525} from '@patternfly/react-data-view/dist/esm/DataViewTable' ;
26- import { CubesIcon } from '@patternfly/react-icons' ;
26+ import { CubesIcon , GithubIcon } from '@patternfly/react-icons' ;
2727import { Tbody , Td , Tr } from '@patternfly/react-table' ;
2828
2929import ArgoCDLink from '../shared/ArgoCDLink/ArgoCDLink' ;
@@ -74,7 +74,7 @@ export const useColumnsDV = () => {
7474 } ,
7575 } ,
7676 {
77- cell : 'Path' ,
77+ cell : 'Path / Chart ' ,
7878 id : 'path' ,
7979 props : {
8080 key : 'path' ,
@@ -92,25 +92,31 @@ export const useColumnsDV = () => {
9292 return columns ;
9393} ;
9494
95+ function processPath ( path : string ) {
96+ if ( path !== null && path !== undefined ) {
97+ if ( path === '.' ) {
98+ return '(root)' ;
99+ }
100+ return path ;
101+ }
102+ return '' ;
103+ }
104+
95105export const useRowsDV = ( sources : ApplicationSource [ ] ) : DataViewTr [ ] => {
96106 const rows : DataViewTr [ ] = [ ] ;
107+
97108 sources . forEach ( ( source , index ) => {
109+ const isOci = source ?. repoURL ?. startsWith ( 'oci://' ) ;
98110 rows . push ( [
99111 {
100112 id : index + '-type' ,
101113 cell : (
102- < Tooltip content = { source . chart ? 'Helm' : 'Git' } >
103- < img
104- loading = "lazy"
105- src = {
106- source . chart
107- ? helmImage //require('@images/helm.png').default || require('@images/helm.png')
108- : gitImage //require('@images/git.png').default || require('@images/git.png')
109- }
110- alt = { source . chart ? 'Helm' : 'Git' }
111- width = "19px"
112- height = "24px"
113- />
114+ // eslint-disable-next-line no-nested-ternary
115+ < Tooltip content = { source . chart ? 'Helm' : isOci ? 'OCI' : 'Git' } >
116+ < div >
117+ { /* eslint-disable-next-line no-nested-ternary */ }
118+ { source . chart ? < HelmIcon /> : isOci ? < OciIcon /> : < GitIcon /> }
119+ </ div >
114120 </ Tooltip >
115121 ) ,
116122 dataLabel : 'Type' ,
@@ -119,7 +125,17 @@ export const useRowsDV = (sources: ApplicationSource[]): DataViewTr[] => {
119125 id : index + '-repository' ,
120126 cell : (
121127 < div >
122- < ExternalLink href = { source . repoURL } > { repoUrl ( source . repoURL ) } </ ExternalLink >
128+ { /* eslint-disable-next-line no-nested-ternary */ }
129+ { source . chart ? (
130+ < ExternalLink href = { source . repoURL } > { source . repoURL } </ ExternalLink >
131+ ) : isOci ? (
132+ < div > { source . repoURL } </ div >
133+ ) : (
134+ < ExternalLink href = { source . repoURL } >
135+ { source . repoURL . indexOf ( 'github' ) > 0 && < GithubIcon /> }
136+ { repoUrl ( source . repoURL ) }
137+ </ ExternalLink >
138+ ) }
123139 </ div >
124140 ) ,
125141 dataLabel : 'Repository' ,
@@ -129,26 +145,32 @@ export const useRowsDV = (sources: ApplicationSource[]): DataViewTr[] => {
129145 cell : < div > { source . targetRevision } </ div > ,
130146 dataLabel : 'TargetRevision' ,
131147 } ,
132-
133148 {
134149 id : index + '-path' ,
135150 cell : (
136151 < div >
137152 { /* eslint-disable-next-line no-nested-ternary */ }
138153 { source . chart ? (
139154 source . chart
140- ) : source . path ? (
141- < ExternalLink
142- href = { revisionUrl ( source . repoURL , source . targetRevision , true ) + '/' + source . path }
143- >
144- { source . path }
145- </ ExternalLink >
155+ ) : // eslint-disable-next-line no-nested-ternary
156+ source . path ? (
157+ ! isOci ? (
158+ < ExternalLink
159+ href = {
160+ revisionUrl ( source . repoURL , source . targetRevision , true ) + '/' + source . path
161+ }
162+ >
163+ { source . path }
164+ </ ExternalLink >
165+ ) : (
166+ < div > { processPath ( source . path ) } </ div >
167+ )
146168 ) : (
147169 '-'
148170 ) }
149171 </ div >
150172 ) ,
151- dataLabel : 'Path' ,
173+ dataLabel : 'Chart / Path' ,
152174 } ,
153175 {
154176 id : index + '-ref' ,
0 commit comments