Commit Graph

3302 Commits

Author SHA1 Message Date
Charles Bochet
6683ffb890
Clarify storybook tests (#6073)
In this PR, I'm simplifying storybook setup:
1) Remove build --test configuration that prevent autodocs. We are not
using autodocs at all (the dev experience is not good enough), so I have
completely disabled it.
2) Clarify `serve` vs `test` vs `serve-and-test` configurations


After this PR:
- you can serve storybook in two modes: `npx nx run
twenty-front:storybook:serve:dev` and `npx nx run
twenty-front:storybook:serve:static`
- you can run tests agains an already served storybook (this is useful
in dev so you don't have to rebuild everytime to run tests): `npx nx run
twenty-front:storybook:test`
- you can conbine both: `npx nx run
twenty-front:storybook:serve-and-test:static`
2024-06-30 20:02:13 +02:00
Thomas des Francs
36530dbe89
0.21 changelog (#6072) 2024-06-29 11:37:57 +02:00
martmull
b8f33f6f59
5095 move onboardingstatus computation from frontend to backend (#5954)
- move front `onboardingStatus` computing to server side
- add logic to `useSetNextOnboardingStatus`
- update some missing redirections in
`usePageChangeEffectNavigateLocation`
- separate subscriptionStatus from onboardingStatus
2024-06-28 17:32:02 +02:00
bosiraphael
1a66db5bff
Refactor messaging refresh access token (#6034)
- Put error handling outside of `refreshAndSaveAccessToken`
- return after failing to refresh access token in
`processMessageBatchImport`
- remove unnecessary token refresh in `processMessageListFetch`
2024-06-27 17:07:45 +02:00
bosiraphael
4f9527c860
5901 refactor email and calendar auto contact creation to create them by batch (#6038)
Closes #5901
2024-06-27 16:37:34 +02:00
bosiraphael
d1bb0fb822
Change messaging batch size and cron pattern (#6063)
Change messaging batch size and cron pattern to accelerate messages
import
2024-06-27 16:23:47 +02:00
bosiraphael
ac7d905c84
Create fields for calendar and messaging settings v2 (#6049)
Create fields for calendar and messaging settings v2
2024-06-27 16:23:25 +02:00
Weiko
86fa6ec85f
fix navigation panel workspace picker padding (#6062)
## Before
<img width="223" alt="Screenshot 2024-06-27 at 15 23 26"
src="https://github.com/twentyhq/twenty/assets/1834158/18cb5e15-352f-4e65-9cff-6e396abe4318">

## After



<img width="229" alt="Screenshot 2024-06-27 at 15 23 07"
src="https://github.com/twentyhq/twenty/assets/1834158/53502c23-d9b4-4967-9e56-26e62e5e50ea">

<img width="225" alt="Screenshot 2024-06-27 at 15 25 23"
src="https://github.com/twentyhq/twenty/assets/1834158/fbb751ba-2bde-44f0-9c70-a9091e9b9012">
2024-06-27 15:43:00 +02:00
Lucas Bordeau
3c3bd96687
Fixed board card field max width (#6061)
Add a max-width to prevent overflow of board card fields
2024-06-27 15:07:03 +02:00
bosiraphael
845fcb65ce
Replace ObjectRecord<MessageChannelWorkspaceEntity> with MessageChannelWorkspaceEntity (#6059)
Replace ObjectRecord<MessageChannelWorkspaceEntity> with
MessageChannelWorkspaceEntity
2024-06-27 14:35:25 +02:00
Marie
46f0840c99
Manage isFocused state for table cells (#6058)
as per title
2024-06-27 14:26:39 +02:00
Thomas des Francs
67e9378787
Update create-workspace.mdx (#6053)
Fix a dead link that was redirecting to a 400
2024-06-27 11:42:26 +02:00
Jérémy M
95c5602a4e
feat: manually implement joinColumn (#6022)
This PR introduce a new decorator named `@WorkspaceJoinColumn`, the goal
of this one is to manually declare the join columns inside the workspace
entities, so we don't have to rely on `ObjectRecord` type.

This decorator can be used that way:

```typescript
  @WorkspaceRelation({
    standardId: ACTIVITY_TARGET_STANDARD_FIELD_IDS.company,
    type: RelationMetadataType.MANY_TO_ONE,
    label: 'Company',
    description: 'ActivityTarget company',
    icon: 'IconBuildingSkyscraper',
    inverseSideTarget: () => CompanyWorkspaceEntity,
    inverseSideFieldKey: 'activityTargets',
  })
  @WorkspaceIsNullable()
  company: Relation<CompanyWorkspaceEntity> | null;

  // The argument is the name of the relation above
  @WorkspaceJoinColumn('company')
  companyId: string | null;
```
2024-06-27 11:41:22 +02:00
Marie
7eb69a78ef
Relations many in table view (#5842)
Closes #5924.

Adding the "many" side of relations in the table view, and fixing some
issues (glitch in Multi record select, cache update after update).

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-06-27 11:28:03 +02:00
ADITHYA THEJAS S
dcb709feee
hide delete button for selection over 100 - issue #6023 (#6030)
hide the "Delete" Button when more than 100 records are Selected

---------

Co-authored-by: Weiko <corentin@twenty.com>
2024-06-27 11:21:45 +02:00
bosiraphael
97822533db
Fix cache flush in messaging-channel-sync-status.service (#6024)
Fix cache flush in messaging-channel-sync-status.service
2024-06-27 09:58:37 +02:00
bosiraphael
03b00c49d5
Improve gmail error handling by catching and throttling for 400 failedPrecondition (#6044)
Closes #5897
2024-06-27 09:57:19 +02:00
Félix Malfait
08c081d315
Add boolean with toggle in csv import (#6050)
Better UI when importing boolean via CSV (with a toggle)
2024-06-26 22:55:49 +02:00
Félix Malfait
7b816e500c
Basic import for select in CSV (#6047)
Enables basic support for Select import and field matching in CSV. 
It's not pretty! But it's better than what we had before.
We should iterate on that quickly

<img width="591" alt="Screenshot 2024-06-26 at 18 41 16"
src="https://github.com/twentyhq/twenty/assets/6399865/99f67f39-3f0f-4074-aac6-3200954be08a">
2024-06-26 22:37:07 +02:00
Weiko
1eb9c582f3
Rename mutation maximum affected records (#6042)
As per my last comment on https://github.com/twentyhq/twenty/pull/6039,
we decided to rename this var
2024-06-26 18:00:25 +02:00
Félix Malfait
87abc1b31d
Fix search in csv import (#6045)
A mini quality of life improvements, the search was case-sensitive which
was frustrating
2024-06-26 17:32:25 +02:00
Félix Malfait
cd6775da32
Don't display unmatched columns in csv import (#6037)
Adding a toggle so that, by default, we don't see dozens of fields but
only the field we matched, during the data validation step in csv export

<img width="785" alt="Screenshot 2024-06-26 at 13 25 36"
src="https://github.com/twentyhq/twenty/assets/6399865/ae558eb5-7461-4bc8-a836-ecff8b6d0dff">
2024-06-26 15:37:37 +02:00
Weiko
6599bc136e
Add mutationMaximumRecordAffected to clientConfig (#6039)
We are exposing the server mutationMaximumRecordAffected value via
clientConfig so it can be used by the FE.

This is a first step for https://github.com/twentyhq/twenty/issues/6025

<img width="610" alt="Screenshot 2024-06-26 at 14 58 26"
src="https://github.com/twentyhq/twenty/assets/1834158/9d192976-fd22-45d2-bdaa-a8ff6bb90ca2">
2024-06-26 15:21:13 +02:00
Félix Malfait
cf67ed09d0
Upsert endpoint and CSV import upsert (#5970)
This PR introduces an `upsert` parameter (along the existing `data`
param) for `createOne` and `createMany` mutations.

When upsert is set to `true`, the function will look for records with
the same id if an id was passed. If not id was passed, it will leverage
the existing duplicate check mechanism to find a duplicate. If a record
is found, then the function will perform an update instead of a create.

Unfortunately I had to remove some nice tests that existing on the args
factory. Those tests where mostly testing the duplication rule
generation logic but through a GraphQL angle. Since I moved the
duplication rule logic to a dedicated service, if I kept the tests but
mocked the service we wouldn't really be testing anything useful. The
right path would be to create new tests for this service that compare
the JSON output and not the GraphQL output but I chose not to work on
this as it's equivalent to rewriting the tests from scratch and I have
other competing priorities.
2024-06-26 11:39:16 +02:00
Charles Bochet
1736aee7ff
Remove message-import cache when connectedAccount is removed (#6021) 2024-06-26 11:23:08 +02:00
Lucas Bordeau
3b7901b49a
Removed performance optimization and put back previous system with recoil states for edit mode and soft focus to avoid side effects. (#6019)
Fixes https://github.com/twentyhq/twenty/issues/6016

This was another side effect of the optimization made on
RecordTableCellContainer to avoid using recoil states, but which causes
too many unpredictable side effects.

I just put back the previous system which works well. We'll see how to
optimize it again later.
2024-06-25 15:53:31 +02:00
Weiko
78865ee73e
Fix billing signup when workspace does not exist (#6018) 2024-06-25 15:51:01 +02:00
Jérémy M
7c2e745b45
feat: Dynamic hook registration for WorkspaceQueryHooks (#6008)
#### Overview

This PR introduces a new API for dynamically registering and executing
pre and post query hooks in the Workspace Query Hook system using the
`@WorkspaceQueryHook` decorator. This approach eliminates the need for
manual provider registration, and fix the issue of `undefined` or `null`
repository using `@InjectWorkspaceRepository`.

#### New API

**Define a Hook**

Use the `@WorkspaceQueryHook` decorator to define pre or post hooks:

```typescript
@WorkspaceQueryHook({
  key: `calendarEvent.findMany`,
  scope: Scope.REQUEST,
})
export class CalendarEventFindManyPreQueryHook implements WorkspaceQueryHookInstance {
  async execute(userId: string, workspaceId: string, payload: FindManyResolverArgs): Promise<void> {
    if (!payload?.filter?.id?.eq) {
      throw new BadRequestException('id filter is required');
    }

    // Implement hook logic here
  }
}
```

This API simplifies the registration and execution of query hooks,
providing a more flexible and maintainable approach.

---------

Co-authored-by: Weiko <corentin@twenty.com>
2024-06-25 12:41:46 +02:00
bosiraphael
4dfca45fd3
5615 create messageongoingstalecron (#6005)
Closes #5615
2024-06-25 11:57:02 +02:00
Charles Bochet
f8c057deea
Fix sign up broken because of missing workspace schema (#6013)
Allow workspace datasource factory to return null if the workspace
schema has not been created yet
2024-06-25 10:59:07 +02:00
martmull
7fb5c9b60f
Remove useless api position parameter (#6010)
- remove buggy addition of position parameter
- check created records are in first position by default
2024-06-25 10:30:19 +02:00
Hanch Han
797c2f4b6e
Add calendar cron command on self-hosting-var.mdx (#6009)
To enable Google Calendar integration, you need to run `yarn
command:prod cron📆google-calendar-sync` in the worker
container. However, currently, the self-hosting guide does not tell you
how to do it. If you just follow the guide, only Gmail integration will
be enabled. So I added the command for calendar sync cron on
self-hosting-var.mdx.
2024-06-25 08:59:31 +02:00
bosiraphael
a001bf1514
5951 create a command to trigger the import of a single message (#5962)
Closes #5951

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2024-06-24 18:01:22 +02:00
bosiraphael
f3701281e9
Create new sync statuses and stages for calendar (#5997)
Create fields:
- syncStatus
- syncStage
- syncStageStartedAt
2024-06-24 16:39:56 +02:00
Charles Bochet
ad61efe6ed
Remove multi select usage (#6004)
As per title!

Also, I'm removing an incorrect logic in the enum migration runner that
takes care of the case where we have no defaultValue but non nullable
which is not a valid business case.
2024-06-24 16:39:17 +02:00
Us3r-gitHub
24c31f9b39
Fix(view): Show Kanban View Creation (#5985)
# This PR
- Revise my previous work (PR #5969)
Because it would break the current logic and cause unexpected behavior.
(Issue #5979)
- Solve (Issue #5915) with another way

@lucasbordeau  What do you think about my current approach?
@JarWarren Please check it out—I'd love to get your feedback too!

---------

Co-authored-by: Achsan <achsanh@gmail.com>
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-06-24 16:05:40 +02:00
Aakarshan Thapa
57bbd7c129
Add update chevron (#5988)
Fixes #5986 


1. Added right chevron to Fields Menu Item
<img width="735" alt="Screenshot 2024-06-21 at 5 59 46 PM"
src="https://github.com/twentyhq/twenty/assets/63531478/1515aba0-6732-424d-a0b3-5cc826a35b16">



2. Changed color of Hidden fields menu item chevron and stroke of left
chevron
<img width="735" alt="Screenshot 2024-06-21 at 6 21 30 PM"
src="https://github.com/twentyhq/twenty/assets/63531478/20952197-2f09-486c-a3bb-5b6c285a6996">

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-06-24 15:01:21 +02:00
Rob Luke
901ef65545
feat: add australian dollar currency (#5990)
Hi Twenty team,
I'd love to have Australian dollar as an option in Twenty! Please let me
me know if I have missed anything I need to change to enable this.
Thanks for a a great product

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-06-24 14:55:37 +02:00
Atharv Parlikar
28c8f0df32
Turned on tooltip on kanban cards with shortDelay (#5991)
fixes: #5982 

Demo:


https://github.com/twentyhq/twenty/assets/58113282/6593381c-c01a-4259-9caa-8612247a9e95

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-06-24 14:51:18 +02:00
bosiraphael
77f9f6473b
Create feature flag for calendar V2 (#5998)
Create feature flag for calendar V2
2024-06-24 13:54:52 +02:00
Charles Bochet
498e4ff6ba
Refactor infiniteScoll to use debouncing (#5999)
Same as https://github.com/twentyhq/twenty/pull/5996 but with
useDebounced as asked in review
2024-06-24 13:45:07 +02:00
Raunak Singh Jolly
2e4ba9ca7b
Remove Right-Edge Gap in Table Cell Display (#5992)
fixes #5941 

![Screenshot from 2024-06-23
17-24-24](https://github.com/twentyhq/twenty/assets/59247136/ae67603a-824d-4e6b-b873-2d58e6296341)

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-06-24 12:03:46 +02:00
Charles Bochet
e8f386ce43
Fix infinite scroll issue on table (#5996)
We had an issue on infinite scroll on table view.
The fetch more logic was modifying isTableLastRowVisible state (which is
wrong, how could it know)? This was done to prevent loading too much
data at once. This was causing some race condition on
isTableLastRowVisible (as the table itself was also changing it
depending on the real visibility of the line)

I have remove this hacky usage of isTableLastRowVisible and replaced it
by a setTimeout to let the user some time to scroll and introduce a
throttle logic.
2024-06-24 11:20:16 +02:00
Charles Bochet
158e7a31f4
Improve tests (#5994)
Our tests on FE are red, which is a threat to code quality. I'm adding a
few unit tests to improve the coverage and lowering a bit the lines
coverage threshold
2024-06-23 20:12:18 +02:00
Weiko
e13dc7a1fc
[FlexibleSchema] Add IndexMetadata decorator (#5981)
## Context
Our Flexible Schema engine dynamically generates entities/tables/APIs
for us but was not flexible enough to build indexes in the DB. With more
and more features involving heavy queries such as Messaging, we are now
adding a new WorkspaceIndex() decorator for our standard objects (will
come later for custom objects). This decorator will give enough
information to the workspace sync metadata manager to generate the
proper migrations that will create or drop indexes on demand.
To be aligned with the rest of the engine, we are adding 2 new tables:
IndexMetadata and IndexFieldMetadata, that will store the info of our
indexes.

## Implementation

```typescript
@WorkspaceEntity({
  standardId: STANDARD_OBJECT_IDS.person,
  namePlural: 'people',
  labelSingular: 'Person',
  labelPlural: 'People',
  description: 'A person',
  icon: 'IconUser',
})
export class PersonWorkspaceEntity extends BaseWorkspaceEntity {
  @WorkspaceField({
    standardId: PERSON_STANDARD_FIELD_IDS.email,
    type: FieldMetadataType.EMAIL,
    label: 'Email',
    description: 'Contact’s Email',
    icon: 'IconMail',
  })
  @WorkspaceIndex()
  email: string;
```
By simply adding the WorkspaceIndex decorator, sync-metadata command
will create a new index for that column.
We can also add composite indexes, note that the order is important for
PSQL.
```typescript
@WorkspaceEntity({
  standardId: STANDARD_OBJECT_IDS.person,
  namePlural: 'people',
  labelSingular: 'Person',
  labelPlural: 'People',
  description: 'A person',
  icon: 'IconUser',
})
@WorkspaceIndex(['phone', 'email'])
export class PersonWorkspaceEntity extends BaseWorkspaceEntity {
```

Currently composite fields and relation fields are not handled by
@WorkspaceIndex() and you will need to use this notation instead
```typescript
@WorkspaceIndex(['companyId', 'nameFirstName'])
export class PersonWorkspaceEntity extends BaseWorkspaceEntity {
```
<img width="700" alt="Screenshot 2024-06-21 at 15 15 45"
src="https://github.com/twentyhq/twenty/assets/1834158/ac6da1d9-d315-40a4-9ba6-6ab9ae4709d4">

Next step: We might need to implement more complex index expressions,
this is why we have an expression column in IndexMetadata.
What I had in mind for the decorator, still open to discussion
```typescript
@WorkspaceIndex(['nameFirstName', 'nameLastName'], { expression: "$1 || ' ' || $2"})
export class PersonWorkspaceEntity extends BaseWorkspaceEntity {
```

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2024-06-22 12:39:57 +02:00
Jérémy M
0b4bfce324
feat: drop calendar repository (#5824)
This PR is replacing and removing all the raw queries and repositories
with the new `TwentyORM` and injection system using
`@InjectWorkspaceRepository`.
Some logic that was contained inside repositories has been moved to the
services.
In this PR we're only replacing repositories for calendar feature.

---------

Co-authored-by: Weiko <corentin@twenty.com>
Co-authored-by: bosiraphael <raphael.bosi@gmail.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
2024-06-22 09:26:58 +02:00
Vitor Hugo Rodrigues
91b0c2bb8e
feat: add brazilian real currency (#5989)
Added support to Brazilian Real currency code, added the new code on
`CurrencyCode.ts` and on `SETTINGS_FIELD_CURRENCY_CODES`
2024-06-22 08:38:52 +02:00
Ymir
d126b148a1
Navigation Panel UI Sizing Changes (#5964)
## Fixes #5902 :
- [x] Navigation items' height should be risen to 28px.
> For clarity:
- [x] Also increased the height of NavigationDrawerSectionTitle to 28px
to match navigation item.
- [x] The gap between sections should be reduced to 12px
> Was already completed it seems.
- [x] The workspace switcher should be aligned with the navigation items

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-06-21 16:49:48 +02:00
Thomas Trompette
9a4a2e4ca9
Fix links chip design (#5963)
Fix https://github.com/twentyhq/twenty/issues/5938 and
https://github.com/twentyhq/twenty/issues/5655

- Make sure chip count is displayed
- Fix padding
- Fix background colors, border
- Add hover and active states

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-06-21 16:15:17 +02:00
Akilesh Praveen
732653034e
fix: background colors for record table (#5967)
# Summary
- Address issue #5959 
- Update background color on hover & click for record table

# Test Plan

![Kapture 2024-06-19 at 20 32
44](https://github.com/twentyhq/twenty/assets/10789158/18a58c09-040a-47e6-953d-aac6f3803486)
2024-06-21 16:01:27 +02:00