diff --git a/ui/src/app/applications/components/application-create-panel/application-create-panel.tsx b/ui/src/app/applications/components/application-create-panel/application-create-panel.tsx index 07efd4dd82..698a275158 100644 --- a/ui/src/app/applications/components/application-create-panel/application-create-panel.tsx +++ b/ui/src/app/applications/components/application-create-panel/application-create-panel.tsx @@ -272,9 +272,7 @@ export const ApplicationCreatePanel = (props: { {(repoType === 'git' && ( -
- -
+
{ +export class RevisionFormField extends React.PureComponent { + constructor(props: RevisionFormFieldProps) { + super(props); + this.state = {filterType: 'Branches'}; + } + + public setFilter(newValue: string) { + this.setState({filterType: newValue}); + } + public render() { + const selectedFilter = this.state.filterType; + const extraPadding = this.props.hideLabel ? '0em' : '1.53em'; + const rowClass = this.props.hideLabel ? '' : ' argo-form-row'; return ( - - => { - if (src.repoURL) { - return services.repos - .revisions(src.repoURL) - .then(revisionsRes => ['HEAD'].concat(revisionsRes.branches || []).concat(revisionsRes.tags || [])) - .catch(() => []); - } - return []; - }}> - {(revisions: string[]) => ( - - )} - - - +
+
+ + => { + if (src.repoURL) { + return services.repos + .revisions(src.repoURL) + .then(revisionsRes => + ['HEAD'] + .concat(selectedFilter === 'Branches' ? revisionsRes.branches || [] : []) + .concat(selectedFilter === 'Tags' ? revisionsRes.tags || [] : []) + ) + .catch(() => []); + } + return []; + }}> + {(revisions: string[]) => ( + + )} + + + +
+
+ ( +

+ {this.state.filterType} +

+ )} + qeId='application-create-dropdown-revision' + items={['Branches', 'Tags'].map((type: 'Branches' | 'Tags') => ({ + title: type, + action: () => { + this.setFilter(type); + } + }))} + /> +
+
); } } diff --git a/ui/src/app/shared/components/revision-help-icon.tsx b/ui/src/app/shared/components/revision-help-icon.tsx index 06752fb5ae..ff41828998 100644 --- a/ui/src/app/shared/components/revision-help-icon.tsx +++ b/ui/src/app/shared/components/revision-help-icon.tsx @@ -1,8 +1,8 @@ import {HelpIcon} from 'argo-ui'; import * as React from 'react'; -export const RevisionHelpIcon = ({type, top}: {type: string; top?: string}) => ( -
+export const RevisionHelpIcon = ({type, top, right}: {type: string; top?: string; right?: string}) => ( +
{type === 'helm' ? ( ) : (