-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
fix(ui): improve markdown styles for workflow-row, workflow-templates, cluster-workflow-templates, and cron-workflows #13930
fix(ui): improve markdown styles for workflow-row, workflow-templates, cluster-workflow-templates, and cron-workflows #13930
Conversation
Signed-off-by: stevenbjohnson <[email protected]>
Signed-off-by: stevenbjohnson <[email protected]>
Signed-off-by: stevenbjohnson <[email protected]>
Signed-off-by: stevenbjohnson <[email protected]>
Signed-off-by: stevenbjohnson <[email protected]>
Signed-off-by: stevenbjohnson <[email protected]>
Signed-off-by: stevenbjohnson <[email protected]>
Signed-off-by: stevenbjohnson <[email protected]>
e19d707
to
52a3791
Compare
Signed-off-by: stevenbjohnson <[email protected]>
Signed-off-by: stevenbjohnson <[email protected]>
Signed-off-by: stevenbjohnson <[email protected]>
Signed-off-by: stevenbjohnson <[email protected]>
Signed-off-by: stevenbjohnson <[email protected]>
Signed-off-by: stevenbjohnson <[email protected]>
…iption to workflow-drawer Signed-off-by: stevenbjohnson <[email protected]>
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.
a couple nits and a question about DRYing up some repetitive code. Not sure if possible to centralize or if we should.
And we discussed alt tags for mouseover when title/description gets auto-shortened due to overflow. You mentioned it makes the UI very wonky. Follow up for a future PR.
Nice work.
ui/src/cluster-workflow-templates/cluster-workflow-template-markdown.scss
Outdated
Show resolved
Hide resolved
ui/src/cluster-workflow-templates/cluster-workflow-template-markdown.tsx
Outdated
Show resolved
Hide resolved
…for utils function Signed-off-by: stevenbjohnson <[email protected]>
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.
Locally tested and looks great
ui/src/cluster-workflow-templates/cluster-workflow-template-markdown.scss
Outdated
Show resolved
Hide resolved
const title = wf.metadata.annotations?.[ANNOTATION_TITLE] ?? wf.metadata.name; | ||
const description = (wf.metadata.annotations?.[ANNOTATION_DESCRIPTION] && `\n${wf.metadata.annotations[ANNOTATION_DESCRIPTION]}`) || ''; | ||
const hasAnnotation = title !== wf.metadata.name || description !== ''; | ||
const title = (wf.metadata.annotations?.[ANNOTATION_TITLE] && `${escapeInvalidMarkdown(wf.metadata.annotations[ANNOTATION_TITLE])}`) ?? wf.metadata.name; |
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.
Why using ??
instead of ||
here ? You have a chance of having an empty title
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.
Thanks for the feedback, @Adrien-D! The syntax for the title
was taken from an existing line for setting the title in the workflows-row.tsx
file. Seems the use of the nullish coalescing operator is to ensure users can enter values that would otherwise be evaluated as "false-y." This approach was carried over to ensure that defaulting to the wf.metadata.name
is only in the case of a null
or undefined
value in the [ANNOTATION_TITLE]
field.
Please let me know if the use of the ||
operator is a preferred method to use here and I can go through the files and make the update.
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 is not really a preferred method, but as it's taken from an existing line, it's all good !
Signed-off-by: stevenbjohnson <[email protected]>
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.
Thank you!
Motivation
These changes are being proposed to improve the
workflows-row
component. With the addition of the.wf-rows-name
class for displaying thetitle
anddescription
annotations, previous styles that handled overflow and text-overflow are being overridden. This results in lengthy titles and descriptions creating wrapped text that renders inconsistently sized workflow-row components and makes details difficult to read.Similarly, there are some markdown text formats that cause the UI to render the
workflow-row
component inconsistently and make the title and description equally as difficult to read.Modifications
workflows-row.scss
styles for the.wf-rows-name
classline-height by 1em
inline-block
displaymiddle
vertical alignment (useless withoutinline-block
)overflow
andtext-overflow
without wrapping (applies to all child elements, as well)Before Change:
After Change:
workflows-list__timestamp
class, ensuring times remain aligned inworkflows-row
when not ISO format (the above changes will create misalignment when atitle
anddescription
are present)Before Change:
After Change:
EscapeInvalidMarkdown()
to prevent markdown text formats that cause large variances inworkflow-row
sizing, as well as complicate readability (markdown that starts with a header, blockquotes, or list items will have characters removed):Supported formatting:
**…**
)_…_
OR*…*
)~…~
)`…`
)[…](URL)
)Not supported formatting:
__…__
)#
)-#
)-
OR*
)\n
OR|
)```…```
)>
)DESCRIPTION
section to theworkflow-drawer
component that will render the unescaped markdown from thetitle
anddescription
for users to view the full values input when truncated in theworkflow-row
Verification
Changes were tested in and verified in a dev container, running the UI and submitting workflows with a variety of title/description combinations:
UPDATE:
This formatting logic and component rendering has been added to support the recent changes to CronWorkflows, WorkflowTemplates, and ClusterWorkflowTemplates
INFO
and show any user-added markdown