mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +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 { isObject } from '../../../../components/Common/utils/jsUtils';
|
||||
import { transformErrorResponse } from '../../../Data/errorUtils';
|
||||
// import {
|
||||
// useAllDriverCapabilities,
|
||||
// useDriverCapabilities,
|
||||
// } from '../../../Data/hooks/useDriverCapabilities';
|
||||
import { useAllDriverCapabilities } from '../../../Data/hooks/useAllDriverCapabilities';
|
||||
import { Feature } from '../../../DataSource';
|
||||
import { useMetadataMigration } from '../../../MetadataAPI';
|
||||
@ -50,6 +46,18 @@ const defaultCapabilities = {
|
||||
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']) => {
|
||||
if ('toRemoteSchema' in target) return null;
|
||||
|
||||
@ -156,7 +164,9 @@ export const useCreateTableRelationships = (
|
||||
mutate(
|
||||
{
|
||||
query: {
|
||||
type: 'bulk_atomic',
|
||||
type: isRemoteRelPresentInPayload(payloads)
|
||||
? 'bulk_keep_going'
|
||||
: 'bulk_atomic',
|
||||
args: payloads,
|
||||
resource_version,
|
||||
},
|
||||
|
@ -217,20 +217,22 @@ export const metadataReducer = (
|
||||
case 'Metadata/ADD_INHERITED_ROLE':
|
||||
return {
|
||||
...state,
|
||||
inheritedRoles: [...state.inheritedRoles, action.data],
|
||||
inheritedRoles: [...(state.inheritedRoles ?? []), action.data],
|
||||
};
|
||||
case 'Metadata/DELETE_INHERITED_ROLE':
|
||||
return {
|
||||
...state,
|
||||
inheritedRoles: [
|
||||
...state.inheritedRoles.filter(ir => ir.role_name !== action.data),
|
||||
...(state.inheritedRoles ?? []).filter(
|
||||
ir => ir.role_name !== action.data
|
||||
),
|
||||
],
|
||||
};
|
||||
case 'Metadata/UPDATE_INHERITED_ROLE':
|
||||
return {
|
||||
...state,
|
||||
inheritedRoles: [
|
||||
...state.inheritedRoles.map(ir =>
|
||||
...(state.inheritedRoles ?? []).map(ir =>
|
||||
ir.role_name === action.data.role_name ? action.data : ir
|
||||
),
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user