Skip to content
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

feat: show history about completed runs in each cron workflow #11790

Closed
wants to merge 22 commits into from
Closed

feat: show history about completed runs in each cron workflow #11790

wants to merge 22 commits into from

Conversation

yunwoo-yu
Copy link
Contributor

Fixes #11706

Motivation

  • You can view completed workflows on the cron-workflows detail page.
  • You can explore workflows that you want users to see more easily. Better UX
  • We've taken the component that was applied to the workflow view and reused it.

Modifications

  • before
    image

  • after
    image

Verification

juijeong8324 and others added 13 commits September 3, 2023 17:34
Signed-off-by: juijeong8324 <juijeong8324@gmail.com>

Signed-off-by: Justice <juijeong8324@gmail.com>
Signed-off-by: juijeong8324 <juijeong8324@gmail.com>

Signed-off-by: Justice <juijeong8324@gmail.com>
Co-authored-by: Anton Gilgur <4970083+agilgur5@users.noreply.github.com>
Signed-off-by: Justice <juijeong8324@gmail.com>
Signed-off-by: GeunSam2 <rootiron96@gmail.com>
Signed-off-by: GeunSam2 <rootiron96@gmail.com>
…juijeong8324

Fix/docs lint error for juijeong8324
Add artifact-visualization-demo.png at docs/assets

Signed-off-by: Justice <juijeong8324@gmail.com>
Signed-off-by: Justice <juijeong8324@gmail.com>
Signed-off-by: YunCow <skypnal12@gmail.com>
Copy link
Member

@agilgur5 agilgur5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for implementing this!

There are some issues with the implementation right now, as not everything is transferable from the Workflows List. See some comments below

@@ -62,6 +73,16 @@ export const CronWorkflowDetails = ({match, location, history}: RouteComponentPr

useEffect(() => setEdited(true), [cronWorkflow]);

useEffect(() => {
services.workflows.list(namespace, selectedPhases, selectedLabels, pagination).then(res => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we can filter in the request to not retrieve unnecessary workflows, although that might not be possible

Copy link
Member

@agilgur5 agilgur5 Sep 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is possible (and is already done in the Workflows List filter for Cron Workflows).
you can pass in a label with the Cron Workflow name: workflows.argoproj.io/cron-workflow=<name-of-cron-workflow>

That is the only label that should be passed as there is otherwise no label filter here (that is similarly only in the sidebar on the Workflows List page)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also should use async/await per #11740

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Thanks for the feedback, would it be ok to change to async/await and get the data via label names like on the workflows List page?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can replace selectedLabels (the 3rd argument to list) with the cron-workflow label from above

@@ -25,6 +30,12 @@ export const CronWorkflowDetails = ({match, location, history}: RouteComponentPr
const [name] = useState(match.params.name);
const [sidePanel, setSidePanel] = useState(queryParams.get('sidePanel'));
const [tab, setTab] = useState(queryParams.get('tab'));
const [workflows, setWorkflows] = useState<Workflow[]>([]);
const [{selectedPhases, selectedLabels, paginationLimit}, setSelectedData] = useState<WorkflowListRenderOptions>(JSON.parse(localStorage.getItem('ListOptions/options')));
Copy link
Member

@agilgur5 agilgur5 Sep 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are no phases or labels here. those are from the sidebar filter in the Workflows List which is not present here.

pagination does not seem to be present either. there seems to be some logic here, but no UI elements for pagination.

also the localStorage call would not apply here as it is specific to the Workflows list page

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Thanks I was wondering this, would it be a good idea to put a selection or pagination in the detail cron page?

Copy link
Member

@agilgur5 agilgur5 Sep 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think filtering is needed right now. pagination would be nice to have, but for a first-pass MVP, I think we can leave out pagination as well.

You may have not noticed, but the main overall Cron Workflows page itself actually doesn't implement pagination yet 😅 : #10846

@@ -183,6 +204,17 @@ export const CronWorkflowDetails = ({match, location, history}: RouteComponentPr

return items;
};
const updateCurrentlySelectedAndBatchActions = (newSelectedWorkflows: Map<string, Workflow>): void => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the checkbox is unused here. No batch actions were added to this page, so it's not useable currently

Copy link
Contributor Author

@yunwoo-yu yunwoo-yu Sep 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • The workflows-row component has fixed selection and checkboxes. What do you think about creating a new cron-workflows-row component?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So ideally we would factor out a workflows-row without checkboxes and then use that in both places.
In particular, this history view you've created could also be useful for Workflow Templates as well, so making it reusable would be useful.

That being said, that requires a bit of refactoring. As a first-pass, we could just make the checkboxes no-op for now and refactor later -- that was why I commented on the function itself and not the UI elements.
I'll leave that decision up to you for if you want to try to tackle a refactor or just leave the checkboxes non-functional for now.

Copy link
Contributor Author

@yunwoo-yu yunwoo-yu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback, I've got a few questions and will try to revise it in the direction of your feedback 👍🙇‍♂️

@@ -62,6 +73,16 @@ export const CronWorkflowDetails = ({match, location, history}: RouteComponentPr

useEffect(() => setEdited(true), [cronWorkflow]);

useEffect(() => {
services.workflows.list(namespace, selectedPhases, selectedLabels, pagination).then(res => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Thanks for the feedback, would it be ok to change to async/await and get the data via label names like on the workflows List page?

@@ -25,6 +30,12 @@ export const CronWorkflowDetails = ({match, location, history}: RouteComponentPr
const [name] = useState(match.params.name);
const [sidePanel, setSidePanel] = useState(queryParams.get('sidePanel'));
const [tab, setTab] = useState(queryParams.get('tab'));
const [workflows, setWorkflows] = useState<Workflow[]>([]);
const [{selectedPhases, selectedLabels, paginationLimit}, setSelectedData] = useState<WorkflowListRenderOptions>(JSON.parse(localStorage.getItem('ListOptions/options')));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Thanks I was wondering this, would it be a good idea to put a selection or pagination in the detail cron page?

@yunwoo-yu
Copy link
Contributor Author

@agilgur5

hello 😄

I'll hide the checkbox for now, thanks for the advice

The PR got stuck in the commit log, so I'll repromote it again

Thanks!

@yunwoo-yu yunwoo-yu closed this Sep 13, 2023
@agilgur5
Copy link
Member

agilgur5 commented Sep 13, 2023

The PR got stuck in the commit log, so I'll repromote it again

You can rebase the branch and force push. No need to open a new PR.

Or if you create a new branch with the original commits cherry-picked, you can just name it the same as the old branch and force push.

@yunwoo-yu
Copy link
Contributor Author

Uncontributed commits from collaborators got mixed up in the middle, and it was really hard to pick them out 😅

And I deleted the already forked repository. Maybe juijeong8324 will PR it again!

@agilgur5
Copy link
Member

And I deleted the already forked repository. Maybe juijeong8324 will PR it again!

Gotcha. Ok.

Uncontributed commits from collaborators got mixed up in the middle, and it was really hard to pick them out 😅

You can always use git reflog to find the reference before merging and checkout back to that. Then do a cleaner rebase as opposed to a merge. reflog is always your friend if you screw something up.

I've had to teach a lot of engineers how to properly use git before. It can do almost everything you need, just need to learn how 🙂 rebase -i is definitely my favorite 😄

@agilgur5
Copy link
Member

agilgur5 commented Sep 13, 2023

Replaced by / followed up in #11811

@agilgur5
Copy link
Member

@yunwoo-yu I noticed in this PR and in #11788 that you used your fork's master branch. You usually want to use feature branches. That makes it easier to separate your work and could make it easier to rebase and cherry-pick as well.

@yunwoo-yu
Copy link
Contributor Author

@agilgur5

For the next PR, I'll create a separate feat branch and upload it. Thanks 😁

And like you said, I was able to get rid of the merged fact with reflog. I had already deleted the repository so I didn't get to try it, but I'll do it the way you suggested next time. 👍

@agilgur5 agilgur5 added the solution/superseded This PR or issue has been superseded by another one (slightly different from a duplicate) label Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ui solution/superseded This PR or issue has been superseded by another one (slightly different from a duplicate)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI - show history about completed runs in each cron workflow
4 participants