Skip to content

Commit be73cc1

Browse files
author
OpenShift Bot
authored
Merge pull request #1228 from spadgett/invalid-fields-advanced-options
Merged by openshift-bot
2 parents 3d2855d + a6ecc11 commit be73cc1

File tree

4 files changed

+153
-119
lines changed

4 files changed

+153
-119
lines changed

app/views/create/fromimage.html

+6-3
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@
109109
</div>
110110
</div>
111111

112-
<div class="col-md-4" ng-if="advancedOptions || advancedSourceOptions">
112+
<!-- Use ng-show instead of ng-if so the form is still marked invalid if a hidden field has errors. -->
113+
<div class="col-md-4" ng-show="advancedOptions || advancedSourceOptions">
113114
<div class="form-group">
114115
<label for="gitref">Git Reference</label>
115116
<div>
@@ -128,7 +129,8 @@
128129
</div>
129130
</div>
130131

131-
<div ng-if="advancedOptions || advancedSourceOptions" class="form-group">
132+
<!-- Use ng-show instead of ng-if so the form is still marked invalid if a hidden field has errors. -->
133+
<div ng-show="advancedOptions || advancedSourceOptions" class="form-group">
132134
<label for="contextdir">Context Dir</label>
133135
<div>
134136
<input
@@ -144,7 +146,8 @@
144146
<div class="help-block">Optional subdirectory for the application source code, used as the context directory for the build.</div>
145147
</div>
146148

147-
<div ng-if="advancedOptions">
149+
<!-- Use ng-show instead of ng-if so the form is still marked invalid if a hidden field has errors. -->
150+
<div ng-show="advancedOptions">
148151
<div class="form-group">
149152
<osc-secrets model="buildConfig.secrets.gitSecret"
150153
namespace="projectName"

app/views/edit/build-config.html

+99-88
Original file line numberDiff line numberDiff line change
@@ -347,15 +347,18 @@ <h3 class="with-divider">Image Configuration</h3>
347347
</div>
348348
</div>
349349

350-
<div class="form-group" ng-if="view.advancedOptions && strategyType !== 'JenkinsPipeline'">
351-
<osc-secrets model="secrets.picked.pullSecret"
352-
namespace="projectName"
353-
display-type="pull"
354-
type="image"
355-
secrets-by-type="secrets.secretsByType"
356-
service-account-to-link="builder"
357-
alerts="alerts">
358-
</osc-secrets>
350+
<div class="form-group" ng-if="strategyType !== 'JenkinsPipeline'">
351+
<!-- Use ng-show instead of ng-if so the form is still marked invalid if a hidden field has errors. -->
352+
<div ng-show="view.advancedOptions">
353+
<osc-secrets model="secrets.picked.pullSecret"
354+
namespace="projectName"
355+
display-type="pull"
356+
type="image"
357+
secrets-by-type="secrets.secretsByType"
358+
service-account-to-link="builder"
359+
alerts="alerts">
360+
</osc-secrets>
361+
</div>
359362
</div>
360363

361364
<div class="form-group" ng-if="view.advancedOptions">
@@ -398,7 +401,8 @@ <h3 class="with-divider">Image Configuration</h3>
398401
</div>
399402
</div>
400403

401-
<div class="form-group" ng-if="view.advancedOptions">
404+
<!-- Use ng-show instead of ng-if so the form is still marked invalid if a hidden field has errors. -->
405+
<div class="form-group" ng-show="view.advancedOptions">
402406
<osc-secrets model="secrets.picked.pushSecret"
403407
namespace="projectName"
404408
display-type="push"
@@ -430,7 +434,8 @@ <h3 class="with-divider">Environment Variables<span class="help action-inline">
430434
</div>
431435
</div>
432436
<div ng-if="sources.git || !(updatedBuildConfig | isJenkinsPipelineStrategy)" class="section">
433-
<div ng-if="view.advancedOptions">
437+
<!-- Use ng-show instead of ng-if so the form is still marked invalid if a hidden field has errors. -->
438+
<div ng-show="view.advancedOptions">
434439
<h3 class="with-divider">Triggers
435440
<a ng-href="{{'build-triggers' | helpLink}}" target="_blank"><span class="learn-more-inline">Learn More&nbsp;<i class="fa fa-external-link" aria-hidden="true"></i></span></a>
436441
</h3>
@@ -485,23 +490,25 @@ <h5>Image change</h5>
485490
</dl>
486491
</div>
487492
</div>
488-
<div class="section" ng-if="!(updatedBuildConfig | isJenkinsPipelineStrategy) && view.advancedOptions">
489-
<h3 class="with-divider">
490-
Build Secrets
491-
<a href="{{'source_secrets' | helpLink}}" target="_blank"><span class="learn-more-inline">Learn More&nbsp;<i class="fa fa-external-link" aria-hidden="true"></i></span></a>
492-
</h3>
493-
<div class="form-group">
494-
<osc-source-secrets model="secrets.picked.sourceSecrets"
495-
namespace="projectName"
496-
secrets-by-type="secrets.secretsByType"
497-
strategy-type="strategyType"
498-
service-account-to-link="builder"
499-
alerts="alerts"
500-
display-type="source"
501-
type="source">
502-
</osc-source-secrets>
493+
<div class="section" ng-if="!(updatedBuildConfig | isJenkinsPipelineStrategy)">
494+
<!-- Use ng-show instead of ng-if so the form is still marked invalid if a hidden field has errors. -->
495+
<div ng-show="view.advancedOptions">
496+
<h3 class="with-divider">
497+
Build Secrets
498+
<a href="{{'source_secrets' | helpLink}}" target="_blank"><span class="learn-more-inline">Learn More&nbsp;<i class="fa fa-external-link" aria-hidden="true"></i></span></a>
499+
</h3>
500+
<div class="form-group">
501+
<osc-source-secrets model="secrets.picked.sourceSecrets"
502+
namespace="projectName"
503+
secrets-by-type="secrets.secretsByType"
504+
strategy-type="strategyType"
505+
service-account-to-link="builder"
506+
alerts="alerts"
507+
display-type="source"
508+
type="source">
509+
</osc-source-secrets>
510+
</div>
503511
</div>
504-
505512
</div>
506513
<div class="section mar-bottom-lg" ng-if="view.advancedOptions">
507514
<h3 class="with-divider">Run Policy
@@ -529,74 +536,78 @@ <h3 class="with-divider">Run Policy
529536
</div>
530537
</div>
531538

532-
<div ng-if="view.advancedOptions && !(updatedBuildConfig | isJenkinsPipelineStrategy)" class="section">
533-
<h3 class="with-divider">
534-
Post-Commit Hooks
535-
<span class="help action-inline">
536-
<a href="{{'build-hooks' | helpLink}}" aria-hidden="true" target="_blank"><span class="learn-more-inline">Learn More&nbsp;<i class="fa fa-external-link"></i></span></a>
537-
</span>
538-
</h3>
539+
<div ng-if="!(updatedBuildConfig | isJenkinsPipelineStrategy)" class="section">
540+
<!-- Use ng-show instead of ng-if so the form is still marked invalid if a hidden field has errors. -->
541+
<div ng-show="view.advancedOptions">
542+
<h3 class="with-divider">
543+
Post-Commit Hooks
544+
<span class="help action-inline">
545+
<a href="{{'build-hooks' | helpLink}}" aria-hidden="true" target="_blank"><span class="learn-more-inline">Learn More&nbsp;<i class="fa fa-external-link"></i></span></a>
546+
</span>
547+
</h3>
539548

540-
<div class="checkbox">
541-
<label>
542-
<input type="checkbox" ng-model="view.hasHooks" id="enable-build-hooks">
543-
Run build hooks after image is built
544-
</label>
545-
<div class="help-block">
546-
Build hooks allow you to run commands at the end of the build to verify the image.
549+
<div class="checkbox">
550+
<label>
551+
<input type="checkbox" ng-model="view.hasHooks" aria-describedby="build-hooks-help">
552+
Run build hooks after image is built
553+
</label>
554+
<div class="help-block" id="build-hooks-help">
555+
Build hooks allow you to run commands at the end of the build to verify the image.
556+
</div>
547557
</div>
548-
</div>
549558

550-
<div ng-if="view.hasHooks">
551-
<div class="form-group">
552-
<h4>Hook Types</h4>
553-
<ui-select
554-
ng-model="buildHookSelection.type"
555-
title="Choose a type of build hook">
556-
<ui-select-match>{{$select.selected.label}}</ui-select-match>
557-
<ui-select-choices repeat="type in buildHookTypes">
558-
{{type.label}}
559-
</ui-select-choices>
560-
</ui-select>
561-
</div>
559+
<div ng-if="view.hasHooks">
560+
<div class="form-group">
561+
<label>Hook Types</label>
562+
<ui-select
563+
ng-model="buildHookSelection.type"
564+
title="Choose a type of build hook">
565+
<ui-select-match>{{$select.selected.label}}</ui-select-match>
566+
<ui-select-choices repeat="type in buildHookTypes">
567+
{{type.label}}
568+
</ui-select-choices>
569+
</ui-select>
570+
</div>
562571

563-
<fieldset>
564-
<div ng-if="buildHookSelection.type.id === 'script' || buildHookSelection.type.id === 'scriptArgs'">
565-
<h4>Script</h4>
566-
<div
567-
ui-ace="{
568-
mode: 'sh',
569-
theme: 'eclipse',
570-
rendererOptions: {
571-
fadeFoldWidgets: true,
572-
showPrintMargin: false
573-
}
574-
}"
575-
ng-model="updatedBuildConfig.spec.postCommit.script"
576-
required
577-
class="ace-bordered ace-inline mar-top-md">
572+
<fieldset>
573+
<div ng-if="buildHookSelection.type.id === 'script' || buildHookSelection.type.id === 'scriptArgs'">
574+
<label class="required">Script</label>
575+
<div
576+
ui-ace="{
577+
mode: 'sh',
578+
theme: 'eclipse',
579+
rendererOptions: {
580+
fadeFoldWidgets: true,
581+
showPrintMargin: false
582+
}
583+
}"
584+
ng-model="updatedBuildConfig.spec.postCommit.script"
585+
required
586+
class="ace-bordered ace-inline">
587+
</div>
578588
</div>
579-
</div>
580589

581-
<div ng-if="buildHookSelection.type.id === 'command' || buildHookSelection.type.id === 'commandArgs'">
582-
<h4>Command</h4>
583-
<edit-command
584-
args="updatedBuildConfig.spec.postCommit.command"
585-
placeholder="Add to command"
586-
is-required="true">
587-
</edit-command>
588-
</div>
590+
<div ng-if="buildHookSelection.type.id === 'command' || buildHookSelection.type.id === 'commandArgs'">
591+
<label class="required">Command</label>
592+
<edit-command
593+
args="updatedBuildConfig.spec.postCommit.command"
594+
placeholder="Add to command"
595+
is-required="true">
596+
</edit-command>
597+
</div>
589598

590-
<div ng-if="buildHookSelection.type.id === 'args' || buildHookSelection.type.id === 'commandArgs' || buildHookSelection.type.id === 'scriptArgs' ">
591-
<h4>Arguments</h4>
592-
<edit-command
593-
args="updatedBuildConfig.spec.postCommit.args"
594-
type="arguments"
595-
description="getArgumentsDescription()"
596-
is-required="true">
597-
</edit-command>
598-
</div>
599-
</fieldset>
599+
<div ng-if="buildHookSelection.type.id === 'args' || buildHookSelection.type.id === 'commandArgs' || buildHookSelection.type.id === 'scriptArgs' "
600+
ng-class="{ 'mar-top-lg': buildHookSelection.type.id === 'scriptArgs' }">
601+
<label class="required">Arguments</label>
602+
<edit-command
603+
args="updatedBuildConfig.spec.postCommit.args"
604+
type="arguments"
605+
description="getArgumentsDescription()"
606+
is-required="true">
607+
</edit-command>
608+
</div>
609+
</fieldset>
610+
</div>
600611
</div>
601612
</div>
602613

app/views/edit/deployment-config.html

+6-3
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ <h3>Deployment Strategy</h3>
115115
</div>
116116

117117
<div ng-if="strategyData.type === 'Rolling'">
118-
<div ng-if="view.advancedStrategyOptions">
118+
<!-- Use ng-show instead of ng-if so the form is still marked invalid if a hidden field has errors. -->
119+
<div ng-show="view.advancedStrategyOptions">
119120
<div class="form-group">
120121
<label for="updatePeriod">Update Period</label>
121122
<span class="input-group"
@@ -228,7 +229,8 @@ <h3>Deployment Strategy</h3>
228229
</div>
229230
</div>
230231

231-
<div ng-if="view.advancedStrategyOptions">
232+
<!-- Use ng-show instead of ng-if so the form is still marked invalid if a hidden field has errors. -->
233+
<div ng-show="view.advancedStrategyOptions">
232234
<div class="lifecycle-hooks">
233235
<div class="lifecycle-hook" id="pre-lifecycle-hook">
234236

@@ -318,7 +320,8 @@ <h4>Container {{containerName}}</h4>
318320
</label>
319321
</div>
320322

321-
<div ng-if="view.advancedImageOptions">
323+
<!-- Use ng-show instead of ng-if so the form is still marked invalid if a hidden field has errors. -->
324+
<div ng-show="view.advancedImageOptions">
322325
<div class="mar-top-lg">
323326
<osc-secrets model="secrets.pullSecrets"
324327
namespace="projectName"

0 commit comments

Comments
 (0)