mirror of
https://github.com/status-im/spiff-arena.git
synced 2025-01-20 15:08:51 +00:00
more api cleanup w/ burnettk
This commit is contained in:
parent
bc7c5920b2
commit
e889bfc716
@ -338,9 +338,9 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/ProcessModel"
|
$ref: "#/components/schemas/ProcessModel"
|
||||||
|
|
||||||
/process-models/{modified_process_model_id}/files:
|
/process-models/{modified_process_model_identifier}/files:
|
||||||
parameters:
|
parameters:
|
||||||
- name: modified_process_model_id
|
- name: modified_process_model_identifier
|
||||||
in: path
|
in: path
|
||||||
required: true
|
required: true
|
||||||
description: The process_model_id, modified to replace slashes (/)
|
description: The process_model_id, modified to replace slashes (/)
|
||||||
@ -565,33 +565,6 @@ paths:
|
|||||||
items:
|
items:
|
||||||
$ref: "#/components/schemas/Workflow"
|
$ref: "#/components/schemas/Workflow"
|
||||||
|
|
||||||
/process-instances/{process_instance_id}/task/{task_id}/update:
|
|
||||||
parameters:
|
|
||||||
- name: process_instance_id
|
|
||||||
in: path
|
|
||||||
required: true
|
|
||||||
description: The unique id of the process instance
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
- name: task_id
|
|
||||||
in: path
|
|
||||||
required: true
|
|
||||||
description: The unique id of the task
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
post:
|
|
||||||
operationId: spiffworkflow_backend.routes.process_api_blueprint.update_task_data
|
|
||||||
summary: Update the task data for requested instance and task
|
|
||||||
tags:
|
|
||||||
- Process Instances
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: Task Updated Successfully
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: "#/components/schemas/Workflow"
|
|
||||||
|
|
||||||
/process-models/{process_group_id}/{process_model_id}/script-unit-tests:
|
/process-models/{process_group_id}/{process_model_id}/script-unit-tests:
|
||||||
parameters:
|
parameters:
|
||||||
- name: process_group_id
|
- name: process_group_id
|
||||||
@ -646,9 +619,9 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/Workflow"
|
$ref: "#/components/schemas/Workflow"
|
||||||
|
|
||||||
/process-instances/{modified_process_model_id}:
|
/process-instances/{modified_process_model_identifier}:
|
||||||
parameters:
|
parameters:
|
||||||
- name: modified_process_model_id
|
- name: modified_process_model_identifier
|
||||||
in: path
|
in: path
|
||||||
required: true
|
required: true
|
||||||
description: The unique id of an existing process model.
|
description: The unique id of an existing process model.
|
||||||
@ -912,9 +885,9 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/OkTrue"
|
$ref: "#/components/schemas/OkTrue"
|
||||||
|
|
||||||
/process-models/{modified_process_model_id}/files/{file_name}:
|
/process-models/{modified_process_model_identifier}/files/{file_name}:
|
||||||
parameters:
|
parameters:
|
||||||
- name: modified_process_model_id
|
- name: modified_process_model_identifier
|
||||||
in: path
|
in: path
|
||||||
required: true
|
required: true
|
||||||
description: The modified process model id
|
description: The modified process model id
|
||||||
@ -1091,9 +1064,9 @@ paths:
|
|||||||
items:
|
items:
|
||||||
$ref: "#/components/schemas/Task"
|
$ref: "#/components/schemas/Task"
|
||||||
|
|
||||||
/task-data/{modified_process_model_id}/{process_instance_id}:
|
/task-data/{modified_process_model_identifier}/{process_instance_id}:
|
||||||
parameters:
|
parameters:
|
||||||
- name: modified_process_model_id
|
- name: modified_process_model_identifier
|
||||||
in: path
|
in: path
|
||||||
required: true
|
required: true
|
||||||
description: The modified id of an existing process model
|
description: The modified id of an existing process model
|
||||||
@ -1132,11 +1105,44 @@ paths:
|
|||||||
items:
|
items:
|
||||||
$ref: "#/components/schemas/Task"
|
$ref: "#/components/schemas/Task"
|
||||||
|
|
||||||
/service_tasks:
|
/task-data/{modified_process_model_identifier}/{process_instance_id}/{task_id}:
|
||||||
|
parameters:
|
||||||
|
- name: modified_process_model_identifier
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
description: The modified id of an existing process model
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
- name: process_instance_id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
description: The unique id of an existing process instance.
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
- name: task_id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
description: The unique id of the task.
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
put:
|
||||||
|
operationId: spiffworkflow_backend.routes.process_api_blueprint.update_task_data
|
||||||
|
summary: Update the task data for requested instance and task
|
||||||
|
tags:
|
||||||
|
- Process Instances
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Task Updated Successfully
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/Workflow"
|
||||||
|
|
||||||
|
/service-tasks:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Service Tasks
|
- Service Tasks
|
||||||
operationId: spiffworkflow_backend.routes.process_api_blueprint.service_tasks_show
|
operationId: spiffworkflow_backend.routes.process_api_blueprint.service_task_list
|
||||||
summary: Gets all available service task connectors
|
summary: Gets all available service task connectors
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
|
@ -69,6 +69,12 @@ permissions:
|
|||||||
users: []
|
users: []
|
||||||
allowed_permissions: [create, read, update, delete]
|
allowed_permissions: [create, read, update, delete]
|
||||||
uri: /v1.0/tasks/*
|
uri: /v1.0/tasks/*
|
||||||
|
service-tasks:
|
||||||
|
groups: [everybody]
|
||||||
|
users: []
|
||||||
|
allowed_permissions: [read]
|
||||||
|
uri: /v1.0/service-tasks
|
||||||
|
|
||||||
|
|
||||||
# read all for everybody
|
# read all for everybody
|
||||||
read-all-process-groups:
|
read-all-process-groups:
|
||||||
|
@ -158,9 +158,9 @@ def modify_process_model_id(process_model_id: str) -> str:
|
|||||||
return process_model_id.replace("/", ":")
|
return process_model_id.replace("/", ":")
|
||||||
|
|
||||||
|
|
||||||
def un_modify_modified_process_model_id(modified_process_model_id: str) -> str:
|
def un_modify_modified_process_model_id(modified_process_model_identifier: str) -> str:
|
||||||
"""Un_modify_modified_process_model_id."""
|
"""Un_modify_modified_process_model_id."""
|
||||||
return modified_process_model_id.replace(":", "/")
|
return modified_process_model_identifier.replace(":", "/")
|
||||||
|
|
||||||
|
|
||||||
def process_group_add(body: dict) -> flask.wrappers.Response:
|
def process_group_add(body: dict) -> flask.wrappers.Response:
|
||||||
@ -411,9 +411,9 @@ def process_list() -> Any:
|
|||||||
return SpecReferenceSchema(many=True).dump(references)
|
return SpecReferenceSchema(many=True).dump(references)
|
||||||
|
|
||||||
|
|
||||||
def get_file(modified_process_model_id: str, file_name: str) -> Any:
|
def get_file(modified_process_model_identifier: str, file_name: str) -> Any:
|
||||||
"""Get_file."""
|
"""Get_file."""
|
||||||
process_model_identifier = modified_process_model_id.replace(":", "/")
|
process_model_identifier = modified_process_model_identifier.replace(":", "/")
|
||||||
process_model = get_process_model(process_model_identifier)
|
process_model = get_process_model(process_model_identifier)
|
||||||
files = SpecFileService.get_files(process_model, file_name)
|
files = SpecFileService.get_files(process_model, file_name)
|
||||||
if len(files) == 0:
|
if len(files) == 0:
|
||||||
@ -433,10 +433,10 @@ def get_file(modified_process_model_id: str, file_name: str) -> Any:
|
|||||||
|
|
||||||
|
|
||||||
def process_model_file_update(
|
def process_model_file_update(
|
||||||
modified_process_model_id: str, file_name: str
|
modified_process_model_identifier: str, file_name: str
|
||||||
) -> flask.wrappers.Response:
|
) -> flask.wrappers.Response:
|
||||||
"""Process_model_file_update."""
|
"""Process_model_file_update."""
|
||||||
process_model_identifier = modified_process_model_id.replace(":", "/")
|
process_model_identifier = modified_process_model_identifier.replace(":", "/")
|
||||||
process_model = get_process_model(process_model_identifier)
|
process_model = get_process_model(process_model_identifier)
|
||||||
|
|
||||||
request_file = get_file_from_request()
|
request_file = get_file_from_request()
|
||||||
@ -462,10 +462,10 @@ def process_model_file_update(
|
|||||||
|
|
||||||
|
|
||||||
def process_model_file_delete(
|
def process_model_file_delete(
|
||||||
modified_process_model_id: str, file_name: str
|
modified_process_model_identifier: str, file_name: str
|
||||||
) -> flask.wrappers.Response:
|
) -> flask.wrappers.Response:
|
||||||
"""Process_model_file_delete."""
|
"""Process_model_file_delete."""
|
||||||
process_model_identifier = modified_process_model_id.replace(":", "/")
|
process_model_identifier = modified_process_model_identifier.replace(":", "/")
|
||||||
process_model = get_process_model(process_model_identifier)
|
process_model = get_process_model(process_model_identifier)
|
||||||
try:
|
try:
|
||||||
SpecFileService.delete_file(process_model, file_name)
|
SpecFileService.delete_file(process_model, file_name)
|
||||||
@ -481,9 +481,9 @@ def process_model_file_delete(
|
|||||||
return Response(json.dumps({"ok": True}), status=200, mimetype="application/json")
|
return Response(json.dumps({"ok": True}), status=200, mimetype="application/json")
|
||||||
|
|
||||||
|
|
||||||
def add_file(modified_process_model_id: str) -> flask.wrappers.Response:
|
def add_file(modified_process_model_identifier: str) -> flask.wrappers.Response:
|
||||||
"""Add_file."""
|
"""Add_file."""
|
||||||
process_model_identifier = modified_process_model_id.replace(":", "/")
|
process_model_identifier = modified_process_model_identifier.replace(":", "/")
|
||||||
process_model = get_process_model(process_model_identifier)
|
process_model = get_process_model(process_model_identifier)
|
||||||
request_file = get_file_from_request()
|
request_file = get_file_from_request()
|
||||||
if not request_file.filename:
|
if not request_file.filename:
|
||||||
@ -504,10 +504,12 @@ def add_file(modified_process_model_id: str) -> flask.wrappers.Response:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def process_instance_create(modified_process_model_id: str) -> flask.wrappers.Response:
|
def process_instance_create(
|
||||||
|
modified_process_model_identifier: str,
|
||||||
|
) -> flask.wrappers.Response:
|
||||||
"""Create_process_instance."""
|
"""Create_process_instance."""
|
||||||
process_model_identifier = un_modify_modified_process_model_id(
|
process_model_identifier = un_modify_modified_process_model_id(
|
||||||
modified_process_model_id
|
modified_process_model_identifier
|
||||||
)
|
)
|
||||||
process_instance = (
|
process_instance = (
|
||||||
ProcessInstanceService.create_process_instance_from_process_model_identifier(
|
ProcessInstanceService.create_process_instance_from_process_model_identifier(
|
||||||
@ -1075,7 +1077,9 @@ def process_instance_show(
|
|||||||
return make_response(jsonify(process_instance), 200)
|
return make_response(jsonify(process_instance), 200)
|
||||||
|
|
||||||
|
|
||||||
def process_instance_delete(process_instance_id: int, modified_process_model_identifier: str) -> flask.wrappers.Response:
|
def process_instance_delete(
|
||||||
|
process_instance_id: int, modified_process_model_identifier: str
|
||||||
|
) -> flask.wrappers.Response:
|
||||||
"""Create_process_instance."""
|
"""Create_process_instance."""
|
||||||
process_instance = find_process_instance_by_id_or_raise(process_instance_id)
|
process_instance = find_process_instance_by_id_or_raise(process_instance_id)
|
||||||
|
|
||||||
@ -1157,8 +1161,8 @@ def process_instance_report_delete(
|
|||||||
return Response(json.dumps({"ok": True}), status=200, mimetype="application/json")
|
return Response(json.dumps({"ok": True}), status=200, mimetype="application/json")
|
||||||
|
|
||||||
|
|
||||||
def service_tasks_show() -> flask.wrappers.Response:
|
def service_task_list() -> flask.wrappers.Response:
|
||||||
"""Service_tasks_show."""
|
"""Service_task_list."""
|
||||||
available_connectors = ServiceTaskService.available_connectors()
|
available_connectors = ServiceTaskService.available_connectors()
|
||||||
return Response(
|
return Response(
|
||||||
json.dumps(available_connectors), status=200, mimetype="application/json"
|
json.dumps(available_connectors), status=200, mimetype="application/json"
|
||||||
@ -1365,7 +1369,7 @@ def get_tasks(
|
|||||||
|
|
||||||
|
|
||||||
def process_instance_task_list(
|
def process_instance_task_list(
|
||||||
modified_process_model_id: str,
|
modified_process_model_identifier: str,
|
||||||
process_instance_id: int,
|
process_instance_id: int,
|
||||||
all_tasks: bool = False,
|
all_tasks: bool = False,
|
||||||
spiff_step: int = 0,
|
spiff_step: int = 0,
|
||||||
@ -1926,7 +1930,12 @@ def _update_form_schema_with_task_data_as_needed(
|
|||||||
_update_form_schema_with_task_data_as_needed(o, task_data)
|
_update_form_schema_with_task_data_as_needed(o, task_data)
|
||||||
|
|
||||||
|
|
||||||
def update_task_data(process_instance_id: str, task_id: str, body: Dict) -> Response:
|
def update_task_data(
|
||||||
|
process_instance_id: str,
|
||||||
|
modified_process_model_identifier: str,
|
||||||
|
task_id: str,
|
||||||
|
body: Dict,
|
||||||
|
) -> Response:
|
||||||
"""Update task data."""
|
"""Update task data."""
|
||||||
process_instance = ProcessInstanceModel.query.filter(
|
process_instance = ProcessInstanceModel.query.filter(
|
||||||
ProcessInstanceModel.id == int(process_instance_id)
|
ProcessInstanceModel.id == int(process_instance_id)
|
||||||
|
@ -81,7 +81,7 @@ export default function ProcessInstanceShow() {
|
|||||||
setTasksCallHadError(true);
|
setTasksCallHadError(true);
|
||||||
};
|
};
|
||||||
HttpService.makeCallToBackend({
|
HttpService.makeCallToBackend({
|
||||||
path: `/process-models/${modifiedProcessModelId}/process-instances/${params.process_instance_id}`,
|
path: `/process-instances/${modifiedProcessModelId}/${params.process_instance_id}`,
|
||||||
successCallback: setProcessInstance,
|
successCallback: setProcessInstance,
|
||||||
});
|
});
|
||||||
let taskParams = '?all_tasks=true';
|
let taskParams = '?all_tasks=true';
|
||||||
@ -179,7 +179,7 @@ export default function ProcessInstanceShow() {
|
|||||||
<Link
|
<Link
|
||||||
reloadDocument
|
reloadDocument
|
||||||
data-qa="process-instance-step-link"
|
data-qa="process-instance-step-link"
|
||||||
to={`/admin/process-models/${
|
to={`/admin/process-instances/${
|
||||||
params.process_model_id
|
params.process_model_id
|
||||||
}/process-instances/${params.process_instance_id}/${
|
}/process-instances/${params.process_instance_id}/${
|
||||||
currentSpiffStep(processInstanceToUse) + distance
|
currentSpiffStep(processInstanceToUse) + distance
|
||||||
@ -447,8 +447,8 @@ export default function ProcessInstanceShow() {
|
|||||||
// taskToUse is copy of taskToDisplay, with taskDataToDisplay in data attribute
|
// taskToUse is copy of taskToDisplay, with taskDataToDisplay in data attribute
|
||||||
const taskToUse: any = { ...taskToDisplay, data: taskDataToDisplay };
|
const taskToUse: any = { ...taskToDisplay, data: taskDataToDisplay };
|
||||||
HttpService.makeCallToBackend({
|
HttpService.makeCallToBackend({
|
||||||
path: `/process-instances/${params.process_instance_id}/task/${taskToUse.id}/update`,
|
path: `/task-data/${modifiedProcessModelId}/${params.process_instance_id}/${taskToUse.id}`,
|
||||||
httpMethod: 'POST',
|
httpMethod: 'PUT',
|
||||||
successCallback: saveTaskDataResult,
|
successCallback: saveTaskDataResult,
|
||||||
failureCallback: saveTaskDataFailure,
|
failureCallback: saveTaskDataFailure,
|
||||||
postBody: {
|
postBody: {
|
||||||
|
@ -283,7 +283,7 @@ export default function ProcessModelEditDiagram() {
|
|||||||
|
|
||||||
const onServiceTasksRequested = (event: any) => {
|
const onServiceTasksRequested = (event: any) => {
|
||||||
HttpService.makeCallToBackend({
|
HttpService.makeCallToBackend({
|
||||||
path: `/service_tasks`,
|
path: `/service-tasks`,
|
||||||
successCallback: makeApiHandler(event),
|
successCallback: makeApiHandler(event),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user