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%;"> <table style="width: 100%;">
<tr ng-show="nextStepCounter > 0"> <tr ng-show="nextStepCounter > 0">
<td width="200px">Repository</td> <td width="200px">Repository</td>
<td>{{ state.gitURL }}</td> <td>{{ state.build_source }}</td>
</tr> </tr>
<tr ng-show="nextStepCounter > 1"> <tr ng-show="nextStepCounter > 1">
<td>Dockerfile Location:</td> <td>Dockerfile Location:</td>
<td> <td>
<div class="dockerfile-location"> <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> </div>
</td> </td>
</table> </table>
@ -21,19 +21,19 @@
steps-completed="stepsCompleted()"> steps-completed="stepsCompleted()">
<!-- Git URL Input --> <!-- 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"> load-message="Loading Git URL Input">
<div style="margin-bottom: 12px;">Please enter the URL used to clone your git repository:</div> <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%;" <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> </div>
<!-- Dockerfile folder select --> <!-- 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"> load-message="Loading Folder Input">
<div style="margin-bottom: 12px">Dockerfile Location:</div> <div style="margin-bottom: 12px">Dockerfile Location:</div>
<input class="form-control" type="text" placeholder="/" style="width: 100%;" <input class="form-control" type="text" placeholder="/" style="width: 100%;"
ng-model="state.currentLocation"> ng-model="state.subdir" ng-pattern="/^($|\/|\/.+)/">
</div> </div>
</div> </div>
</div> </div>

View file

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