refactored DockerfileServiceImpl to return promise instead of callbacks
This commit is contained in:
commit
4e913f106d
34 changed files with 299 additions and 490 deletions
|
@ -39,28 +39,7 @@ angular.module('quay').directive('dockerfileBuildForm', function () {
|
|||
$scope.state = 'checking';
|
||||
$scope.selectedFiles = files;
|
||||
|
||||
// FIXME: Remove this
|
||||
// DockerfileService.getDockerfile(files[0], function(df) {
|
||||
// var baseImage = df.getRegistryBaseImage();
|
||||
// if (baseImage) {
|
||||
// checkPrivateImage(baseImage);
|
||||
// } else {
|
||||
// $scope.state = 'ready';
|
||||
// }
|
||||
//
|
||||
// $scope.$apply(function() {
|
||||
// opt_callback && opt_callback(true, 'Dockerfile found and valid')
|
||||
// });
|
||||
// }, function(msg) {
|
||||
// $scope.state = 'empty';
|
||||
// $scope.privateBaseRepository = null;
|
||||
//
|
||||
// $scope.$apply(function() {
|
||||
// opt_callback && opt_callback(false, msg || 'Could not find valid Dockerfile');
|
||||
// });
|
||||
// });
|
||||
|
||||
DockerfileService.extractDockerfile(files[0])
|
||||
DockerfileService.getDockerfile(files[0])
|
||||
.then(function(dockerfileInfo) {
|
||||
var baseImage = dockerfileInfo.getRegistryBaseImage();
|
||||
if (baseImage) {
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<table class="co-table" style="margin-top: 20px;">
|
||||
<table class="co-table">
|
||||
<thead>
|
||||
<td class="checkbox-col"></td>
|
||||
<td ng-class="$ctrl.TableService.tablePredicateClass('id', $ctrl.local.namespaceOptions.predicate, $ctrl.local.namespaceOptions.reverse)">
|
||||
|
@ -39,7 +39,7 @@
|
|||
|
||||
<tr class="co-checkable-row"
|
||||
ng-repeat="namespace in $ctrl.local.orderedNamespaces.visibleEntries | slice:($ctrl.namespacesPerPage * $ctrl.local.namespaceOptions.page):($ctrl.namespacesPerPage * ($ctrl.local.namespaceOptions.page + 1))"
|
||||
ng-class="$ctrl.local.selectedNamespace == $ctrl.namespace ? 'checked' : ''"
|
||||
ng-class="$ctrl.local.selectedNamespace == namespace ? 'checked' : ''"
|
||||
bindonce>
|
||||
<td>
|
||||
<input type="radio"
|
||||
|
@ -290,19 +290,22 @@
|
|||
</div>
|
||||
|
||||
<!-- Warning -->
|
||||
<div class="col-lg-7 col-md-7 col-sm-12 main-col" ng-if="$ctrl.local.triggerAnalysis.status == 'warning'">
|
||||
<div class="col-lg-7 col-md-7 col-sm-12 main-col"
|
||||
ng-if="$ctrl.local.triggerAnalysis.status == 'warning'">
|
||||
<h3 class="warning"><i class="fa fa-exclamation-triangle"></i> Verification Warning</h3>
|
||||
{{ $ctrl.local.triggerAnalysis.message }}
|
||||
</div>
|
||||
|
||||
<!-- Public base -->
|
||||
<div class="col-lg-7 col-md-7 col-sm-12 main-col" ng-if="$ctrl.local.triggerAnalysis.status == 'publicbase'">
|
||||
<div class="col-lg-7 col-md-7 col-sm-12 main-col"
|
||||
ng-if="$ctrl.local.triggerAnalysis.status == 'publicbase'">
|
||||
<h3 class="success"><i class="fa fa-check-circle"></i> Ready to go!</h3>
|
||||
<strong>Click "Create Trigger" to complete setup of this build trigger</strong>
|
||||
</div>
|
||||
|
||||
<!-- Requires robot and is not admin -->
|
||||
<div class="col-lg-7 col-md-7 col-sm-12 main-col" ng-if="$ctrl.local.triggerAnalysis.status == 'requiresrobot' && !$ctrl.local.triggerAnalysis.is_admin">
|
||||
<div class="col-lg-7 col-md-7 col-sm-12 main-col"
|
||||
ng-if="$ctrl.local.triggerAnalysis.status == 'requiresrobot' && !$ctrl.local.triggerAnalysis.is_admin">
|
||||
<h3>Robot Account Required</h3>
|
||||
<p>The selected Dockerfile in the selected repository depends upon a private base image</p>
|
||||
<p>A robot account with access to the base image is required to setup this trigger, but you are not the administrator of this namespace.</p>
|
||||
|
@ -310,7 +313,8 @@
|
|||
</div>
|
||||
|
||||
<!-- Requires robot and is admin -->
|
||||
<div class="col-lg-7 col-md-7 col-sm-12 main-col" ng-if="$ctrl.local.triggerAnalysis.status == 'requiresrobot' && $ctrl.local.triggerAnalysis.is_admin">
|
||||
<div class="col-lg-7 col-md-7 col-sm-12 main-col"
|
||||
ng-if="$ctrl.local.triggerAnalysis.status == 'requiresrobot' && $ctrl.local.triggerAnalysis.is_admin">
|
||||
<h3>Select Robot Account</h3>
|
||||
<strong>
|
||||
The selected Dockerfile in the selected repository depends upon a private base image. Select a robot account with access:
|
||||
|
@ -338,7 +342,7 @@
|
|||
</thead>
|
||||
|
||||
<tr class="co-checkable-row"
|
||||
ng-repeat="robot in $ctrl.local.orderedRobotAccounts.visibleEntries | slice:($ctrl.robotsPerPage * $ctrl.local.namespaceOptions.page):(robotsPerPage * ($ctrl.local.robotOptions.page + 1))"
|
||||
ng-repeat="robot in $ctrl.local.orderedRobotAccounts.visibleEntries | slice:($ctrl.robotsPerPage * $ctrl.local.namespaceOptions.page):($ctrl.robotsPerPage * ($ctrl.local.robotOptions.page + 1))"
|
||||
ng-class="$ctrl.local.robotAccount == robot ? 'checked' : ''"
|
||||
bindonce>
|
||||
<td>
|
||||
|
@ -355,8 +359,8 @@
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="empty" ng-if="$ctrl.local.triggerAnalysis.robots.length && !$ctrl.local.orderedRobotAccounts.entries.length"
|
||||
style="margin-top: 20px;">
|
||||
<div class="empty" style="margin-top: 20px;"
|
||||
ng-if="$ctrl.local.triggerAnalysis.robots.length && !$ctrl.local.orderedRobotAccounts.entries.length">
|
||||
<div class="empty-primary-msg">No matching robot accounts found.</div>
|
||||
<div class="empty-secondary-msg">Try expanding your filtering terms.</div>
|
||||
</div>
|
||||
|
|
|
@ -62,14 +62,8 @@ export class ManageTriggerGithostComponent implements ng.IComponentController {
|
|||
|
||||
public $onInit(): void {
|
||||
// TODO: Replace $scope.$watch with @Output methods for child component mutations or $onChanges for parent mutations
|
||||
this.$scope.$watch(() => this.trigger, (trigger) => {
|
||||
if (trigger && this.repository) {
|
||||
this.config = trigger['config'] || {};
|
||||
this.namespaceTitle = 'organization';
|
||||
this.local.selectedNamespace = null;
|
||||
this.loadNamespaces();
|
||||
}
|
||||
});
|
||||
this.$scope.$watch(() => this.trigger, this.initialSetup.bind(this));
|
||||
this.$scope.$watch(() => this.repository, this.initialSetup.bind(this));
|
||||
|
||||
this.$scope.$watch(() => this.local.selectedNamespace, (namespace) => {
|
||||
if (namespace) {
|
||||
|
@ -102,6 +96,20 @@ export class ManageTriggerGithostComponent implements ng.IComponentController {
|
|||
this.$scope.$watch(() => this.local.robotOptions.filter, this.buildOrderedRobotAccounts);
|
||||
}
|
||||
|
||||
private initialSetup(): void {
|
||||
if (!this.repository || !this.trigger) { return; }
|
||||
|
||||
if (this.namespaceTitle) {
|
||||
// Already setup.
|
||||
return;
|
||||
}
|
||||
|
||||
this.config = this.trigger['config'] || {};
|
||||
this.namespaceTitle = 'organization';
|
||||
this.local.selectedNamespace = null;
|
||||
this.loadNamespaces();
|
||||
}
|
||||
|
||||
public getTriggerIcon(): any {
|
||||
return this.TriggerService.getIcon(this.trigger.service);
|
||||
}
|
||||
|
|
|
@ -57,6 +57,8 @@ angular.module('quay').directive('manualTriggerBuildDialog', function () {
|
|||
$scope.fieldOptions[parameter['name']] = resp['values'];
|
||||
});
|
||||
}
|
||||
|
||||
delete $scope.parameters[parameter['name']];
|
||||
}
|
||||
|
||||
$scope.runParameters = parameters;
|
||||
|
|
Reference in a new issue