From 02169ffbd9b30c894b2137864ec7ce53ef4c4a59 Mon Sep 17 00:00:00 2001 From: shuhaib-aot Date: Wed, 27 Mar 2024 09:55:00 +0530 Subject: [PATCH] Removed taskvariable create filter and select_all_field from mapper table --- ...c_removed_select_all_field_from_mapper_.py | 28 +++++++ .../models/form_process_mapper.py | 5 -- .../schemas/form_process_mapper.py | 1 - .../Form/Steps/TaskvariableCreate.js | 84 ------------------- 4 files changed, 28 insertions(+), 90 deletions(-) create mode 100644 forms-flow-api/migrations/versions/fdfe787a197c_removed_select_all_field_from_mapper_.py delete mode 100644 forms-flow-web/src/components/Form/Steps/TaskvariableCreate.js diff --git a/forms-flow-api/migrations/versions/fdfe787a197c_removed_select_all_field_from_mapper_.py b/forms-flow-api/migrations/versions/fdfe787a197c_removed_select_all_field_from_mapper_.py new file mode 100644 index 0000000000..fbbe29f706 --- /dev/null +++ b/forms-flow-api/migrations/versions/fdfe787a197c_removed_select_all_field_from_mapper_.py @@ -0,0 +1,28 @@ +"""Removed select_all_field from mapper table + +Revision ID: fdfe787a197c +Revises: 78e2529b7c39 +Create Date: 2024-03-27 09:48:57.957044 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'fdfe787a197c' +down_revision = '78e2529b7c39' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('form_process_mapper', 'selected_all_field') + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('form_process_mapper', sa.Column('selected_all_field', sa.BOOLEAN(), autoincrement=False, nullable=True)) + # ### end Alembic commands ### diff --git a/forms-flow-api/src/formsflow_api/models/form_process_mapper.py b/forms-flow-api/src/formsflow_api/models/form_process_mapper.py index 640352c592..9e230f1b43 100644 --- a/forms-flow-api/src/formsflow_api/models/form_process_mapper.py +++ b/forms-flow-api/src/formsflow_api/models/form_process_mapper.py @@ -52,9 +52,6 @@ class FormProcessMapper(AuditDateTimeMixin, AuditUserMixin, BaseModel, db.Model) task_variable = db.Column(JSON, nullable=True) version = db.Column(db.Integer, nullable=False, default=1) description = db.Column(db.String, nullable=True) - selected_all_field = db.Column( - db.Boolean, nullable=True, default=False - ) # if it is true, automatically select all fields as task variables from a form. __table_args__ = ( UniqueConstraint("form_id", "version", "tenant", name="_form_version_uc"), @@ -81,7 +78,6 @@ def create_from_dict(cls, mapper_info: dict) -> FormProcessMapper: mapper.task_variable = mapper_info.get("task_variable") mapper.version = mapper_info.get("version") mapper.description = mapper_info.get("description") - mapper.selected_all_field = mapper_info.get("selected_all_field") mapper.save() return mapper except Exception as err: # pylint: disable=broad-except @@ -109,7 +105,6 @@ def update(self, mapper_info: dict): "task_variable", "process_tenant", "description", - "selected_all_field", ], mapper_info, ) diff --git a/forms-flow-api/src/formsflow_api/schemas/form_process_mapper.py b/forms-flow-api/src/formsflow_api/schemas/form_process_mapper.py index 20bef5e95e..324bbdcde3 100644 --- a/forms-flow-api/src/formsflow_api/schemas/form_process_mapper.py +++ b/forms-flow-api/src/formsflow_api/schemas/form_process_mapper.py @@ -31,7 +31,6 @@ class Meta: # pylint: disable=too-few-public-methods process_tenant = fields.Str(data_key="processTenant") deleted = fields.Boolean(data_key="deleted") description = fields.Str(data_key="description") - selected_all_field = fields.Bool(data_key="selectedAllField") class FormProcessMapperListReqSchema(Schema): diff --git a/forms-flow-web/src/components/Form/Steps/TaskvariableCreate.js b/forms-flow-web/src/components/Form/Steps/TaskvariableCreate.js deleted file mode 100644 index e5527d3562..0000000000 --- a/forms-flow-web/src/components/Form/Steps/TaskvariableCreate.js +++ /dev/null @@ -1,84 +0,0 @@ -import React, { useState } from "react"; -import { Button } from "react-bootstrap"; -import Select from "react-select"; -import { useTranslation } from "react-i18next"; -import { Row, Col } from "react-bootstrap"; - -const TaskvariableCreate = ({ options, addTaskVariable }) => { - const { t } = useTranslation(); - const [selectedValue, setSelectedValue] = useState(""); - const [taskLabel, setTaskLable] = useState(""); - - const fomatOptionLabel = ({ label, value }, { context }) => { - if (context === "value") { - return
{value}
; - } else if (context === "menu") { - return
{`${value} (${label})`}
; - } - }; - - const selectTaskVariable = (data) => { - setSelectedValue(data); - setTaskLable(data.label); - }; - - const addTask = () => { - const data = { - key: selectedValue.value, - defaultLabel: selectedValue.label, - label: taskLabel, - }; - if (selectedValue.value && taskLabel && selectedValue.label) { - addTaskVariable(data); - } - }; - - return ( - <> - - - - { - setTaskLable(e.target.value); - }} - className="form-control" - placeholder={t("Enter Label")} - data-testid="task-variable-label-input" - /> - - - - - - - - - ); -}; - -export default TaskvariableCreate;