setup sync screen

This commit is contained in:
Brad Rydzewski 2014-07-09 22:24:06 -07:00
parent 9424b55046
commit 491b0e9eee
13 changed files with 92 additions and 11 deletions

View file

@ -38,6 +38,7 @@
<script src="/scripts/controllers/user.js"></script>
<script src="/scripts/controllers/users.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/services/auth.js"></script>
<script src="/scripts/services/conf.js"></script>

View file

@ -16,6 +16,11 @@ app.config(['$routeProvider', '$locationProvider', function($routeProvider, $loc
}
}
})
.when('/sync', {
templateUrl: '/views/sync.html',
controller: 'SyncController',
title: 'Sync'
})
.when('/login', {
templateUrl: '/views/login.html',
title: 'Login',
@ -94,7 +99,7 @@ app.config(['$routeProvider', '$locationProvider', function($routeProvider, $loc
}
})
.when('/:remote/:owner/:name/settings', {
templateUrl: '/views/repo_conf.html',
templateUrl: '/views/repo_edit.html',
controller: 'RepoConfigController',
title: 'Repository Settings',
resolve: {

View file

@ -12,7 +12,7 @@ angular.module('app').controller("HomeController", function($scope, $http, feed,
$http({method: 'GET', url: '/v1/user/feed'}).
success(function(data, status, headers, config) {
console.log(data)
$scope.feed = (typeof data==='string')?[]:data; //.splice(0, 3);
$scope.feed = (typeof data==='string')?[]:data;
}).
error(function(data, status, headers, config) {
console.log(data);

View 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);
});

View file

@ -2,7 +2,7 @@
angular.module('app').controller("UserController", function($scope, $http, user, notify) {
$scope.user = user;
$scope.account = user;
// get the user details
$http({method: 'GET', url: '/v1/user'}).

View file

@ -667,6 +667,21 @@ nav div.options .pure-button i {
#loginpage .pure-g .pure-u-1:last-child a {
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 {
width: 100%;
background: #f2f5f8;
@ -675,6 +690,15 @@ nav div.options .pure-button i {
padding: 40px 0px 20px 0px;
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 {
max-width: 1180px;
margin: 0px auto;

View file

@ -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 {
width:100%;
background:#f2f5f8;
@ -610,6 +626,16 @@ nav {
padding:40px 0px 20px 0px;
border-bottom:1px solid #EEE;
h1 {
text-align: center;
font-size: 24px;
margin-bottom:20px;
i {
font-size:32px;
margin-top:20px;
}
}
div {
max-width:1180px;
margin:0px auto;

File diff suppressed because one or more lines are too long

View file

@ -8,15 +8,15 @@
<div class="pure-u-1-6">
<div>
<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>
</div>
</div>
<div class="pure-u-5-6">
<div>
<h4>bradrydzewski</h4>
<span class="fullname">Brad Rydzewski</span>
<span class="email">brad.rydzewski@gmail.com</span>
<h4>{{ account.login }}</h4>
<span class="fullname">{{ account.name }}</span>
<span class="email">{{ account.email }}</span>
</div>
<!-- button to toggle HTML5 desktop notifications for build events -->
@ -34,7 +34,7 @@
</div>
<div class="pure-u-5-6">
<div>
{{ user.token }}
{{ account.token }}
</div>
</div>
</section>

View file

@ -4,7 +4,13 @@
<a href="/">dashboard</a>
</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">
<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">

View 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>

View file

@ -27,6 +27,7 @@ func NewLoginHandler(users database.UserManager, repos database.RepoManager, per
// GET /login/:host
func (h *LoginHandler) GetLogin(w http.ResponseWriter, r *http.Request) error {
host := r.FormValue(":host")
redirect := "/"
// get the remote system's client.
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
// the database code.
if u.IsStale() {
redirect = "/sync"
log.Println("sync user account.", u.Login)
// 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)
// redirect the user to their dashboard
http.Redirect(w, r, "/", http.StatusSeeOther)
http.Redirect(w, r, redirect, http.StatusSeeOther)
return nil
}