custom trigger: build trigger config

This commit is contained in:
Jimmy Zelinskie 2015-04-01 13:31:51 -04:00
parent d2f9a8838c
commit 4e097c1f9d
2 changed files with 19 additions and 10 deletions

View file

@ -3,14 +3,14 @@
<table style="width: 100%;">
<tr ng-show="nextStepCounter > 0">
<td width="200px">Repository</td>
<td>{{ state.gitURL }}</td>
<td>{{ state.build_source }}</td>
</tr>
<tr ng-show="nextStepCounter > 1">
<td>Dockerfile Location:</td>
<td>
<div class="dockerfile-location">
<i class="fa fa-folder fa-lg"></i> {{ state.currentLocation || '(Repository Root)' }}
<i class="fa fa-folder fa-lg"></i> {{ state.subdir == '/' || !state.subdir ? '(Repository Root)' : subdir }}
</div>
</td>
</table>
@ -21,19 +21,19 @@
steps-completed="stepsCompleted()">
<!-- Git URL Input -->
<div class="step-view-step" complete-condition="state.gitURL" load-callback="nopLoad(callback)"
<div class="step-view-step" complete-condition="trigger['config']['build_source']" load-callback="nopLoad(callback)"
load-message="Loading Git URL Input">
<div style="margin-bottom: 12px;">Please enter the URL used to clone your git repository:</div>
<input class="form-control" type="text" placeholder="git://example.com/namespace/repository.git" style="width: 100%;"
ng-model="state.gitURL" ng-pattern="/(git|http|https):\/\/(.*)(\.git)/">
ng-model="state.build_source" ng-pattern="/(git|http|https):\/\/(.+)(\.git)/">
</div>
<!-- Dockerfile folder select -->
<div class="step-view-step" complete-condition="state.currentLocation" load-callback="nopLoad(callback)"
<div class="step-view-step" complete-condition="trigger.$ready" load-callback="nopLoad(callback)"
load-message="Loading Folder Input">
<div style="margin-bottom: 12px">Dockerfile Location:</div>
<input class="form-control" type="text" placeholder="/" style="width: 100%;"
ng-model="state.currentLocation">
ng-model="state.subdir" ng-pattern="/^($|\/|\/.+)/">
</div>
</div>
</div>

View file

@ -19,17 +19,26 @@ angular.module('quay').directive('triggerSetupCustom', function() {
},
controller: function($scope, $element, ApiService) {
$scope.analyzeCounter = 0;
$scope.setupReady = false,
$scope.setupReady = false;
$scope.state = {
'gitURL': null,
'subdir': null,
'build_source': null,
'subdir': null
};
$scope.stepsCompleted = function() {
$scope.analyze({'isValid': $scope.state.gitURL != null && $scope.subdir != null});
$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();
};