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}} {{/if}}
</li> </li>
{{/if}} {{/if}}
{{!TODO: for some reason showDownloadLog, which just delegates to jobIdForLog {{#if view.showDownloadLog}}
does not refresh 'if' properly, need further investigation}}
{{#if view.jobIdForLog}}
<li class="icon download-log" title="Download Log"> <li class="icon download-log" title="Download Log">
<a class="download-log" {{bind-attr href="view.plainTextLogUrl"}}></a> <a class="download-log" {{bind-attr href="view.plainTextLogUrl"}}></a>
</li> </li>
{{/if}} {{/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}} {{#if view.displayCodeClimate}}
<li class="icon code-climate" title="Test Coverage with Code Climate"> <li class="icon code-climate" title="Test Coverage with Code Climate">
<a href="#" name="code-climate" <a href="#" name="code-climate"

View File

@ -260,7 +260,7 @@ Travis.reopen
jobIdForLog: (-> jobIdForLog: (->
@get('job.id') || @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') ).property('job.id', 'build.jobs.firstObject.id', 'build.jobs.length')
job: (-> job: (->
@ -283,7 +283,8 @@ Travis.reopen
).property('displayRemoveLog', 'hasPermission') ).property('displayRemoveLog', 'hasPermission')
displayRemoveLog: (-> 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') ).property('isJobTab', 'isBuildTab', 'build.jobs.length', 'job.canRemoveLog')
canCancelBuild: (-> canCancelBuild: (->