From 638463671a79512f7deb9b23e24ec34f01b611c5 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Thu, 13 Mar 2014 15:25:38 -0400 Subject: [PATCH] Add ability for new repositories to be linked to Github --- static/css/quay.css | 9 +++++ static/js/controllers.js | 19 +++++++-- static/partials/new-repo.html | 74 ++++++++++++++++++++++++++++------- 3 files changed, 84 insertions(+), 18 deletions(-) diff --git a/static/css/quay.css b/static/css/quay.css index bde24600a..ec1b17447 100644 --- a/static/css/quay.css +++ b/static/css/quay.css @@ -776,11 +776,20 @@ i.toggle-icon:hover { margin-bottom: 16px; } +.new-repo .section-title { + float: right; + color: #aaa; +} + .new-repo .repo-option { margin: 6px; margin-top: 16px; } +.new-repo .repo-option label { + font-weight: normal; +} + .new-repo .repo-option i { font-size: 18px; padding-left: 10px; diff --git a/static/js/controllers.js b/static/js/controllers.js index 22e56f08d..7d3378c31 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -1888,13 +1888,16 @@ function V1Ctrl($scope, $location, UserService) { UserService.updateUserIn($scope); } -function NewRepoCtrl($scope, $location, $http, $timeout, UserService, ApiService, PlanService) { +function NewRepoCtrl($scope, $location, $http, $timeout, UserService, ApiService, PlanService, KeyService) { UserService.updateUserIn($scope); + $scope.githubRedirectUri = KeyService.githubRedirectUri; + $scope.githubClientId = KeyService.githubClientId; + $scope.repo = { 'is_public': 1, 'description': '', - 'initialize': false + 'initialize': '' }; // Watch the namespace on the repo. If it changes, we update the plan and the public/private @@ -1963,12 +1966,20 @@ function NewRepoCtrl($scope, $location, $http, $timeout, UserService, ApiService $scope.creating = false; $scope.created = created; - // Repository created. Start the upload process if applicable. - if ($scope.repo.initialize) { + // Start the upload process if applicable. + if ($scope.repo.initialize == 'dockerfile' || $scope.repo.initialize == 'zipfile') { $scope.createdForBuild = created; return; } + // Conduct the Github redirect if applicable. + if ($scope.repo.initialize == 'github') { + window.location = 'https://github.com/login/oauth/authorize?client_id=' + $scope.githubClientId + + '&scope=repo,user:email&redirect_uri=' + $scope.githubRedirectUri + '/trigger/' + + repo.namespace + '/' + repo.name; + return; + } + // Otherwise, redirect to the repo page. $location.path('/repository/' + created.namespace + '/' + created.name); }, function(result) { diff --git a/static/partials/new-repo.html b/static/partials/new-repo.html index 041fcc828..d84e7172a 100644 --- a/static/partials/new-repo.html +++ b/static/partials/new-repo.html @@ -35,7 +35,8 @@
- Description:
+
Repository Description
+
@@ -46,13 +47,14 @@
+
Repository Visibility
- + Anyone can see and pull from this repository. You choose who can push.
@@ -61,7 +63,7 @@
- + You choose who can see, pull and push from/to this repository.
@@ -94,31 +96,75 @@
-
- -
- - Automatically populate your repository with a new image constructed from a Dockerfile -
+
Initialize repository
-
-
+
+ +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+
+
+
+
+
Upload DockerfileZIP file
+
+
+
+
+
+
+
+
+ +
+
+
+
+ You will be redirected to authorize via GitHub once the repository has been created +
+
+
+