Replace shouldSyncNameAndLabel with isLabelSyncedWithName (#8067)

For consistency. 
This was not deployed yet so allowing myself just to rename everything,
meaning developers will need to reset their db.
This commit is contained in:
Marie
2024-10-25 18:28:58 +02:00
committed by GitHub
parent e5175194ac
commit d51a797d91
22 changed files with 80 additions and 80 deletions

View File

@ -124,7 +124,7 @@ describe('useCommandMenu', () => {
namePlural: 'tasks',
labelSingular: 'Task',
labelPlural: 'Tasks',
shouldSyncLabelAndName: true,
isLabelSyncedWithName: true,
shortcut: 'T',
description: 'A task',
icon: 'IconCheckbox',

View File

@ -25,7 +25,7 @@ export const FIND_MANY_OBJECT_METADATA_ITEMS = gql`
labelIdentifierFieldMetadataId
imageIdentifierFieldMetadataId
shortcut
shouldSyncLabelAndName
isLabelSyncedWithName
indexMetadatas(paging: { first: 100 }) {
edges {
node {

View File

@ -25,7 +25,7 @@ export const query = gql`
labelIdentifierFieldMetadataId
imageIdentifierFieldMetadataId
shortcut
shouldSyncLabelAndName
isLabelSyncedWithName
fields(paging: { first: 1000 }, filter: $fieldFilter) {
edges {
node {

View File

@ -30,7 +30,7 @@ describe('objectMetadataItemSchema', () => {
namePlural: 'notCamelCase',
nameSingular: 'notCamelCase',
updatedAt: 'invalid date',
shouldSyncLabelAndName: 'not a boolean',
isLabelSyncedWithName: 'not a boolean',
};
// When

View File

@ -27,5 +27,5 @@ export const objectMetadataItemSchema = z.object({
nameSingular: camelCaseStringSchema,
updatedAt: z.string().datetime(),
shortcut: z.string().nullable().optional(),
shouldSyncLabelAndName: z.boolean(),
isLabelSyncedWithName: z.boolean(),
}) satisfies z.ZodType<ObjectMetadataItem>;

View File

@ -25,7 +25,7 @@ const objectMetadataItem: ObjectMetadataItem = {
isRemote: false,
labelPlural: 'object1s',
labelSingular: 'object1',
shouldSyncLabelAndName: true,
isLabelSyncedWithName: true,
};
describe('turnSortsIntoOrderBy', () => {

View File

@ -26,7 +26,7 @@ describe('useLimitPerMetadataItem', () => {
namePlural: 'namePlural',
nameSingular: 'nameSingular',
updatedAt: 'updatedAt',
shouldSyncLabelAndName: false,
isLabelSyncedWithName: false,
fields: [],
indexMetadatas: [],
},

View File

@ -34,7 +34,7 @@ const objectData: ObjectMetadataItem[] = [
labelSingular: 'labelSingular',
namePlural: 'namePlural',
nameSingular: 'nameSingular',
shouldSyncLabelAndName: false,
isLabelSyncedWithName: false,
updatedAt: 'updatedAt',
fields: [
{

View File

@ -36,7 +36,7 @@ export const settingsDataModelObjectAboutFormSchema = objectMetadataItemSchema
.pick({
nameSingular: true,
namePlural: true,
shouldSyncLabelAndName: true,
isLabelSyncedWithName: true,
})
.partial(),
);
@ -115,10 +115,10 @@ export const SettingsDataModelObjectAboutForm = ({
isAdvancedModeEnabled,
);
const shouldSyncLabelAndName = watch('shouldSyncLabelAndName');
const isLabelSyncedWithName = watch('isLabelSyncedWithName');
const labelSingular = watch('labelSingular');
const labelPlural = watch('labelPlural');
const apiNameTooltipText = shouldSyncLabelAndName
const apiNameTooltipText = isLabelSyncedWithName
? 'Deactivate "Synchronize Objects Labels and API Names" to set a custom API name'
: 'Input must be in camel case and cannot start with a number';
@ -129,7 +129,7 @@ export const SettingsDataModelObjectAboutForm = ({
setValue('labelPlural', newLabelPluralValue, {
shouldDirty: isDefined(labelSingular) ? true : false,
});
if (shouldSyncLabelAndName === true) {
if (isLabelSyncedWithName === true) {
fillNamePluralFromLabelPlural(newLabelPluralValue);
}
};
@ -182,7 +182,7 @@ export const SettingsDataModelObjectAboutForm = ({
onChange={(value) => {
onChange(value);
fillLabelPlural(value);
if (shouldSyncLabelAndName === true) {
if (isLabelSyncedWithName === true) {
fillNameSingularFromLabelSingular(value);
}
}}
@ -204,7 +204,7 @@ export const SettingsDataModelObjectAboutForm = ({
value={value}
onChange={(value) => {
onChange(value);
if (shouldSyncLabelAndName === true) {
if (isLabelSyncedWithName === true) {
fillNamePluralFromLabelPlural(value);
}
}}
@ -251,7 +251,7 @@ export const SettingsDataModelObjectAboutForm = ({
placeholder: 'listing',
defaultValue: objectMetadataItem?.nameSingular,
disabled:
disabled || disableNameEdit || shouldSyncLabelAndName,
disabled || disableNameEdit || isLabelSyncedWithName,
tooltip: apiNameTooltipText,
},
{
@ -260,7 +260,7 @@ export const SettingsDataModelObjectAboutForm = ({
placeholder: 'listings',
defaultValue: objectMetadataItem?.namePlural,
disabled:
disabled || disableNameEdit || shouldSyncLabelAndName,
disabled || disableNameEdit || isLabelSyncedWithName,
tooltip: apiNameTooltipText,
},
].map(
@ -318,10 +318,10 @@ export const SettingsDataModelObjectAboutForm = ({
),
)}
<Controller
name="shouldSyncLabelAndName"
name="isLabelSyncedWithName"
control={control}
defaultValue={
objectMetadataItem?.shouldSyncLabelAndName ?? true
objectMetadataItem?.isLabelSyncedWithName ?? true
}
render={({ field: { onChange, value } }) => (
<SyncObjectLabelAndNameToggle

View File

@ -14,7 +14,7 @@ describe('settingsCreateObjectInputSchema', () => {
labelSingular: 'Label ',
namePlural: 'namePlural',
nameSingular: 'nameSingular',
shouldSyncLabelAndName: false,
isLabelSyncedWithName: false,
};
// When
@ -29,7 +29,7 @@ describe('settingsCreateObjectInputSchema', () => {
labelSingular: 'Label',
namePlural: 'namePlural',
nameSingular: 'nameSingular',
shouldSyncLabelAndName: false,
isLabelSyncedWithName: false,
});
});

View File

@ -12,6 +12,6 @@ export const settingsCreateObjectInputSchema =
namePlural:
values.namePlural ??
computeMetadataNameFromLabelOrThrow(values.labelPlural),
shouldSyncLabelAndName: values.shouldSyncLabelAndName ?? true,
isLabelSyncedWithName: values.isLabelSyncedWithName ?? true,
}),
);