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

Support custom object renaming #7504

Merged
merged 26 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0dd3ed1
Support custom object renaming
gitstart-twenty Oct 8, 2024
86fffc3
fix ci checks
gitstart-twenty Oct 8, 2024
283431e
fix object-metadata.service.ts lint
gitstart-twenty Oct 8, 2024
101ca97
Merge branch 'main' of github.com:twentyhq/twenty into TWNTY-5491
ijreilly Oct 10, 2024
18b0f11
Merge branch 'main' into TWNTY-5491
gitstart-twenty Oct 11, 2024
304f7df
update UI behavior, rename variables and new column name
gitstart-twenty Oct 11, 2024
0fcc21b
fix lint issues
gitstart-twenty Oct 11, 2024
eb10349
Merge branch 'TWNTY-5491' of github.com:twentyhq/twenty into TWNTY-5491
ijreilly Oct 14, 2024
3586bf7
WIP
ijreilly Oct 15, 2024
acc86d6
wip
ijreilly Oct 15, 2024
6039816
Update form schema and transform values if needed
ijreilly Oct 16, 2024
a90f56e
refactor object metadata service
ijreilly Oct 16, 2024
83a5882
Refactor form
ijreilly Oct 16, 2024
3b30190
Merge branch 'main' of github.com:twentyhq/twenty into TWNTY-5491
ijreilly Oct 16, 2024
680ed90
set default shouldSync value to false for existing objects
ijreilly Oct 16, 2024
2aca357
Finish merge
ijreilly Oct 16, 2024
a5010a6
generate metadata
ijreilly Oct 16, 2024
85da3af
Minor fixes and code quality improvements
ijreilly Oct 16, 2024
319542d
Merge branch 'main' into TWNTY-5491
charlesBochet Oct 17, 2024
54bb45a
Fix tests
charlesBochet Oct 17, 2024
4a68d29
Merge branch 'main' into TWNTY-5491
Weiko Oct 23, 2024
e24827f
fix typo
Weiko Oct 23, 2024
326cd92
fix after rebase
Weiko Oct 23, 2024
8b9a5b8
Forbid update of object to same singular and plural names
ijreilly Oct 24, 2024
f9c33f9
fix timeline activities and view update
Weiko Oct 24, 2024
aefbe6c
Merge branch 'main' into TWNTY-5491
Weiko Oct 24, 2024
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
12 changes: 6 additions & 6 deletions packages/twenty-front/src/generated-metadata/gql.ts

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions packages/twenty-front/src/generated-metadata/graphql.ts

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions packages/twenty-front/src/generated/graphql.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,7 @@ export type UpdateBillingEntity = {
};

export type UpdateObjectPayload = {
areLabelAndNameSync?: InputMaybe<Scalars['Boolean']>;
description?: InputMaybe<Scalars['String']>;
icon?: InputMaybe<Scalars['String']>;
imageIdentifierFieldMetadataId?: InputMaybe<Scalars['String']>;
Expand Down Expand Up @@ -1246,6 +1247,7 @@ export type FieldFilter = {

export type Object = {
__typename?: 'object';
areLabelAndNameSync: Scalars['Boolean'];
createdAt: Scalars['DateTime'];
dataSourceId: Scalars['String'];
description?: Maybe<Scalars['String']>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const FIND_MANY_OBJECT_METADATA_ITEMS = gql`
updatedAt
labelIdentifierFieldMetadataId
imageIdentifierFieldMetadataId
areLabelAndNameSync
fields(paging: { first: 1000 }, filter: $fieldFilter) {
edges {
node {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ export const objectMetadataItemSchema = z.object({
namePlural: camelCaseStringSchema,
nameSingular: camelCaseStringSchema,
updatedAt: z.string().datetime(),
areLabelAndNameSync: z.boolean(),
}) satisfies z.ZodType<ObjectMetadataItem>;
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,21 @@ import styled from '@emotion/styled';
import { ReactNode } from 'react';
import { isDefined } from '~/utils/isDefined';

const StyledSettingsPageContainer = styled.div<{ width?: number }>`
const StyledSettingsPageContainer = styled.div<{
width?: number;
individualPaddingLeftForItems?: boolean;
}>`
display: flex;
flex-direction: column;
gap: ${({ theme }) => theme.spacing(8)};
overflow: auto;
padding: ${({ theme }) => theme.spacing(6, 8, 8)};
${({ individualPaddingLeftForItems }) =>
individualPaddingLeftForItems && 'padding-left: 0;'}
& > * {
padding-left: ${({ theme, individualPaddingLeftForItems }) =>
individualPaddingLeftForItems ? theme.spacing(8) : undefined};
}
width: ${({ width }) => {
if (isDefined(width)) {
return width + 'px';
Expand All @@ -25,10 +34,16 @@ const StyledSettingsPageContainer = styled.div<{ width?: number }>`

export const SettingsPageContainer = ({
children,
individualPaddingLeftForItems,
}: {
children: ReactNode;
individualPaddingLeftForItems?: boolean;
}) => (
<ScrollWrapper contextProviderName="settingsPageContainer">
<StyledSettingsPageContainer>{children}</StyledSettingsPageContainer>
<StyledSettingsPageContainer
individualPaddingLeftForItems={individualPaddingLeftForItems}
>
{children}
</StyledSettingsPageContainer>
</ScrollWrapper>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import { Toggle } from '@/ui/input/components/Toggle';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { IconRefresh, MAIN_COLORS } from 'twenty-ui';

const StyledToggleContainer = styled.div`
align-items: center;
border: 1px solid ${({ theme }) => theme.border.color.medium};
border-radius: ${({ theme }) => theme.border.radius.sm};
display: flex;
justify-content: space-between;
padding: ${({ theme }) => theme.spacing(4)};
`;

const StyledIconRefreshContainer = styled.div`
border: 2px solid ${({ theme }) => theme.border.color.medium};
border-radius: 3px;
margin-right: ${({ theme }) => theme.spacing(3)};
width: ${({ theme }) => theme.spacing(8)};
height: ${({ theme }) => theme.spacing(8)};
display: flex;
align-items: center;
justify-content: center;
`;

const StyledTitleContainer = styled.div`
align-items: center;
display: flex;
justify-content: space-between;
`;

const StyledTitle = styled.h2`
color: ${({ theme }) => theme.font.color.primary};
font-size: ${({ theme }) => theme.font.size.md};
font-weight: ${({ theme }) => theme.font.weight.semiBold};
margin: 0;
`;

const StyledDescription = styled.h3`
color: ${({ theme }) => theme.font.color.tertiary};
font-size: ${({ theme }) => theme.font.size.md};
font-weight: ${({ theme }) => theme.font.weight.regular};
margin: 0;
margin-top: ${({ theme }) => theme.spacing(2)};
`;

type SyncObjectLabelAndNameToggleProps = {
value: boolean;
onChange: (value: boolean) => void;
};

export const SyncObjectLabelAndNameToggle = ({
value,
onChange,
}: SyncObjectLabelAndNameToggleProps) => {
const theme = useTheme();
return (
<StyledToggleContainer>
<StyledTitleContainer>
<StyledIconRefreshContainer>
<IconRefresh size={22.5} color={theme.font.color.tertiary} />
</StyledIconRefreshContainer>
<div>
<StyledTitle>Synchronize Objects Labels and API Names</StyledTitle>
<StyledDescription>
Should changing an object's label also change the API?
Weiko marked this conversation as resolved.
Show resolved Hide resolved
</StyledDescription>
</div>
</StyledTitleContainer>
<Toggle onChange={onChange} color={MAIN_COLORS.yellow} value={value} />
</StyledToggleContainer>
);
};
Loading
Loading