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: Display title and description in archived view #10796

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added docs/assets/workflow-title-and-description.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions docs/title-and-description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Title and Description

If you add specific title and description annotations to your workflow they will show up on the workflow lists.

```yaml
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
name: my-wf
annotations:
workflows.argoproj.io/title: 'Test Title'
workflows.argoproj.io/description: 'Test Description'
```

Note:

- no title or description, defaults to `workflow.metadata.name`
- no title, description (title defaults to `workflow.metadata.name`)
- title, no description
- title and description

![Workflow Title And Description](assets/workflow-title-and-description.png)
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ nav:
- artifact-visualization.md
- widgets.md
- intermediate-inputs.md
- title-and-description.md
- Debugging Tools:
- workflow-events.md
- debug-pause.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {Loading} from '../../../shared/components/loading';
import {PaginationPanel} from '../../../shared/components/pagination-panel';
import {PhaseIcon} from '../../../shared/components/phase-icon';
import {Timestamp} from '../../../shared/components/timestamp';
import {WorkflowsRowName} from '../../../shared/components/workflows-row-name/workflows-row-name';
import {ZeroState} from '../../../shared/components/zero-state';
import {formatDuration, wfDuration} from '../../../shared/duration';
import {Pagination, parseLimit} from '../../../shared/pagination';
Expand Down Expand Up @@ -275,7 +276,9 @@ export class ArchivedWorkflowList extends BasePage<RouteComponentProps<any>, Sta
<div className='columns small-1'>
<PhaseIcon value={w.status.phase} />
</div>
<div className='columns small-3'>{w.metadata.name}</div>
<div className='columns small-3'>
<WorkflowsRowName metadata={w.metadata} />
</div>
<div className='columns small-2'>{w.metadata.namespace}</div>
<div className='columns small-2'>
<Timestamp date={w.status.startedAt} />
Expand Down
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;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as kubernetes from 'argo-ui/src/models/kubernetes';
import * as React from 'react';
import {ANNOTATION_DESCRIPTION, ANNOTATION_TITLE} from '../../../shared/annotations';

require('./workflows-row-name.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 content = `${title}${description}`;
return <div className='wf-rows-name'>{content}</div>;
};
45 changes: 38 additions & 7 deletions ui/src/app/shared/services/archived-workflows-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,46 @@ import {Pagination} from '../pagination';
import {Utils} from '../utils';
import requests from './requests';
export class ArchivedWorkflowsService {
public list(namespace: string, name: string, namePrefix: string, phases: string[], labels: string[], minStartedAt: Date, maxStartedAt: Date, pagination: Pagination) {
public list(
namespace: string,
name: string,
namePrefix: string,
phases: string[],
labels: string[],
minStartedAt: Date,
maxStartedAt: Date,
pagination: Pagination,
fields = [
'metadata',
'items.metadata.uid',
'items.metadata.name',
'items.metadata.namespace',
'items.metadata.creationTimestamp',
'items.metadata.labels',
'items.metadata.annotations',
'items.status.phase',
'items.status.message',
'items.status.finishedAt',
'items.status.startedAt',
'items.status.estimatedDuration',
'items.status.progress',
'items.spec.suspend'
]
) {
const params = Utils.queryParams({
name,
namePrefix,
phases,
labels,
minStartedAt,
maxStartedAt,
pagination
});
params.push(`fields=${fields.join(',')}`);
if (namespace === '') {
return requests
.get(`api/v1/archived-workflows?${Utils.queryParams({name, namePrefix, phases, labels, minStartedAt, maxStartedAt, pagination}).join('&')}`)
.then(res => res.body as models.WorkflowList);
return requests.get(`api/v1/archived-workflows?${params.join('&')}`).then(res => res.body as models.WorkflowList);
} else {
return requests
.get(`api/v1/archived-workflows?namespace=${namespace}&${Utils.queryParams({name, namePrefix, phases, labels, minStartedAt, maxStartedAt, pagination}).join('&')}`)
.then(res => res.body as models.WorkflowList);
return requests.get(`api/v1/archived-workflows?namespace=${namespace}&${params.join('&')}).join('&')}`).then(res => res.body as models.WorkflowList);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import {Ticker} from 'argo-ui/src/index';
import * as React from 'react';
import {Link} from 'react-router-dom';
import {Workflow} from '../../../../models';
import {ANNOTATION_DESCRIPTION, ANNOTATION_TITLE} from '../../../shared/annotations';
import {uiUrl} from '../../../shared/base';
import {DurationPanel} from '../../../shared/components/duration-panel';
import {PhaseIcon} from '../../../shared/components/phase-icon';
import {Timestamp} from '../../../shared/components/timestamp';
import {WorkflowsRowName} from '../../../shared/components/workflows-row-name/workflows-row-name';
import {wfDuration} from '../../../shared/duration';
import {WorkflowDrawer} from '../workflow-drawer/workflow-drawer';

Expand Down Expand Up @@ -50,8 +50,7 @@ export class WorkflowsRow extends React.Component<WorkflowsRowProps, WorkflowRow
</div>
<Link to={uiUrl(`workflows/${wf.metadata.namespace}/${wf.metadata.name}`)} className='small-11 row'>
<div className='columns small-3'>
{(wf.metadata.annotations && wf.metadata.annotations[ANNOTATION_TITLE]) || wf.metadata.name}
{wf.metadata.annotations && wf.metadata.annotations[ANNOTATION_DESCRIPTION] ? <p>{wf.metadata.annotations[ANNOTATION_DESCRIPTION]}</p> : null}
<WorkflowsRowName metadata={wf.metadata} />
</div>
<div className='columns small-1'>{wf.metadata.namespace}</div>
<div className='columns small-1'>
Expand Down