Work In Progress!

Get the full activation and deactivation cycle working for bitbucket.
This commit is contained in:
Joseph Schorr 2015-04-28 18:15:12 -04:00
parent 5cc91ed202
commit 6479f8ddc9
8 changed files with 204 additions and 65 deletions

View file

@ -18,7 +18,7 @@ angular.module('quay').directive('triggerSetupGithost', function () {
'analyze': '&analyze'
},
controller: function($scope, $element, ApiService) {
controller: function($scope, $element, ApiService, TriggerService) {
$scope.analyzeCounter = 0;
$scope.setupReady = false;
$scope.refs = null;
@ -33,6 +33,12 @@ angular.module('quay').directive('triggerSetupGithost', function () {
'currentLocation': null
};
var checkLocation = function() {
var location = $scope.state.currentLocation || '';
$scope.state.isInvalidLocation = $scope.supportsFullListing &&
$scope.locations.indexOf(location) < 0;
};
$scope.isMatching = function(kind, name, filter) {
try {
var patt = new RegExp(filter);
@ -122,8 +128,8 @@ angular.module('quay').directive('triggerSetupGithost', function () {
$scope.setLocation($scope.locations[0]);
} else {
$scope.state.currentLocation = null;
$scope.state.isInvalidLocation = resp['subdir'].indexOf('') < 0;
$scope.trigger.$ready = true;
checkLocation();
}
callback();
@ -131,9 +137,9 @@ angular.module('quay').directive('triggerSetupGithost', function () {
}
$scope.handleLocationInput = function(location) {
$scope.state.isInvalidLocation = $scope.locations.indexOf(location) < 0;
$scope.trigger['config']['subdir'] = location || '';
$scope.trigger.$ready = true;
checkLocation();
};
$scope.handleLocationSelected = function(datum) {
@ -142,9 +148,9 @@ angular.module('quay').directive('triggerSetupGithost', function () {
$scope.setLocation = function(location) {
$scope.state.currentLocation = location;
$scope.state.isInvalidLocation = false;
$scope.trigger['config']['subdir'] = location || '';
$scope.trigger.$ready = true;
checkLocation();
};
$scope.selectRepo = function(repo, org) {
@ -199,6 +205,11 @@ angular.module('quay').directive('triggerSetupGithost', function () {
$scope.repoLookahead = repos;
};
$scope.$watch('trigger', function(trigger) {
if (!trigger) { return; }
$scope.supportsFullListing = TriggerService.supportsFullListing(trigger.service)
});
$scope.$watch('state.currentRepo', function(repo) {
if (repo) {
$scope.selectRepoInternal(repo);