Skip to content

Commit fb634ec

Browse files
authored
Improve Process Detail step timestamp using step started and completed datetime (#2096)
* Improve Process Detail step timestamp using step started and completed datetime * Add changeset and version compatibility * revert wrongly updated minimum core version in version-compatibility.json * Update types and tests
1 parent 796d299 commit fb634ec

File tree

9 files changed

+44
-40
lines changed

9 files changed

+44
-40
lines changed

.changeset/evil-cameras-bathe.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@orchestrator-ui/orchestrator-ui-components': minor
3+
---
4+
5+
Improve Process Detail step timestamp using step started and completed datetime

packages/orchestrator-ui-components/src/components/WfoWorkflowSteps/WfoStep/WfoStep.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { WfoStepForm } from './WfoStepForm';
2626
export interface WfoStepProps {
2727
stepListItem: StepListItem;
2828
startedAt: string;
29+
completedAt: string;
2930
showHiddenKeys: boolean;
3031
onToggleStepDetail: () => void;
3132
isTask: boolean;
@@ -39,6 +40,7 @@ export const WfoStep = React.forwardRef(
3940
stepListItem,
4041
onToggleStepDetail,
4142
startedAt,
43+
completedAt,
4244
showHiddenKeys,
4345
isStartStep = false,
4446
isTask,
@@ -130,13 +132,13 @@ export const WfoStep = React.forwardRef(
130132
</EuiText>
131133
<EuiText>
132134
{step.status}{' '}
133-
{step.executed &&
134-
`- ${formatDate(step.executed)}`}
135+
{step.completed &&
136+
`- ${formatDate(step.completed)}`}
135137
</EuiText>
136138
</EuiFlexItem>
137139

138140
<EuiFlexGroup css={stepRowStyle}>
139-
{step.executed && (
141+
{step.completed && (
140142
<>
141143
{isExpanded && (
142144
<EuiButton
@@ -165,7 +167,7 @@ export const WfoStep = React.forwardRef(
165167
<EuiText size="m">
166168
{calculateTimeDifference(
167169
startedAt,
168-
step.executed,
170+
completedAt,
169171
)}
170172
</EuiText>
171173
</EuiFlexItem>

packages/orchestrator-ui-components/src/components/WfoWorkflowSteps/WfoStepList/WfoStepList.tsx

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export type WfoStepListRef = {
1515
export type WfoStepListProps = {
1616
stepListItems: StepListItem[];
1717
showHiddenKeys: boolean;
18-
startedAt: string;
1918
onToggleExpandStepListItem: (stepListItem: StepListItem) => void;
2019
onTriggerExpandStepListItem: (stepListItem: StepListItem) => void;
2120
isTask: boolean;
@@ -27,7 +26,6 @@ export const WfoStepList = React.forwardRef(
2726
{
2827
stepListItems,
2928
showHiddenKeys,
30-
startedAt,
3129
onToggleExpandStepListItem,
3230
onTriggerExpandStepListItem,
3331
isTask,
@@ -52,8 +50,6 @@ export const WfoStepList = React.forwardRef(
5250

5351
const { contentRef } = useContentRef();
5452

55-
let stepStartTime = startedAt;
56-
5753
useImperativeHandle(reference, () => ({
5854
scrollToStep: async (stepId: string) => {
5955
// Applied a promise construction to wait for the browser to expand the step before scrolling
@@ -103,32 +99,26 @@ export const WfoStepList = React.forwardRef(
10399

104100
return (
105101
<>
106-
{stepListItems.map((stepListItem, index) => {
107-
const stepComponent = (
108-
<div key={`step-${index}`}>
109-
{index !== 0 && <div css={stepSpacerStyle} />}
110-
<WfoStep
111-
ref={getReferenceCallbackForStepId(
112-
stepListItem.step.stepId,
113-
)}
114-
onToggleStepDetail={() =>
115-
onToggleExpandStepListItem(stepListItem)
116-
}
117-
stepListItem={stepListItem}
118-
startedAt={stepStartTime}
119-
showHiddenKeys={showHiddenKeys}
120-
isStartStep={index === 0}
121-
isTask={isTask}
122-
processId={processId}
123-
/>
124-
</div>
125-
);
126-
127-
if (index > 0) {
128-
stepStartTime = stepListItem.step.executed;
129-
}
130-
return stepComponent;
131-
})}
102+
{stepListItems.map((stepListItem, index) => (
103+
<div key={`step-${index}`}>
104+
{index !== 0 && <div css={stepSpacerStyle} />}
105+
<WfoStep
106+
ref={getReferenceCallbackForStepId(
107+
stepListItem.step.stepId,
108+
)}
109+
onToggleStepDetail={() =>
110+
onToggleExpandStepListItem(stepListItem)
111+
}
112+
stepListItem={stepListItem}
113+
startedAt={stepListItem.step.started}
114+
completedAt={stepListItem.step.completed}
115+
showHiddenKeys={showHiddenKeys}
116+
isStartStep={index === 0}
117+
isTask={isTask}
118+
processId={processId}
119+
/>
120+
</div>
121+
))}
132122
</>
133123
);
134124
},

packages/orchestrator-ui-components/src/components/WfoWorkflowSteps/WfoWorkflowStepList/WfoWorkflowStepList.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ export const WfoWorkflowStepList = React.forwardRef(
7070
steps = [],
7171
lastStatus,
7272
traceBack,
73-
startedAt,
7473
processId,
7574
isTask,
7675
userInputForm,
@@ -206,7 +205,6 @@ export const WfoWorkflowStepList = React.forwardRef(
206205
<WfoStepList
207206
ref={reference}
208207
stepListItems={stepListItems}
209-
startedAt={startedAt}
210208
showHiddenKeys={showHiddenKeys}
211209
isTask={isTask}
212210
onToggleExpandStepListItem={

packages/orchestrator-ui-components/src/pages/processes/timelineUtils.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import {
77
} from './timelineUtils';
88

99
const baseStep: Step = {
10-
executed: 'testExecuted',
10+
started: 'testStarted',
11+
completed: 'testCompleted',
1112
name: 'tesName',
1213
state: {
1314
testKey: 'testValue',

packages/orchestrator-ui-components/src/rtk/endpoints/processDetail.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ export const processDetailQuery = `query ProcessDetail($processId: String!) {
3030
name
3131
status
3232
stepId
33-
executed
3433
stateDelta
34+
started
35+
completed
3536
}
3637
customer {
3738
fullname

packages/orchestrator-ui-components/src/types/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,10 @@ export interface Step {
251251
name: string;
252252
status: StepStatus;
253253
stepId: string; // sic backend
254-
executed: string;
255254
state: StepState | undefined;
256255
stateDelta: StepState;
256+
started: string;
257+
completed: string;
257258
}
258259

259260
export interface WorkflowDefinition {

packages/orchestrator-ui-components/src/utils/getProductNamesFromProcess.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ const getProcessDetail = (data: Partial<ProcessDetail> = {}): ProcessDetail => {
1717
name: 'step name',
1818
status: StepStatus.RUNNING,
1919
stepId: 'step id',
20-
executed: 'executed',
20+
started: 'started',
21+
completed: 'completed',
2122
state: {},
2223
stateDelta: {},
2324
},

version-compatibility.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
[
2+
{
3+
"orchestratorUiVersion": "5.3.5",
4+
"minimumOrchestratorCoreVersion": "4.2.0",
5+
"changes": "Breaking Change on process.steps, using new props started and completed from graphql to improve the process detail timestamps."
6+
},
27
{
38
"orchestratorUiVersion": "5.0.0",
49
"minimumOrchestratorCoreVersion": "4.0.0",

0 commit comments

Comments
 (0)