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: Allow markdown title and description in CronWorkflows, WorkflowTemplates, & ClusterWorkflowTemplates. Fixes #12644 #12697

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

panicboat
Copy link
Contributor

@panicboat panicboat commented Feb 25, 2024

Fixes #12644

Motivation

Use markdown for better visibility

Modifications

  • Allow markdown in WorkflowTemplate.
  • Allow markdown in CronWorkflow
  • Allow markdown in ClusterWorkflowTemplate

image
image
image

Verification

  • no annotations
  • only title with markdown
  • only description with markdown
  • title and description with markdown

@panicboat panicboat changed the title feat: Allow markdown title and description. feat: Allow markdown title and description. Fixes #12644 Feb 25, 2024
@panicboat panicboat marked this pull request as ready for review February 25, 2024 07:27
@agilgur5 agilgur5 changed the title feat: Allow markdown title and description. Fixes #12644 feat: Allow markdown title and description in CronWorkflows & WorkflowTemplates. Fixes #12644 Feb 25, 2024
@agilgur5 agilgur5 self-assigned this Feb 25, 2024
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.

I mentioned in the issue that you should use the code from #12580 which contains various fixes, optimizations, and more.

This should also add new sections for all 3 of these to the docs from #12582. Could just add screenshots to those sections, don't need to give examples again since they're effectively the same amongst these. Using the same example text as the existing docs would be desired for consistency as well (your screenshots here have different text, so would not suffice)

@panicboat panicboat force-pushed the panicboat/allow-for-markdown-in-workflow-title-and-description branch from b1a0428 to b0b528f Compare February 26, 2024 09:56
@panicboat panicboat marked this pull request as draft February 26, 2024 09:56
@panicboat panicboat changed the title feat: Allow markdown title and description in CronWorkflows & WorkflowTemplates. Fixes #12644 feat: Allow markdown title and description in CronWorkflows & WorkflowTemplates, ClusterWorkflowTemplates. Fixes #12644 Mar 3, 2024
@panicboat panicboat force-pushed the panicboat/allow-for-markdown-in-workflow-title-and-description branch from 657d309 to 1824504 Compare March 3, 2024 11:23
@panicboat panicboat marked this pull request as ready for review March 3, 2024 11:30
@panicboat panicboat requested a review from agilgur5 March 3, 2024 11:30
@agilgur5 agilgur5 changed the title feat: Allow markdown title and description in CronWorkflows & WorkflowTemplates, ClusterWorkflowTemplates. Fixes #12644 feat: Allow markdown title and description in CronWorkflows, WorkflowTemplates, & ClusterWorkflowTemplates. Fixes #12644 Mar 3, 2024
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.

There's a few issues with all the copy+pasting here. In the components below, copy+pasting is not the right approach -- importing would be better. In the CSS, the copy+pasted code seems largely irrelevant.
Please be thoughtful about what and how you copy+paste.

I've also requested some changes to the docs.

See in-line comments below

Comment on lines 79 to 81
{templates.map(t => (
<Link className='row argo-table-list__row' key={t.metadata.uid} to={uiUrl(`cluster-workflow-templates/${t.metadata.name}`)}>
<div className='columns small-1'>
<i className='fa fa-clone' />
</div>
<div className='columns small-5'>{t.metadata.name}</div>
<div className='columns small-3'>
<Timestamp date={t.metadata.creationTimestamp} />
</div>
</Link>
))}
{templates.map(t => {
return <ClusterWorkflowTemplateRow workflow={t} key={`${t.metadata.namespace}/${t.metadata.name}`} />;
})}
Copy link
Member

Choose a reason for hiding this comment

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

Conversely, I don't think this row needs to be split into a separate component at this time. It can be left as-is within the list component. The row is quite short here (note that the Workflows Row has much more details than this row)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be easier to renovate the system in the future if it were structured in the same way.
Personally, I would like to keep it the same. Is that a problem?

Copy link
Member

Choose a reason for hiding this comment

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

Ah I see what you were going for, because workflows-row is split it out, make the others consistent.

Two things:

  1. The Workflows List is the exception to things because it's so big and detailed; I'm not sure that other components should follow its example
  2. If we do want to refactor this as such, it would be better done as a separate refactor PR. That keeps things "atomic" and single purpose -- in particular, it keeps the diff here to only what is necessary for this feature, which makes it easier to review now and easier to understand in the future if someone looks at this PR (if this needs a revert for some reason, for historical purposes, or if someone want to copy this PR to another feature, etc). Similarly a refactor is easier to read / review / revert etc as its own independent PR -- the changes should effectively be a no-op as they do not change behavior.

Copy link
Member

@agilgur5 agilgur5 Mar 5, 2024

Choose a reason for hiding this comment

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

Also I see that the variables here are a bit harder to use without a separated component. That is a bit annoying.

There's a few techniques to workaround that. Two main ones I am thinking of are to call a function to do some of the logic and to split out the title/desc as its own component, but in the same file for now. The latter would be more consistent with the Workflows Row and would be easier to follow-up with a refactor if desired

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I made the title and description separate components.

docs/title-and-description.md Outdated Show resolved Hide resolved
@panicboat panicboat requested a review from agilgur5 March 4, 2024 17:04
@panicboat panicboat marked this pull request as draft March 5, 2024 03:12
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.

This is looking much better! 🙂

I left several small documentation comments in-line below, as well as a few code comments. I haven't reviewed the row components as I think it'd be easier to do so if those are not refactored in this PR.

Also DCO is missing on one of your commits here

docs/title-and-description.md Outdated Show resolved Hide resolved
docs/title-and-description.md Outdated Show resolved Hide resolved
docs/title-and-description.md Outdated Show resolved Hide resolved
docs/title-and-description.md Outdated Show resolved Hide resolved
docs/title-and-description.md Outdated Show resolved Hide resolved
docs/title-and-description.md Outdated Show resolved Hide resolved
docs/title-and-description.md Outdated Show resolved Hide resolved
Comment on lines 79 to 81
{templates.map(t => (
<Link className='row argo-table-list__row' key={t.metadata.uid} to={uiUrl(`cluster-workflow-templates/${t.metadata.name}`)}>
<div className='columns small-1'>
<i className='fa fa-clone' />
</div>
<div className='columns small-5'>{t.metadata.name}</div>
<div className='columns small-3'>
<Timestamp date={t.metadata.creationTimestamp} />
</div>
</Link>
))}
{templates.map(t => {
return <ClusterWorkflowTemplateRow workflow={t} key={`${t.metadata.namespace}/${t.metadata.name}`} />;
})}
Copy link
Member

Choose a reason for hiding this comment

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

Ah I see what you were going for, because workflows-row is split it out, make the others consistent.

Two things:

  1. The Workflows List is the exception to things because it's so big and detailed; I'm not sure that other components should follow its example
  2. If we do want to refactor this as such, it would be better done as a separate refactor PR. That keeps things "atomic" and single purpose -- in particular, it keeps the diff here to only what is necessary for this feature, which makes it easier to review now and easier to understand in the future if someone looks at this PR (if this needs a revert for some reason, for historical purposes, or if someone want to copy this PR to another feature, etc). Similarly a refactor is easier to read / review / revert etc as its own independent PR -- the changes should effectively be a no-op as they do not change behavior.

Copy link
Member

@agilgur5 agilgur5 Mar 5, 2024

Choose a reason for hiding this comment

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

could you make an additional small modification to this file? now that it's shared, I think we could be more explicit that this component is not meant to be used in isolation and that instead the lazy-loaded suspense variant should be used.

Could you add an _ underscore prefix to the name of the file, i.e. _react-markdown-gfm.tsx to give some form of indication that it's "private"? (the underscore prefix does not actually do anything in JS/TS, but people with experience in other languages might recognize it).

Also could you add at the top of the file a comment saying to use the lazy loaded suspense variant instead with its filename listed? GitHub won't let me comment in-line at the top because the first line is unchanged

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 your support.
I learned a lot.
I've made some corrections, can you check them?

Copy link
Member

@terrytangyuan terrytangyuan left a comment

Choose a reason for hiding this comment

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

@jmeridth Would you like to help review this once it's ready?

@panicboat panicboat force-pushed the panicboat/allow-for-markdown-in-workflow-title-and-description branch from 6d5030c to 793b48a Compare March 5, 2024 11:03
Signed-off-by: panicboat <panicboat@gmail.com>

fix: review points on CronWorkflow

Signed-off-by: panicboat <panicboat@gmail.com>

fix: review points

Signed-off-by: panicboat <panicboat@gmail.com>

fix: review points

Signed-off-by: panicboat <panicboat@gmail.com>

fix: review point

Signed-off-by: panicboat <panicboat@gmail.com>

fix: review point

Signed-off-by: panicboat <panicboat@gmail.com>

Update ui/src/app/cluster-workflow-templates/cluster-workflow-template-list.scss

Signed-off-by: panicboat <panicboat@gmail.com>

fix: review points

Signed-off-by: panicboat <panicboat@gmail.com>

fix: review points

Signed-off-by: panicboat <panicboat@gmail.com>

fix: spelling error

fix: rename wf name

Signed-off-by: panicboat <panicboat@gmail.com>

Apply suggestions from code review

Signed-off-by: panicboat <panicboat@gmail.com>

feat: Allow markdown title and description.

Signed-off-by: panicboat <panicboat@gmail.com>

fix: review points

Signed-off-by: panicboat <panicboat@gmail.com>
Co-Authored-By: Anton Gilgur <4970083+agilgur5@users.noreply.github.com>
@panicboat panicboat force-pushed the panicboat/allow-for-markdown-in-workflow-title-and-description branch from 793b48a to 028eb74 Compare March 5, 2024 13:19
@panicboat panicboat requested a review from agilgur5 March 5, 2024 13:25
@panicboat panicboat marked this pull request as ready for review March 5, 2024 13:25
@agilgur5 agilgur5 added this to the v3.6.0 milestone Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI: Support markdown in CronWorkflow/WorkflowTemplate title/description
4 participants