diff --git a/forms-flow-web/src/components/Form/constants/FormTable.js b/forms-flow-web/src/components/Form/constants/FormTable.js index 9da3d37135..1dcacdcb35 100644 --- a/forms-flow-web/src/components/Form/constants/FormTable.js +++ b/forms-flow-web/src/components/Form/constants/FormTable.js @@ -300,12 +300,15 @@ function FormTable() { - + diff --git a/forms-flow-web/src/components/ServiceFlow/list/sort/CreateNewFilter.js b/forms-flow-web/src/components/ServiceFlow/list/sort/CreateNewFilter.js index ca6fed530a..cc665b3573 100644 --- a/forms-flow-web/src/components/ServiceFlow/list/sort/CreateNewFilter.js +++ b/forms-flow-web/src/components/ServiceFlow/list/sort/CreateNewFilter.js @@ -33,7 +33,14 @@ import TaskAttributeComponent from "./TaskAttributeComponent"; import { toast } from "react-toastify"; import { getUserRoles } from "../../../../apiManager/services/authorizationService"; import { setUserGroups } from "../../../../actions/authorizationActions"; -import { Badge, ListGroup, OverlayTrigger, Popover } from "react-bootstrap"; +import { + Badge, + ListGroup, + OverlayTrigger, + Popover, + Modal, + Button, +} from "react-bootstrap"; import { trimFirstSlash } from "../../constants/taskConstants"; import { cloneDeep, omitBy } from "lodash"; import { @@ -112,6 +119,8 @@ export default function CreateNewFilterDrawer({ const { t } = useTranslation(); const [modalShow, setModalShow] = useState(false); const [checkboxes, setCheckboxes] = useState(initialValueOfTaskAttribute); + const [showDeleteModal, setShowDeleteModal] = useState(false); + const [showAlert, setShowAlert] = useState(false); const fetchTasks = (resData) => { const reqParamData = { @@ -503,6 +512,11 @@ export default function CreateNewFilterDrawer({ setOpenFilterDrawer(!openFilterDrawer); }; + const deleteConfirmationModalToggleDrawer = () => { + setOpenFilterDrawer(!openFilterDrawer); + }; + + const candidateGroups = useSelector( (state) => state.user?.userDetail?.groups || [] ); @@ -543,6 +557,38 @@ export default function CreateNewFilterDrawer({ setShowUndefinedVariable(showUndefinedVariable); }; + + const hideDeleteConfirmation = () => { + setShowDeleteModal(false); + deleteConfirmationModalToggleDrawer(); + }; + + const showDeleteConfirmation = () => { + setShowDeleteModal(true); + toggleDrawer(); + }; + + const FilterDelete = () => { + hideDeleteConfirmation(); + handleFilterDelete(); + }; + + const textTruncate = (wordLength, targetLength, text) => { + return text?.length > wordLength + ? text.substring(0, targetLength) + "..." + : text; + }; + + const handleFilterName = (e) => { + const value = e.target.value; + setFilterName(value); + if (value.length >= 50) { + setShowAlert(true); + } else { + setShowAlert(false); + } + }; + const list = () => (
@@ -560,13 +606,18 @@ export default function CreateNewFilterDrawer({ setFilterName(e.target.value)} - title={t("Add filter name")} + onChange={handleFilterName} + title={t("Add fliter name")} /> + {showAlert && ( +

+ {t("Filter name should be less than 50 characters")} +

+ )}
@@ -835,8 +886,7 @@ export default function CreateNewFilterDrawer({ + + + ); } diff --git a/forms-flow-web/src/containers/TaskHead.js b/forms-flow-web/src/containers/TaskHead.js index a5cfad6b35..5e69ce1f62 100644 --- a/forms-flow-web/src/containers/TaskHead.js +++ b/forms-flow-web/src/containers/TaskHead.js @@ -45,6 +45,12 @@ function TaskHead() { const count = isTaskListLoading ? "" : `(${itemCount})`; + const textTruncate = (wordLength, targetLength, text) => { + return text?.length > wordLength + ? text.substring(0, targetLength) + "..." + : text; + }; + return (
@@ -55,7 +61,8 @@ function TaskHead() { {selectedFilter?.name ? - `${selectedFilter?.name} ${count}` : filterListLoading() } + textTruncate(25, 23, `${selectedFilter?.name} ${count}`) : + filterListLoading() } } onClick={goToTask}