-
Notifications
You must be signed in to change notification settings - Fork 358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add current state to workflow states table and format duration time #9191
Add current state to workflow states table and format duration time #9191
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, if possible, could you please post a before/after screenshot of the page from where this change is coming in from?
I'm concerned this will appear like the step is done. Wonder if we can have a leading icon that represent the current state of the state |
Looks good @GilbertCherrie I wonder if it's possible to format as |
b133310
to
08934ea
Compare
08934ea
to
bbdc248
Compare
@agrare I made all the requested changes if you can review this again |
More specifically the formatting should match whatever the other columns show. |
That's a good choice... I was also thinking something like possibly
|
82aca2e
to
58c913b
Compare
58c913b
to
e70ef0b
Compare
// Converts the duration time in ms and returns a string in format: w days x hours y minutes z seconds | ||
// duration: time in ms | ||
const convertDuration = (duration) => { | ||
const durationString = moment.duration(duration, 'milliseconds').toISOString().split('PT')[1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm very surprised this doesn't "throw away" the days, months, years component of the time
@@ -59,6 +89,20 @@ export const workflowStatusData = (response) => { | |||
return undefined; | |||
} | |||
const rows = response.context ? rowData(response.context) : []; | |||
if (response.context && response.context.State) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agrare I think this code depends on nil-ing out the state when the flow is completed. Is that in yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it isn't, started it but ran into some issues because we use context.output
after a workflow has completed so need to tweak some stuff to be able to do this in floe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GilbertCherrie Since the "final" state might appear twice, I'm concerned this will double up the presentation of it. @agrare Thoughts on how we can avoid presenting the final state twice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agrare If we do a state retry or a state gets re-run in a loop, does each iteration get it's own GUID? If so, then yeah, an ID check might work.
@GilbertCherrie You could also just check the very last state in the StatesHistory and if it's the same as the "current" state then don't show it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do a state retry or a state gets re-run in a loop, does each iteration get it's own GUID? If so, then yeah, an ID check might work.
Here is an example of the same state retried twice from floe specs:
"StateHistory"=>
[{"Name"=>"State",
"Input"=>{"foo"=>{"bar"=>"baz"}, "bar"=>{"baz"=>"foo"}},
"Guid"=>"63837184-0795-41df-8d23-da034b8b2850",
"EnteredTime"=>"2024-05-24T12:49:47Z",
"RunnerContext"=>{"container_ref"=>"container-d"},
"Output"=>{"Error"=>"States.Timeout"},
"NextState"=>nil,
"FinishedTime"=>"2024-05-24T12:49:47Z",
"Duration"=>0.423689375,
"RetryCount"=>2,
"Retrier"=>["States.Timeout"]},
{"Name"=>"State",
"Input"=>{"foo"=>{"bar"=>"baz"}, "bar"=>{"baz"=>"foo"}},
"Guid"=>"63837184-0795-41df-8d23-da034b8b2850",
"EnteredTime"=>"2024-05-24T12:49:47Z",
"RunnerContext"=>{"container_ref"=>"container-d"},
"Output"=>{"Error"=>"States.Timeout"},
"NextState"=>nil,
"FinishedTime"=>"2024-05-24T12:49:47Z",
"Duration"=>0.423689375,
"RetryCount"=>2,
"Retrier"=>["States.Timeout"]}]
The State gets a Guid when it is started and a state that is retried multiple times is still the same state so it has the same Guid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agrare One more question. When the entire flow is done, does the "current" state have a "finished time"? If so, that might be the simplest check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes,
"State"=>
{"Name"=>"NextState",
"Input"=>{"foo"=>1, "result"=>{"foo"=>"bar", "bar"=>"baz"}},
"Guid"=>"81de8e05-8118-49d0-b97e-779904fb07c3",
"EnteredTime"=>"2024-05-24T14:34:29Z",
"Output"=>{"foo"=>1, "result"=>{"foo"=>"bar", "bar"=>"baz"}},
"NextState"=>nil,
"FinishedTime"=>"2024-05-24T14:34:29Z",
"Duration"=>0.348082391}
@GilbertCherrie I love the new icons, but there seems to be a spacing issue - I feel like the old icons looked proportionally better or perhaps aligned better? I can't quite put my finger on it. |
I can add padding to the right if they are too close |
e70ef0b
to
489ec75
Compare
489ec75
to
87d7593
Compare
@Fryguy I made all the requested changes if you can review again when you have time. The screenshot above shows the updated icon styles. Let me know if it's good now. |
Checked commit GilbertCherrie@87d7593 with ruby 2.7.8, rubocop 1.56.3, haml-lint 0.51.0, and yamllint |
Backported to
|
Add current state to workflow states table and format duration time (cherry picked from commit a9b704b)
Fixes: #9189
Adds the current state to the workflow states table. Also, formats the duration time to be displays as a string in days hours minutes seconds format instead of just seconds.
Before:
After: