mirror of
https://github.com/twentyhq/twenty.git
synced 2024-11-29 19:10:19 +03:00
minor fix - reset single entity search (#7420)
minor follow up fix #7285 --------- Co-authored-by: Félix Malfait <felix@twenty.com>
This commit is contained in:
parent
a946c6a33d
commit
e3ed574420
@ -992,6 +992,7 @@ export type RelationDefinition = {
|
|||||||
|
|
||||||
/** Relation definition type */
|
/** Relation definition type */
|
||||||
export enum RelationDefinitionType {
|
export enum RelationDefinitionType {
|
||||||
|
ManyToMany = 'MANY_TO_MANY',
|
||||||
ManyToOne = 'MANY_TO_ONE',
|
ManyToOne = 'MANY_TO_ONE',
|
||||||
OneToMany = 'ONE_TO_MANY',
|
OneToMany = 'ONE_TO_MANY',
|
||||||
OneToOne = 'ONE_TO_ONE'
|
OneToOne = 'ONE_TO_ONE'
|
||||||
@ -999,6 +1000,7 @@ export enum RelationDefinitionType {
|
|||||||
|
|
||||||
/** Type of the relation */
|
/** Type of the relation */
|
||||||
export enum RelationMetadataType {
|
export enum RelationMetadataType {
|
||||||
|
ManyToMany = 'MANY_TO_MANY',
|
||||||
ManyToOne = 'MANY_TO_ONE',
|
ManyToOne = 'MANY_TO_ONE',
|
||||||
OneToMany = 'ONE_TO_MANY',
|
OneToMany = 'ONE_TO_MANY',
|
||||||
OneToOne = 'ONE_TO_ONE'
|
OneToOne = 'ONE_TO_ONE'
|
||||||
|
@ -93,7 +93,6 @@ export const RecordBoardColumnHeader = () => {
|
|||||||
newRecord,
|
newRecord,
|
||||||
handleNewButtonClick,
|
handleNewButtonClick,
|
||||||
handleCreateSuccess,
|
handleCreateSuccess,
|
||||||
|
|
||||||
handleEntitySelect,
|
handleEntitySelect,
|
||||||
} = useColumnNewCardActions(columnDefinition.id);
|
} = useColumnNewCardActions(columnDefinition.id);
|
||||||
const { isOpportunitiesCompanyFieldDisabled } =
|
const { isOpportunitiesCompanyFieldDisabled } =
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { RecordBoardContext } from '@/object-record/record-board/contexts/RecordBoardContext';
|
import { RecordBoardContext } from '@/object-record/record-board/contexts/RecordBoardContext';
|
||||||
import { RecordBoardColumnContext } from '@/object-record/record-board/record-board-column/contexts/RecordBoardColumnContext';
|
import { RecordBoardColumnContext } from '@/object-record/record-board/record-board-column/contexts/RecordBoardColumnContext';
|
||||||
import { recordBoardNewRecordByColumnIdSelector } from '@/object-record/record-board/states/selectors/recordBoardNewRecordByColumnIdSelector';
|
import { recordBoardNewRecordByColumnIdSelector } from '@/object-record/record-board/states/selectors/recordBoardNewRecordByColumnIdSelector';
|
||||||
|
import { useEntitySelectSearch } from '@/object-record/relation-picker/hooks/useEntitySelectSearch';
|
||||||
import { EntityForSelect } from '@/object-record/relation-picker/types/EntityForSelect';
|
import { EntityForSelect } from '@/object-record/relation-picker/types/EntityForSelect';
|
||||||
import { RelationPickerHotkeyScope } from '@/object-record/relation-picker/types/RelationPickerHotkeyScope';
|
import { RelationPickerHotkeyScope } from '@/object-record/relation-picker/types/RelationPickerHotkeyScope';
|
||||||
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
|
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
|
||||||
@ -17,6 +18,9 @@ export const useAddNewCard = () => {
|
|||||||
const columnContext = useContext(RecordBoardColumnContext);
|
const columnContext = useContext(RecordBoardColumnContext);
|
||||||
const { createOneRecord, selectFieldMetadataItem } =
|
const { createOneRecord, selectFieldMetadataItem } =
|
||||||
useContext(RecordBoardContext);
|
useContext(RecordBoardContext);
|
||||||
|
const { resetSearchFilter } = useEntitySelectSearch({
|
||||||
|
relationPickerScopeId: 'relation-picker',
|
||||||
|
});
|
||||||
|
|
||||||
const {
|
const {
|
||||||
goBackToPreviousHotkeyScope,
|
goBackToPreviousHotkeyScope,
|
||||||
@ -132,11 +136,12 @@ export const useAddNewCard = () => {
|
|||||||
company: null,
|
company: null,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
resetSearchFilter();
|
||||||
if (isOpportunity === true) {
|
if (isOpportunity === true) {
|
||||||
goBackToPreviousHotkeyScope();
|
goBackToPreviousHotkeyScope();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[getColumnDefinitionId, goBackToPreviousHotkeyScope],
|
[getColumnDefinitionId, goBackToPreviousHotkeyScope, resetSearchFilter],
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleCreate = (
|
const handleCreate = (
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
IconComponent,
|
IconComponent,
|
||||||
|
IllustrationIconManyToMany,
|
||||||
IllustrationIconOneToMany,
|
IllustrationIconOneToMany,
|
||||||
IllustrationIconOneToOne,
|
IllustrationIconOneToOne,
|
||||||
} from 'twenty-ui';
|
} from 'twenty-ui';
|
||||||
@ -34,4 +35,11 @@ export const RELATION_TYPES: Record<
|
|||||||
imageSrc: OneToManySvg,
|
imageSrc: OneToManySvg,
|
||||||
isImageFlipped: true,
|
isImageFlipped: true,
|
||||||
},
|
},
|
||||||
|
// Not supported yet
|
||||||
|
[RelationDefinitionType.ManyToMany]: {
|
||||||
|
label: 'Belongs to many',
|
||||||
|
Icon: IllustrationIconManyToMany,
|
||||||
|
imageSrc: OneToManySvg,
|
||||||
|
isImageFlipped: true,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
@ -66,7 +66,11 @@ const StyledInputsContainer = styled.div`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
const RELATION_TYPE_OPTIONS = Object.entries(RELATION_TYPES)
|
const RELATION_TYPE_OPTIONS = Object.entries(RELATION_TYPES)
|
||||||
.filter(([value]) => 'ONE_TO_ONE' !== value && 'MANY_TO_MANY' !== value)
|
.filter(
|
||||||
|
([value]) =>
|
||||||
|
RelationDefinitionType.OneToOne !== value &&
|
||||||
|
RelationDefinitionType.ManyToMany !== value,
|
||||||
|
)
|
||||||
.map(([value, { label, Icon }]) => ({
|
.map(([value, { label, Icon }]) => ({
|
||||||
label,
|
label,
|
||||||
value: value as RelationType,
|
value: value as RelationType,
|
||||||
|
Loading…
Reference in New Issue
Block a user