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: Date range filter for workflow list. Fixes #8329 #8596

Merged
merged 19 commits into from
Jun 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
21400d9
chore(deps): bump peaceiris/actions-gh-pages from 2.9.0 to 3.8.0 (#1)
dependabot[bot] Apr 23, 2022
a4afd9a
Merge branch 'argoproj:master' into master
momom-i Apr 25, 2022
45f6a41
chore(deps): bump google.golang.org/api from 0.75.0 to 0.76.0 (#2)
dependabot[bot] Apr 26, 2022
e04edb8
chore(deps): bump github.com/argoproj/pkg from 0.12.0 to 0.13.0 (#3)
dependabot[bot] Apr 26, 2022
8eba7bb
Merge branch 'argoproj:master' into master
momom-i Apr 27, 2022
8c2adc1
chore(deps): bump github.com/argoproj/pkg from 0.13.0 to 0.13.1 (#4)
dependabot[bot] Apr 29, 2022
b25a240
chore(deps): bump google.golang.org/api from 0.76.0 to 0.77.0 (#5)
dependabot[bot] Apr 29, 2022
960a6c0
chore(deps): bump github.com/argoproj/pkg from 0.13.1 to 0.13.2 (#6)
dependabot[bot] Apr 29, 2022
0f1993d
chore(deps): bump google.golang.org/api from 0.77.0 to 0.78.0 (#7)
dependabot[bot] May 3, 2022
85517cd
feat: Added a date range filter for Workflow. Fixes #8329
momom-i May 3, 2022
b3cff26
fix: delete date filter warning
momom-i May 4, 2022
754f925
Merge branch 'master' into date-range-filter
alexec May 4, 2022
5f03b52
fix: conflict
momom-i May 5, 2022
0a2adc3
fix: conflict
momom-i May 5, 2022
d23899c
feat: Added a date range filter for Workflow. Fixes #8329
momom-i May 3, 2022
82c2270
fix: delete date filter warning
momom-i May 4, 2022
d4e0269
fix: add first time user panel
momom-i May 8, 2022
14bdf02
fix: add clear button on date range filter
momom-i May 8, 2022
81d8957
fix: merge conflict
momom-i May 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ui/src/app/shared/components/first-time-user-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {useEffect, useState} from 'react';
// This wraps the children components in a FTU which allows you to provide an explanation of how to use the feature.
// The child components are hidden behind the panel until the users dismissed the panel by clicking "Continue".
// The fact the users dismissed the panel is persisted in local storage and the panel not show again.
export const FirstTimeUserPanel = ({id, explanation, children}: {id: string; explanation: string; children: React.ReactElement}) => {
export const FirstTimeUserPanel = ({id, explanation, children, style}: {id: string; explanation: string; children: React.ReactElement; style?: React.CSSProperties}) => {
const localStorageKey = 'FirstTimeUserPanel/' + id;
const [dismissed, setDismissed] = useState(localStorage.getItem(localStorageKey) === 'true');

Expand All @@ -14,9 +14,9 @@ export const FirstTimeUserPanel = ({id, explanation, children}: {id: string; exp

if (!dismissed) {
return (
<div className='white-box'>
<div className='white-box' style={{textAlign: 'center', ...style}}>
<p>{explanation}</p>
<p style={{textAlign: 'center'}}>
<p>
<a onClick={() => setDismissed(true)}>Continue</a>
</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import DatePicker from 'react-datepicker';
import * as models from '../../../../models';
import {WorkflowPhase} from '../../../../models';
import {CheckboxFilter} from '../../../shared/components/checkbox-filter/checkbox-filter';
Expand All @@ -15,7 +16,9 @@ interface WorkflowFilterProps {
phaseItems: WorkflowPhase[];
selectedPhases: WorkflowPhase[];
selectedLabels: string[];
onChange: (namespace: string, selectedPhases: WorkflowPhase[], labels: string[]) => void;
minStartedAt?: Date;
maxStartedAt?: Date;
onChange: (namespace: string, selectedPhases: WorkflowPhase[], labels: string[], minStartedAt: Date, maxStartedAt: Date) => void;
}

export class WorkflowFilters extends React.Component<WorkflowFilterProps, {}> {
Expand All @@ -40,7 +43,7 @@ export class WorkflowFilters extends React.Component<WorkflowFilterProps, {}> {
<NamespaceFilter
value={this.props.namespace}
onChange={ns => {
this.props.onChange(ns, this.props.selectedPhases, this.props.selectedLabels);
this.props.onChange(ns, this.props.selectedPhases, this.props.selectedLabels, this.props.minStartedAt, this.props.maxStartedAt);
}}
/>
</div>
Expand All @@ -51,7 +54,7 @@ export class WorkflowFilters extends React.Component<WorkflowFilterProps, {}> {
autocomplete={this.labelSuggestion}
tags={this.props.selectedLabels}
onChange={tags => {
this.props.onChange(this.props.namespace, this.props.selectedPhases, tags);
this.props.onChange(this.props.namespace, this.props.selectedPhases, tags, this.props.minStartedAt, this.props.maxStartedAt);
}}
/>
</div>
Expand Down Expand Up @@ -82,20 +85,61 @@ export class WorkflowFilters extends React.Component<WorkflowFilterProps, {}> {
this.props.onChange(
this.props.namespace,
selected.map(x => x as WorkflowPhase),
this.props.selectedLabels
this.props.selectedLabels,
this.props.minStartedAt,
this.props.maxStartedAt
);
}}
items={this.getPhaseItems(this.props.workflows)}
type='phase'
/>
</div>
<div className='columns small-5 xlarge-12'>
<p className='wf-filters-container__title'>Started Time</p>
<div>
<DatePicker
selected={this.props.minStartedAt}
onChange={date => {
this.props.onChange(this.props.namespace, this.props.selectedPhases, this.props.selectedLabels, date, this.props.maxStartedAt);
}}
placeholderText='From'
dateFormat='dd MMM yyyy'
todayButton='Today'
className='argo-field argo-textarea'
/>
<a
onClick={() => {
this.props.onChange(this.props.namespace, this.props.selectedPhases, this.props.selectedLabels, undefined, this.props.maxStartedAt);
}}>
<i className='fa fa-times-circle' />
</a>
</div>
<div>
<DatePicker
selected={this.props.maxStartedAt}
onChange={date => {
this.props.onChange(this.props.namespace, this.props.selectedPhases, this.props.selectedLabels, this.props.minStartedAt, date);
}}
placeholderText='To'
dateFormat='dd MMM yyyy'
todayButton='Today'
className='argo-field argo-textarea'
/>
<a
onClick={() => {
this.props.onChange(this.props.namespace, this.props.selectedPhases, this.props.selectedLabels, this.props.minStartedAt, undefined);
}}>
<i className='fa fa-times-circle' />
</a>
</div>
</div>
</div>
</div>
);
}

private setLabel(name: string, value: string) {
this.props.onChange(this.props.namespace, this.props.selectedPhases, [name.concat('=' + value)]);
this.props.onChange(this.props.namespace, this.props.selectedPhases, [name.concat('=' + value)], this.props.minStartedAt, this.props.maxStartedAt);
}

private getPhaseItems(workflows: models.Workflow[]) {
Expand Down
Loading