@@ -17,7 +17,7 @@ angular.module('openshiftConsole')
17
17
$scope . options = { } ;
18
18
$scope . builderOptions = { } ;
19
19
$scope . outputOptions = { } ;
20
- $scope . imageSourcesOptions = { } ;
20
+ $scope . imageSourceOptions = { } ;
21
21
$scope . selectTypes = {
22
22
ImageStreamTag : "Image Stream Tag" ,
23
23
ImageStreamImage : "Image Stream Image" ,
@@ -171,7 +171,7 @@ angular.module('openshiftConsole')
171
171
$scope . imageSourceTypes = angular . copy ( $scope . buildFromTypes ) ;
172
172
var imageSourceFrom = $scope . sourceImage . from ;
173
173
$scope . imageSourceOptions = $scope . setPickedVariables (
174
- $scope . imageSourcesOptions ,
174
+ $scope . imageSourceOptions ,
175
175
imageSourceFrom . kind ,
176
176
imageSourceFrom . namespace || buildConfig . metadata . namespace ,
177
177
imageSourceFrom . name . split ( ":" ) [ 0 ] ,
@@ -226,23 +226,26 @@ angular.module('openshiftConsole')
226
226
// If builder or output image reference kind is DockerImage select the first imageSteam and imageStreamTag
227
227
// in the picker, so when the user changes the reference kind to ImageStreamTag the picker is filled with
228
228
// default(first) value.
229
- var builderSelectFirstOption = $scope . builderOptions . pickedType === "DockerImage" ;
230
- $scope . updateBuilderImageStreams ( $scope . builderOptions . pickedNamespace , builderSelectFirstOption ) ;
229
+ if ( $scope . builderOptions . pickedType === "ImageStreamTag" ) {
230
+ $scope . updateBuilderImageStreams ( $scope . builderOptions . pickedNamespace , false ) ;
231
+ }
231
232
232
- var outputSelectFirstOption = $scope . outputOptions . pickedType === "DockerImage" ;
233
- $scope . updateOutputImageStreams ( $scope . outputOptions . pickedNamespace , outputSelectFirstOption ) ;
233
+ if ( $scope . outputOptions . pickedType === "ImageStreamTag" ) {
234
+ $scope . updateOutputImageStreams ( $scope . outputOptions . pickedNamespace , false ) ;
235
+ }
234
236
235
237
if ( $scope . sources . images && $scope . sourceImage ) {
236
238
$scope . imageSourceBuildFrom . projects = angular . copy ( $scope . buildFrom . projects ) ;
237
239
if ( ! $scope . imageSourceBuildFrom . projects . contains ( $scope . imageSourceOptions . pickedNamespace ) ) {
238
- $scope . checkNamespaceAvailability ( $scope . imageSourceOptions . pickedNamespace , "imageSource" ) ;
240
+ $scope . checkNamespaceAvailability ( $scope . imageSourceOptions . pickedNamespace ) ;
239
241
$scope . imageSourceBuildFrom . projects . push ( $scope . imageSourceOptions . pickedNamespace ) ;
240
242
}
241
- var imageSourceSelectFirstOption = $scope . imageSourceOptions . pickedType === "DockerImage" ;
242
- $scope . updateImageSourceImageStreams ( $scope . imageSourceOptions . pickedNamespace , imageSourceSelectFirstOption ) ;
243
+ if ( $scope . imageSourceOptions . pickedType === "ImageStreamTag" ) {
244
+ $scope . updateImageSourceImageStreams ( $scope . imageSourceOptions . pickedNamespace , false ) ;
245
+ }
243
246
}
247
+ $scope . loaded = true ;
244
248
} ) ;
245
- $scope . loaded = true ;
246
249
// If we found the item successfully, watch for changes on it
247
250
watches . push ( DataService . watchObject ( "buildconfigs" , $routeParams . buildconfig , context , function ( buildConfig , action ) {
248
251
if ( action === "DELETED" ) {
@@ -351,7 +354,7 @@ angular.module('openshiftConsole')
351
354
$scope . imageSourceBuildFrom . tags = { } ;
352
355
var projectImageStreams = imageStreams . by ( "metadata.name" ) ;
353
356
if ( ! _ . isEmpty ( projectImageStreams ) ) {
354
- if ( ! Object . keys ( projectImageStreams ) . contains ( $scope . imageSourceBuildFrom . imageStream ) && projectName === $scope . imageSourceBuildFrom . namespace ) {
357
+ if ( ! _ . has ( projectImageStreams , $scope . imageSourceBuildFrom . imageStream ) && projectName === $scope . imageSourceBuildFrom . namespace && ! selectFirstOption ) {
355
358
$scope . imageSourceBuildFrom . imageStreams . push ( $scope . imageSourceImageStream . imageStream ) ;
356
359
$scope . imageSourceOptions . pickedImageStream = $scope . imageSourceImageStream . imageStream ;
357
360
$scope . imageSourceBuildFrom . tags [ $scope . imageSourceImageStream . imageStream ] = [ $scope . imageSourceImageStream . tag ] ;
@@ -385,7 +388,7 @@ angular.module('openshiftConsole')
385
388
$scope . imageSourceOptions . pickedImageStream = $scope . imageSourceBuildFrom . imageStreams [ 0 ] ;
386
389
$scope . clearSelectedTag ( $scope . imageSourceOptions , $scope . imageSourceBuildFrom . tags ) ;
387
390
}
388
- } else if ( projectName === $scope . outputImageStream . namespace ) {
391
+ } else if ( projectName === $scope . outputImageStream . namespace && ! selectFirstOption ) {
389
392
$scope . imageSourceBuildFrom . imageStreams . push ( $scope . imageSourceImageStream . imageStream ) ;
390
393
$scope . imageSourceOptions . pickedImageStream = $scope . imageSourceImageStream . imageStream ;
391
394
$scope . imageSourceBuildFrom . tags [ $scope . imageSourceImageStream . imageStream ] = [ $scope . imageSourceImageStream . tag ] ;
@@ -415,7 +418,7 @@ angular.module('openshiftConsole')
415
418
$scope . buildFrom . tags = { } ;
416
419
var projectImageStreams = imageStreams . by ( "metadata.name" ) ;
417
420
if ( ! _ . isEmpty ( projectImageStreams ) ) {
418
- if ( ! Object . keys ( projectImageStreams ) . contains ( $scope . builderImageStream . imageStream ) && projectName === $scope . builderImageStream . namespace && $scope . imageSourceOptions . ImageStream !== "" ) {
421
+ if ( ! _ . has ( projectImageStreams , $scope . builderImageStream . imageStream ) && projectName === $scope . builderImageStream . namespace && ! selectFirstOption ) {
419
422
$scope . buildFrom . imageStreams . push ( $scope . builderImageStream . imageStream ) ;
420
423
$scope . builderOptions . pickedImageStream = $scope . builderImageStream . imageStream ;
421
424
$scope . buildFrom . tags [ $scope . builderImageStream . imageStream ] = [ $scope . builderImageStream . tag ] ;
@@ -450,7 +453,7 @@ angular.module('openshiftConsole')
450
453
$scope . builderOptions . pickedImageStream = $scope . buildFrom . imageStreams [ 0 ] ;
451
454
$scope . clearSelectedTag ( $scope . builderOptions , $scope . buildFrom . tags ) ;
452
455
}
453
- } else if ( projectName === $scope . builderImageStream . namespace ) {
456
+ } else if ( projectName === $scope . builderImageStream . namespace && ! selectFirstOption ) {
454
457
$scope . buildFrom . imageStreams . push ( $scope . builderImageStream . imageStream ) ;
455
458
$scope . builderOptions . pickedImageStream = $scope . builderImageStream . imageStream ;
456
459
$scope . buildFrom . tags [ $scope . builderImageStream . imageStream ] = [ $scope . builderImageStream . tag ] ;
@@ -479,7 +482,7 @@ angular.module('openshiftConsole')
479
482
$scope . pushTo . tags = { } ;
480
483
var projectImageStreams = imageStreams . by ( "metadata.name" ) ;
481
484
if ( ! _ . isEmpty ( projectImageStreams ) ) {
482
- if ( ! Object . keys ( projectImageStreams ) . contains ( $scope . outputImageStream . imageStream ) && projectName === $scope . outputImageStream . namespace ) {
485
+ if ( ! _ . has ( projectImageStreams , $scope . outputImageStream . imageStream ) && projectName === $scope . outputImageStream . namespace && ! selectFirstOption ) {
483
486
$scope . pushTo . imageStreams . push ( $scope . outputImageStream . imageStream ) ;
484
487
$scope . outputOptions . pickedImageStream = $scope . outputImageStream . imageStream ;
485
488
$scope . outputOptions . pickedTag = $scope . outputImageStream . tag ;
@@ -503,7 +506,7 @@ angular.module('openshiftConsole')
503
506
} else if ( ! $scope . pushTo . imageStreams . contains ( $scope . outputOptions . pickedImageStream ) ) {
504
507
$scope . outputOptions . pickedTag = "" ;
505
508
}
506
- } else if ( projectName === $scope . outputImageStream . namespace ) {
509
+ } else if ( projectName === $scope . outputImageStream . namespace && ! selectFirstOption ) {
507
510
$scope . pushTo . imageStreams . push ( $scope . outputImageStream . imageStream ) ;
508
511
$scope . outputOptions . pickedImageStream = $scope . outputImageStream . imageStream ;
509
512
$scope . outputOptions . pickedTag = $scope . outputImageStream . tag ;
0 commit comments