fixed linting issues w/ burnettk
This commit is contained in:
parent
deb16b80c3
commit
48893cae13
|
@ -27,12 +27,12 @@ class UserModel(SpiffworkflowBaseDBModel):
|
||||||
|
|
||||||
id: int = db.Column(db.Integer, primary_key=True)
|
id: int = db.Column(db.Integer, primary_key=True)
|
||||||
username: str = db.Column(db.String(255), nullable=False, unique=True)
|
username: str = db.Column(db.String(255), nullable=False, unique=True)
|
||||||
email: str = db.Column(db.String(255), index=True)
|
email: str | None = db.Column(db.String(255), index=True)
|
||||||
|
|
||||||
service = db.Column(db.String(255), nullable=False, unique=False, index=True) # not 'openid' -- google, aws
|
service = db.Column(db.String(255), nullable=False, unique=False, index=True) # not 'openid' -- google, aws
|
||||||
service_id = db.Column(db.String(255), nullable=False, unique=False, index=True)
|
service_id = db.Column(db.String(255), nullable=False, unique=False, index=True)
|
||||||
|
|
||||||
display_name: str = db.Column(db.String(255))
|
display_name: str | None = db.Column(db.String(255))
|
||||||
tenant_specific_field_1: str | None = db.Column(db.String(255))
|
tenant_specific_field_1: str | None = db.Column(db.String(255))
|
||||||
tenant_specific_field_2: str | None = db.Column(db.String(255))
|
tenant_specific_field_2: str | None = db.Column(db.String(255))
|
||||||
tenant_specific_field_3: str | None = db.Column(db.String(255))
|
tenant_specific_field_3: str | None = db.Column(db.String(255))
|
||||||
|
|
|
@ -29,9 +29,11 @@ def get_onboarding() -> Response:
|
||||||
task = processor.next_task()
|
task = processor.next_task()
|
||||||
db.session.flush()
|
db.session.flush()
|
||||||
if task:
|
if task:
|
||||||
task_model: TaskModel | None = TaskModel.query.filter_by(guid=str(task.id),
|
task_model: TaskModel | None = TaskModel.query.filter_by(
|
||||||
process_instance_id=process_instance.id).first()
|
guid=str(task.id), process_instance_id=process_instance.id
|
||||||
result['task_id'] = task_model.guid
|
).first()
|
||||||
result['instructions'] = JinjaService.render_instructions_for_end_user(task_model)
|
if task_model is not None:
|
||||||
|
result["task_id"] = task_model.guid
|
||||||
|
result["instructions"] = JinjaService.render_instructions_for_end_user(task_model)
|
||||||
|
|
||||||
return make_response(result, 200)
|
return make_response(result, 200)
|
||||||
|
|
|
@ -19,4 +19,4 @@ class TimesExecutedByUser(Script):
|
||||||
if process_model_identifer is not None:
|
if process_model_identifer is not None:
|
||||||
return ProcessInstanceService.times_executed_by_user(process_model_identifer)
|
return ProcessInstanceService.times_executed_by_user(process_model_identifer)
|
||||||
else:
|
else:
|
||||||
return False
|
return 0
|
||||||
|
|
|
@ -57,18 +57,15 @@ class ProcessInstanceService:
|
||||||
)
|
)
|
||||||
return started_instance is not None
|
return started_instance is not None
|
||||||
|
|
||||||
def times_executed_by_user(process_model_identifier: str) -> bool:
|
@staticmethod
|
||||||
|
def times_executed_by_user(process_model_identifier: str) -> int:
|
||||||
total = (
|
total = (
|
||||||
db.session.query(ProcessInstanceModel)
|
db.session.query(ProcessInstanceModel)
|
||||||
.filter(
|
.filter(ProcessInstanceModel.process_model_identifier == process_model_identifier)
|
||||||
ProcessInstanceModel.process_model_identifier == process_model_identifier
|
|
||||||
)
|
|
||||||
.count()
|
.count()
|
||||||
)
|
)
|
||||||
return total
|
return total
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def next_start_event_configuration(process_instance_model: ProcessInstanceModel) -> StartConfiguration:
|
def next_start_event_configuration(process_instance_model: ProcessInstanceModel) -> StartConfiguration:
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -45,4 +45,8 @@ class TestOnboarding(BaseTest):
|
||||||
)
|
)
|
||||||
|
|
||||||
assert results.status_code == 200
|
assert results.status_code == 200
|
||||||
assert results.json == {"type": "default_view", "value": "my_tasks"}
|
assert len(results.json.keys()) == 4
|
||||||
|
assert results.json["type"] == "default_view"
|
||||||
|
assert results.json["value"] == "my_tasks"
|
||||||
|
assert results.json["instructions"] == ""
|
||||||
|
assert results.json["task_id"] is not None
|
||||||
|
|
|
@ -52,6 +52,7 @@ export default function HomePageRoutes() {
|
||||||
<OnboardingView />
|
<OnboardingView />
|
||||||
{renderTabs()}
|
{renderTabs()}
|
||||||
<Routes>
|
<Routes>
|
||||||
|
<Route path="/" element={<InProgressInstances />} />
|
||||||
<Route path="my-tasks" element={<MyTasks />} />
|
<Route path="my-tasks" element={<MyTasks />} />
|
||||||
<Route path=":process_instance_id/:task_id" element={<TaskShow />} />
|
<Route path=":process_instance_id/:task_id" element={<TaskShow />} />
|
||||||
<Route path="grouped" element={<InProgressInstances />} />
|
<Route path="grouped" element={<InProgressInstances />} />
|
||||||
|
|
|
@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
|
||||||
import MDEditor from '@uiw/react-md-editor';
|
import MDEditor from '@uiw/react-md-editor';
|
||||||
import HttpService from '../services/HttpService';
|
import HttpService from '../services/HttpService';
|
||||||
import { Onboarding } from '../interfaces';
|
import { Onboarding } from '../interfaces';
|
||||||
|
import { objectIsEmpty } from '../helpers';
|
||||||
|
|
||||||
export default function OnboardingView() {
|
export default function OnboardingView() {
|
||||||
const [onboarding, setOnboarding] = useState<Onboarding | null>(null);
|
const [onboarding, setOnboarding] = useState<Onboarding | null>(null);
|
||||||
|
@ -16,7 +17,11 @@ export default function OnboardingView() {
|
||||||
}, [setOnboarding]);
|
}, [setOnboarding]);
|
||||||
|
|
||||||
const onboardingElement = () => {
|
const onboardingElement = () => {
|
||||||
if (onboarding && onboarding.instructions.length > 0) {
|
if (
|
||||||
|
onboarding &&
|
||||||
|
!objectIsEmpty(onboarding) &&
|
||||||
|
onboarding.instructions.length > 0
|
||||||
|
) {
|
||||||
return (
|
return (
|
||||||
<MDEditor.Markdown
|
<MDEditor.Markdown
|
||||||
className="onboarding"
|
className="onboarding"
|
||||||
|
|
Loading…
Reference in New Issue