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

Master to develop 24 04 2024 #2028

Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/forms-flow-api-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

strategy:
matrix:
python-version: [3.12.2]
python-version: [3.12.3]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/forms-flow-data-analysis-api-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

strategy:
matrix:
python-version: [3.11.8]
python-version: [3.11.9]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/forms-flow-documents-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:

strategy:
matrix:
python-version: [3.12.2]
python-version: [3.12.3]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 2 additions & 0 deletions deployment/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ services:
API_LOG_ROTATION_WHEN: ${API_LOG_ROTATION_WHEN:-d}
API_LOG_ROTATION_INTERVAL: ${API_LOG_ROTATION_INTERVAL:-1}
API_LOG_BACKUP_COUNT: ${API_LOG_BACKUP_COUNT:-7}
CONFIGURE_LOGS: ${CONFIGURE_LOGS:-true}
REDIS_URL: ${REDIS_URL:-redis://redis:6379/0}

stdin_open: true # -i
Expand Down Expand Up @@ -287,6 +288,7 @@ services:
API_LOG_ROTATION_WHEN: ${API_LOG_ROTATION_WHEN:-d}
API_LOG_ROTATION_INTERVAL: ${API_LOG_ROTATION_INTERVAL:-1}
API_LOG_BACKUP_COUNT: ${API_LOG_BACKUP_COUNT:-7}
CONFIGURE_LOGS: ${CONFIGURE_LOGS:-true}
REDIS_URL: ${REDIS_URL:-redis://redis:6379/0}

stdin_open: true # -i
Expand Down
2 changes: 2 additions & 0 deletions deployment/docker/sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,12 @@ CUSTOM_SUBMISSION_URL=http://{your-ip-address}:{port}
#++++++++++++++++--- formsflow.ai Modules and themeing ENV Variables - STOP ---+++++++++++++++++++++++++#

##Log File Rotation Configuration for API Logs
##CONFIGURE_LOGS: Set to 'false' to disable log file rotation. Default value is true
##API_LOG_ROTATION_WHEN: Specifies the frequency of log file rotation - 'd' for days, 'h' for hours, 'm' for minutes.
##API_LOG_ROTATION_INTERVAL: Sets the time interval for log file rotation - '1' for every day.
##API_LOG_BACKUP_COUNT: Determines the number of backup log files to keep - '7' for logs from the past 7 day.

#API_LOG_ROTATION_WHEN=d
#API_LOG_ROTATION_INTERVAL=1
#API_LOG_BACKUP_COUNT=7
#CONFIGURE_LOGS=true
1 change: 1 addition & 0 deletions forms-flow-api/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ services:
API_LOG_ROTATION_WHEN: ${API_LOG_ROTATION_WHEN:-d}
API_LOG_ROTATION_INTERVAL: ${API_LOG_ROTATION_INTERVAL:-1}
API_LOG_BACKUP_COUNT: ${API_LOG_BACKUP_COUNT:-7}
CONFIGURE_LOGS: ${CONFIGURE_LOGS:-true}
REDIS_URL: ${REDIS_URL:-redis://redis:6379/0}

stdin_open: true # -i
Expand Down
2 changes: 1 addition & 1 deletion forms-flow-api/requirements/prod.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ sqlalchemy_utils
markupsafe
PyJWT
redis
git+https://github.com/AOT-Technologies/forms-flow-ai.git@develop#egg=formsflow_api_utils&subdirectory=forms-flow-api-utils
git+https://github.com/AOT-Technologies/forms-flow-ai.git@develop#egg=formsflow_api_utils&subdirectory=forms-flow-api-utils
1 change: 1 addition & 0 deletions forms-flow-api/sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ FORMIO_ROOT_PASSWORD=changeme
#API_LOG_ROTATION_WHEN=d
#API_LOG_ROTATION_INTERVAL=1
#API_LOG_BACKUP_COUNT=7
#CONFIGURE_LOGS=true

#Redis configuration
REDIS_URL=redis://{your-ip-address}:6379/0
17 changes: 17 additions & 0 deletions forms-flow-api/src/formsflow_api/models/form_process_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,3 +369,20 @@ def tenant_authorization(cls, query: Query, **kwargs):
if tenant_key is not None:
tenant_auth_query = tenant_auth_query.filter(cls.tenant == tenant_key)
return tenant_auth_query

@classmethod
def find_all_active_forms(
cls,
page_number=None,
limit=None,
): # pylint: disable=too-many-arguments
"""Fetch all active forms."""
query = cls.access_filter(query=cls.query)
total_count = query.count()
query = query.with_entities(
cls.form_id,
cls.form_name,
)
limit = total_count if limit is None else limit
query = query.paginate(page=page_number, per_page=limit, error_out=False)
return query.items, total_count
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ def get(): # pylint: disable=too-many-locals
sort_order: str = dict_data.get("sort_order", "desc")
form_type: str = dict_data.get("form_type", None)
is_active = dict_data.get("is_active", None)
active_forms = dict_data.get("active_forms", None)

if form_type:
form_type = form_type.split(",")
Expand All @@ -235,6 +236,7 @@ def get(): # pylint: disable=too-many-locals
form_type=form_type,
is_active=is_active,
is_designer=auth.has_role([DESIGNER_GROUP]),
active_forms=active_forms,
)
return (
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ class FormProcessMapperListRequestSchema(FormProcessMapperListReqSchema):
sort_order = fields.Str(data_key="sortOrder", required=False)
form_type = fields.Str(data_key="formType", required=False)
is_active = fields.Bool(data_key="isActive", required=False)
active_forms = fields.Bool(data_key="activeForms", required=False)
61 changes: 34 additions & 27 deletions forms-flow-api/src/formsflow_api/services/form_process_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,38 +32,45 @@ def get_all_forms(
form_type: str,
is_active,
is_designer: bool,
active_forms: bool,
**kwargs,
): # pylint: disable=too-many-arguments, too-many-locals
"""Get all forms."""
user: UserContext = kwargs["user"]
authorized_form_ids: Set[str] = []
form_ids = Authorization.find_all_resources_authorized(
auth_type=AuthType.DESIGNER if is_designer else AuthType.FORM,
roles=user.group_or_roles,
user_name=user.user_name,
tenant=user.tenant_key,
include_created_by=is_designer,
)
for forms in form_ids:
authorized_form_ids.append(forms.resource_id)
designer_filters = {
"is_active": is_active,
"form_type": form_type,
}
list_form_mappers = (
FormProcessMapper.find_all_forms
if is_designer
else FormProcessMapper.find_all_active_by_formid
)
mappers, get_all_mappers_count = list_form_mappers(
page_number=page_number,
limit=limit,
form_name=form_name,
sort_by=sort_by,
sort_order=sort_order,
form_ids=authorized_form_ids,
**designer_filters if is_designer else {},
)
if active_forms:
mappers, get_all_mappers_count = FormProcessMapper.find_all_active_forms(
page_number=page_number,
limit=limit,
)
else:
form_ids = Authorization.find_all_resources_authorized(
auth_type=AuthType.DESIGNER if is_designer else AuthType.FORM,
roles=user.group_or_roles,
user_name=user.user_name,
tenant=user.tenant_key,
include_created_by=is_designer,
)
for forms in form_ids:
authorized_form_ids.append(forms.resource_id)
designer_filters = {
"is_active": is_active,
"form_type": form_type,
}
list_form_mappers = (
FormProcessMapper.find_all_forms
if is_designer
else FormProcessMapper.find_all_active_by_formid
)
mappers, get_all_mappers_count = list_form_mappers(
page_number=page_number,
limit=limit,
form_name=form_name,
sort_by=sort_by,
sort_order=sort_order,
form_ids=authorized_form_ids,
**designer_filters if is_designer else {},
)
mapper_schema = FormProcessMapperSchema()
return (
mapper_schema.dump(mappers, many=True),
Expand Down
2 changes: 1 addition & 1 deletion forms-flow-data-analysis-api/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
API_LOG_ROTATION_WHEN: ${API_LOG_ROTATION_WHEN:-d}
API_LOG_ROTATION_INTERVAL: ${API_LOG_ROTATION_INTERVAL:-1}
API_LOG_BACKUP_COUNT: ${API_LOG_BACKUP_COUNT:-7}
CONFIGURE_LOGS: ${CONFIGURE_LOGS:-True}
CONFIGURE_LOGS: ${CONFIGURE_LOGS:-true}
stdin_open: true # -i
tty: true # -t
networks:
Expand Down
1 change: 1 addition & 0 deletions forms-flow-data-analysis-api/sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ DATABASE_SUPPORT=DISABLED
#API_LOG_BACKUP_COUNT=7

##CONFIGURE_LOGS: Set to 'false' to disable log file rotation. Default value is true
#CONFIGURE_LOGS=true
1 change: 1 addition & 0 deletions forms-flow-documents/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ services:
API_LOG_ROTATION_WHEN: ${API_LOG_ROTATION_WHEN:-d}
API_LOG_ROTATION_INTERVAL: ${API_LOG_ROTATION_INTERVAL:-1}
API_LOG_BACKUP_COUNT: ${API_LOG_BACKUP_COUNT:-7}
CONFIGURE_LOGS: ${CONFIGURE_LOGS:-true}
REDIS_URL: ${REDIS_URL:-redis://redis:6379/0}
stdin_open: true # -i
tty: true # -t
Expand Down
2 changes: 1 addition & 1 deletion forms-flow-documents/requirements/prod.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ PyJWT
selenium
selenium-wire
nested-lookup
git+https://github.com/AOT-Technologies/forms-flow-ai.git@develop#egg=formsflow_api_utils&subdirectory=forms-flow-api-utils
git+https://github.com/AOT-Technologies/forms-flow-ai.git@develop#egg=formsflow_api_utils&subdirectory=forms-flow-api-utils
1 change: 1 addition & 0 deletions forms-flow-documents/sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ CUSTOM_SUBMISSION_URL=http://{your-ip-address}:6212
#API_LOG_ROTATION_WHEN=d
#API_LOG_ROTATION_INTERVAL=1
#API_LOG_BACKUP_COUNT=7
#CONFIGURE_LOGS=true
4 changes: 2 additions & 2 deletions forms-flow-web/src/apiManager/services/bpmFormServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ export const fetchBPMFormList = (
};

export const fetchAllForms = ()=>{
//isActive means published forms only : status = Active
return RequestService.httpGETRequest(`${API.FORM}?isActive=true`);
//activeForms means published forms only : status = Active
return RequestService.httpGETRequest(`${API.FORM}?activeForms=true`);
};

export const fetchFormByAlias = (path, ...rest) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ export default function CreateNewFilterDrawer({
useEffect(() => {
if (openFilterDrawer) {
dispatch(fetchUserList()); // if the create new filter open then need to fetch list of users
dispatch(fetchAllBpmProcesses()); // if the create new filter open then need to fetch all bpm process
dispatch(fetchAllBpmProcesses({ tenant_key: tenantKey })); // if the create new filter open then need to fetch all bpm process
}
// if the create new filter open then need to fetch all forms
if (openFilterDrawer && !forms?.data?.length) {
Expand Down
Loading