From 7c5cf9b60c02cb912abbf60a9ce1365cca47949d Mon Sep 17 00:00:00 2001 From: sanmont3drepo Date: Thu, 16 Jan 2025 17:55:17 +0000 Subject: [PATCH 1/3] ISSUE #5351 - Fixed selection of collection in groups --- .../groupsCollectionSelect.component.tsx | 18 +++++++++++------- .../groupsCollectionSelect.styles.ts | 9 +++++++++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/frontend/src/v5/ui/routes/viewer/tickets/ticketsForm/ticketGroups/groups/addOrEditGroup/groupSettingsForm/groupsCollectionSelect/groupsCollectionSelect.component.tsx b/frontend/src/v5/ui/routes/viewer/tickets/ticketsForm/ticketGroups/groups/addOrEditGroup/groupSettingsForm/groupsCollectionSelect/groupsCollectionSelect.component.tsx index 03a91e15c51..b3c29fbbd87 100644 --- a/frontend/src/v5/ui/routes/viewer/tickets/ticketsForm/ticketGroups/groups/addOrEditGroup/groupSettingsForm/groupsCollectionSelect/groupsCollectionSelect.component.tsx +++ b/frontend/src/v5/ui/routes/viewer/tickets/ticketsForm/ticketGroups/groups/addOrEditGroup/groupSettingsForm/groupsCollectionSelect/groupsCollectionSelect.component.tsx @@ -15,10 +15,9 @@ * along with this program. If not, see . */ -import { Select } from '@controls/inputs/select/select.component'; import { MenuItem } from '@mui/material'; import { formatMessage } from '@/v5/services/intl'; -import { MenuItemPrefix } from './groupsCollectionSelect.styles'; +import { CollectionSelect, MenuItemPrefix } from './groupsCollectionSelect.styles'; const NONE = formatMessage({ id: 'ticketsGroupSettings.form.groupCollection.option.none', @@ -32,13 +31,18 @@ type GroupsCollectionSelectProps = { prefixes: string[][]; disabled?: boolean; }; -export const GroupsCollectionSelect = ({ value, onChange, prefixes, ...props }: GroupsCollectionSelectProps) => ( - + ); diff --git a/frontend/src/v5/ui/routes/viewer/tickets/ticketsForm/ticketGroups/groups/addOrEditGroup/groupSettingsForm/groupsCollectionSelect/groupsCollectionSelect.styles.ts b/frontend/src/v5/ui/routes/viewer/tickets/ticketsForm/ticketGroups/groups/addOrEditGroup/groupSettingsForm/groupsCollectionSelect/groupsCollectionSelect.styles.ts index d823698cfe9..cb1f5078da8 100644 --- a/frontend/src/v5/ui/routes/viewer/tickets/ticketsForm/ticketGroups/groups/addOrEditGroup/groupSettingsForm/groupsCollectionSelect/groupsCollectionSelect.styles.ts +++ b/frontend/src/v5/ui/routes/viewer/tickets/ticketsForm/ticketGroups/groups/addOrEditGroup/groupSettingsForm/groupsCollectionSelect/groupsCollectionSelect.styles.ts @@ -15,6 +15,7 @@ * along with this program. If not, see . */ +import { Select } from '@controls/inputs/select/select.component'; import { MenuItem as MenuItemBase } from '@mui/material'; import styled, { css } from 'styled-components'; @@ -26,3 +27,11 @@ export const MenuItemPrefix = styled(MenuItemBase)<{ $depth: number }>` } `} `; + +export const CollectionSelect = styled(Select)` + .MuiInputBase-input { + text-overflow: ellipsis; + direction: rtl; + text-align: left; + } +`; From 26de8106702f2236fdca3f522b187b162e3dab0c Mon Sep 17 00:00:00 2001 From: sanmont3drepo Date: Fri, 17 Jan 2025 17:30:47 +0000 Subject: [PATCH 2/3] ISSUE #5351 - Fixed collection edition in ticket groups --- .../groupSettingsForm.component.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/frontend/src/v5/ui/routes/viewer/tickets/ticketsForm/ticketGroups/groups/groupActionMenu/groupSettingsForm/groupSettingsForm.component.tsx b/frontend/src/v5/ui/routes/viewer/tickets/ticketsForm/ticketGroups/groups/groupActionMenu/groupSettingsForm/groupSettingsForm.component.tsx index 006e2d2ce2e..80248420efb 100644 --- a/frontend/src/v5/ui/routes/viewer/tickets/ticketsForm/ticketGroups/groups/groupActionMenu/groupSettingsForm/groupSettingsForm.component.tsx +++ b/frontend/src/v5/ui/routes/viewer/tickets/ticketsForm/ticketGroups/groups/groupActionMenu/groupSettingsForm/groupSettingsForm.component.tsx @@ -86,6 +86,7 @@ export const GroupSettingsForm = ({ value, onSubmit, onCancel, prefixes, isColor const isAdmin = !TicketsCardHooksSelectors.selectReadOnly(); const { teamspace, revision } = useParams(); const { containerOrFederation } = useContext(TicketContext); + const [basePrefixes, setBasePrefixes] = useState([]); const formRef = useRef(null); @@ -144,7 +145,7 @@ export const GroupSettingsForm = ({ value, onSubmit, onCancel, prefixes, isColor }; const handleNewCollectionChange = (collection: string[]) => { - setNewPrefix([collection]); + setNewPrefix(collection); setValue('prefix', collection, { shouldDirty: true }); }; @@ -183,8 +184,14 @@ export const GroupSettingsForm = ({ value, onSubmit, onCancel, prefixes, isColor setIsSmart(!!value?.group?.rules?.length); setInputObjects(convertToV4GroupNodes(value?.group?.objects)); setIsPastingRules(false); + setNewPrefix(newValue.prefix); }, [value, isColored]); + useEffect(() => { + const theval = prefixes.filter((elem) => !isEqual(elem, value?.prefix)); + setBasePrefixes(theval); + }, [prefixes, value?.prefix]); + useEffect(() => { if (!formRef.current) return; const viewportHeight = window.innerHeight; @@ -264,7 +271,7 @@ export const GroupSettingsForm = ({ value, onSubmit, onCancel, prefixes, isColor })} formError={errors?.prefix} disabled={!isAdmin} - prefixes={prefixes.concat(newPrefix).sort()} + prefixes={basePrefixes.concat([newPrefix]).sort()} /> { @@ -275,7 +282,7 @@ export const GroupSettingsForm = ({ value, onSubmit, onCancel, prefixes, isColor {newPrefix?.length ? ( ) : ( Date: Mon, 20 Jan 2025 10:13:49 +0000 Subject: [PATCH 3/3] ISSUE #5351 - Fixed reset of new group after editing an existing one --- .../groupSettingsForm/groupSettingsForm.component.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/v5/ui/routes/viewer/tickets/ticketsForm/ticketGroups/groups/groupActionMenu/groupSettingsForm/groupSettingsForm.component.tsx b/frontend/src/v5/ui/routes/viewer/tickets/ticketsForm/ticketGroups/groups/groupActionMenu/groupSettingsForm/groupSettingsForm.component.tsx index 80248420efb..fe75b281c55 100644 --- a/frontend/src/v5/ui/routes/viewer/tickets/ticketsForm/ticketGroups/groups/groupActionMenu/groupSettingsForm/groupSettingsForm.component.tsx +++ b/frontend/src/v5/ui/routes/viewer/tickets/ticketsForm/ticketGroups/groups/groupActionMenu/groupSettingsForm/groupSettingsForm.component.tsx @@ -175,6 +175,7 @@ export const GroupSettingsForm = ({ value, onSubmit, onCancel, prefixes, isColor group: {}, }); setIsSmart(true); + setNewPrefix([]); return; }