@@ -40,6 +40,24 @@ const getResourceChartImageDetails: any = graphql(`
4040 }
4141` ) ;
4242
43+
44+ const getDatasetResourceChartImageDetails : any = graphql ( `
45+ query resourceChartImages($datasetId: UUID!) {
46+ datasetResourceCharts(datasetId: $datasetId) {
47+ id
48+ name
49+ description
50+ image {
51+ name
52+ path
53+ }
54+ }
55+ }
56+ ` ) ;
57+
58+
59+
60+
4361const AddResourceChartimage : any = graphql ( `
4462 mutation GenerateResourceChartimage($dataset: UUID!) {
4563 addResourceChartImage(dataset: $dataset) {
@@ -96,6 +114,24 @@ const ChartsImage: React.FC<ImageProps> = ({
96114 { }
97115 ) ;
98116
117+ const {
118+ data : chartImagesList ,
119+ refetch : listrefetch ,
120+ } : { data : any ; refetch : any } = useQuery (
121+ [ `chartslist_${ params . id } ` , imageId ] ,
122+ ( ) =>
123+ GraphQL (
124+ getDatasetResourceChartImageDetails ,
125+ {
126+ [ params . entityType ] : params . entitySlug ,
127+ } ,
128+ {
129+ datasetId : params . id
130+ }
131+ ) ,
132+ { }
133+ ) ;
134+
99135 const resourceChartImageMutation : {
100136 mutate : any ;
101137 isLoading : any ;
@@ -147,8 +183,6 @@ const ChartsImage: React.FC<ImageProps> = ({
147183 }
148184 } , [ chartImageDetails ] ) ;
149185
150-
151-
152186 const { mutate, isLoading : editMutationLoading } = useMutation (
153187 ( data : { data : ResourceChartImageInputPartial } ) =>
154188 GraphQL ( UpdateChartImageMutation , { } , data ) ,
@@ -157,6 +191,7 @@ const ChartsImage: React.FC<ImageProps> = ({
157191 toast ( 'ChartImage updated successfully' ) ;
158192 // Optionally, reset form or perform other actions
159193 refetch ( ) ;
194+ listrefetch ( ) ;
160195 } ,
161196 onError : ( error : any ) => {
162197 toast ( `Error: ${ error . message } ` ) ;
@@ -181,6 +216,7 @@ const ChartsImage: React.FC<ImageProps> = ({
181216 } ) ;
182217 {
183218 refetch ( ) ;
219+ listrefetch ( ) ;
184220 }
185221 } ,
186222 [ ]
@@ -248,6 +284,26 @@ const ChartsImage: React.FC<ImageProps> = ({
248284 </ Button >
249285 </ div >
250286 </ div >
287+ { chartImagesList ?. datasetResourceCharts . map (
288+ ( item : any , index : any ) => (
289+ < div
290+ key = { index }
291+ className = { `rounded-1 border-1 border-solid border-baseGraySlateSolid6 px-6 py-3 ${ imageId === item . id ? ' bg-baseGraySlateSolid5' : '' } ` }
292+ >
293+ < Button
294+ kind = { 'tertiary' }
295+ className = "flex w-full justify-start"
296+ disabled = { imageId === item . id }
297+ onClick = { ( ) => {
298+ setImageId ( item . id ) ;
299+ setIsSheetOpen ( false ) ;
300+ } }
301+ >
302+ { item . name }
303+ </ Button >
304+ </ div >
305+ )
306+ ) }
251307 </ div >
252308 </ Sheet . Content >
253309 </ Sheet >
0 commit comments