commit
2a13eade80
35 changed files with 797 additions and 136 deletions
|
@ -34,6 +34,9 @@ angular.module('quay').directive('repoPanelBuilds', function () {
|
|||
$scope.showTriggerStartDialogCounter = 0;
|
||||
$scope.showTriggerSetupCounter = 0;
|
||||
|
||||
$scope.triggerCredentialsModalTrigger = null;
|
||||
$scope.triggerCredentialsModalCounter = 0;
|
||||
|
||||
var updateBuilds = function() {
|
||||
if (!$scope.allBuilds) { return; }
|
||||
|
||||
|
@ -164,6 +167,11 @@ angular.module('quay').directive('repoPanelBuilds', function () {
|
|||
$scope.options.predicate = predicate;
|
||||
};
|
||||
|
||||
$scope.showTriggerCredentialsModal = function(trigger) {
|
||||
$scope.triggerCredentialsModalTrigger = trigger;
|
||||
$scope.triggerCredentialsModalCounter++;
|
||||
};
|
||||
|
||||
$scope.askDeleteTrigger = function(trigger) {
|
||||
$scope.deleteTriggerInfo = {
|
||||
'trigger': trigger
|
||||
|
|
16
static/js/directives/ui/credentials.js
Normal file
16
static/js/directives/ui/credentials.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* An element which displays a credentials for a build trigger.
|
||||
*/
|
||||
angular.module('quay').directive('credentials', function() {
|
||||
var directiveDefinitionObject = {
|
||||
templateUrl: '/static/directives/credentials.html',
|
||||
replace: false,
|
||||
transclude: false,
|
||||
restrict: 'C',
|
||||
scope: {
|
||||
'trigger': '=trigger'
|
||||
},
|
||||
controller: function($scope) {}
|
||||
};
|
||||
return directiveDefinitionObject;
|
||||
});
|
|
@ -25,6 +25,10 @@ angular.module('quay').directive('manualTriggerBuildDialog', function () {
|
|||
});
|
||||
};
|
||||
|
||||
$scope.getPattern = function(field) {
|
||||
return new RegExp(field.regex);
|
||||
};
|
||||
|
||||
$scope.show = function() {
|
||||
$scope.parameters = {};
|
||||
$scope.fieldOptions = {};
|
||||
|
@ -58,4 +62,4 @@ angular.module('quay').directive('manualTriggerBuildDialog', function () {
|
|||
}
|
||||
};
|
||||
return directiveDefinitionObject;
|
||||
});
|
||||
});
|
||||
|
|
|
@ -14,12 +14,13 @@ angular.module('quay').directive('setupTriggerDialog', function () {
|
|||
'canceled': '&canceled',
|
||||
'activated': '&activated'
|
||||
},
|
||||
controller: function($scope, $element, ApiService, UserService) {
|
||||
controller: function($scope, $element, ApiService, UserService, TriggerService) {
|
||||
var modalSetup = false;
|
||||
|
||||
$scope.state = {};
|
||||
$scope.nextStepCounter = -1;
|
||||
$scope.currentView = 'config';
|
||||
$scope.TriggerService = TriggerService
|
||||
|
||||
$scope.show = function() {
|
||||
if (!$scope.trigger || !$scope.repository) { return; }
|
||||
|
@ -113,10 +114,11 @@ angular.module('quay').directive('setupTriggerDialog', function () {
|
|||
});
|
||||
|
||||
ApiService.activateBuildTrigger(data, params).then(function(resp) {
|
||||
$scope.hide();
|
||||
$scope.trigger['is_active'] = true;
|
||||
$scope.trigger['config'] = resp['config'];
|
||||
$scope.trigger['pull_robot'] = resp['pull_robot'];
|
||||
$scope.activated({'trigger': $scope.trigger});
|
||||
$scope.currentView = 'postActivation';
|
||||
}, errorHandler);
|
||||
};
|
||||
|
||||
|
|
29
static/js/directives/ui/trigger-credentials-dialog.js
Normal file
29
static/js/directives/ui/trigger-credentials-dialog.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* An element which displays a dialog with the necessary credentials for a build trigger.
|
||||
*/
|
||||
angular.module('quay').directive('triggerCredentialsDialog', function () {
|
||||
var directiveDefinitionObject = {
|
||||
priority: 0,
|
||||
templateUrl: '/static/directives/trigger-credentials-dialog.html',
|
||||
replace: false,
|
||||
transclude: true,
|
||||
restrict: 'C',
|
||||
scope: {
|
||||
'trigger': '=trigger',
|
||||
'counter': '=counter'
|
||||
},
|
||||
controller: function($scope, $element) {
|
||||
var show = function() {
|
||||
if (!$scope.trigger || !$scope.counter) {
|
||||
$('#triggercredentialsmodal').modal('hide');
|
||||
return;
|
||||
}
|
||||
$('#triggercredentialsmodal').modal({});
|
||||
};
|
||||
|
||||
$scope.$watch('trigger', show);
|
||||
$scope.$watch('counter', show);
|
||||
}
|
||||
};
|
||||
return directiveDefinitionObject;
|
||||
});
|
49
static/js/directives/ui/trigger-setup-custom.js
Normal file
49
static/js/directives/ui/trigger-setup-custom.js
Normal file
|
@ -0,0 +1,49 @@
|
|||
/**
|
||||
* An element which displays custom git-specific setup information for its build triggers.
|
||||
*/
|
||||
angular.module('quay').directive('triggerSetupCustom', function() {
|
||||
var directiveDefinitionObject = {
|
||||
priority: 0,
|
||||
templateUrl: '/static/directives/trigger-setup-custom.html',
|
||||
replace: false,
|
||||
transclude: false,
|
||||
restrict: 'C',
|
||||
scope: {
|
||||
'repository': '=repository',
|
||||
'trigger': '=trigger',
|
||||
|
||||
'nextStepCounter': '=nextStepCounter',
|
||||
'currentStepValid': '=currentStepValid',
|
||||
|
||||
'analyze': '&analyze'
|
||||
},
|
||||
controller: function($scope, $element, ApiService) {
|
||||
$scope.analyzeCounter = 0;
|
||||
$scope.setupReady = false;
|
||||
|
||||
$scope.state = {
|
||||
'build_source': null,
|
||||
'subdir': null
|
||||
};
|
||||
|
||||
$scope.stepsCompleted = function() {
|
||||
$scope.analyze({'isValid': $scope.state.build_source != null && $scope.state.subdir != null});
|
||||
};
|
||||
|
||||
$scope.$watch('state.build_source', function(build_source) {
|
||||
$scope.trigger['config']['build_source'] = build_source;
|
||||
});
|
||||
|
||||
$scope.$watch('state.subdir', function(subdir) {
|
||||
$scope.trigger['config']['subdir'] = subdir;
|
||||
$scope.trigger.$ready = subdir != null;
|
||||
});
|
||||
|
||||
$scope.nopLoad = function(callback) {
|
||||
callback();
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
return directiveDefinitionObject;
|
||||
});
|
Reference in a new issue