- Fix initdb
- Add ability to specific custom fields for manual running of build triggers and add a "branch name" selector for running github builds
This commit is contained in:
parent
6c520b8b0b
commit
039d53ea6c
10 changed files with 346 additions and 41 deletions
|
@ -4705,4 +4705,15 @@ i.slack-icon {
|
|||
|
||||
.team-view .organization-header .popover-content {
|
||||
min-width: 500px;
|
||||
}
|
||||
|
||||
#startTriggerDialog .trigger-description {
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 20px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
#startTriggerDialog #runForm .field-title {
|
||||
width: 120px;
|
||||
padding-right: 10px;
|
||||
}
|
38
static/directives/manual-trigger-build-dialog.html
Normal file
38
static/directives/manual-trigger-build-dialog.html
Normal file
|
@ -0,0 +1,38 @@
|
|||
<!-- Modal message dialog -->
|
||||
<div class="modal fade" id="startTriggerDialog">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">Manully Start Build Trigger</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="trigger-description" trigger="trigger"></div>
|
||||
|
||||
<form name="runForm" id="runForm">
|
||||
<table width="100%">
|
||||
<tr ng-repeat="field in runParameters">
|
||||
<td class="field-title" valign="top">{{ field.title }}:</td>
|
||||
<td>
|
||||
<div ng-switch on="field.type">
|
||||
<span ng-switch-when="option">
|
||||
<span class="quay-spinner" ng-show="!fieldOptions[field.name]"></span>
|
||||
<select ng-model="parameters[field.name]" ng-show="fieldOptions[field.name]"
|
||||
ng-options="value for value in fieldOptions[field.name]"
|
||||
required>
|
||||
</select>
|
||||
</span>
|
||||
<input type="text" class="form-control" ng-model="parameters[field.name]" ng-switch-when="string" required>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" ng-disabled="runForm.$invalid" ng-click="startTrigger()">Start Build</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
106
static/js/app.js
106
static/js/app.js
|
@ -620,24 +620,46 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading
|
|||
}]);
|
||||
|
||||
|
||||
$provide.factory('TriggerDescriptionBuilder', ['UtilService', '$sanitize', function(UtilService, $sanitize) {
|
||||
var builderService = {};
|
||||
$provide.factory('TriggerService', ['UtilService', '$sanitize', function(UtilService, $sanitize) {
|
||||
var triggerService = {};
|
||||
|
||||
builderService.getDescription = function(name, config) {
|
||||
switch (name) {
|
||||
case 'github':
|
||||
var triggerTypes = {
|
||||
'github': {
|
||||
'description': function(config) {
|
||||
var source = UtilService.textToSafeHtml(config['build_source']);
|
||||
var desc = '<i class="fa fa-github fa-lg" style="margin-left: 2px; margin-right: 2px"></i> Push to Github Repository ';
|
||||
desc += '<a href="https://github.com/' + source + '" target="_blank">' + source + '</a>';
|
||||
desc += '<br>Dockerfile folder: //' + UtilService.textToSafeHtml(config['subdir']);
|
||||
return desc;
|
||||
},
|
||||
|
||||
default:
|
||||
return 'Unknown';
|
||||
'run_parameters': [
|
||||
{
|
||||
'title': 'Branch',
|
||||
'type': 'option',
|
||||
'name': 'branch_name'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
triggerService.getDescription = function(name, config) {
|
||||
var type = triggerTypes[name];
|
||||
if (!type) {
|
||||
return 'Unknown';
|
||||
}
|
||||
return type['description'](config);
|
||||
};
|
||||
|
||||
return builderService;
|
||||
triggerService.getRunParameters = function(name, config) {
|
||||
var type = triggerTypes[name];
|
||||
if (!type) {
|
||||
return [];
|
||||
}
|
||||
return type['run_parameters'];
|
||||
}
|
||||
|
||||
return triggerService;
|
||||
}]);
|
||||
|
||||
$provide.factory('StringBuilderService', ['$sce', 'UtilService', function($sce, UtilService) {
|
||||
|
@ -3053,7 +3075,7 @@ quayApp.directive('logsView', function () {
|
|||
'repository': '=repository',
|
||||
'performer': '=performer'
|
||||
},
|
||||
controller: function($scope, $element, $sce, Restangular, ApiService, TriggerDescriptionBuilder,
|
||||
controller: function($scope, $element, $sce, Restangular, ApiService, TriggerService,
|
||||
StringBuilderService, ExternalNotificationData) {
|
||||
$scope.loading = true;
|
||||
$scope.logs = null;
|
||||
|
@ -3118,7 +3140,7 @@ quayApp.directive('logsView', function () {
|
|||
'set_repo_description': 'Change description for repository {repo}: {description}',
|
||||
'build_dockerfile': function(metadata) {
|
||||
if (metadata.trigger_id) {
|
||||
var triggerDescription = TriggerDescriptionBuilder.getDescription(
|
||||
var triggerDescription = TriggerService.getDescription(
|
||||
metadata['service'], metadata['config']);
|
||||
return 'Build image from Dockerfile for repository {repo} triggered by ' + triggerDescription;
|
||||
}
|
||||
|
@ -3170,12 +3192,12 @@ quayApp.directive('logsView', function () {
|
|||
}
|
||||
},
|
||||
'setup_repo_trigger': function(metadata) {
|
||||
var triggerDescription = TriggerDescriptionBuilder.getDescription(
|
||||
var triggerDescription = TriggerService.getDescription(
|
||||
metadata['service'], metadata['config']);
|
||||
return 'Setup build trigger - ' + triggerDescription;
|
||||
},
|
||||
'delete_repo_trigger': function(metadata) {
|
||||
var triggerDescription = TriggerDescriptionBuilder.getDescription(
|
||||
var triggerDescription = TriggerService.getDescription(
|
||||
metadata['service'], metadata['config']);
|
||||
return 'Delete build trigger - ' + triggerDescription;
|
||||
},
|
||||
|
@ -4873,6 +4895,66 @@ quayApp.directive('dropdownSelectMenu', function () {
|
|||
});
|
||||
|
||||
|
||||
quayApp.directive('manualTriggerBuildDialog', function () {
|
||||
var directiveDefinitionObject = {
|
||||
templateUrl: '/static/directives/manual-trigger-build-dialog.html',
|
||||
replace: false,
|
||||
transclude: false,
|
||||
restrict: 'C',
|
||||
scope: {
|
||||
'repository': '=repository',
|
||||
'counter': '=counter',
|
||||
'trigger': '=trigger',
|
||||
'startBuild': '&startBuild'
|
||||
},
|
||||
controller: function($scope, $element, ApiService, TriggerService) {
|
||||
$scope.parameters = {};
|
||||
$scope.fieldOptions = {};
|
||||
|
||||
$scope.startTrigger = function() {
|
||||
$('#startTriggerDialog').modal('hide');
|
||||
$scope.startBuild({
|
||||
'trigger': $scope.trigger,
|
||||
'parameters': $scope.parameters
|
||||
});
|
||||
};
|
||||
|
||||
$scope.show = function() {
|
||||
$scope.parameters = {};
|
||||
$scope.fieldOptions = {};
|
||||
|
||||
var parameters = TriggerService.getRunParameters($scope.trigger.service);
|
||||
for (var i = 0; i < parameters.length; ++i) {
|
||||
var parameter = parameters[i];
|
||||
if (parameter['type'] == 'option') {
|
||||
// Load the values for this parameter.
|
||||
var params = {
|
||||
'repository': $scope.repository.namespace + '/' + $scope.repository.name,
|
||||
'trigger_uuid': $scope.trigger.id,
|
||||
'field_name': parameter['name']
|
||||
};
|
||||
|
||||
ApiService.listTriggerFieldValues(null, params).then(function(resp) {
|
||||
$scope.fieldOptions[parameter['name']] = resp['values'];
|
||||
});
|
||||
}
|
||||
}
|
||||
$scope.runParameters = parameters;
|
||||
|
||||
$('#startTriggerDialog').modal('show');
|
||||
};
|
||||
|
||||
$scope.$watch('counter', function(counter) {
|
||||
if (counter) {
|
||||
$scope.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
return directiveDefinitionObject;
|
||||
});
|
||||
|
||||
|
||||
quayApp.directive('setupTriggerDialog', function () {
|
||||
var directiveDefinitionObject = {
|
||||
templateUrl: '/static/directives/setup-trigger-dialog.html',
|
||||
|
|
|
@ -1234,7 +1234,9 @@ function RepoBuildCtrl($scope, Restangular, ApiService, $routeParams, $rootScope
|
|||
fetchRepository();
|
||||
}
|
||||
|
||||
function RepoAdminCtrl($scope, Restangular, ApiService, KeyService, $routeParams, $rootScope, $location, UserService, Config, Features, ExternalNotificationData) {
|
||||
function RepoAdminCtrl($scope, Restangular, ApiService, KeyService, TriggerService, $routeParams,
|
||||
$rootScope, $location, UserService, Config, Features, ExternalNotificationData) {
|
||||
|
||||
var namespace = $routeParams.namespace;
|
||||
var name = $routeParams.name;
|
||||
|
||||
|
@ -1539,14 +1541,22 @@ function RepoAdminCtrl($scope, Restangular, ApiService, KeyService, $routeParams
|
|||
$scope.deleteTrigger(trigger);
|
||||
};
|
||||
|
||||
$scope.startTrigger = function(trigger) {
|
||||
$scope.showManualBuildDialog = 0;
|
||||
|
||||
$scope.startTrigger = function(trigger, opt_custom) {
|
||||
var parameters = TriggerService.getRunParameters(trigger.service);
|
||||
if (parameters.length && !opt_custom) {
|
||||
$scope.currentStartTrigger = trigger;
|
||||
$scope.showManualBuildDialog++;
|
||||
return;
|
||||
}
|
||||
|
||||
var params = {
|
||||
'repository': namespace + '/' + name,
|
||||
'trigger_uuid': trigger.id
|
||||
};
|
||||
|
||||
ApiService.manuallyStartBuildTrigger(null, params).then(function(resp) {
|
||||
window.console.log(resp);
|
||||
ApiService.manuallyStartBuildTrigger(opt_custom || {}, params).then(function(resp) {
|
||||
var url = '/repository/' + namespace + '/' + name + '/build?current=' + resp['id'];
|
||||
document.location = url;
|
||||
}, ApiService.errorDisplay('Could not start build'));
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<ul class="nav nav-pills nav-stacked">
|
||||
<li class="active"><a href="javascript:void(0)" data-toggle="tab" data-target="#permissions">Permissions</a></li>
|
||||
<li><a href="javascript:void(0)" data-toggle="tab" data-target="#trigger" ng-click="loadTriggers()"
|
||||
quay-require="['BUILD_SUPPORT']">Build Triggers</a></li>
|
||||
quay-show="Features.BUILD_SUPPORT">Build Triggers</a></li>
|
||||
<li><a href="javascript:void(0)" data-toggle="tab" data-target="#badge">Status Badge</a></li>
|
||||
<li><a href="javascript:void(0)" data-toggle="tab" data-target="#notification" ng-click="loadNotifications()">Notifications</a></li>
|
||||
<li><a href="javascript:void(0)" data-toggle="tab" data-target="#publicprivate">Public/Private</a></li>
|
||||
|
@ -226,7 +226,7 @@
|
|||
</div>
|
||||
|
||||
<!-- Triggers tab -->
|
||||
<div id="trigger" class="tab-pane" quay-require="['BUILD_SUPPORT']">
|
||||
<div id="trigger" class="tab-pane" quay-show="['BUILD_SUPPORT']">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Build Triggers
|
||||
<i class="info-icon fa fa-info-circle" data-placement="left" data-content="Triggers from various services (such as GitHub) which tell the repository to be built and updated."></i>
|
||||
|
@ -378,6 +378,12 @@
|
|||
counter="showNewNotificationCounter"
|
||||
notification-created="handleNotificationCreated(notification)"></div>
|
||||
|
||||
<!-- Manual trigger dialog -->
|
||||
<div class="manual-trigger-build-dialog" repository="repo"
|
||||
trigger="currentStartTrigger"
|
||||
counter="showManualBuildDialog"
|
||||
start-build="startTrigger(trigger, parameters)"></div>
|
||||
|
||||
<!-- Modal message dialog -->
|
||||
<div class="modal fade" id="makepublicModal">
|
||||
<div class="modal-dialog">
|
||||
|
|
Reference in a new issue