From 1a1fedfb74c286ef93e052cc80af620029801eef Mon Sep 17 00:00:00 2001 From: Lisa P Date: Tue, 29 Sep 2015 15:23:44 +0200 Subject: [PATCH] fix last_branch fields on dashbaord --- app/components/dashboard-row.coffee | 4 ++-- app/controllers/dashboard/repositories.coffee | 6 ++++++ app/routes/owner/repositories.coffee | 2 +- app/styles/app/layouts/dashboard.sass | 2 +- app/templates/components/dashboard-row.hbs | 14 +++++++------- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/app/components/dashboard-row.coffee b/app/components/dashboard-row.coffee index 410c4e81..4ed5cbe4 100644 --- a/app/components/dashboard-row.coffee +++ b/app/components/dashboard-row.coffee @@ -5,7 +5,7 @@ DashboardRowComponent = Ember.Component.extend tagName: 'li' - classNameBindings: ['repo.last_build.state'] + classNameBindings: ['repo.default_branch.last_build.state'] classNames: ['dashboard-row'] isLoading: false isTriggering: false @@ -13,7 +13,7 @@ DashboardRowComponent = Ember.Component.extend urlGithubCommit: (-> githubCommitUrl(@get('repo.slug'), @get('repo.default_branch.last_build.commit.sha')) - ).property('repo.last_build') + ).property('repo') # canTrigger: (-> # if !@get('auth.signedIn') diff --git a/app/controllers/dashboard/repositories.coffee b/app/controllers/dashboard/repositories.coffee index f7c27196..f536320c 100644 --- a/app/controllers/dashboard/repositories.coffee +++ b/app/controllers/dashboard/repositories.coffee @@ -10,6 +10,12 @@ Controller = Ember.Controller.extend filter = @get('filter') repos = @get('model') org = @get('org') + + repos = repos.filter (item, index) -> + console.log(item) + item.get('default_branch.last_build') != null + .sortBy('default_branch.last_build.finished_at') + .reverse() if org repos = repos.filter (item, index) -> diff --git a/app/routes/owner/repositories.coffee b/app/routes/owner/repositories.coffee index 404c2574..6304f923 100644 --- a/app/routes/owner/repositories.coffee +++ b/app/routes/owner/repositories.coffee @@ -13,6 +13,6 @@ Route = TravisRoute.extend options = {} if @get('auth.signedIn') options.headers = { Authorization: "token #{@auth.token()}" } - $.ajax(config.apiEndpoint + "/v3/owner/#{transition.params.owner.owner}?include=user.repositories,organization.repositories,build.commit,repository.active", options) + $.ajax(config.apiEndpoint + "/v3/repos?repository.active=true&include=user.repositories,organization.repositories,build.commit", options) `export default Route` diff --git a/app/styles/app/layouts/dashboard.sass b/app/styles/app/layouts/dashboard.sass index 2ecdadd7..345d39ae 100644 --- a/app/styles/app/layouts/dashboard.sass +++ b/app/styles/app/layouts/dashboard.sass @@ -5,7 +5,7 @@ overflow: hidden &:after content: "" - @include fadeOut(right, -90deg, $white) + @include fadeOut(right, -90deg, $white, 20%) @mixin colorDashboardTiles($color, $status, $color2: $color) &.#{$status} diff --git a/app/templates/components/dashboard-row.hbs b/app/templates/components/dashboard-row.hbs index 7a962b32..7d877398 100644 --- a/app/templates/components/dashboard-row.hbs +++ b/app/templates/components/dashboard-row.hbs @@ -1,7 +1,7 @@
-

{{#link-to "owner" repo.owner.login}}{{status-icon status=repo.last_build.state}} {{repo.owner.login}}{{/link-to}}

+

{{#link-to "owner" repo.owner.login}}{{status-icon status=repo.default_branch.last_build.state}} {{repo.owner.login}}{{/link-to}}

{{#link-to "repo" repo.owner.login repo.name}}{{repo.name}}{{/link-to}}

@@ -10,8 +10,8 @@
{{#link-to "build" repo.owner.login repo.name repo.last_build.id}} - {{request-icon build=repo.last_build}} - #{{repo.last_build.number}} {{repo.last_build.state}} on {{repo.name}} + {{request-icon build=repo.default_branch.last_build}} + #{{repo.default_branch.last_build.number}} {{repo.default_branch.last_build.state}} on {{repo.default_branch.name}} {{/link-to}}
@@ -48,7 +48,7 @@ - {{format-sha repo.last_build.commit.sha}} + {{format-sha repo.default_branch.last_build.commit.sha}} @@ -57,7 +57,7 @@
-
+
@@ -75,8 +75,8 @@ - {{#if repo.last_build}} - {{format-time repo.last_build.finished_at}} + {{#if repo.default_branch.last_build}} + {{format-time repo.default_branch.last_build.finished_at}} {{else}} - {{/if}}