Merge branch 'master' of github.com:travis-ci/travis-web

This commit is contained in:
Lisa Passing 2015-06-17 15:35:47 +02:00
commit 607b092918
18 changed files with 81 additions and 26 deletions

BIN
.DS_Store vendored

Binary file not shown.

1
.gitignore vendored
View File

@ -13,6 +13,7 @@ coverage/*
libpeerconnection.log
npm-debug.log
testem.log
.DS_Store
# files generated by older build tools
public/scripts

View File

@ -5,6 +5,11 @@
Route = TravisRoute.extend BuildFaviconMixin,
needsAuth: false
beforeModel: ->
@_super.apply(this, arguments)
@get('auth').refreshUserData()
renderTemplate: ->
if @get('config').pro
$('body').addClass('pro')

View File

@ -50,6 +50,8 @@
width: 1.4em
.icon--env
width: 1.1em
.icon.api
height: 1.5em
@media #{$medium-up}
height: 36px

View File

@ -88,6 +88,12 @@
.icon--grey.pull_request
background-image: inline-image('svg/icon-request-pull.svg')
.icon-api,
.icon.api
background-image: inline-image('svg/api-white.svg')
.icon--grey.api
background-image: inline-image('svg/api-light-grey.svg')
.icon-lock
background-image: inline-image('dashboard/private-icon.svg')

View File

@ -105,21 +105,22 @@
height: 100%
border-top-left-radius: 4px
border-bottom-left-radius: 4px
.icon-status
.icon
display: block
.icon-status
width: 1.1em
height: 1.2em
margin: .7em auto 1em
.icon.push
display: block
width: 1.4em
height: 1.1em
margin: -0.2em auto 0
.icon.pull_request
display: block
width: 1.1em
height: 1.6em
margin: -0.5em auto 0
.icon.api
margin: -0.4em 0.75em
.icon--job
@extend %absolute-center
@ -154,6 +155,8 @@
white-space: nowrap
@media #{$xlarge-up}
@include grid-column(5)
.icon.api
margin: -0.2em 0.75em
p.tile-single-line
padding: .7em 0

View File

@ -3,8 +3,8 @@
{{else}}
<section {{bind-attr class=":tile :tile--pass :row build.state"}}>
<div class="tile-status">
<span {{bind-attr class=":icon :icon-status build.state"}}></span>
<span {{bind-attr class=":request-kind build.eventType :icon"}}></span>
<span {{bind-attr class=":icon :icon-status build.state"}} {{bind-attr title="build.state"}}></span>
<span {{bind-attr class=":request-kind build.eventType :icon"}} {{bind-attr title="build.eventType"}}></span>
</div>
<div class="tile-main medium-8 columns">

View File

@ -1,6 +1,6 @@
<div class="tile-status">
<span class="icon icon-status {{build.state}}"></span>
<span class="request-kind icon {{build.eventType}}"></span>
<span class="icon icon-status {{build.state}}" title="{{build.state}}"></span>
<span class="request-kind icon {{build.eventType}}" title="{{build.eventType}}"></span>
</div>
<div class="column tile-main medium-6">

View File

@ -2,8 +2,8 @@
<section {{bind-attr class=":tile :tile--pass :row job.state"}} {{!-- id="new-summary" --}}>
<div class="tile-status">
<span {{bind-attr class=":icon :icon-status job.state"}}></span>
<span {{bind-attr class=":request-kind job.build.eventType :icon"}}></span>
<span {{bind-attr class=":icon :icon-status job.state"}} {{bind-attr title="job.state"}}></span>
<span {{bind-attr class=":request-kind job.build.eventType :icon"}} {{bind-attr title="job.build.eventType"}}></span>
</div>
<div class="tile-main medium-8 columns">

View File

@ -52,11 +52,16 @@ Auth = Ember.Object.extend
null
validateUser: (user) ->
fieldsToValidate = ['id', 'login', 'token', 'correct_scopes']
fieldsToValidate = ['id', 'login', 'token']
isTravisBecome = sessionStorage.getItem('travis.become')
unless isTravisBecome
fieldsToValidate.push 'correct_scopes'
if config.pro
fieldsToValidate.push 'channels'
fieldsToValidate.every( (field) => @validateHas(field, user) ) && user.correct_scopes
fieldsToValidate.every( (field) => @validateHas(field, user) ) && (isTravisBecome || user.correct_scopes)
validateHas: (field, user) ->
if user[field]
@ -74,18 +79,26 @@ Auth = Ember.Object.extend
@set('state', 'signed-in')
Travis.trigger('user:signed_in', data.user)
@sendToApp('afterSignIn')
@refreshUserData(data.user)
refreshUserData: (user) ->
Ajax.get "/users/#{user.id}", (data) =>
@store.pushPayload(users: [data.user])
# if user is still signed in, update saved data
if @get('signedIn')
data.user.token = user.token
@storeData(data, @sessionStorage)
@storeData(data, @storage)
, (status, xhr) =>
@signOut() if status == 403
unless user
if data = @userDataFrom(@sessionStorage) || @userDataFrom(@storage)
user = data.user
if user
Ajax.get "/users/#{user.id}", (data) =>
if data.user.correct_scopes
userRecord = @loadUser(data.user)
userRecord.get('permissions')
# if user is still signed in, update saved data
if @get('signedIn')
data.user.token = user.token
@storeData(data, @sessionStorage)
@storeData(data, @storage)
else
@signOut()
, (status, xhr) =>
@signOut() if status == 403
signedIn: (->
@get('state') == 'signed-in'
@ -105,9 +118,7 @@ Auth = Ember.Object.extend
loadUser: (user) ->
@store.pushPayload(users: [user])
user = @store.recordForId('user', user.id)
user.get('permissions')
user
@store.recordForId('user', user.id)
receiveMessage: (event) ->
if event.origin == @expectedOrigin()
@ -129,9 +140,9 @@ Auth = Ember.Object.extend
# as a direct response to either manual sign in or autoSignIn (right now
# we treat both cases behave the same in terms of sent events which I think
# makes it more complicated than it should be).
controller = @container.lookup('controller:auth')
router = @container.lookup('router:main')
try
controller.send(name)
router.send(name)
catch error
unless error.message =~ /Can't trigger action/
throw error

View File

@ -48,4 +48,6 @@ Auth = Ember.Object.extend
if @get('state') == 'signed-in'
'a-token'
refreshUserData: (->)
`export default Auth`

Binary file not shown.

Binary file not shown.

BIN
public/.DS_Store vendored

Binary file not shown.

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 17 12.3" enable-background="new 0 0 17 12.3" xml:space="preserve">
<path fill="#969496" d="M16,3.2h-1.4v-2c0-0.6-0.4-1.1-1-1.1h-3.1c-0.5,0-1,0.5-1,1.1v2H7.2v-2c0-0.6-0.4-1.1-1-1.1H3.2
c-0.5,0-1,0.5-1,1.1v2H1c-0.5,0-1,0.5-1,1.1v6.8c0,0.6,0.4,1.1,1,1.1H16c0.5,0,1-0.5,1-1.1V4.3C17,3.7,16.6,3.2,16,3.2z"/>
</svg>

After

Width:  |  Height:  |  Size: 593 B

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="144.57px" height="215.43px" viewBox="0 0 144.57 215.43" enable-background="new 0 0 144.57 215.43" xml:space="preserve">
<path fill="#D0CFCE" d="M136.066,82.628H124.16V65.619c0-5.103-3.401-9.354-8.504-9.354H89.293c-4.252,0-8.504,4.252-8.504,9.354
v17.009H61.23V65.619c0-5.103-3.402-9.354-8.504-9.354H27.213c-4.252,0-8.504,4.252-8.504,9.354v17.009H8.504
C4.252,82.628,0,86.88,0,91.983v57.828c0,5.103,3.402,9.354,8.504,9.354h127.562c4.252,0,8.504-4.252,8.504-9.354V91.983
C144.57,86.88,141.168,82.628,136.066,82.628z"/>
</svg>

After

Width:  |  Height:  |  Size: 905 B

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 17 12.3" enable-background="new 0 0 17 12.3" xml:space="preserve">
<path fill="#FFFFFF" d="M16,3.2h-1.4v-2c0-0.6-0.4-1.1-1-1.1h-3.1c-0.5,0-1,0.5-1,1.1v2H7.2v-2c0-0.6-0.4-1.1-1-1.1H3.2
c-0.5,0-1,0.5-1,1.1v2H1c-0.5,0-1,0.5-1,1.1v6.8c0,0.6,0.4,1.1,1,1.1H16c0.5,0,1-0.5,1-1.1V4.3C17,3.7,16.6,3.2,16,3.2z"/>
</svg>

After

Width:  |  Height:  |  Size: 593 B

View File

@ -33,5 +33,6 @@ __END__
var storage = %s;
storage.setItem('travis.token', %p);
storage.setItem('travis.user', %p);
storage.setItem('travis.become', true);
window.location = %p;
</script>