fixed up the process instance show page and moved contents of scss to css file and load that last w/ burnettk

This commit is contained in:
jasquat 2022-11-10 15:44:58 -05:00
parent 2f992e67cd
commit 7aca52035c
11 changed files with 242 additions and 170 deletions

View File

@ -64,7 +64,6 @@ class ProcessInstanceStatus(SpiffEnum):
faulted = "faulted"
suspended = "suspended"
terminated = "terminated"
erroring = "erroring"
class ProcessInstanceModel(SpiffworkflowBaseDBModel):

View File

@ -83,10 +83,6 @@ class ProcessInstanceReportModel(SpiffworkflowBaseDBModel):
report_metadata = {
"columns": [
{"Header": "id", "accessor": "id"},
{
"Header": "process_group_identifier",
"accessor": "process_group_identifier",
},
{
"Header": "process_model_identifier",
"accessor": "process_model_identifier",

View File

@ -64,7 +64,7 @@ class ProcessInstanceService:
processor.do_engine_steps(save=True)
except Exception as e:
db.session.rollback() # in case the above left the database with a bad transaction
process_instance.status = ProcessInstanceStatus.erroring.value
process_instance.status = ProcessInstanceStatus.faulted.value
db.session.add(process_instance)
db.session.commit()
error_message = (

View File

@ -17,5 +17,6 @@ export const PROCESS_STATUSES = [
];
// with time: yyyy-MM-dd HH:mm:ss
export const DATE_TIME_FORMAT = 'yyyy-MM-dd HH:mm:ss';
export const DATE_FORMAT = 'yyyy-MM-dd';
export const DATE_FORMAT_CARBON = 'Y-m-d';

View File

@ -1,5 +1,5 @@
import { format } from 'date-fns';
import { DATE_FORMAT } from './config';
import { DATE_TIME_FORMAT, DATE_FORMAT } from './config';
import {
DEFAULT_PER_PAGE,
DEFAULT_PAGE,
@ -51,6 +51,14 @@ export const convertStringToDate = (dateString: string) => {
return null;
};
export const convertSecondsToFormattedDateTime = (seconds: number) => {
if (seconds) {
const dateObject = new Date(seconds * 1000);
return format(dateObject, DATE_TIME_FORMAT);
}
return null;
};
export const convertSecondsToFormattedDate = (seconds: number) => {
if (seconds) {
const dateObject = new Date(seconds * 1000);

View File

@ -1,24 +1,79 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* site is mainly using white theme. */
/* header is mainly using g100 */
/* mockup wanted white, not grey, text */
.cds--header, a.cds--header__menu-item {
color: white;
}
h1{
height: 36px;
font-family: 'IBM Plex Sans';
font-style: normal;
font-weight: 400;
font-size: 28px;
line-height: 36px;
color: #161616;
flex: none;
order: 0;
align-self: stretch;
flex-grow: 0;
margin-bottom: 1em
}
.span-tag {
color: black;
}
.cds--btn.button-white-background {
color: #393939;
background: #FFFFFF;
background-blend-mode: multiply;
border: 1px solid #393939;
}
.cds--btn.button-white-background:hover {
background: #525252;
}
.cds--breadcrumb-item a.cds--link:hover {
color: #525252;
}
.cds--breadcrumb-item a.cds--link:visited {
color: #525252;
}
.cds--breadcrumb-item a.cds--link:visited:hover {
color: #525252;
}
.cds--breadcrumb-item a.cds--link {
color: #525252;
}
.cds--btn--ghost {
color: black;
}
.cds--btn--ghost:visited {
color: black;
}
.cds--btn--ghost:hover {
color: black;
}
.cds--btn--ghost:visited:hover {
color: black;
}
.cds--header__global .cds--btn--primary {
background-color: #161616
}
.cds--btn--primary {
background-color: #393939;
}
.cds--btn--primary:hover {
background-color: #474747;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
span.bjs-crumb {
color: #0000ff;
}
.bjs-breadcrumbs li:last-of-type span.bjs-crumb a {
color: black;
}
.app-logo {
height: 85%;
width: 85%;
@ -52,6 +107,26 @@ span.bjs-crumb {
margin-bottom: 2em;
}
h1.with-icons {
margin-top: 5px;
}
.grid-list-title {
font-weight: 600;
font-size: 14px;
line-height: 18px;
color: #161616;
}
.grid-date {
font-size: 14px;
line-height: 18px;
letter-spacing: 0.16px;
color: #525252;
}
.smaller-text {
font-size: 14px;
}
.diagram-editor-canvas {
border:1px solid #000000;
height:70vh;
@ -59,13 +134,6 @@ span.bjs-crumb {
margin:auto;
}
.cds--btn.button-white-background {
color: #393939;
background: #FFFFFF;
background-blend-mode: multiply;
border: 1px solid #393939;
}
.with-bottom-margin {
margin-bottom: 1em;
}

View File

@ -15,85 +15,3 @@
@use '@carbon/colors';
// @use '@carbon/react/scss/colors';
@use '@carbon/react/scss/themes';
// var(--cds-link-text-color, var(--cds-link-primary, #0f62fe))
// site is mainly using white theme.
// header is mainly using g100
// mockup wanted white, not grey, text
.cds--header, a.cds--header__menu-item {
// background-color: colors.$gray-100;
color: white;
}
h1{
height: 36px;
font-family: 'IBM Plex Sans';
font-style: normal;
font-weight: 400;
font-size: 28px;
line-height: 36px;
color: #161616;
flex: none;
order: 0;
align-self: stretch;
flex-grow: 0;
margin-bottom: 1em
}
.cds--breadcrumb-item a.cds--link:hover {
color: #525252;
}
.cds--breadcrumb-item a.cds--link:visited {
color: #525252;
}
.cds--breadcrumb-item a.cds--link:visited:hover {
color: #525252;
}
.cds--breadcrumb-item a.cds--link {
color: #525252;
}
.cds--btn--ghost {
color: black;
}
.cds--btn--ghost:visited {
color: black;
}
.cds--btn--ghost:hover {
color: black;
}
.cds--btn--ghost:visited:hover {
color: black;
}
$slightly-lighter-gray: #474747;
$spiff-header-background-color: #161616;
.cds--header__global .cds--btn--primary {
background-color: $spiff-header-background-color;
}
.cds--btn--primary {
background-color: #393939;
}
.cds--btn--primary:hover {
background-color: $slightly-lighter-gray;
}
// .cds--btn--ghost:visited {
// color: black;
// }
// .cds--btn--ghost:hover {
// color: black;
// }
// .cds--btn--ghost:visited:hover {
// color: black;
// }
// :root {
// --cds-link-primary: #525252;
// }
// .card {
// background: var(--orange);
// --orange: hsl(255, 72%, var(--lightness));
// }

View File

@ -3,8 +3,8 @@ import * as ReactDOMClient from 'react-dom/client';
import App from './App';
import 'bootstrap/dist/css/bootstrap.css';
import './index.css';
import './index.scss';
import './index.css';
import reportWebVitals from './reportWebVitals';
import UserService from './services/UserService';

View File

@ -113,11 +113,12 @@ export default function MessageInstanceList() {
)}:link`,
],
[
`${searchParams.get('process_instance_id')}`,
`Process Instance: ${searchParams.get('process_instance_id')}`,
`/admin/process-models/${searchParams.get(
'process_model_id'
)}/process-instances/${searchParams.get('process_instance_id')}`,
],
['Messages'],
]}
/>
);

View File

@ -88,9 +88,10 @@ export default function ProcessInstanceLogList() {
)}:link`,
],
[
`${params.process_instance_id}`,
`Process Instance: ${params.process_instance_id}`,
`/admin/process-models/${params.process_model_id}/process-instances/${params.process_instance_id}`,
],
['Logs'],
]}
/>
<PaginationForTable

View File

@ -1,20 +1,33 @@
import { useContext, useEffect, useState } from 'react';
import Editor from '@monaco-editor/react';
import { useParams, useNavigate, Link } from 'react-router-dom';
import {
TrashCan,
StopOutline,
PauseOutline,
PlayOutline,
CaretLeft,
CaretRight,
InProgress,
Checkmark,
Warning,
// @ts-ignore
} from '@carbon/icons-react';
import {
Grid,
Column,
Button,
ButtonSet,
Tag,
Modal,
Stack,
UnorderedList,
// @ts-ignore
} from '@carbon/react';
import ProcessBreadcrumb from '../components/ProcessBreadcrumb';
import HttpService from '../services/HttpService';
import ReactDiagramEditor from '../components/ReactDiagramEditor';
import {
convertSecondsToFormattedDate,
convertSecondsToFormattedDateTime,
unModifyProcessModelPath,
} from '../helpers';
import ButtonWithConfirmation from '../components/ButtonWithConfirmation';
@ -132,7 +145,7 @@ export default function ProcessInstanceShow() {
const spiffStepLink = (
processInstanceToUse: any,
label: string,
label: any,
distance: number
) => {
return (
@ -155,7 +168,7 @@ export default function ProcessInstanceShow() {
return null;
}
return spiffStepLink(processInstanceToUse, '<<', -1);
return spiffStepLink(processInstanceToUse, <CaretLeft />, -1);
};
const nextStepLink = (processInstanceToUse: any) => {
@ -163,49 +176,87 @@ export default function ProcessInstanceShow() {
return null;
}
return spiffStepLink(processInstanceToUse, '>>', 1);
return spiffStepLink(processInstanceToUse, <CaretRight />, 1);
};
const getInfoTag = (processInstanceToUse: any) => {
const currentEndDate = convertSecondsToFormattedDate(
const currentEndDate = convertSecondsToFormattedDateTime(
processInstanceToUse.end_in_seconds
);
let currentEndDateTag;
if (currentEndDate) {
currentEndDateTag = (
<li>
Completed:{' '}
{convertSecondsToFormattedDate(processInstanceToUse.end_in_seconds) ||
'N/A'}
</li>
<Grid condensed fullWidth>
<Column sm={1} md={1} lg={1} className="grid-list-title">
Completed:{' '}
</Column>
<Column sm={3} md={3} lg={3} className="grid-date">
{convertSecondsToFormattedDateTime(
processInstanceToUse.end_in_seconds
) || 'N/A'}
</Column>
</Grid>
);
}
let statusIcon = <InProgress />;
if (processInstanceToUse.status === 'suspended') {
statusIcon = <PauseOutline />;
} else if (processInstanceToUse.status === 'complete') {
statusIcon = <Checkmark />;
} else if (processInstanceToUse.status === 'terminated') {
statusIcon = <StopOutline />;
} else if (processInstanceToUse.status === 'faulted') {
statusIcon = <Warning />;
}
return (
<UnorderedList>
<li>
Started:{' '}
{convertSecondsToFormattedDate(processInstanceToUse.start_in_seconds)}
</li>
<>
<Grid condensed fullWidth>
<Column sm={1} md={1} lg={1} className="grid-list-title">
Started:{' '}
</Column>
<Column sm={3} md={3} lg={3} className="grid-date">
{convertSecondsToFormattedDateTime(
processInstanceToUse.start_in_seconds
)}
</Column>
</Grid>
{currentEndDateTag}
<li>Status: {processInstanceToUse.status}</li>
<li>
<Link
data-qa="process-instance-log-list-link"
to={`/admin/process-models/${modifiedProcessModelId}/process-instances/${params.process_instance_id}/logs`}
>
Logs
</Link>
</li>
<li>
<Link
data-qa="process-instance-message-instance-list-link"
to={`/admin/messages?process_model_id=${params.process_model_id}&process_instance_id=${params.process_instance_id}`}
>
Messages
</Link>
</li>
</UnorderedList>
<Grid condensed fullWidth>
<Column sm={1} md={1} lg={1} className="grid-list-title">
Status:{' '}
</Column>
<Column sm={3} md={3} lg={3}>
<Tag type="gray" size="sm" className="span-tag">
{processInstanceToUse.status} {statusIcon}
</Tag>
</Column>
</Grid>
<br />
<Grid condensed fullWidth>
<Column sm={2} md={2} lg={2}>
<ButtonSet>
<Button
size="sm"
className="button-white-background"
data-qa="process-instance-log-list-link"
href={`/admin/process-models/${modifiedProcessModelId}/process-instances/${params.process_instance_id}/logs`}
>
Logs
</Button>
<Button
size="sm"
className="button-white-background"
data-qa="process-instance-message-instance-list-link"
href={`/admin/messages?process_model_id=${params.process_model_id}&process_instance_id=${params.process_instance_id}`}
>
Messages
</Button>
</ButtonSet>
</Column>
</Grid>
</>
);
};
@ -216,9 +267,15 @@ export default function ProcessInstanceShow() {
) === -1
) {
return (
<Button onClick={terminateProcessInstance} variant="warning">
Terminate
</Button>
<ButtonWithConfirmation
kind="ghost"
renderIcon={StopOutline}
iconDescription="Terminate"
hasIconOnly
description={`Terminate Process Instance: ${processInstanceToUse.id}`}
onConfirmation={terminateProcessInstance}
confirmButtonLabel="Terminate"
/>
);
}
return <div />;
@ -231,9 +288,14 @@ export default function ProcessInstanceShow() {
) === -1
) {
return (
<Button onClick={suspendProcessInstance} variant="warning">
Suspend
</Button>
<Button
onClick={suspendProcessInstance}
kind="ghost"
renderIcon={PauseOutline}
iconDescription="Suspend"
hasIconOnly
size="lg"
/>
);
}
return <div />;
@ -242,9 +304,14 @@ export default function ProcessInstanceShow() {
const resumeButton = (processInstanceToUse: any) => {
if (processInstanceToUse.status === 'suspended') {
return (
<Button onClick={resumeProcessInstance} variant="warning">
Resume
</Button>
<Button
onClick={resumeProcessInstance}
kind="ghost"
renderIcon={PlayOutline}
iconDescription="Resume"
hasIconOnly
size="lg"
/>
);
}
return <div />;
@ -434,9 +501,9 @@ export default function ProcessInstanceShow() {
const stepsElement = (processInstanceToUse: any) => {
return (
<Grid fullWidth>
<Grid condensed fullWidth>
<Column sm={3} md={3} lg={3}>
<Stack orientation="horizontal" gap={3}>
<Stack orientation="horizontal" gap={3} className="smaller-text">
{previousStepLink(processInstanceToUse)}
Step {currentSpiffStep(processInstanceToUse)} of{' '}
{processInstanceToUse.spiff_step}
@ -447,6 +514,25 @@ export default function ProcessInstanceShow() {
);
};
const buttonIcons = (processInstanceToUse: any) => {
const elements = [];
elements.push(terminateButton(processInstanceToUse));
elements.push(suspendButton(processInstanceToUse));
elements.push(resumeButton(processInstanceToUse));
elements.push(
<ButtonWithConfirmation
kind="ghost"
renderIcon={TrashCan}
iconDescription="Delete"
hasIconOnly
description={`Delete Process Instance: ${processInstanceToUse.id}`}
onConfirmation={deleteProcessInstance}
confirmButtonLabel="Delete"
/>
);
return elements;
};
if (processInstance && tasks) {
const processInstanceToUse = processInstance as any;
const taskIds = getTaskIds();
@ -463,20 +549,14 @@ export default function ProcessInstanceShow() {
`Process Model: ${processModelId}`,
`process_model:${processModelId}:link`,
],
[`${processInstanceToUse.id}`],
[`Process Instance Id: ${processInstanceToUse.id}`],
]}
/>
<h1>Process Instance Id: {processInstanceToUse.id}</h1>
<Stack orientation="horizontal" gap={3}>
<ButtonWithConfirmation
description="Delete Process Instance?"
onConfirmation={deleteProcessInstance}
buttonLabel="Delete"
confirmButtonLabel="Delete"
/>
{terminateButton(processInstanceToUse)}
{suspendButton(processInstanceToUse)}
{resumeButton(processInstanceToUse)}
<Stack orientation="horizontal" gap={1}>
<h1 className="with-icons">
Process Instance Id: {processInstanceToUse.id}
</h1>
{buttonIcons(processInstanceToUse)}
</Stack>
<br />
<br />