Skip to content

Commit 2560a9f

Browse files
committed
Fix runtime error on deploy image page
The ng-form was not correctly initialized, resulting in a runtime error.
1 parent f62c98f commit 2560a9f

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

app/scripts/directives/deployImage.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ angular.module("openshiftConsole")
2323
isDialog: '='
2424
},
2525
templateUrl: 'views/directives/deploy-image.html',
26-
link: function($scope) {
26+
controller: function($scope) {
27+
// Must be initialized the controller. The link function is too late.
2728
$scope.forms = {};
28-
29+
},
30+
link: function($scope) {
2931
// Pick from an image stream tag or Docker image name.
3032
$scope.mode = "istag"; // "istag" or "dockerImage"
3133

@@ -196,6 +198,12 @@ angular.module("openshiftConsole")
196198
}
197199
});
198200

201+
$scope.$watch('imageName', function() {
202+
if ($scope.mode === 'dockerImage') {
203+
$scope.forms.imageSelection.imageName.$setValidity("imageLoaded", false);
204+
}
205+
});
206+
199207
$scope.$watch('istag', function(istag, old) {
200208
if (istag === old) {
201209
return;

dist/scripts/scripts.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13068,6 +13068,9 @@ context: "=",
1306813068
isDialog: "="
1306913069
},
1307013070
templateUrl: "views/directives/deploy-image.html",
13071+
controller: [ "$scope", function(e) {
13072+
e.forms = {};
13073+
} ],
1307113074
link: function(n) {
1307213075
function l() {
1307313076
var e = p.mapEntries(p.compactEntries(n.labels));
@@ -13083,7 +13086,7 @@ labels: e,
1308313086
pullSecrets: n.pullSecrets
1308413087
});
1308513088
}
13086-
n.forms = {}, n.mode = "istag", n.istag = {}, n.app = {}, n.env = [], n.labels = [ {
13089+
n.mode = "istag", n.istag = {}, n.app = {}, n.env = [], n.labels = [ {
1308713090
name: "app",
1308813091
value: ""
1308913092
} ], n.pullSecrets = [ {
@@ -13149,6 +13152,8 @@ name: "app"
1314913152
!a || a.value && a.value !== t || (a.value = e);
1315013153
}), n.$watch("mode", function(e, t) {
1315113154
e !== t && (delete n.import, n.istag = {}, "dockerImage" === e ? n.forms.imageSelection.imageName.$setValidity("imageLoaded", !1) : n.forms.imageSelection.imageName.$setValidity("imageLoaded", !0));
13155+
}), n.$watch("imageName", function() {
13156+
"dockerImage" === n.mode && n.forms.imageSelection.imageName.$setValidity("imageLoaded", !1);
1315213157
}), n.$watch("istag", function(t, a) {
1315313158
if (t !== a) if (t.namespace && t.imageStream && t.tagObject) {
1315413159
var s, c = _.get(t, "tagObject.items[0].image");

0 commit comments

Comments
 (0)