Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace shouldSyncNameAndLabel with isLabelSyncedWithName #8067

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/twenty-front/src/generated-metadata/gql.ts

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions packages/twenty-front/src/generated-metadata/graphql.ts

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions packages/twenty-front/src/generated/graphql.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Apollo from '@apollo/client';
import { gql } from '@apollo/client';
import * as Apollo from '@apollo/client';
export type Maybe<T> = T | null;
export type InputMaybe<T> = Maybe<T>;
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
Expand Down Expand Up @@ -1155,13 +1155,13 @@ export type UpdateObjectPayload = {
icon?: InputMaybe<Scalars['String']>;
imageIdentifierFieldMetadataId?: InputMaybe<Scalars['String']>;
isActive?: InputMaybe<Scalars['Boolean']>;
isLabelSyncedWithName?: InputMaybe<Scalars['Boolean']>;
labelIdentifierFieldMetadataId?: InputMaybe<Scalars['String']>;
labelPlural?: InputMaybe<Scalars['String']>;
labelSingular?: InputMaybe<Scalars['String']>;
namePlural?: InputMaybe<Scalars['String']>;
nameSingular?: InputMaybe<Scalars['String']>;
shortcut?: InputMaybe<Scalars['String']>;
shouldSyncLabelAndName?: InputMaybe<Scalars['Boolean']>;
};

export type UpdateOneObjectInput = {
Expand Down Expand Up @@ -1471,6 +1471,7 @@ export type Object = {
indexMetadatas: ObjectIndexMetadatasConnection;
isActive: Scalars['Boolean'];
isCustom: Scalars['Boolean'];
isLabelSyncedWithName: Scalars['Boolean'];
isRemote: Scalars['Boolean'];
isSystem: Scalars['Boolean'];
labelIdentifierFieldMetadataId?: Maybe<Scalars['String']>;
Expand All @@ -1479,7 +1480,6 @@ export type Object = {
namePlural: Scalars['String'];
nameSingular: Scalars['String'];
shortcut?: Maybe<Scalars['String']>;
shouldSyncLabelAndName: Scalars['Boolean'];
updatedAt: Scalars['DateTime'];
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ describe('useCommandMenu', () => {
namePlural: 'tasks',
labelSingular: 'Task',
labelPlural: 'Tasks',
shouldSyncLabelAndName: true,
isLabelSyncedWithName: true,
shortcut: 'T',
description: 'A task',
icon: 'IconCheckbox',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const FIND_MANY_OBJECT_METADATA_ITEMS = gql`
labelIdentifierFieldMetadataId
imageIdentifierFieldMetadataId
shortcut
shouldSyncLabelAndName
isLabelSyncedWithName
indexMetadatas(paging: { first: 100 }) {
edges {
node {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const query = gql`
labelIdentifierFieldMetadataId
imageIdentifierFieldMetadataId
shortcut
shouldSyncLabelAndName
isLabelSyncedWithName
fields(paging: { first: 1000 }, filter: $fieldFilter) {
edges {
node {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('objectMetadataItemSchema', () => {
namePlural: 'notCamelCase',
nameSingular: 'notCamelCase',
updatedAt: 'invalid date',
shouldSyncLabelAndName: 'not a boolean',
isLabelSyncedWithName: 'not a boolean',
};

// When
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const objectMetadataItem: ObjectMetadataItem = {
isRemote: false,
labelPlural: 'object1s',
labelSingular: 'object1',
shouldSyncLabelAndName: true,
isLabelSyncedWithName: true,
};

describe('turnSortsIntoOrderBy', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('useLimitPerMetadataItem', () => {
namePlural: 'namePlural',
nameSingular: 'nameSingular',
updatedAt: 'updatedAt',
shouldSyncLabelAndName: false,
isLabelSyncedWithName: false,
fields: [],
indexMetadatas: [],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const objectData: ObjectMetadataItem[] = [
labelSingular: 'labelSingular',
namePlural: 'namePlural',
nameSingular: 'nameSingular',
shouldSyncLabelAndName: false,
isLabelSyncedWithName: false,
updatedAt: 'updatedAt',
fields: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const settingsDataModelObjectAboutFormSchema = objectMetadataItemSchema
.pick({
nameSingular: true,
namePlural: true,
shouldSyncLabelAndName: true,
isLabelSyncedWithName: true,
})
.partial(),
);
Expand Down Expand Up @@ -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';

Expand All @@ -129,7 +129,7 @@ export const SettingsDataModelObjectAboutForm = ({
setValue('labelPlural', newLabelPluralValue, {
shouldDirty: isDefined(labelSingular) ? true : false,
});
if (shouldSyncLabelAndName === true) {
if (isLabelSyncedWithName === true) {
fillNamePluralFromLabelPlural(newLabelPluralValue);
}
};
Expand Down Expand Up @@ -182,7 +182,7 @@ export const SettingsDataModelObjectAboutForm = ({
onChange={(value) => {
onChange(value);
fillLabelPlural(value);
if (shouldSyncLabelAndName === true) {
if (isLabelSyncedWithName === true) {
fillNameSingularFromLabelSingular(value);
}
}}
Expand All @@ -204,7 +204,7 @@ export const SettingsDataModelObjectAboutForm = ({
value={value}
onChange={(value) => {
onChange(value);
if (shouldSyncLabelAndName === true) {
if (isLabelSyncedWithName === true) {
fillNamePluralFromLabelPlural(value);
}
}}
Expand Down Expand Up @@ -251,7 +251,7 @@ export const SettingsDataModelObjectAboutForm = ({
placeholder: 'listing',
defaultValue: objectMetadataItem?.nameSingular,
disabled:
disabled || disableNameEdit || shouldSyncLabelAndName,
disabled || disableNameEdit || isLabelSyncedWithName,
tooltip: apiNameTooltipText,
},
{
Expand All @@ -260,7 +260,7 @@ export const SettingsDataModelObjectAboutForm = ({
placeholder: 'listings',
defaultValue: objectMetadataItem?.namePlural,
disabled:
disabled || disableNameEdit || shouldSyncLabelAndName,
disabled || disableNameEdit || isLabelSyncedWithName,
tooltip: apiNameTooltipText,
},
].map(
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('settingsCreateObjectInputSchema', () => {
labelSingular: 'Label ',
namePlural: 'namePlural',
nameSingular: 'nameSingular',
shouldSyncLabelAndName: false,
isLabelSyncedWithName: false,
};

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ export const settingsCreateObjectInputSchema =
namePlural:
values.namePlural ??
computeMetadataNameFromLabelOrThrow(values.labelPlural),
shouldSyncLabelAndName: values.shouldSyncLabelAndName ?? true,
isLabelSyncedWithName: values.isLabelSyncedWithName ?? true,
}),
);
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ export const SettingsObjectEdit = () => {
) => {
let values = formValues;
if (
formValues.shouldSyncLabelAndName === true ||
activeObjectMetadataItem.shouldSyncLabelAndName === true
formValues.isLabelSyncedWithName === true ||
activeObjectMetadataItem.isLabelSyncedWithName === true
) {
values = {
...values,
Expand Down
Loading
Loading