mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
console (fix): use bulk_keep_going
if remote rels are present
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9934 GitOrigin-RevId: 30285a2862c79de6ef57695a6739a442485b4ad2
This commit is contained in:
parent
4c66d648c7
commit
a2e15d9ae6
@ -1,10 +1,6 @@
|
|||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
import { isObject } from '../../../../components/Common/utils/jsUtils';
|
import { isObject } from '../../../../components/Common/utils/jsUtils';
|
||||||
import { transformErrorResponse } from '../../../Data/errorUtils';
|
import { transformErrorResponse } from '../../../Data/errorUtils';
|
||||||
// import {
|
|
||||||
// useAllDriverCapabilities,
|
|
||||||
// useDriverCapabilities,
|
|
||||||
// } from '../../../Data/hooks/useDriverCapabilities';
|
|
||||||
import { useAllDriverCapabilities } from '../../../Data/hooks/useAllDriverCapabilities';
|
import { useAllDriverCapabilities } from '../../../Data/hooks/useAllDriverCapabilities';
|
||||||
import { Feature } from '../../../DataSource';
|
import { Feature } from '../../../DataSource';
|
||||||
import { useMetadataMigration } from '../../../MetadataAPI';
|
import { useMetadataMigration } from '../../../MetadataAPI';
|
||||||
@ -50,6 +46,18 @@ const defaultCapabilities = {
|
|||||||
isRemoteSchemaRelationshipSupported: true,
|
isRemoteSchemaRelationshipSupported: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isRemoteRelPresentInPayload = (
|
||||||
|
data: ReturnType<typeof createTableRelationshipRequestBody>[]
|
||||||
|
) => {
|
||||||
|
const remoteRel = data.find(rel => {
|
||||||
|
if (rel === 'Not implemented') return false;
|
||||||
|
|
||||||
|
return rel.type.includes('_create_remote_relationship');
|
||||||
|
});
|
||||||
|
|
||||||
|
return !!remoteRel;
|
||||||
|
};
|
||||||
|
|
||||||
const getTargetName = (target: AllowedRelationshipDefinitions['target']) => {
|
const getTargetName = (target: AllowedRelationshipDefinitions['target']) => {
|
||||||
if ('toRemoteSchema' in target) return null;
|
if ('toRemoteSchema' in target) return null;
|
||||||
|
|
||||||
@ -156,7 +164,9 @@ export const useCreateTableRelationships = (
|
|||||||
mutate(
|
mutate(
|
||||||
{
|
{
|
||||||
query: {
|
query: {
|
||||||
type: 'bulk_atomic',
|
type: isRemoteRelPresentInPayload(payloads)
|
||||||
|
? 'bulk_keep_going'
|
||||||
|
: 'bulk_atomic',
|
||||||
args: payloads,
|
args: payloads,
|
||||||
resource_version,
|
resource_version,
|
||||||
},
|
},
|
||||||
|
@ -217,20 +217,22 @@ export const metadataReducer = (
|
|||||||
case 'Metadata/ADD_INHERITED_ROLE':
|
case 'Metadata/ADD_INHERITED_ROLE':
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
inheritedRoles: [...state.inheritedRoles, action.data],
|
inheritedRoles: [...(state.inheritedRoles ?? []), action.data],
|
||||||
};
|
};
|
||||||
case 'Metadata/DELETE_INHERITED_ROLE':
|
case 'Metadata/DELETE_INHERITED_ROLE':
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
inheritedRoles: [
|
inheritedRoles: [
|
||||||
...state.inheritedRoles.filter(ir => ir.role_name !== action.data),
|
...(state.inheritedRoles ?? []).filter(
|
||||||
|
ir => ir.role_name !== action.data
|
||||||
|
),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
case 'Metadata/UPDATE_INHERITED_ROLE':
|
case 'Metadata/UPDATE_INHERITED_ROLE':
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
inheritedRoles: [
|
inheritedRoles: [
|
||||||
...state.inheritedRoles.map(ir =>
|
...(state.inheritedRoles ?? []).map(ir =>
|
||||||
ir.role_name === action.data.role_name ? action.data : ir
|
ir.role_name === action.data.role_name ? action.data : ir
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user