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 @@ +
+
+

Default Branch

+ +
-
-

Default Branch

- -
+
+

Active Branches

+ +
-
-

Active Branches

- -
- -
-

Inactive Branches

- -
+
+

Inactive Branches

+ +
-{{!-- {{#if content.isLoaded}} --}} + {{!-- {{#if content.isLoaded}} --}} -{{!-- {{else}} - {{loading-indicator}} -{{/if}} --}} + {{!-- {{else}} + {{loading-indicator}} + {{/if}} --}} +
\ No newline at end of file diff --git a/app/templates/components/branch-row.hbs b/app/templates/components/branch-row.hbs index 386b677a..d70e952d 100644 --- a/app/templates/components/branch-row.hbs +++ b/app/templates/components/branch-row.hbs @@ -1,6 +1,6 @@
-

{{status-icon build=build}}{{build.commit.branch}}

+

{{status-icon build=build}}{{build.name}}

+ + {{#if build.last_build}} + ~ builds + {{else}} + 0 builds + {{/if}} +
- {{#link-to "build" build.repo build}} - {{request-icon build=build}} - #{{build.number}} {{build.state}} - {{/link-to}} -
+ {{#if build.last_build}} + {{#link-to "build" build.repository.slug build.last_build.id}} + {{request-icon build=build}} + #{{build.last_build.number}} {{build.last_build.state}} + {{/link-to}} + {{else}} + {{request-icon build=build}} - + {{/if}} +
-
+
@@ -49,7 +58,12 @@ - {{format-time build.finishedAt}}
+ {{#if build.last_build}} + {{format-time build.last_build.finished_at}} + {{else}} + - + {{/if}} +
@@ -57,7 +71,7 @@
- + -
avatar{{build.commit.committerName}}
+
+ {{#if build.last_build}} + avatar{{build.last_build.commit.committer.name}} + {{else}} +
no commits yet + {{/if}} +
diff --git a/app/templates/components/request-icon.hbs b/app/templates/components/request-icon.hbs index 051ed431..ef8b00f8 100644 --- a/app/templates/components/request-icon.hbs +++ b/app/templates/components/request-icon.hbs @@ -1,4 +1,4 @@ -{{#if isPush}} +{{#if isEmpty}} @@ -7,35 +7,46 @@ c0-1.2,1-2.2,2.2-2.2c1.2,0,2.2,1,2.2,2.2c0,0,0,0,0,0c0,0,0,0,0,0C12.2,11.2,11.2,12.2,10,12.2z"/> -{{/if}} +{{else}} + {{#if isPush}} + + + + + + {{/if}} -{{#if isPR}} - - - - - - -{{/if}} + {{#if isPR}} + + + + + + + {{/if}} -{{#if isAPI}} - - - - - + {{#if isAPI}} + + + + + + {{/if}} {{/if}} diff --git a/app/templates/components/status-icon.hbs b/app/templates/components/status-icon.hbs index d192fa78..b27ddc57 100644 --- a/app/templates/components/status-icon.hbs +++ b/app/templates/components/status-icon.hbs @@ -1,50 +1,61 @@ -{{#if hasPassed}} - - - +{{#if isEmpty}} + + + + + -{{/if}} +{{else}} + {{#if hasPassed}} + + + + + + {{/if}} -{{#if hasFailed}} - - - - - -{{/if}} + {{#if hasFailed}} + + + + + + {{/if}} -{{#if wasCanceled}} - - - - - -{{/if}} + {{#if wasCanceled}} + + + + + + {{/if}} -{{#if hasErrored}} - - - - - - -{{/if}} + {{#if hasErrored}} + + + + + + + {{/if}} -{{#if isRunning}} -
- - -
+ {{#if isRunning}} +
+ + +
+ {{/if}} {{/if}} \ No newline at end of file