-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui): Add workflow author information to workflow summary and dra…
…wer (#9119) Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
- Loading branch information
1 parent
18be959
commit 20f8582
Showing
5 changed files
with
120 additions
and
1 deletion.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
ui/src/app/workflows/components/workflow-creator-info/workflow-creator-info.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,44 @@ | ||
@import 'node_modules/argo-ui/src/styles/config'; | ||
|
||
.wf-row-creator-labels { | ||
display: flex; | ||
flex-wrap: wrap; | ||
align-items: center; | ||
height: 100%; | ||
$gutter: 0.5em; | ||
border-radius: 0 0 3px 3px; | ||
|
||
.tag { | ||
line-height: normal; | ||
background-color: $argo-color-gray-3; | ||
border-radius: 3px; | ||
height: auto; | ||
margin: $gutter 0; | ||
margin-right: 10px; | ||
display: flex; | ||
overflow: hidden; | ||
cursor: pointer; | ||
|
||
&:hover { | ||
.key { | ||
color: $argo-color-teal-5; | ||
} | ||
.value { | ||
color: $argo-color-gray-3; | ||
} | ||
} | ||
|
||
.key, .value { | ||
padding: 0.5em 8px; | ||
} | ||
|
||
.key { | ||
color: $argo-color-gray-6; | ||
} | ||
|
||
.value { | ||
color: white; | ||
background-color: $argo-color-teal-5; | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
ui/src/app/workflows/components/workflow-creator-info/workflow-creator-info.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,48 @@ | ||
import * as React from 'react'; | ||
import * as models from '../../../../models'; | ||
import {labels} from '../../../../models'; | ||
|
||
require('./workflow-creator-info.scss'); | ||
|
||
interface WorkflowCreatorInfoProps { | ||
workflow: models.Workflow; | ||
onChange: (key: string, value: string) => void; | ||
} | ||
|
||
export class WorkflowCreatorInfo extends React.Component<WorkflowCreatorInfoProps, {}> { | ||
constructor(props: WorkflowCreatorInfoProps) { | ||
super(props); | ||
} | ||
|
||
public render() { | ||
const w = this.props.workflow; | ||
const creatorLabels = []; | ||
if (w.metadata.labels) { | ||
const creatorInfoMap = new Map<string, string>([ | ||
['Name', w.metadata.labels[labels.creator]], | ||
['Email', w.metadata.labels[labels.creatorEmail]], | ||
['Preferred username', w.metadata.labels[labels.creatorPreferredUsername]] | ||
]); | ||
creatorInfoMap.forEach((value: string, key: string) => { | ||
if (value !== '' && value !== undefined) { | ||
creatorLabels.push( | ||
<div | ||
title={`List workflows created by ${key}=${value}`} | ||
className='tag' | ||
key={`${w.metadata.uid}-${key}`} | ||
onClick={async e => { | ||
e.preventDefault(); | ||
this.props.onChange(key, value); | ||
}}> | ||
<div className='key'>{key}</div> | ||
<div className='value'>{value}</div> | ||
</div> | ||
); | ||
} | ||
}); | ||
} else { | ||
creatorLabels.push(<div key={`${w.metadata.uid}- `}> No creator information </div>); | ||
} | ||
return <div className='wf-row-creator-labels'>{creatorLabels}</div>; | ||
} | ||
} |
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
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