diff --git a/cmd/drone-server/static/scripts/controllers/repos.js b/cmd/drone-server/static/scripts/controllers/repos.js index 19768d74..c74a28e0 100644 --- a/cmd/drone-server/static/scripts/controllers/repos.js +++ b/cmd/drone-server/static/scripts/controllers/repos.js @@ -4,9 +4,13 @@ * ReposCtrl responsible for rendering the user's * repository home screen. */ - function ReposCtrl($scope, $stateParams, repos, users) { + function ReposCtrl($scope, $location, $stateParams, repos, users) { + $scope.loading = true; + $scope.waiting = false; + // Gets the currently authenticated user users.getCached().then(function (payload) { + $scope.loading = false; $scope.user = payload.data; }); @@ -17,6 +21,24 @@ }).catch(function (err) { $scope.error = err; }); + + // Adds a repository + $scope.add = function (event, fullName) { + $scope.error = undefined; + if (event.which && event.which !== 13) { + return; + } + $scope.waiting = true; + + repos.post(fullName).then(function (payload) { + $location.path('/' + fullName); + $scope.waiting = false; + }).catch(function (err) { + $scope.error = err; + $scope.waiting = false; + $scope.search_text = undefined; + }); + } } /** diff --git a/cmd/drone-server/static/scripts/controllers/users.js b/cmd/drone-server/static/scripts/controllers/users.js index d9b817de..bc47527b 100644 --- a/cmd/drone-server/static/scripts/controllers/users.js +++ b/cmd/drone-server/static/scripts/controllers/users.js @@ -42,20 +42,35 @@ * This part of the site is for administrators only. */ function UsersCtrl($scope, users) { + $scope.loading = true; + $scope.waiting = false; + // Gets the currently authenticated user users.getCached().then(function(payload){ $scope.user = payload.data; }); + // Gets the list of all system users users.list().then(function(payload){ + $scope.loading = true; $scope.users = payload.data; }); - $scope.login=""; - $scope.add = function(login) { + $scope.add = function(event, login) { + $scope.error = undefined; + if (event.which && event.which !== 13) { + return; + } + $scope.waiting = true; + users.post(login).then(function(payload){ $scope.users.push(payload.data); - $scope.login=""; + $scope.search_text=undefined; + $scope.waiting = false; + }).catch(function (err) { + $scope.error = err; + $scope.waiting = false; + $scope.search_text = undefined; }); } diff --git a/cmd/drone-server/static/scripts/views/builds/index/content.html b/cmd/drone-server/static/scripts/views/builds/index/content.html index f3e33084..b2326610 100644 --- a/cmd/drone-server/static/scripts/views/builds/index/content.html +++ b/cmd/drone-server/static/scripts/views/builds/index/content.html @@ -16,6 +16,16 @@ +
[![Build Status]({{ window.location.origin }}/api/badges/{{ repo.full_name }}/status.svg)]({{ window.location.origin }}/{{ repo.full_name }})+
{{ window.location.origin }}/api/badges/{{ repo.full_name }}/cc.xml+
{{ repo.keypair.public }}+
NOTE: The below sections should re-architected and are therefore not styled. The delete page should be combined with this current page. Secret variables should be stored in the .drone.yml instead of the user interface
+[![Build Status]({{ window.location.origin }}/api/badges/{{ repo.full_name }}/status.svg)]({{ window.location.origin }}/{{ repo.full_name }})-
{{ window.location.origin }}/api/badges/{{ repo.full_name }}/cc.xml-
{{ repo.keypair.public }}-