@@ -23,7 +23,7 @@ import { GraphQL } from '@/lib/api';
2323import { formatDate , toTitleCase } from '@/lib/utils' ;
2424import { Icons } from '@/components/icons' ;
2525
26- const datasetSummaryQuery = graphql ( `
26+ const datasetSummaryQuery : any = graphql ( `
2727 query datasetsSummary($filters: DatasetFilter) {
2828 datasets(filters: $filters) {
2929 metadata {
@@ -46,22 +46,6 @@ const datasetSummaryQuery = graphql(`
4646 description
4747 }
4848 }
49- accessModels {
50- id
51- name
52- description
53- type
54- created
55- modified
56- modelResources {
57- resource {
58- name
59- description
60- id
61- type
62- }
63- }
64- }
6549 tags {
6650 id
6751 value
@@ -179,7 +163,7 @@ const Page = () => {
179163 id : string ;
180164 } > ( ) ;
181165
182- const { data, isLoading, refetch } = useQuery ( [ `summary_${ params . id } ` ] , ( ) =>
166+ const getDatasetsSummary : { data : any , isLoading : any , refetch : any } = useQuery ( [ `summary_${ params . id } ` ] , ( ) =>
183167 GraphQL (
184168 datasetSummaryQuery ,
185169 {
@@ -190,15 +174,15 @@ const Page = () => {
190174 ) ;
191175
192176 useEffect ( ( ) => {
193- refetch ( ) ;
177+ getDatasetsSummary . refetch ( ) ;
194178 } ) ;
195179
196180 const Summary = [
197181 {
198182 name : 'Resource' ,
199- data : data ?. datasets [ 0 ] ?. resources ,
183+ data : getDatasetsSummary . data ?. datasets [ 0 ] ?. resources ,
200184 error :
201- data && data ?. datasets [ 0 ] ?. resources . length === 0
185+ getDatasetsSummary . data && getDatasetsSummary . data ?. datasets [ 0 ] ?. resources . length === 0
202186 ? 'No Resources found. Please add to continue.'
203187 : '' ,
204188 errorType : 'critical' ,
@@ -207,9 +191,9 @@ const Page = () => {
207191 ? [
208192 {
209193 name : 'Access Type' ,
210- data : data ?. datasets [ 0 ] ?. accessModels ,
194+ data : getDatasetsSummary . data ?. datasets [ 0 ] ?. accessModels ,
211195 error :
212- data && data ?. datasets [ 0 ] ?. accessModels . length === 0
196+ getDatasetsSummary . data && getDatasetsSummary . data ?. datasets [ 0 ] ?. accessModels . length === 0
213197 ? 'No Access Type found. Please add to continue.'
214198 : '' ,
215199 errorType : 'critical' ,
@@ -218,18 +202,18 @@ const Page = () => {
218202 : [ ] ) ,
219203 {
220204 name : 'Metadata' ,
221- data : data ?. datasets [ 0 ] ?. metadata ,
205+ data : getDatasetsSummary . data ?. datasets [ 0 ] ?. metadata ,
222206 error : '' ,
223207 } ,
224208 ] ;
225209
226210 const PrimaryMetadata = [
227- { label : 'Dataset Name' , value : data ?. datasets [ 0 ] . title } ,
228- { label : 'Description' , value : data ?. datasets [ 0 ] . description } ,
229- { label : 'Date of Creation' , value : formatDate ( data ?. datasets [ 0 ] . created ) } ,
211+ { label : 'Dataset Name' , value : getDatasetsSummary . data ?. datasets [ 0 ] . title } ,
212+ { label : 'Description' , value : getDatasetsSummary . data ?. datasets [ 0 ] . description } ,
213+ { label : 'Date of Creation' , value : formatDate ( getDatasetsSummary . data ?. datasets [ 0 ] . created ) } ,
230214 {
231215 label : 'Date of Last Update' ,
232- value : formatDate ( data ?. datasets [ 0 ] . modified ) ,
216+ value : formatDate ( getDatasetsSummary . data ?. datasets [ 0 ] . modified ) ,
233217 } ,
234218 ] ;
235219 const router = useRouter ( ) ;
@@ -269,7 +253,7 @@ const Page = () => {
269253 </ Text >
270254 </ div >
271255 < div className = " flex flex-col gap-10 pt-6" >
272- { isLoading || mutationLoading ? (
256+ { getDatasetsSummary . isLoading || mutationLoading ? (
273257 < div className = " mt-8 flex justify-center" >
274258 < Spinner />
275259 </ div >
@@ -356,7 +340,7 @@ const Page = () => {
356340 Tags:
357341 </ Text >
358342 < div className = "flex gap-2 lg:basis-4/5" >
359- { data ?. datasets [ 0 ] . tags . map (
343+ { getDatasetsSummary . data ?. datasets [ 0 ] . tags . map (
360344 ( item : any , index : any ) => (
361345 < Tag key = { index } > { item . value } </ Tag >
362346 )
@@ -373,9 +357,9 @@ const Page = () => {
373357 < Button
374358 className = "m-auto w-fit"
375359 disabled = {
376- ! data ?. datasets [ 0 ] ?. resources . length ||
360+ ! getDatasetsSummary . data ?. datasets [ 0 ] ?. resources . length ||
377361 ( process . env . NEXT_PUBLIC_ENABLE_ACCESSMODEL === 'true' &&
378- ! data ?. datasets [ 0 ] ?. accessModels . length )
362+ ! getDatasetsSummary . data ?. datasets [ 0 ] ?. accessModels . length )
379363 }
380364 onClick = { ( ) => mutate ( ) }
381365 >
0 commit comments