mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-23 16:09:11 +00:00
fix: allow renaming custom field (#803)
* fix: allow renaming custom field * style: change time-to-end icon
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
import { memo, useEffect, useState } from 'react';
|
import { memo, useEffect, useState } from 'react';
|
||||||
import { Tooltip } from '@chakra-ui/react';
|
import { Tooltip } from '@chakra-ui/react';
|
||||||
import { BiArrowToBottom } from '@react-icons/all-files/bi/BiArrowToBottom';
|
|
||||||
import { IoArrowDown } from '@react-icons/all-files/io5/IoArrowDown';
|
import { IoArrowDown } from '@react-icons/all-files/io5/IoArrowDown';
|
||||||
import { IoArrowUp } from '@react-icons/all-files/io5/IoArrowUp';
|
import { IoArrowUp } from '@react-icons/all-files/io5/IoArrowUp';
|
||||||
|
import { IoFlag } from '@react-icons/all-files/io5/IoFlag';
|
||||||
import { IoPeople } from '@react-icons/all-files/io5/IoPeople';
|
import { IoPeople } from '@react-icons/all-files/io5/IoPeople';
|
||||||
import { IoPlay } from '@react-icons/all-files/io5/IoPlay';
|
import { IoPlay } from '@react-icons/all-files/io5/IoPlay';
|
||||||
import { IoPlayForward } from '@react-icons/all-files/io5/IoPlayForward';
|
import { IoPlayForward } from '@react-icons/all-files/io5/IoPlayForward';
|
||||||
@@ -173,7 +173,7 @@ function TimerIcon(props: { type: TimerType; className: string }) {
|
|||||||
return <IoTime className={className} />;
|
return <IoTime className={className} />;
|
||||||
}
|
}
|
||||||
if (type === TimerType.TimeToEnd) {
|
if (type === TimerType.TimeToEnd) {
|
||||||
return <BiArrowToBottom className={className} />;
|
return <IoFlag className={className} />
|
||||||
}
|
}
|
||||||
return <IoArrowDown className={className} />;
|
return <IoArrowDown className={className} />;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -404,12 +404,13 @@ export const editCustomField = async (label: string, newField: Partial<CustomFie
|
|||||||
throw new Error('Change of field type is not allowed');
|
throw new Error('Change of field type is not allowed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
persistedCustomFields[newField.label] = { ...existingField, ...newField };
|
||||||
|
|
||||||
if (existingField.label !== newField.label) {
|
if (existingField.label !== newField.label) {
|
||||||
|
delete persistedCustomFields[existingField.label];
|
||||||
customFieldChangelog[label] = newField.label;
|
customFieldChangelog[label] = newField.label;
|
||||||
}
|
}
|
||||||
|
|
||||||
persistedCustomFields[label] = { ...existingField, ...newField };
|
|
||||||
|
|
||||||
scheduleCustomFieldPersist(persistedCustomFields);
|
scheduleCustomFieldPersist(persistedCustomFields);
|
||||||
invalidateIfUsed(label);
|
invalidateIfUsed(label);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user