Fix update_by_pk and delete_by_pk placeholders

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9375
GitOrigin-RevId: d73bc541f160e6f6f32dfa0f6b19cff730e73099
This commit is contained in:
Luca Restagno 2023-06-02 10:58:30 +02:00 committed by hasura-bot
parent 936134d157
commit f6cb0d7310
4 changed files with 10 additions and 6 deletions

View File

@ -104,6 +104,10 @@ const RootFieldEditor: React.FC<RootFieldEditorProps> = ({
if (rfType.includes('one')) {
return `${rfType.replace('one', rootField)}_one`;
}
if (rfType.includes('_by_pk')) {
const [type] = rfType.split('_by_pk');
return `${type}_${rootField}_by_pk`;
}
if (rfType === 'custom_name') {
return rootField;
}
@ -183,9 +187,9 @@ const RootFieldEditor: React.FC<RootFieldEditorProps> = ({
{getRootFieldRow('insert_one', insertOneOnChange)}
{getRootFieldRow('update', updateOnChange)}
{getRootFieldRow('update_by_pk', updateByPkOnChange)}
{getRootFieldRow('update_many', updateManyOnChange)}
{getRootFieldRow('delete', deleteOnChange)}
{getRootFieldRow('delete_by_pk', deleteByPkOnChange)}
{getRootFieldRow('update_many', updateManyOnChange)}
</div>
)}
</CollapsibleToggle>

View File

@ -320,7 +320,7 @@ export const ModifyTable: React.VFC<ModifyTableProps> = ({
</div>
)}
{isCustomGqlRootSupported && (
<div className="w-full sm:w-6/12 mb-md">
<div className="w-full sm:w-8/12 mb-md">
<RootFields tableSchema={table} />
</div>
)}

View File

@ -58,10 +58,10 @@ describe('getTrackingTableFormPlaceholders', () => {
insert_one: 'insert_customizeTableName_one (default)',
update: 'update_customizeTableName (default)',
update_by_pk: 'update_by_pk_customizeTableName (default)',
update_by_pk: 'update_customizeTableName_by_pk (default)',
delete: 'delete_customizeTableName (default)',
delete_by_pk: 'delete_by_pk_customizeTableName (default)',
delete_by_pk: 'delete_customizeTableName_by_pk (default)',
update_many: 'update_many_customizeTableName (default)',
};

View File

@ -19,9 +19,9 @@ export const customFieldNamesPlaceholders = (
insert: `insert_${tableName} (default)`,
insert_one: `insert_${tableName}_one (default)`,
update: `update_${tableName} (default)`,
update_by_pk: `update_by_pk_${tableName} (default)`,
update_by_pk: `update_${tableName}_by_pk (default)`,
delete: `delete_${tableName} (default)`,
delete_by_pk: `delete_by_pk_${tableName} (default)`,
delete_by_pk: `delete_${tableName}_by_pk (default)`,
update_many: `update_many_${tableName} (default)`,
});