mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 20:01:02 +00:00
setup sync screen
This commit is contained in:
parent
9424b55046
commit
491b0e9eee
13 changed files with 92 additions and 11 deletions
|
@ -38,6 +38,7 @@
|
||||||
<script src="/scripts/controllers/user.js"></script>
|
<script src="/scripts/controllers/user.js"></script>
|
||||||
<script src="/scripts/controllers/users.js"></script>
|
<script src="/scripts/controllers/users.js"></script>
|
||||||
<script src="/scripts/controllers/setup.js"></script>
|
<script src="/scripts/controllers/setup.js"></script>
|
||||||
|
<script src="/scripts/controllers/sync.js"></script>
|
||||||
<script src="/scripts/controllers/main.js"></script>
|
<script src="/scripts/controllers/main.js"></script>
|
||||||
<script src="/scripts/services/auth.js"></script>
|
<script src="/scripts/services/auth.js"></script>
|
||||||
<script src="/scripts/services/conf.js"></script>
|
<script src="/scripts/services/conf.js"></script>
|
||||||
|
|
|
@ -16,6 +16,11 @@ app.config(['$routeProvider', '$locationProvider', function($routeProvider, $loc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.when('/sync', {
|
||||||
|
templateUrl: '/views/sync.html',
|
||||||
|
controller: 'SyncController',
|
||||||
|
title: 'Sync'
|
||||||
|
})
|
||||||
.when('/login', {
|
.when('/login', {
|
||||||
templateUrl: '/views/login.html',
|
templateUrl: '/views/login.html',
|
||||||
title: 'Login',
|
title: 'Login',
|
||||||
|
@ -94,7 +99,7 @@ app.config(['$routeProvider', '$locationProvider', function($routeProvider, $loc
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.when('/:remote/:owner/:name/settings', {
|
.when('/:remote/:owner/:name/settings', {
|
||||||
templateUrl: '/views/repo_conf.html',
|
templateUrl: '/views/repo_edit.html',
|
||||||
controller: 'RepoConfigController',
|
controller: 'RepoConfigController',
|
||||||
title: 'Repository Settings',
|
title: 'Repository Settings',
|
||||||
resolve: {
|
resolve: {
|
||||||
|
|
|
@ -12,7 +12,7 @@ angular.module('app').controller("HomeController", function($scope, $http, feed,
|
||||||
$http({method: 'GET', url: '/v1/user/feed'}).
|
$http({method: 'GET', url: '/v1/user/feed'}).
|
||||||
success(function(data, status, headers, config) {
|
success(function(data, status, headers, config) {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
$scope.feed = (typeof data==='string')?[]:data; //.splice(0, 3);
|
$scope.feed = (typeof data==='string')?[]:data;
|
||||||
}).
|
}).
|
||||||
error(function(data, status, headers, config) {
|
error(function(data, status, headers, config) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
|
10
server/app/scripts/controllers/sync.js
Normal file
10
server/app/scripts/controllers/sync.js
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('app').controller("SyncController", function($scope, $http, $interval, $location, users) {
|
||||||
|
$interval(function() {
|
||||||
|
// todo(bradrydzewski) We should poll the user to see
|
||||||
|
// if the sync process is complete. If no, we should
|
||||||
|
// repeat.
|
||||||
|
$location.path("/");
|
||||||
|
}, 5000);
|
||||||
|
});
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
angular.module('app').controller("UserController", function($scope, $http, user, notify) {
|
angular.module('app').controller("UserController", function($scope, $http, user, notify) {
|
||||||
|
|
||||||
$scope.user = user;
|
$scope.account = user;
|
||||||
|
|
||||||
// get the user details
|
// get the user details
|
||||||
$http({method: 'GET', url: '/v1/user'}).
|
$http({method: 'GET', url: '/v1/user'}).
|
||||||
|
|
|
@ -667,6 +667,21 @@ nav div.options .pure-button i {
|
||||||
#loginpage .pure-g .pure-u-1:last-child a {
|
#loginpage .pure-g .pure-u-1:last-child a {
|
||||||
margin-bottom: 0px;
|
margin-bottom: 0px;
|
||||||
}
|
}
|
||||||
|
#syncpage {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
#syncpage section {
|
||||||
|
padding: 40px 0px 20px 0px;
|
||||||
|
}
|
||||||
|
#syncpage section h1 {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 24px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
#syncpage section h1 i {
|
||||||
|
font-size: 32px;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
#homepage {
|
#homepage {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: #f2f5f8;
|
background: #f2f5f8;
|
||||||
|
@ -675,6 +690,15 @@ nav div.options .pure-button i {
|
||||||
padding: 40px 0px 20px 0px;
|
padding: 40px 0px 20px 0px;
|
||||||
border-bottom: 1px solid #EEE;
|
border-bottom: 1px solid #EEE;
|
||||||
}
|
}
|
||||||
|
#homepage section h1 {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 24px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
#homepage section h1 i {
|
||||||
|
font-size: 32px;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
#homepage section div {
|
#homepage section div {
|
||||||
max-width: 1180px;
|
max-width: 1180px;
|
||||||
margin: 0px auto;
|
margin: 0px auto;
|
||||||
|
|
|
@ -602,6 +602,22 @@ nav {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#syncpage {
|
||||||
|
width:100%;
|
||||||
|
section {
|
||||||
|
padding:40px 0px 20px 0px;
|
||||||
|
h1 {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 24px;
|
||||||
|
margin-bottom:20px;
|
||||||
|
i {
|
||||||
|
font-size:32px;
|
||||||
|
margin-top:20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#homepage {
|
#homepage {
|
||||||
width:100%;
|
width:100%;
|
||||||
background:#f2f5f8;
|
background:#f2f5f8;
|
||||||
|
@ -610,6 +626,16 @@ nav {
|
||||||
padding:40px 0px 20px 0px;
|
padding:40px 0px 20px 0px;
|
||||||
border-bottom:1px solid #EEE;
|
border-bottom:1px solid #EEE;
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 24px;
|
||||||
|
margin-bottom:20px;
|
||||||
|
i {
|
||||||
|
font-size:32px;
|
||||||
|
margin-top:20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
div {
|
div {
|
||||||
max-width:1180px;
|
max-width:1180px;
|
||||||
margin:0px auto;
|
margin:0px auto;
|
||||||
|
|
2
server/app/styles/drone.min.css
vendored
2
server/app/styles/drone.min.css
vendored
File diff suppressed because one or more lines are too long
|
@ -8,15 +8,15 @@
|
||||||
<div class="pure-u-1-6">
|
<div class="pure-u-1-6">
|
||||||
<div>
|
<div>
|
||||||
<a href="https://gravatar.com/" target="_blank">
|
<a href="https://gravatar.com/" target="_blank">
|
||||||
<img ng-src="https://gravatar.com/avatar/{{ user.gravatar }}?d=identicon" />
|
<img ng-src="{{ account.gravatar | gravatar }}" />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="pure-u-5-6">
|
<div class="pure-u-5-6">
|
||||||
<div>
|
<div>
|
||||||
<h4>bradrydzewski</h4>
|
<h4>{{ account.login }}</h4>
|
||||||
<span class="fullname">Brad Rydzewski</span>
|
<span class="fullname">{{ account.name }}</span>
|
||||||
<span class="email">brad.rydzewski@gmail.com</span>
|
<span class="email">{{ account.email }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- button to toggle HTML5 desktop notifications for build events -->
|
<!-- button to toggle HTML5 desktop notifications for build events -->
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="pure-u-5-6">
|
<div class="pure-u-5-6">
|
||||||
<div>
|
<div>
|
||||||
{{ user.token }}
|
{{ account.token }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -4,7 +4,13 @@
|
||||||
<a href="/">dashboard</a>
|
<a href="/">dashboard</a>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<section>
|
<section ng-if="feed.length == 0">
|
||||||
|
<div>
|
||||||
|
<h1>Activate your Repositories<br/><i class="fa fa-long-arrow-down"></i></h1>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section ng-if="feed.length > 0">
|
||||||
<div class="pure-g cards">
|
<div class="pure-g cards">
|
||||||
<a class="pure-u-1 pure-u-md-1-2 pure-u-lg-1-4 pure-u-xl-1-4 card card" href="/{{ commit | fullPath }}" ng-repeat="commit in feed | limitTo:4" data-status="{{ commit.status }}">
|
<a class="pure-u-1 pure-u-md-1-2 pure-u-lg-1-4 pure-u-xl-1-4 card card" href="/{{ commit | fullPath }}" ng-repeat="commit in feed | limitTo:4" data-status="{{ commit.status }}">
|
||||||
<div class="l-box">
|
<div class="l-box">
|
||||||
|
|
7
server/app/views/sync.html
Normal file
7
server/app/views/sync.html
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<article id="syncpage">
|
||||||
|
<section>
|
||||||
|
<div>
|
||||||
|
<h1>Syncing your Account<br/><i class="fa fa-refresh fa-spin"></i></h1>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</article>
|
|
@ -27,6 +27,7 @@ func NewLoginHandler(users database.UserManager, repos database.RepoManager, per
|
||||||
// GET /login/:host
|
// GET /login/:host
|
||||||
func (h *LoginHandler) GetLogin(w http.ResponseWriter, r *http.Request) error {
|
func (h *LoginHandler) GetLogin(w http.ResponseWriter, r *http.Request) error {
|
||||||
host := r.FormValue(":host")
|
host := r.FormValue(":host")
|
||||||
|
redirect := "/"
|
||||||
|
|
||||||
// get the remote system's client.
|
// get the remote system's client.
|
||||||
remote := h.conf.Find().GetRemote(host)
|
remote := h.conf.Find().GetRemote(host)
|
||||||
|
@ -88,6 +89,7 @@ func (h *LoginHandler) GetLogin(w http.ResponseWriter, r *http.Request) error {
|
||||||
// should be injected into this struct, just like
|
// should be injected into this struct, just like
|
||||||
// the database code.
|
// the database code.
|
||||||
if u.IsStale() {
|
if u.IsStale() {
|
||||||
|
redirect = "/sync"
|
||||||
log.Println("sync user account.", u.Login)
|
log.Println("sync user account.", u.Login)
|
||||||
|
|
||||||
// sync inside a goroutine. This should eventually be moved to
|
// sync inside a goroutine. This should eventually be moved to
|
||||||
|
@ -138,7 +140,7 @@ func (h *LoginHandler) GetLogin(w http.ResponseWriter, r *http.Request) error {
|
||||||
h.sess.SetUser(w, r, u)
|
h.sess.SetUser(w, r, u)
|
||||||
|
|
||||||
// redirect the user to their dashboard
|
// redirect the user to their dashboard
|
||||||
http.Redirect(w, r, "/", http.StatusSeeOther)
|
http.Redirect(w, r, redirect, http.StatusSeeOther)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue