mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
Fix: user defined functions UX interactions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9359 GitOrigin-RevId: 92fc049a396e6bd11ed9003b6d784e80e2290618
This commit is contained in:
parent
7ecf9dafeb
commit
b19eff22e9
@ -40,14 +40,19 @@ export type TrackFunctionFormProps = {
|
||||
defaultValues?: TrackFunctionFormSchema;
|
||||
};
|
||||
|
||||
export const TrackFunctionForm = (props: TrackFunctionFormProps) => {
|
||||
const { data: untrackedFunctions = [] } = useUntrackedFunctions(
|
||||
props.dataSourceName
|
||||
);
|
||||
export const TrackFunctionForm = ({
|
||||
dataSourceName,
|
||||
onSuccess,
|
||||
onClose,
|
||||
defaultValues,
|
||||
}: TrackFunctionFormProps) => {
|
||||
const { data: untrackedFunctions = [] } =
|
||||
useUntrackedFunctions(dataSourceName);
|
||||
|
||||
const { trackFunction, isLoading: isTrackingInProgress } = useTrackFunction({
|
||||
dataSourceName: props.dataSourceName,
|
||||
dataSourceName: dataSourceName,
|
||||
onSuccess: () => {
|
||||
onClose();
|
||||
hasuraToast({
|
||||
type: 'success',
|
||||
title: 'Success',
|
||||
@ -72,12 +77,12 @@ export const TrackFunctionForm = (props: TrackFunctionFormProps) => {
|
||||
} = useConsoleForm({
|
||||
schema: validationSchema,
|
||||
options: {
|
||||
defaultValues: props.defaultValues,
|
||||
defaultValues: defaultValues,
|
||||
},
|
||||
});
|
||||
|
||||
const { data: tableOptions = [] } = useMetadata(m =>
|
||||
MetadataSelectors.findSource(props.dataSourceName)(m)?.tables.map(t => ({
|
||||
MetadataSelectors.findSource(dataSourceName)(m)?.tables.map(t => ({
|
||||
label: getQualifiedTable(t.table).join(' / '),
|
||||
value: JSON.stringify(t.table),
|
||||
}))
|
||||
@ -88,7 +93,7 @@ export const TrackFunctionForm = (props: TrackFunctionFormProps) => {
|
||||
if (untrackedFunctions === Feature.NotImplemented)
|
||||
return (
|
||||
<IndicatorCard headline="Feature is not implemented">
|
||||
This feature is not available for {props.dataSourceName}
|
||||
This feature is not available for {dataSourceName}
|
||||
</IndicatorCard>
|
||||
);
|
||||
|
||||
@ -116,14 +121,14 @@ export const TrackFunctionForm = (props: TrackFunctionFormProps) => {
|
||||
<Dialog
|
||||
hasBackdrop
|
||||
title="Track Function"
|
||||
onClose={props.onClose}
|
||||
onClose={onClose}
|
||||
footer={
|
||||
<Dialog.Footer
|
||||
onSubmit={() => {
|
||||
handleSubmit(onHandleSubmit)();
|
||||
}}
|
||||
isLoading={isTrackingInProgress}
|
||||
onClose={props.onClose}
|
||||
onClose={onClose}
|
||||
callToDeny="Cancel"
|
||||
callToAction="Track Function"
|
||||
onSubmitAnalyticsName="actions-tab-generate-types-submit"
|
||||
|
@ -44,7 +44,7 @@ export const TrackedFunctions = (props: TrackedFunctionsProps) => {
|
||||
|
||||
const invalidateMetadata = useInvalidateMetadata();
|
||||
|
||||
const { untrackFunction, isLoading: isUntrackingInProgreess } =
|
||||
const { untrackFunction, isLoading: isUntrackingInProgress } =
|
||||
useTrackFunction({
|
||||
dataSourceName,
|
||||
onError: err => {
|
||||
@ -100,7 +100,7 @@ export const TrackedFunctions = (props: TrackedFunctionsProps) => {
|
||||
},
|
||||
});
|
||||
}}
|
||||
isLoading={isLoading}
|
||||
isLoading={isUntrackingInProgress}
|
||||
{...listProps}
|
||||
showButton
|
||||
/>
|
||||
@ -189,7 +189,7 @@ export const TrackedFunctions = (props: TrackedFunctionsProps) => {
|
||||
},
|
||||
});
|
||||
}}
|
||||
isLoading={activeRow === index && isUntrackingInProgreess}
|
||||
isLoading={activeRow === index && isUntrackingInProgress}
|
||||
loadingText="Please wait"
|
||||
>
|
||||
Untrack
|
||||
|
Loading…
Reference in New Issue
Block a user