forked from argoproj/argo-workflows
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(markdown): Allow markdown in workflow title and description
Fixes: argoproj#10126 - [x] new react component for handling workflow row name - [x] new css file to manage row name column - [x] new example file for title and description with markdown - [x] include `remark-gfm` for GitHub Friendly Markdown (aka urls automatically translate to links) - [x] Add User Guid -> UI Features -> Title and Description docs page Signed-off-by: jmeridth <jmeridth@gmail.com> Co-authored-by: bencompton <benjamincompton@gmail.com>
- Loading branch information
1 parent
d536eec
commit e0075a8
Showing
10 changed files
with
830 additions
and
9 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Title and Description | ||
|
||
If you add specific title and description annotations to your workflow they will show up on the workflow lists. It will also work with markdown. | ||
|
||
```yaml | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Workflow | ||
metadata: | ||
name: my-wf | ||
annotations: | ||
workflows.argoproj.io/title: '**Build and test**' | ||
workflows.argoproj.io/description: '`SuperDuperProject` PR #6529: Implement frobbing (aff39ee)' | ||
``` | ||
Examples by row: | ||
- markdown title, markdown description using [`remark-gfm`](https://github.com/remarkjs/remark-gfm) to auto turn URLs into links | ||
- no title or description, defaults to `workflow.metadata.name` | ||
- markdown title, no description | ||
- no title, markdown description (title defaults to `workflow.metadata.name`) | ||
- markdown title, markdown description (description includes URL that auto turns into anchor | ||
- markdown title, markdown description, includes markdown URL | ||
- markdown title, markdown description, includes markdown URL (pr link goes to `github.com`) | ||
|
||
![Workflow Title And Description](assets/workflow-title-and-description.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Workflow | ||
metadata: | ||
generateName: title-and-description-with-markdown- | ||
labels: | ||
workflows.argoproj.io/archive-strategy: "false" | ||
annotations: | ||
workflows.argoproj.io/title: "**Test Title**" | ||
workflows.argoproj.io/description: | | ||
`This is a simple hello world example.` | ||
You can also run it in Python: https://couler-proj.github.io/couler/examples/#hello-world | ||
spec: | ||
entrypoint: whalesay | ||
templates: | ||
- name: whalesay | ||
container: | ||
image: docker/whalesay:latest | ||
command: [cowsay] | ||
args: ["hello world"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
ui/src/app/workflows/components/workflows-row/workflows-row-name.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import * as kubernetes from 'argo-ui/src/models/kubernetes'; | ||
import * as React from 'react'; | ||
import ReactMarkdown from 'react-markdown'; | ||
import remarkGfm from 'remark-gfm'; | ||
import {ANNOTATION_DESCRIPTION, ANNOTATION_TITLE} from '../../../shared/annotations'; | ||
|
||
require('./workflows-row.scss'); | ||
|
||
export const WorkflowsRowName = ({metadata}: {metadata: kubernetes.ObjectMeta}) => { | ||
const title = (metadata.annotations && metadata.annotations[ANNOTATION_TITLE]) || metadata.name; | ||
const description = (metadata.annotations && metadata.annotations[ANNOTATION_DESCRIPTION] && `\n${metadata.annotations[ANNOTATION_DESCRIPTION]}`) || ''; | ||
const markdown = `${title}${description}`; | ||
return ( | ||
<div className='wf-rows-name'> | ||
<ReactMarkdown children={markdown} components={{p: React.Fragment}} remarkPlugins={[remarkGfm]} /> | ||
</div> | ||
); | ||
}; |
8 changes: 8 additions & 0 deletions
8
ui/src/app/workflows/components/workflows-row/workflows-row.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@import 'node_modules/argo-ui/src/styles/config'; | ||
|
||
.wf-rows-name { | ||
white-space: pre-line; | ||
line-height: 1.5em; | ||
display: inline-block; | ||
vertical-align: middle; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.