Fix cannot-use-robot for private base image bug in build dialog
There are a number of small state fixes in this PR, which result in the build dialog being properly reset state-wise each time it is displayed, thus fixing the state inconsistency. Fixes #2106
This commit is contained in:
parent
6de039dc97
commit
3193f32a95
6 changed files with 44 additions and 16 deletions
|
@ -16,6 +16,7 @@ angular.module('quay').directive('dockerfileBuildDialog', function () {
|
|||
controller: function($scope, $element, ApiService) {
|
||||
$scope.viewTriggers = false;
|
||||
$scope.triggers = null;
|
||||
$scope.viewCounter = 0;
|
||||
|
||||
$scope.startTriggerCounter = 0;
|
||||
$scope.startTrigger = null;
|
||||
|
@ -51,6 +52,7 @@ angular.module('quay').directive('dockerfileBuildDialog', function () {
|
|||
$scope.viewTriggers = false;
|
||||
$scope.startTrigger = null;
|
||||
$scope.buildStarting = false;
|
||||
$scope.viewCounter++;
|
||||
|
||||
$element.find('.dockerfilebuildModal').modal({});
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ angular.module('quay').directive('dockerfileBuildForm', function () {
|
|||
'repository': '=repository',
|
||||
|
||||
'isReady': '=?isReady',
|
||||
'reset': '=?reset',
|
||||
|
||||
'readyForBuild': '&readyForBuild'
|
||||
},
|
||||
|
@ -100,11 +101,13 @@ angular.module('quay').directive('dockerfileBuildForm', function () {
|
|||
};
|
||||
|
||||
var checkEntity = function() {
|
||||
if (!$scope.pullEntity) { return; }
|
||||
if (!$scope.pullEntity) {
|
||||
$scope.state = 'awaiting-bot';
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.state = 'checking-bot';
|
||||
$scope.currentRobotHasPermission = null;
|
||||
if (!$scope.pullEntity) { return; }
|
||||
|
||||
var permParams = {
|
||||
'repository': $scope.privateBaseRepository,
|
||||
|
@ -118,6 +121,14 @@ angular.module('quay').directive('dockerfileBuildForm', function () {
|
|||
};
|
||||
|
||||
$scope.$watch('pullEntity', checkEntity);
|
||||
$scope.$watch('reset', function(reset) {
|
||||
if (reset) {
|
||||
$scope.state = 'empty';
|
||||
$scope.pullEntity = null;
|
||||
$scope.privateBaseRepository = null;
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$watch('state', function(state) {
|
||||
$scope.isReady = state == 'ready';
|
||||
if ($scope.isReady) {
|
||||
|
|
|
@ -14,7 +14,9 @@ angular.module('quay').directive('fileUploadBox', function () {
|
|||
|
||||
'filesSelected': '&filesSelected',
|
||||
'filesCleared': '&filesCleared',
|
||||
'filesValidated': '&filesValidated'
|
||||
'filesValidated': '&filesValidated',
|
||||
|
||||
'reset': '=?reset'
|
||||
},
|
||||
controller: function($rootScope, $scope, $element, ApiService) {
|
||||
var MEGABYTE = 1000000;
|
||||
|
@ -148,6 +150,13 @@ angular.module('quay').directive('fileUploadBox', function () {
|
|||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.$watch('reset', function(reset) {
|
||||
if (reset) {
|
||||
$scope.state = 'clear';
|
||||
$element.find('#file-drop-' + $scope.boxId).parent().trigger('reset');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
return directiveDefinitionObject;
|
||||
|
|
Reference in a new issue