-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Features/geo area rest graphql #2962
Conversation
8b72bb3
to
4c1b89e
Compare
@@ -50,6 +53,10 @@ function FileUpload(props: Props) { | |||
disabled, | |||
projectIds, | |||
buttonOnly, | |||
// value: valueFromProps, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unwanted comments.
onChange={handleFileInputChange} | ||
status={undefined} | ||
status={status ? currentStatus : ''} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
status={status ? currentStatus : ''} | |
status={status ? currentStatus : undefined} |
@@ -122,16 +132,31 @@ function FileUpload(props: Props) { | |||
], | |||
); | |||
|
|||
const currentStatus = useMemo(() => { | |||
if (isNotDefined(status)) { | |||
return ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return ''; | |
return undefined; |
82804b6
to
9106c9f
Compare
@@ -69,6 +72,7 @@ function RegionSelectInput<K extends string, GK extends string>( | |||
const variables = useMemo(() => ({ | |||
excludeProject: [projectId], | |||
search: debouncedSearchText, | |||
public: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Much awaited 😄
createRegion( | ||
data: $data | ||
) { | ||
ok | ||
errors | ||
result { | ||
id | ||
isPublished | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix indentation
ok | ||
errors | ||
result { | ||
tolerance | ||
title | ||
staleGeoAreas | ||
parentNameProp | ||
parentCodeProp | ||
codeProp | ||
nameProp | ||
geoShapeFile { | ||
file { | ||
url | ||
} | ||
id | ||
title | ||
mimeType | ||
} | ||
level | ||
id | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix indent
const initialFormValue: PartialAdminLevelInput = { | ||
...remainingValues, | ||
geoShapeFile: geoShapeFile?.id, | ||
region: regionId, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use useMemo
|
||
const { | ||
pending: deleteAdminLevelPending, | ||
trigger: deleteAdminLevel, | ||
} = useLazyRequest<unknown, number>({ | ||
} = useLazyRequest<unknown, string>({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to replace this function as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backend work is left.
const valueWithClientId = { | ||
...value, | ||
clientId: value.id.toString(), | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure we don't need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes i checked it, we don't need it anymore
patchRegion({ | ||
variables: { | ||
projectId, | ||
regionId: [String(value)], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this replace the previous regions and only set one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mutation only requires selected region for the patch not the entire list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okayy, thenks
5a2006d
to
2bada9c
Compare
import { FileInput, useAlert } from '@the-deep/deep-ui'; | ||
import { IoCloudUpload } from 'react-icons/io5'; | ||
import { gql, useMutation } from '@apollo/client'; | ||
import { removeNull } from '@togglecorp/toggle-form'; | ||
import { _cs } from '@togglecorp/fujs'; | ||
import { _cs, isDefined, isNotDefined } from '@togglecorp/fujs'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's separate these out in multiple lines.
|
||
if (isDefined(result) && ok) { | ||
alert.show( | ||
'Admin level is successfully update!', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Admin level is successfully update!', | |
'Admin level is successfully updated!', |
); | ||
submit(); | ||
}, [setError, validate, addAdminLevelTrigger]); | ||
}, [setError, validate, updateAdminLevel, createAdminLevel, valueFromProps.id]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's separate these in multiple lines.
@@ -1,14 +1,14 @@ | |||
import React, { useCallback, useMemo, useState } from 'react'; | |||
import { | |||
_cs, | |||
randomString, | |||
_cs, isNotDefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate lines please.
{ | ||
skip: !isExpanded, | ||
variables: adminLevelQueryVariables, | ||
// NOTE: this prop is required for onCompleted to be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
|
||
if (errors) { | ||
alert.show( | ||
'Failed to publish selected region.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Failed to publish selected region.', | |
'Failed to delete selected region.', |
2bada9c
to
a2107df
Compare
a2107df
to
7908dd9
Compare
Addresses
Depends on
Changes
This PR doesn't introduce any:
console.log
meant for debuggingThis PR contains valid: