Fix download log and remove log button display checks

For some reason when we run get('build.jobs.firstObject.id') it returns
different result than get('build.jobs').objectAt(0).get('id'). I can't reproduce
it on a clean Ember application, so it's probably a consequence of something
that we do in our views.
This commit is contained in:
Piotr Sarnacki 2015-01-08 15:13:54 +01:00
parent f1f5d26a51
commit cc7fef21ca
2 changed files with 10 additions and 5 deletions

View File

@ -32,13 +32,17 @@
{{/if}}
</li>
{{/if}}
{{!TODO: for some reason showDownloadLog, which just delegates to jobIdForLog
does not refresh 'if' properly, need further investigation}}
{{#if view.jobIdForLog}}
{{#if view.showDownloadLog}}
<li class="icon download-log" title="Download Log">
<a class="download-log" {{bind-attr href="view.plainTextLogUrl"}}></a>
</li>
{{/if}}
{{#if view.displayRemoveLog}}
<li class="icon remove-log" title="Remove Log">
<a href="#" {{action "removeLog" target="view"}}
{{bind-attr class="view.canRemoveLog::disabled"}}></a>
</li>
{{/if}}
{{#if view.displayCodeClimate}}
<li class="icon code-climate" title="Test Coverage with Code Climate">
<a href="#" name="code-climate"

View File

@ -260,7 +260,7 @@ Travis.reopen
jobIdForLog: (->
@get('job.id') ||
(@get('build.jobs.length') == 1 && @get('build.jobs.firstObject.id'))
(@get('build.jobs.length') == 1 && @get('build.jobs').objectAt(0).get?('id'))
).property('job.id', 'build.jobs.firstObject.id', 'build.jobs.length')
job: (->
@ -283,7 +283,8 @@ Travis.reopen
).property('displayRemoveLog', 'hasPermission')
displayRemoveLog: (->
(@get('isJobTab') || (@get('isBuildTab') && @get('build.jobs.length') == 1)) && @get('build.jobs.firstObject.canRemoveLog')
(@get('isJobTab') || (@get('isBuildTab') && @get('build.jobs.length') == 1)) &&
@get('build.jobs').objectAt(0).get?('canRemoveLog')
).property('isJobTab', 'isBuildTab', 'build.jobs.length', 'job.canRemoveLog')
canCancelBuild: (->