11import React from 'react' ;
2- import Link from 'next/link' ;
3- import {
4- useParams ,
5- usePathname ,
6- useRouter ,
7- useSearchParams ,
8- } from 'next/navigation' ;
9- import GraphqlTable from '@/app/[locale]/dashboard/components/GraphqlTable/graphqlTable' ;
2+ import { useParams , useRouter } from 'next/navigation' ;
103import { graphql } from '@/gql' ;
114import {
125 CreateFileResourceInput ,
136 UpdateFileResourceInput ,
147} from '@/gql/generated/graphql' ;
15- import { IconTrash } from '@tabler/icons-react' ;
16- import { useMutation , useQuery , useQueryClient } from '@tanstack/react-query' ;
17- import {
18- parseAsBoolean ,
19- parseAsString ,
20- useQueryState ,
21- } from 'next-usequerystate' ;
8+ import { useMutation } from '@tanstack/react-query' ;
9+ import { parseAsString , useQueryState } from 'next-usequerystate' ;
2210import {
2311 Button ,
24- ButtonGroup ,
25- Checkbox ,
2612 Combobox ,
27- DataTable ,
2813 Dialog ,
2914 Divider ,
3015 DropZone ,
@@ -49,7 +34,6 @@ interface TListItem {
4934}
5035
5136export const EditResource = ( { reload, data } : any ) => {
52-
5337 const updateResourceDoc : any = graphql ( `
5438 mutation updateFileResource($fileResourceInput: UpdateFileResourceInput!) {
5539 updateFileResource(fileResourceInput: $fileResourceInput) {
@@ -163,12 +147,12 @@ export const EditResource = ({ reload, data }: any) => {
163147
164148 const ResourceList : TListItem [ ] =
165149 data . map ( ( item : any ) => ( {
166- label : item . name ,
167- value : item . id ,
168- description : item . description ,
169- dataset : item . dataset ?. pk ,
170- fileDetails : item . fileDetails ,
171- } ) ) || [ ] ;
150+ label : item . name ,
151+ value : item . id ,
152+ description : item . description ,
153+ dataset : item . dataset ?. pk ,
154+ fileDetails : item . fileDetails ,
155+ } ) ) || [ ] ;
172156
173157 const getResourceObject = ( resourceId : string ) => {
174158 return ResourceList . find ( ( item ) => item . value === resourceId ) ;
@@ -245,18 +229,21 @@ export const EditResource = ({ reload, data }: any) => {
245229 </ div >
246230 ) ;
247231
248-
249232 const listViewFunction = ( ) => {
250- setResourceId ( '' )
233+ setResourceId ( '' ) ;
251234 } ;
252235
253236 const saveResource = ( ) => {
254237 mutate ( {
255238 fileResourceInput : {
256239 id : resourceId ,
257- description : resourceDesc ? resourceDesc :getResourceObject ( resourceId ) ?. description ,
258- name : resourceName ? resourceName : getResourceObject ( resourceId ) ?. label ,
259- file : resourceFile
240+ description : resourceDesc
241+ ? resourceDesc
242+ : getResourceObject ( resourceId ) ?. description ,
243+ name : resourceName
244+ ? resourceName
245+ : getResourceObject ( resourceId ) ?. label ,
246+ file : resourceFile ,
260247 } ,
261248 } ) ;
262249 } ;
0 commit comments