diff --git a/app/scripts/modules/core/src/pipeline/config/triggers/baseBuild/BaseBuildTriggerTemplate.tsx b/app/scripts/modules/core/src/pipeline/config/triggers/baseBuild/BaseBuildTriggerTemplate.tsx index 73f7f60c6c9..e4655de927c 100644 --- a/app/scripts/modules/core/src/pipeline/config/triggers/baseBuild/BaseBuildTriggerTemplate.tsx +++ b/app/scripts/modules/core/src/pipeline/config/triggers/baseBuild/BaseBuildTriggerTemplate.tsx @@ -14,6 +14,7 @@ import { Spinner } from 'core/widgets/spinners/Spinner'; import { buildDisplayName } from 'core/pipeline/executionBuild/buildDisplayName.filter'; import { timestamp } from 'core/utils/timeFormatters'; import { TetheredSelect } from 'core/presentation/TetheredSelect'; +import { TextInput } from 'core/presentation'; export interface IBaseBuildTriggerTemplateProps extends ITriggerTemplateComponentProps { buildTriggerType: BuildServiceType; @@ -25,6 +26,7 @@ export interface IBaseBuildTriggerTemplateState { buildsLoading?: boolean; loadError?: boolean; selectedBuild?: number; + explicitBuild?: boolean; } export class BaseBuildTriggerTemplate extends React.Component< @@ -44,6 +46,7 @@ export class BaseBuildTriggerTemplate extends React.Component< buildsLoading: false, loadError: false, selectedBuild: 0, + explicitBuild: false, }; } @@ -106,6 +109,16 @@ export class BaseBuildTriggerTemplate extends React.Component< .subscribe(this.buildLoadSuccess, this.buildLoadFailure); }; + private manuallySpecify = () => { + this.setState({ + explicitBuild: true, + }); + }; + + private explicitlyUpdateBuildNumber = (event: React.ChangeEvent) => { + this.updateSelectedBuild({ number: event.target.value }); + }; + public componentDidMount() { this.initialize(); } @@ -134,27 +147,38 @@ export class BaseBuildTriggerTemplate extends React.Component< }; public render() { - const { builds, buildsLoading, loadError, selectedBuild } = this.state; + const { builds, buildsLoading, loadError, selectedBuild, explicitBuild } = this.state; + + const loadingBuilds = ( +
+ +
+ ); + const errorLoadingBuilds =
Error loading builds!
; + const noBuildsFound = ( +
+

No builds found

+
+ ); return (
- {buildsLoading && ( -
-
- -
-
- )} - {loadError &&
Error loading builds!
} - {!buildsLoading && ( -
- {builds.length === 0 && ( -
-

No builds found

-
- )} - {builds.length > 0 && ( +
+
+ {explicitBuild ? ( + + ) : buildsLoading ? ( + loadingBuilds + ) : loadError ? ( + errorLoadingBuilds + ) : builds.length <= 0 ? ( + noBuildsFound + ) : ( )}
- )} + {!explicitBuild && ( +
+ + Manually specify build + +
+ )} +
); }