mirror of
https://github.com/harness/drone.git
synced 2025-05-07 22:11:20 +08:00

removed amber files. replacing with angular removed queue package in favor or worker package removed channel package in favor of pubsub package
36 lines
1.0 KiB
JavaScript
36 lines
1.0 KiB
JavaScript
'use strict';
|
|
|
|
angular.module('app').controller("SetupController", function($scope, $http, $routeParams) {
|
|
|
|
// create a remote that will be populated
|
|
// and persisted to the database.
|
|
$scope.remote = {};
|
|
$scope.remote.type = $routeParams.remote;
|
|
$scope.remote.register = true;
|
|
switch($scope.remote.type) {
|
|
case undefined:
|
|
case 'github.com':
|
|
$scope.remote.type = "github.com"
|
|
$scope.remote.url = "https://github.com";
|
|
$scope.remote.api = "https://api.github.com";
|
|
break;
|
|
case 'bitbucket.org':
|
|
$scope.remote.url = "https://bitbucket.org";
|
|
$scope.remote.api = "https://bitbucket.org";
|
|
break;
|
|
}
|
|
|
|
$scope.save = function() {
|
|
// request to create a new repository
|
|
$http({method: 'POST', url: '/v1/remotes', data: $scope.remote }).
|
|
success(function(data, status, headers, config) {
|
|
delete $scope.failure;
|
|
$scope.remote = data;
|
|
console.log('success', $scope.remote);
|
|
}).
|
|
error(function(data, status, headers, config) {
|
|
$scope.failure = data;
|
|
console.log('failure', $scope.failure);
|
|
});
|
|
};
|
|
}); |