diff --git a/app/components/branch-row.coffee b/app/components/branch-row.coffee index 02115c73..25ee44bb 100644 --- a/app/components/branch-row.coffee +++ b/app/components/branch-row.coffee @@ -7,17 +7,13 @@ BranchRowComponent = Ember.Component.extend tagName: 'li' - classNameBindings: ['build.state'] + classNameBindings: ['build.last_build.state'] classNames: ['branch-row'] isLoading: true - urlAuthorGravatarImage: (-> - gravatarImage(@get('build.commit.authorEmail'), 15) - ).property('build.commit.authorEmail') - urlGithubCommit: (-> - githubCommitUrl(@get('build.repo.slug'), @get('build.commit.sha')) - ).property('build.commit.sha') + githubCommitUrl(@get('build.repository.slug'), @get('build.last_build.commit.sha')) + ).property('build.last_build') getLast5Builds: (-> diff --git a/app/components/request-icon.coffee b/app/components/request-icon.coffee index 031a47a1..a48846d9 100644 --- a/app/components/request-icon.coffee +++ b/app/components/request-icon.coffee @@ -4,19 +4,23 @@ RequestIconComponent = Ember.Component.extend tagName: 'span' classNames: ['icon-request'] - classNameBindings: ['build.state'] + classNameBindings: ['build.last_build.state'] isPush: (-> - @get('build.eventType') == 'push' - ).property('build.eventType') + @get('build.last_build.event_type') == 'push' + ).property('build.last_build') isPR: (-> - @get('build.eventType') == 'pull_request' - ).property('build.eventType') + @get('build.last_build.event_type') == 'pull_request' + ).property('build.last_build') isAPI: (-> - @get('build.eventType') == 'api' - ).property('build.eventType') + @get('build.last_build.event_type') == 'api' + ).property('build.last_build') + + isEmpty: (-> + true if @get('build.last_build') == null + ).property('build.last_build') diff --git a/app/components/status-icon.coffee b/app/components/status-icon.coffee index 493c4b8f..b784b08f 100644 --- a/app/components/status-icon.coffee +++ b/app/components/status-icon.coffee @@ -4,30 +4,34 @@ StatusIconComponent = Ember.Component.extend tagName: 'span' classNames: ['status-icon'] - classNameBindings: ['build.state'] + classNameBindings: ['build.last_build.state'] hasPassed: (-> - @get('build.state') == 'passed' - ).property('build.state') + @get('build.last_build.state') == 'passed' + ).property('build.last_build.state') hasFailed: (-> - @get('build.state') == 'failed' - ).property('build.state') + @get('build.last_build.state') == 'failed' + ).property('build.last_build.state') hasErrored: (-> - @get('build.state') == 'errored' - ).property('build.state') + @get('build.last_build.state') == 'errored' + ).property('build.last_build.state') wasCanceled: (-> - @get('build.state') == 'canceled' - ).property('build.state') + @get('build.last_build.state') == 'canceled' + ).property('build.last_build.state') isRunning: (-> - @get('build.state') == 'started' || - @get('build.state') == 'queued' || - @get('build.state') == 'booting' || - @get('build.state') == 'received' || - @get('build.state') == 'created' - ).property('build.state') + @get('build.last_build.state') == 'started' || + @get('build.last_build.state') == 'queued' || + @get('build.last_build.state') == 'booting' || + @get('build.last_build.state') == 'received' || + @get('build.last_build.state') == 'created' + ).property('build.last_build.state') + + isEmpty: (-> + true if @get('build.last_build') == null + ).property('build.last_build') `export default StatusIconComponent` diff --git a/app/controllers/branches.coffee b/app/controllers/branches.coffee index 77134a0d..7cf00272 100644 --- a/app/controllers/branches.coffee +++ b/app/controllers/branches.coffee @@ -6,18 +6,20 @@ BranchesController = Ember.Controller.extend defaultBranch: (-> repos = @get('model') - - # repos = repos.filter (item, index) -> - # item.get('owner.login') == org - + console.log(repos[0]) + repos[0] ).property('model') activeBranches: (-> repos = @get('model') + repos = repos.filter (item, index) -> + item if item.exists_on_github == true ).property('model') inactiveBranches: (-> repos = @get('model') + repos = repos.filter (item, index) -> + item if item.exists_on_github == false ).property('model') actions: diff --git a/app/routes/branches.coffee b/app/routes/branches.coffee index 345319f1..b6c9b1e4 100644 --- a/app/routes/branches.coffee +++ b/app/routes/branches.coffee @@ -12,15 +12,7 @@ Route = TravisRoute.extend if @get('auth.signedIn') options.headers = { Authorization: "token #{@auth.token()}" } - # $.ajax("#{apiEndpoint}/v3/repo/#{repoId}/branch/master", options).then (response) -> - $.ajax("#{apiEndpoint}/v3/repo/#{repoId}/builds?branch.name=master&limit=5", options).then (response) -> - - console.log(response) - # response.repositories.sortBy('last_build.finished_at').filter( (repo) -> - # repo.last_build - # ).map( (repo) -> - # Ember.Object.create(repo) - # ) - + $.ajax("#{apiEndpoint}/v3/repo/#{repoId}/branches?include=build.commit", options).then (response) -> + response.branches `export default Route` diff --git a/app/styles/app/components/build-tile.sass b/app/styles/app/components/build-tile.sass index 4a97075b..7a1cdda4 100644 --- a/app/styles/app/components/build-tile.sass +++ b/app/styles/app/components/build-tile.sass @@ -54,8 +54,8 @@ @include buildTileColors(#D94341, #FFF7F5, 'failed') @include buildTileColors(#D94341, #FFF7F5, 'errored') @include buildTileColors(#A1A0A0, #F5F5F5, 'canceled') - @include buildTileColors(#ECCE4B, rgba(#ECCE4B, 0.4), 'started') - @include buildTileColors(#ECCE4B, rgba(#ECCE4B, 0.4), 'queued') - @include buildTileColors(#ECCE4B, rgba(#ECCE4B, 0.4), 'booting') - @include buildTileColors(#ECCE4B, rgba(#ECCE4B, 0.4), 'received') - @include buildTileColors(#ECCE4B, rgba(#ECCE4B, 0.4), 'created') + @include buildTileColors(#bfb502, #fdfcee, 'started') + @include buildTileColors(#bfb502, #fdfcee, 'queued') + @include buildTileColors(#bfb502, #fdfcee, 'booting') + @include buildTileColors(#bfb502, #fdfcee, 'received') + @include buildTileColors(#bfb502, #fdfcee, 'created') diff --git a/app/styles/app/layouts/branches.sass b/app/styles/app/layouts/branches.sass index 8ca940c1..22597170 100644 --- a/app/styles/app/layouts/branches.sass +++ b/app/styles/app/layouts/branches.sass @@ -1,6 +1,6 @@ -@mixin statusColors($color, $status) +@mixin statusColors($color, $status, $color2: $color) &.#{$status} - background: linear-gradient(to right, $color 0%, $color 9px, white 10px, white 100%) no-repeat + background: linear-gradient(to right, $color2 0%, $color2 9px, white 10px, white 100%) no-repeat .branch-name, .branch-request a color: $color @@ -10,12 +10,9 @@ .icon-request g > * fill: $color - -// .tabbody -// ul -// padding: 0 -// margin: 0 -// list-style: none +.branches + .small-title + margin: 1.5em 0 0.7em .branch-row border: 1px solid $cream-dark @@ -23,6 +20,7 @@ text-align: right margin-bottom: .3rem color: $grey-dark + background: linear-gradient(to right, #CACECE 0%, #CACECE 9px, white 10px, white 100%) no-repeat span width: 1.3em @@ -32,10 +30,13 @@ vertical-align: middle .avatar + display: inline-block width: 16px + height: 16px margin-right: .7em border-radius: 50% vertical-align: middle + background-color: #E9EBEB .row-item margin: .2em @@ -69,11 +70,11 @@ @include statusColors($red-dark, 'failed') @include statusColors($red-dark, 'errored') @include statusColors($grey-medium, 'canceled') - @include statusColors(#ECCE4B, 'started') - @include statusColors(#ECCE4B, 'queued') - @include statusColors(#ECCE4B, 'booting') - @include statusColors(#ECCE4B, 'received') - @include statusColors(#ECCE4B, 'created') + @include statusColors(#bfb502, 'started', #e5db29) + @include statusColors(#bfb502, 'queued', #e5db29) + @include statusColors(#bfb502, 'booting', #e5db29) + @include statusColors(#bfb502, 'received', #e5db29) + @include statusColors(#bfb502, 'created', #e5db29) %row-element @@ -207,7 +208,7 @@ vertical-align: middle width: 5px height: 5px - border: solid 2px #ECCE4B + border: solid 2px #e5db29 border-radius: 50% transform-origin: center center diff --git a/app/templates/branches.hbs b/app/templates/branches.hbs index b5b0f92a..9fed18f3 100644 --- a/app/templates/branches.hbs +++ b/app/templates/branches.hbs @@ -1,36 +1,37 @@ +