729c990546
## Setup This PR can be tested only if some feature flags have specific values: - `IsWorkflowEnabled` equals `true` - `IsQueryRunnerTwentyORMEnabled` equals `false` These feature flags weren't committed to don't break other branches. ## What this PR brings - Display buttons to activate and deactivate a workflow version and a button to discard the current draft version. I also scaffolded a "Test" button, which doesn't do anything for now. - Wired the activate, deactivate and discard draft buttons to the backend. - Made it possible to "edit" active and deactivated versions by automatically creating a new draft version when the user tries to edit the version. - Hide the "Discard Draft", button if the current version is not a draft or is the first version ever created. - On the backend, don't consider discarded drafts when checking if a new draft version can be created. - On the backend, disallow deleting the first created workflow version. Otherwise, we will end up with a blank canvas in the front end, and it will be impossible to recover from it. - On the backend, disallow running deactivation steps if the workflow version is not currently active. Previously, we were throwing, which is unnecessary as it's a valid case. ## Spotted bugs that we must dive into ### Duplicate workflow versions in Apollo cache https://github.com/user-attachments/assets/7cfffd06-11e0-417a-8da0-f9a5f43b84e2 --------- Co-authored-by: Charles Bochet <charles@twenty.com>
268 lines
7.8 KiB
TypeScript
268 lines
7.8 KiB
TypeScript
import { FieldMetadata } from '@/object-record/record-field/types/FieldMetadata';
|
|
import { ColumnDefinition } from '@/object-record/record-table/types/ColumnDefinition';
|
|
import { filterAvailableTableColumns } from '@/object-record/utils/filterAvailableTableColumns';
|
|
import {
|
|
FieldMetadataType,
|
|
RelationDefinitionType,
|
|
} from '~/generated-metadata/graphql';
|
|
|
|
export const SIGN_IN_BACKGROUND_MOCK_COLUMN_DEFINITIONS = (
|
|
[
|
|
{
|
|
position: 0,
|
|
fieldMetadataId: '20202020-5e4e-4007-a630-8a2617914889',
|
|
label: 'Domain Name',
|
|
size: 100,
|
|
type: FieldMetadataType.Links,
|
|
metadata: {
|
|
fieldName: 'domainName',
|
|
placeHolder: 'Domain Name',
|
|
relationObjectMetadataNameSingular: '',
|
|
relationObjectMetadataNamePlural: '',
|
|
objectMetadataNameSingular: 'company',
|
|
},
|
|
iconName: 'IconLink',
|
|
isVisible: true,
|
|
defaultValue: '',
|
|
},
|
|
{
|
|
position: 1,
|
|
fieldMetadataId: '20202020-7fbd-41ad-b64d-25a15ff62f04',
|
|
label: 'Employees',
|
|
size: 100,
|
|
type: FieldMetadataType.Number,
|
|
metadata: {
|
|
fieldName: 'employees',
|
|
placeHolder: 'Employees',
|
|
relationObjectMetadataNameSingular: '',
|
|
relationObjectMetadataNamePlural: '',
|
|
objectMetadataNameSingular: 'company',
|
|
},
|
|
iconName: 'IconUsers',
|
|
isVisible: true,
|
|
defaultValue: 0,
|
|
},
|
|
{
|
|
position: 2,
|
|
fieldMetadataId: 'REPLACE_ME',
|
|
label: 'Name',
|
|
size: 100,
|
|
type: FieldMetadataType.Text,
|
|
metadata: {
|
|
fieldName: 'name',
|
|
placeHolder: 'Name',
|
|
relationObjectMetadataNameSingular: '',
|
|
relationObjectMetadataNamePlural: '',
|
|
objectMetadataNameSingular: 'company',
|
|
},
|
|
iconName: 'IconBuildingSkyscraper',
|
|
isVisible: true,
|
|
defaultValue: '',
|
|
},
|
|
{
|
|
position: 3,
|
|
fieldMetadataId: '20202020-e7c8-4771-8cc4-ce0e8c36a3c0',
|
|
label: 'Favorites',
|
|
size: 100,
|
|
type: FieldMetadataType.Relation,
|
|
metadata: {
|
|
fieldName: 'favorites',
|
|
relationType: RelationDefinitionType.OneToMany,
|
|
relationObjectMetadataNameSingular: '',
|
|
relationObjectMetadataNamePlural: '',
|
|
objectMetadataNameSingular: 'company',
|
|
},
|
|
iconName: 'IconHeart',
|
|
isVisible: true,
|
|
defaultValue: [],
|
|
},
|
|
{
|
|
position: 4,
|
|
fieldMetadataId: '20202020-ad10-4117-a039-3f04b7a5f939',
|
|
label: 'Address',
|
|
size: 100,
|
|
type: FieldMetadataType.Address,
|
|
metadata: {
|
|
fieldName: 'address',
|
|
placeHolder: 'Address',
|
|
relationObjectMetadataNameSingular: '',
|
|
relationObjectMetadataNamePlural: '',
|
|
objectMetadataNameSingular: 'company',
|
|
},
|
|
iconName: 'IconMap',
|
|
isVisible: true,
|
|
defaultValue: '',
|
|
},
|
|
{
|
|
position: 5,
|
|
fieldMetadataId: '20202020-0739-495d-8e70-c0807f6b2268',
|
|
label: 'Account Owner',
|
|
size: 100,
|
|
type: FieldMetadataType.Relation,
|
|
metadata: {
|
|
fieldName: 'accountOwner',
|
|
relationType: RelationDefinitionType.ManyToOne,
|
|
relationObjectMetadataNameSingular: 'workspaceMember',
|
|
relationObjectMetadataNamePlural: 'workspaceMembers',
|
|
objectMetadataNameSingular: 'company',
|
|
},
|
|
iconName: 'IconUserCircle',
|
|
isVisible: true,
|
|
defaultValue: null,
|
|
},
|
|
{
|
|
position: 6,
|
|
fieldMetadataId: '20202020-68b4-4c8e-af19-738eba2a42a5',
|
|
label: 'People',
|
|
size: 100,
|
|
type: FieldMetadataType.Relation,
|
|
metadata: {
|
|
fieldName: 'people',
|
|
relationType: RelationDefinitionType.OneToMany,
|
|
relationObjectMetadataNameSingular: '',
|
|
relationObjectMetadataNamePlural: '',
|
|
objectMetadataNameSingular: 'company',
|
|
},
|
|
iconName: 'IconUsers',
|
|
isVisible: true,
|
|
defaultValue: [],
|
|
},
|
|
{
|
|
position: 7,
|
|
fieldMetadataId: '20202020-61af-4ffd-b79b-baed6db8ad11',
|
|
label: 'Attachments',
|
|
size: 100,
|
|
type: FieldMetadataType.Relation,
|
|
metadata: {
|
|
fieldName: 'attachments',
|
|
relationType: RelationDefinitionType.OneToMany,
|
|
relationObjectMetadataNameSingular: '',
|
|
relationObjectMetadataNamePlural: '',
|
|
objectMetadataNameSingular: 'company',
|
|
},
|
|
iconName: 'IconFileImport',
|
|
isVisible: true,
|
|
defaultValue: [],
|
|
},
|
|
{
|
|
position: 8,
|
|
fieldMetadataId: '20202020-4dc2-47c9-bb15-6e6f19ba9e46',
|
|
label: 'Creation date',
|
|
size: 100,
|
|
type: FieldMetadataType.DateTime,
|
|
metadata: {
|
|
fieldName: 'createdAt',
|
|
placeHolder: 'Creation date',
|
|
relationObjectMetadataNameSingular: '',
|
|
relationObjectMetadataNamePlural: '',
|
|
objectMetadataNameSingular: 'company',
|
|
},
|
|
iconName: 'IconCalendar',
|
|
isVisible: true,
|
|
defaultValue: '',
|
|
},
|
|
{
|
|
position: 9,
|
|
fieldMetadataId: '20202020-9e9f-4235-98b2-c76f3e2d281e',
|
|
label: 'ICP',
|
|
size: 100,
|
|
type: FieldMetadataType.Boolean,
|
|
metadata: {
|
|
fieldName: 'idealCustomerProfile',
|
|
placeHolder: 'ICP',
|
|
relationObjectMetadataNameSingular: '',
|
|
relationObjectMetadataNamePlural: '',
|
|
objectMetadataNameSingular: 'company',
|
|
},
|
|
iconName: 'IconTarget',
|
|
isVisible: true,
|
|
defaultValue: false,
|
|
},
|
|
{
|
|
position: 10,
|
|
fieldMetadataId: '20202020-a61d-4b78-b998-3fd88b4f73a1',
|
|
label: 'Linkedin',
|
|
size: 100,
|
|
type: FieldMetadataType.Links,
|
|
metadata: {
|
|
fieldName: 'linkedinLink',
|
|
placeHolder: 'Linkedin',
|
|
relationObjectMetadataNameSingular: '',
|
|
relationObjectMetadataNamePlural: '',
|
|
objectMetadataNameSingular: 'company',
|
|
},
|
|
iconName: 'IconBrandLinkedin',
|
|
isVisible: true,
|
|
defaultValue: '',
|
|
},
|
|
{
|
|
position: 11,
|
|
fieldMetadataId: '20202020-e3fc-46ff-b552-3e757843f06e',
|
|
label: 'Opportunities',
|
|
size: 100,
|
|
type: FieldMetadataType.Relation,
|
|
metadata: {
|
|
fieldName: 'opportunities',
|
|
relationType: RelationDefinitionType.OneToMany,
|
|
relationObjectMetadataNameSingular: '',
|
|
relationObjectMetadataNamePlural: '',
|
|
objectMetadataNameSingular: 'company',
|
|
},
|
|
iconName: 'IconTargetArrow',
|
|
isVisible: true,
|
|
defaultValue: [],
|
|
},
|
|
{
|
|
position: 12,
|
|
fieldMetadataId: '20202020-46e3-479a-b8f4-77137c74daa6',
|
|
label: 'X',
|
|
size: 100,
|
|
type: FieldMetadataType.Links,
|
|
metadata: {
|
|
fieldName: 'xLink',
|
|
placeHolder: 'X',
|
|
relationObjectMetadataNameSingular: '',
|
|
relationObjectMetadataNamePlural: '',
|
|
objectMetadataNameSingular: 'company',
|
|
},
|
|
iconName: 'IconBrandX',
|
|
isVisible: true,
|
|
defaultValue: '',
|
|
},
|
|
{
|
|
position: 13,
|
|
fieldMetadataId: '20202020-4a2e-4b41-8562-279963e8947e',
|
|
label: 'Activities',
|
|
size: 100,
|
|
type: FieldMetadataType.Relation,
|
|
metadata: {
|
|
fieldName: 'activityTargets',
|
|
relationType: RelationDefinitionType.OneToMany,
|
|
relationObjectMetadataNameSingular: '',
|
|
relationObjectMetadataNamePlural: '',
|
|
objectMetadataNameSingular: 'company',
|
|
},
|
|
iconName: 'IconCheckbox',
|
|
isVisible: true,
|
|
defaultValue: [],
|
|
},
|
|
{
|
|
position: 14,
|
|
fieldMetadataId: '20202020-4a5a-466f-92d9-c3870d9502a9',
|
|
label: 'ARR',
|
|
size: 100,
|
|
type: FieldMetadataType.Currency,
|
|
metadata: {
|
|
fieldName: 'annualRecurringRevenue',
|
|
placeHolder: 'ARR',
|
|
relationObjectMetadataNameSingular: '',
|
|
relationObjectMetadataNamePlural: '',
|
|
objectMetadataNameSingular: 'company',
|
|
},
|
|
iconName: 'IconMoneybag',
|
|
isVisible: true,
|
|
defaultValue: 0,
|
|
},
|
|
] satisfies ColumnDefinition<FieldMetadata>[]
|
|
).filter(filterAvailableTableColumns);
|