Skip to content

Commit

Permalink
feat: Added workflow summary to workflow-list page. (#9693)
Browse files Browse the repository at this point in the history
* feat: Added workflow summary to workflow-list page. Fixes #6535

Signed-off-by: Anil Kumar <anil225sri@gmail.com>

* feat: rename jobs to workflows

Signed-off-by: Anil Kumar <anil225sri@gmail.com>

* feat: Added workflow summary to workflow-list page. Fixes #6535

Signed-off-by: Anil Kumar <anil225sri@gmail.com>

* feat: rename jobs to workflows

Signed-off-by: Anil Kumar <anil225sri@gmail.com>

* feat: add info icon for workflows summary

Signed-off-by: Anil Kumar <anil225sri@gmail.com>

* feat: add tooltip to workflow status summary

Signed-off-by: Anil Kumar <anil225sri@gmail.com>

* feat: retrigger checks

Signed-off-by: Anil Kumar <anil225sri@gmail.com>

Signed-off-by: Anil Kumar <anil225sri@gmail.com>
  • Loading branch information
anilkumar-pcs committed Oct 8, 2022
1 parent 82201d5 commit 1bbdf0d
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import * as Actions from '../../../shared/workflow-operations-map';
import {WorkflowCreator} from '../workflow-creator';
import {WorkflowFilters} from '../workflow-filters/workflow-filters';
import {WorkflowsRow} from '../workflows-row/workflows-row';
import {WorkflowsSummaryContainer} from '../workflows-summary-container/workflows-summary-container';
import {WorkflowsToolbar} from '../workflows-toolbar/workflows-toolbar';

require('./workflows-list.scss');
Expand Down Expand Up @@ -193,6 +194,7 @@ export class WorkflowsList extends BasePage<RouteComponentProps<any>, State> {
/>
<div className='row'>
<div className='columns small-12 xlarge-2'>
<WorkflowsSummaryContainer workflows={this.state.workflows} />
<div>
<WorkflowFilters
workflows={this.state.workflows || []}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
@import 'node_modules/argo-ui/src/styles/config';

.wf-summary-container {
color: $argo-color-gray-6;
padding: 5px 0px;
overflow: visible;
position: relative;
border-radius: 5px;
box-shadow: 1px 1px 3px #8fa4b1;
padding: 0 1em 0.75em 1em;
margin: 12px 0;
background-color: white;

&__title {
width: 100%;
max-width: 100%;
padding: 8px 0;
font-size: 15px;
background-color: transparent;
border: 0;
margin: 0;
margin-top: 1em;
color: #6d7f8b;
text-transform: uppercase;
}

&__text{
font-size: 16px;
}

&__subtext {
font-size: 12px;
}

&__running {
font-size: 16px;
font-weight: bold;
color: #0DADEA;
}

&__others {
font-size: 12px;
font-weight: bold;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import {Tooltip} from 'argo-ui';
import * as React from 'react';
import {useEffect, useState} from 'react';
import {Workflow} from '../../../../models';

require('./workflows-summary-container.scss');

type ReduceReturnType = Record<string, number>;

export const WorkflowsSummaryContainer = (props: {workflows: Workflow[]}) => {
const [wfSummary, setWfSummary] = useState(null);
useEffect(() => {
if (props.workflows) {
const summary = props.workflows.reduce<ReduceReturnType>((acc, curr) => {
return {...acc, [curr.status.phase]: acc[curr.status.phase] ? ++acc[curr.status.phase] : 1};
}, {});
setWfSummary(summary);
}
}, [props.workflows]);

return (
<div className='wf-summary-container'>
<p className='wf-summary-container__title'>
Workflows Summary{' '}
<Tooltip content='Only workflows in view are summarized'>
<i className='fa fa-info-circle' />
</Tooltip>
</p>
<div className='row'>
<div className='columns small-12 xlarge-12'>
<span className='wf-summary-container__text'>Running workflows &nbsp;</span>
<span className='wf-summary-container__running'>{wfSummary && wfSummary.Running ? wfSummary.Running : 0}</span>
</div>
</div>
<div className='row'>
<div className='columns small-12 xlarge-6'>
<span className='wf-summary-container__subtext'>Pending &nbsp;</span>
<span className='wf-summary-container__others'>{wfSummary && wfSummary.Pending ? wfSummary.Pending : 0}</span>
</div>
<div className='columns small-12 xlarge-6'>
<span className='wf-summary-container__subtext'>Succeeded &nbsp;</span>
<span className='wf-summary-container__others'>{wfSummary && wfSummary.Succeeded ? wfSummary.Succeeded : 0}</span>
</div>
</div>
<div className='row'>
<div className='columns small-12 xlarge-6'>
<span className='wf-summary-container__subtext'>Failed &nbsp;</span>
<span className='wf-summary-container__others'>{wfSummary && wfSummary.Failed ? wfSummary.Failed : 0}</span>
</div>
<div className='columns small-12 xlarge-6'>
<span className='wf-summary-container__subtext'>Error &nbsp;</span>
<span className='wf-summary-container__others'>{wfSummary && wfSummary.Error ? wfSummary.Error : 0}</span>
</div>
</div>
</div>
);
};

0 comments on commit 1bbdf0d

Please sign in to comment.