mirror of
https://github.com/status-im/spiff-arena.git
synced 2025-01-17 05:31:09 +00:00
Add flag to indicate if user filtered
This commit is contained in:
parent
1584f52a18
commit
3bace7d59b
@ -439,6 +439,12 @@ paths:
|
|||||||
description: For filtering - not_started, user_input_required, waiting, complete, error, or suspended
|
description: For filtering - not_started, user_input_required, waiting, complete, error, or suspended
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
|
- name: user_filter
|
||||||
|
in: query
|
||||||
|
required: false
|
||||||
|
description: For filtering - indicates the user has manually entered a query
|
||||||
|
schema:
|
||||||
|
type: boolean
|
||||||
# process_instance_list
|
# process_instance_list
|
||||||
get:
|
get:
|
||||||
operationId: spiffworkflow_backend.routes.process_api_blueprint.process_instance_list
|
operationId: spiffworkflow_backend.routes.process_api_blueprint.process_instance_list
|
||||||
|
@ -74,6 +74,7 @@ from spiffworkflow_backend.services.process_instance_processor import (
|
|||||||
)
|
)
|
||||||
from spiffworkflow_backend.services.process_instance_report_service import (
|
from spiffworkflow_backend.services.process_instance_report_service import (
|
||||||
ProcessInstanceReportService,
|
ProcessInstanceReportService,
|
||||||
|
ProcessInstanceReportFilter,
|
||||||
)
|
)
|
||||||
from spiffworkflow_backend.services.process_instance_service import (
|
from spiffworkflow_backend.services.process_instance_service import (
|
||||||
ProcessInstanceService,
|
ProcessInstanceService,
|
||||||
@ -732,18 +733,32 @@ def process_instance_list(
|
|||||||
end_from: Optional[int] = None,
|
end_from: Optional[int] = None,
|
||||||
end_to: Optional[int] = None,
|
end_to: Optional[int] = None,
|
||||||
process_status: Optional[str] = None,
|
process_status: Optional[str] = None,
|
||||||
|
user_filter: Optional[bool] = False,
|
||||||
) -> flask.wrappers.Response:
|
) -> flask.wrappers.Response:
|
||||||
"""Process_instance_list."""
|
"""Process_instance_list."""
|
||||||
process_instance_report = ProcessInstanceReportModel.default_report(g.user)
|
process_instance_report = ProcessInstanceReportModel.default_report(g.user)
|
||||||
report_filter = ProcessInstanceReportService.filter_from_metadata_with_overrides(
|
|
||||||
process_instance_report,
|
print(f"user_filter: {user_filter}")
|
||||||
process_model_identifier,
|
|
||||||
start_from,
|
if user_filter:
|
||||||
start_to,
|
report_filter = ProcessInstanceReportFilter(
|
||||||
end_from,
|
process_model_identifier,
|
||||||
end_to,
|
start_from,
|
||||||
process_status,
|
start_to,
|
||||||
)
|
end_from,
|
||||||
|
end_to,
|
||||||
|
process_status,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
report_filter = ProcessInstanceReportService.filter_from_metadata_with_overrides(
|
||||||
|
process_instance_report,
|
||||||
|
process_model_identifier,
|
||||||
|
start_from,
|
||||||
|
start_to,
|
||||||
|
end_from,
|
||||||
|
end_to,
|
||||||
|
process_status,
|
||||||
|
)
|
||||||
|
|
||||||
# process_model_identifier = un_modify_modified_process_model_id(modified_process_model_identifier)
|
# process_model_identifier = un_modify_modified_process_model_id(modified_process_model_identifier)
|
||||||
process_instance_query = ProcessInstanceModel.query
|
process_instance_query = ProcessInstanceModel.query
|
||||||
|
@ -125,6 +125,11 @@ export default function ProcessInstanceListTable({
|
|||||||
}
|
}
|
||||||
let queryParamString = `per_page=${perPage}&page=${page}`;
|
let queryParamString = `per_page=${perPage}&page=${page}`;
|
||||||
|
|
||||||
|
const userAppliedFilter = searchParams.get('user_filter');
|
||||||
|
if (userAppliedFilter) {
|
||||||
|
queryParamString += `&user_filter=${userAppliedFilter}`;
|
||||||
|
}
|
||||||
|
|
||||||
Object.keys(parametersToAlwaysFilterBy).forEach((paramName: string) => {
|
Object.keys(parametersToAlwaysFilterBy).forEach((paramName: string) => {
|
||||||
// @ts-expect-error TS(7053) FIXME:
|
// @ts-expect-error TS(7053) FIXME:
|
||||||
const functionToCall = parametersToAlwaysFilterBy[paramName];
|
const functionToCall = parametersToAlwaysFilterBy[paramName];
|
||||||
@ -286,7 +291,7 @@ export default function ProcessInstanceListTable({
|
|||||||
undefined,
|
undefined,
|
||||||
paginationQueryParamPrefix
|
paginationQueryParamPrefix
|
||||||
);
|
);
|
||||||
let queryParamString = `per_page=${perPage}&page=${page}`;
|
let queryParamString = `per_page=${perPage}&page=${page}&user_filter=true`;
|
||||||
|
|
||||||
const startFromSeconds = convertDateStringToSeconds(startFrom);
|
const startFromSeconds = convertDateStringToSeconds(startFrom);
|
||||||
const endFromSeconds = convertDateStringToSeconds(endFrom);
|
const endFromSeconds = convertDateStringToSeconds(endFrom);
|
||||||
@ -338,6 +343,7 @@ export default function ProcessInstanceListTable({
|
|||||||
}
|
}
|
||||||
|
|
||||||
setErrorMessage(null);
|
setErrorMessage(null);
|
||||||
|
console.log(queryParamString);
|
||||||
navigate(`/admin/process-instances?${queryParamString}`);
|
navigate(`/admin/process-instances?${queryParamString}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user