Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/fwf 3661 create task variable UI #2338

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useRef, useEffect } from "react";
import { ListGroup } from "react-bootstrap";
import { CustomPill } from "@formsflow/components";
import { CustomPill,DeleteIcon } from "@formsflow/components";
import PropTypes from 'prop-types';

const RoleSelector = ({ allRoles = [], selectedRoles = [], setSelectedRoles }) => {
Expand Down Expand Up @@ -62,7 +62,7 @@ const RoleSelector = ({ allRoles = [], selectedRoles = [], setSelectedRoles }) =
<CustomPill
key={role + index}
label={role}
icon={true}
icon={<DeleteIcon color="#253DF4" />}
arun-s-aot marked this conversation as resolved.
Show resolved Hide resolved
bg="primary"
onClick={() => removeRole(role)}
/>
Expand Down
25 changes: 21 additions & 4 deletions forms-flow-web/src/components/Form/EditForm/FlowEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
HistoryIcon,
ConfirmModal,
HistoryModal,
CurlyBracketsIcon
} from "@formsflow/components";
import { Card } from "react-bootstrap";
import { useTranslation } from "react-i18next";
Expand All @@ -29,8 +30,9 @@ import {
validateProcess,
} from "../../../helper/processHelper.js";
import PropTypes from "prop-types";
import TaskVariableModal from "../../Modals/TaskVariableModal.js";

const FlowEdit = forwardRef(({ isPublished = false, CategoryType }, ref) => {
const FlowEdit = forwardRef(({ isPublished = false, CategoryType,form }, ref) => {
const { t } = useTranslation();
const dispatch = useDispatch();
const bpmnRef = useRef();
Expand All @@ -40,6 +42,7 @@ const FlowEdit = forwardRef(({ isPublished = false, CategoryType }, ref) => {
const [showDiscardModal, setShowDiscardModal] = useState(false);
const [showHistoryModal, setShowHistoryModal] = useState(false);
const [isReverted, setIsReverted] = useState(false);
const [showTaskVarModal, setShowTaskVarModal] = useState(false);
/* --------- fetching all process history when click history button --------- */
const {
data: { data: historiesData } = {}, // response data destructured
Expand Down Expand Up @@ -124,7 +127,12 @@ const FlowEdit = forwardRef(({ isPublished = false, CategoryType }, ref) => {
useImperativeHandle(ref, () => ({
saveFlow,
}));

const handlePreviewAndVariables = () => {
setShowTaskVarModal(true);
};
const CloseTaskVarModal = () => {
setShowTaskVarModal(false);
};

return (
<>
Expand Down Expand Up @@ -163,8 +171,9 @@ const FlowEdit = forwardRef(({ isPublished = false, CategoryType }, ref) => {
variant="secondary"
size="md"
className="mx-2"
label={t("Preview & Variables")}
onClick={() => console.log("handlePreviewAndVariables")}
icon={<CurlyBracketsIcon />}
label={t("Variables")}
onClick={() => handlePreviewAndVariables()}
dataTestid="preview-and-variables-testid"
ariaLabel={t("{Preview and Variables Button}")}
/>
Expand Down Expand Up @@ -222,6 +231,13 @@ const FlowEdit = forwardRef(({ isPublished = false, CategoryType }, ref) => {
historyCount={historiesData?.totalCount || 0}
currentVersionId={processData.id}
/>
{showTaskVarModal && (
<TaskVariableModal
form={form}
showTaskVarModal={showTaskVarModal}
onClose={CloseTaskVarModal}
/>
)}
</>
);
});
Expand All @@ -231,6 +247,7 @@ FlowEdit.propTypes = {
WORKFLOW: PropTypes.string.isRequired,
}).isRequired,
isPublished: PropTypes.bool.isRequired,
form: PropTypes.object.isRequired,
};

export default FlowEdit;
1 change: 1 addition & 0 deletions forms-flow-web/src/components/Form/EditForm/FormEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,7 @@ const EditComponent = () => {
ref={flowRef}
CategoryType={CategoryType}
isPublished={isPublished}
form={form}
/>}
</div>
<button
Expand Down
Loading
Loading