diff --git a/app/models/build.coffee b/app/models/build.coffee index 61e5609f..b3b72b6f 100644 --- a/app/models/build.coffee +++ b/app/models/build.coffee @@ -51,7 +51,7 @@ Build = Model.extend DurationCalculations, ).property('state') notStarted: (-> - @get('state') in ['queued', 'created'] + @get('state') in ['queued', 'created', 'received'] ).property('state') startedAt: (-> diff --git a/app/models/job.coffee b/app/models/job.coffee index fadea741..ca252075 100644 --- a/app/models/job.coffee +++ b/app/models/job.coffee @@ -62,7 +62,7 @@ Job = Model.extend DurationCalculations, ).property('state') notStarted: (-> - @get('state') in ['queued', 'created'] + @get('state') in ['queued', 'created', 'received'] ).property('state') clearLog: -> diff --git a/app/styles/app/_mixins/mixins.sass b/app/styles/app/_mixins/mixins.sass index f84b3b0e..8286d9d5 100644 --- a/app/styles/app/_mixins/mixins.sass +++ b/app/styles/app/_mixins/mixins.sass @@ -24,4 +24,27 @@ @mixin border-bottom-radius($radius) border-bottom-left-radius: $radius - border-bottom-right-radius: $radius \ No newline at end of file + border-bottom-right-radius: $radius + +@mixin border-top-radius($radius) + border-top-left-radius: $radius + border-top-right-radius: $radius + +%border-radius-4px + border-radius: 4px + +%border-top-4px + border-top-left-radius: 4px + border-top-right-radius: 4px + +%border-bottom-4px + border-bottom-left-radius: 4px + border-bottom-right-radius: 4px + +%absolute-center + position: absolute + top: 0 + right: 0 + left: 0 + bottom: 0 + margin: auto \ No newline at end of file diff --git a/app/styles/app/_mixins/vars.sass b/app/styles/app/_mixins/vars.sass index 2c12db49..797d8011 100644 --- a/app/styles/app/_mixins/vars.sass +++ b/app/styles/app/_mixins/vars.sass @@ -51,4 +51,7 @@ $error-sand: #dcc682 // tabs $tab-nav-inactive-bg: #f8f8f8 $tab-nav-inactive-bg-hover: $white -$tab-active-bg: $blue-grey-light \ No newline at end of file +$tab-active-bg: $blue-grey-light + +// log +$log-header-bg: #444444 \ No newline at end of file diff --git a/app/styles/app/components/buttons.sass b/app/styles/app/components/buttons.sass index 87772870..14192d8c 100644 --- a/app/styles/app/components/buttons.sass +++ b/app/styles/app/components/buttons.sass @@ -83,3 +83,17 @@ $button-border-color: #d4d4d4 #auth #navigation .button--signin display: none +.button--grey + height: 22px + padding: 0 10px 0 10px + background-color: #696867 + color: #f2f2f2 + // line-height: 1.45 + font-size: $font-size-small + border: none + @extend %border-radius-4px + &:hover, + &:active + background-color: lighten(#696867, 10) + &:focus + background-color: #696867 diff --git a/app/styles/app/main/log.sass b/app/styles/app/main/log.sass index 75ebba9b..bf266c2b 100644 --- a/app/styles/app/main/log.sass +++ b/app/styles/app/main/log.sass @@ -1,20 +1,112 @@ -pre#log +.log position: relative - clear: left - min-height: 42px - margin-top: 25px - margin-top: 1em - padding: 15px 0 - color: $color-text-log - font-family: monospace - font-size: $font-size-log - line-height: $line-height-log - white-space: pre-wrap - word-wrap: break-word - background-color: #2a2a2a - border-radius: 4px - counter-reset: line-numbering + margin-top: 35px + + .log-tail + z-index: 99 + position: absolute + display: block + top: 0 + right: 0 + margin: 10px 10px 0 0 + + .tail-label + display: none + cursor: pointer + + &:hover + .tail-label + display: inline-block + .tail-status + display: none + + &.scrolling + position: fixed + right: 32px + + &.bottom + bottom: 45px + top: inherit + + .tail-status + position: relative + display: inline-block + height: 20px; + width: 20px; + vertical-align: middle + background-color: #696867; + border-radius: 50%; + &:after + content: "" + display: block + height: 10px; + width: 10px; + background: #F2F2F2; + border-radius: 50%; + @extend %absolute-center + + &.active .tail-status + background-color: #6b0 + + .to-top + z-index: 99 + position: absolute + display: block + bottom: 2px + right: 2px + + margin-right: 2px + padding-right: 16px + text-align: right + color: #999 + background: inline-image('ui/workers-close.svg') no-repeat right 6px + +.log-header + height: 44px + margin: 0 + padding: .9em .8em .6em + text-align: right + background-color: $log-header-bg + @extend %border-top-4px + a + margin-left: .4em + +.icon + display: inline-block + background: + size: 100% + repeat: no-repeat + width: 1.3em + height: 1.1em + margin-right: 6px + vertical-align: middle +.icon--downloadLog + background-image: inline-image('icons/download-log-icon.svg') +.icon--removeLog + background-image: inline-image('icons/remove-log-icon.svg') +.icon--down + width: 0.7em + height: 0.9em + margin-right: 4px + background-image: inline-image('icons/end-of-log-icon.svg') + +.log-body + position: relative + pre + clear: left + min-height: 42px + padding: 15px 0 + color: $color-text-log + font-family: monospace + font-size: $font-size-log + line-height: $line-height-log + white-space: pre-wrap + word-wrap: break-word + background-color: #2a2a2a + counter-reset: line-numbering + margin-top: 0 + @extend %border-bottom-4px .cut padding: 20px 15px 0 55px @@ -95,74 +187,16 @@ pre#log border-radius: 6px color: #bbb + .loading + padding: 25px 0 0 10px -#log.loading - padding: 25px 0 0 10px - -#log-container - position: relative - margin-top: 35px - -#log-container - #tail - z-index: 99 - position: absolute - display: block - top: 0 - right: 2px - margin: 13px 10px 0 0 - padding: 0 2px 0 3px - color: #666 - text-shadow: 0px 1px 0px #fff - font-family: "Source Sans Pro", Helvetica, sans-serif - font-size: $font-size-tiny - line-height: 14px - text-decoration: none - white-space: nowrap - border: 1px solid #bbb - border-top-color: #ddd - border-bottom-color: #bbb - border-radius: 8px - background: linear-gradient(#fff, #e0e0e0) - - label - display: none - cursor: pointer - - &:hover - padding: 1px 4px 1px 6px - label - display: inline - - &.scrolling - position: fixed - right: 32px - - &.bottom - bottom: 45px - top: inherit - - .status - display: inline-block - margin-right: 1px - width: 8px - height: 8px - background-color: #aaa - border-radius: 4px - box-shadow: $white 1px 1px 2px - - &.active .status - background-color: #6b0 - - .to-top - z-index: 99 - position: absolute - display: block - bottom: 2px - right: 2px - - margin-right: 2px - padding-right: 16px - text-align: right - color: #999 - background: inline-image('ui/workers-close.svg') no-repeat right 6px +.log-notice + background-color: #A6ADAD + color: $white + min-height: 70px + line-height: 35px + text-align: center + @extend %border-radius-4px + @media #{$medium-up} + height: 70px + line-height: 70px diff --git a/app/styles/app/main/tools.sass b/app/styles/app/main/tools.sass index 15062e94..6e3ccefe 100644 --- a/app/styles/app/main/tools.sass +++ b/app/styles/app/main/tools.sass @@ -88,12 +88,6 @@ li.cancel-build a, li.cancel-job a background-image: inline-image('icons/off.svg') - li.download-log a - background-image: inline-image('icons/download-log.svg') - - li.remove-log a - background-image: inline-image('icons/delete-log.svg') - li.code-climate a background-image: inline-image('icons/code-climate-icon.svg') diff --git a/app/templates/jobs/pre.hbs b/app/templates/jobs/pre.hbs index ff9e1293..ca8c1769 100644 --- a/app/templates/jobs/pre.hbs +++ b/app/templates/jobs/pre.hbs @@ -1,25 +1,37 @@ -
- - - -
+ {{#if view.job.notStarted}} +
Hang tight, the log cannot be shown until the build has started.
+ {{/if}} +
+ + {{#if view.canRemoveLog}} + Remove Log {{/if}} - - -

+       Download Log
+    
+
+ + + + {{#if view.job.isFinished}} + Scroll to End of Log + {{else}} + Follow Log + {{/if}} + + +

 
-  {{#if view.log.hasContent}}
-    Top
-  {{/if}}
+      {{#if view.log.hasContent}}
+        Top
+      {{/if}}
 
-  {{#if view.limited}}
-    

- This log is too long to be displayed. Please reduce the verbosity of your - build or download the raw log. -

- {{/if}} -
+ {{#if view.limited}} +

+ This log is too long to be displayed. Please reduce the verbosity of your + build or download the raw log. +

+ {{/if}} +
+
+ diff --git a/app/templates/repos/show/actions.hbs b/app/templates/repos/show/actions.hbs index c262912b..ba47ed3c 100644 --- a/app/templates/repos/show/actions.hbs +++ b/app/templates/repos/show/actions.hbs @@ -32,22 +32,6 @@ {{/if}} {{/if}} - {{#if view.jobIdForLog}} - {{#if view.showDownloadLog}} -
  • - -
  • - {{/if}} - {{/if}} - {{! the next if is a hack for refreshing displayRemoveLog when we change - views, it sometimes doesn't work properly }} - {{#if view.jobIdForLog}} - {{#if view.displayRemoveLog}} -
  • - -
  • - {{/if}} - {{/if}} {{#if view.displayCodeClimate}}
  • console.log 'log view: log will change' if Log.DEBUG @@ -99,6 +101,16 @@ View = Ember.View.extend url ).property('job.log.id', 'job.log.token') + hasPermission: (-> + if permissions = @get('currentUser.permissions') + permissions.contains parseInt(@get('job.repo.id')) + ).property('currentUser.permissions.length', 'job.repo.id') + + canRemoveLog: (-> + if job = @get('job') + job.get('canRemoveLog') && @get('hasPermission') + ).property('job.canRemoveLog', 'hasPermission') + actions: toTop: () -> $(window).scrollTop(0) @@ -108,6 +120,26 @@ View = Ember.View.extend @engine.autoCloseFold = !Travis.tailing.isActive() event.preventDefault() + removeLog: -> + @popupCloseAll() + if @get('canRemoveLog') + job = @get('_job') || @get('build.jobs.firstObject') + job.removeLog().then -> + Travis.flash(success: 'Log has been successfully removed.') + , (xhr) -> + if xhr.status == 409 + Travis.flash(error: 'Log can\'t be removed') + else if xhr.status == 401 + Travis.flash(error: 'You don\'t have sufficient access to remove the log') + else + Travis.flash(error: 'An error occured when removing the log') + + removeLogPopup: -> + if @get('canRemoveLog') + @set('active', true) + @popup('remove-log-popup') + return false + noop: -> # TODO required? `export default View` diff --git a/app/views/repo-actions.coffee b/app/views/repo-actions.coffee index ff8fece9..f40f5942 100644 --- a/app/views/repo-actions.coffee +++ b/app/views/repo-actions.coffee @@ -68,12 +68,6 @@ View = BasicView.extend @popup('code-climate') return false - removeLogPopup: -> - if @get('canRemoveLog') - @set('active', true) - @popup('remove-log-popup') - return false - hasPermission: (-> if permissions = @get('currentUser.permissions') permissions.contains parseInt(@get('repo.id')) diff --git a/public/images/icons/delete-log.svg b/public/images/icons/delete-log.svg deleted file mode 100644 index ae4f5553..00000000 --- a/public/images/icons/delete-log.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - diff --git a/public/images/icons/download-log-icon.svg b/public/images/icons/download-log-icon.svg new file mode 100644 index 00000000..1df8b979 --- /dev/null +++ b/public/images/icons/download-log-icon.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff --git a/public/images/icons/download-log.svg b/public/images/icons/download-log.svg deleted file mode 100644 index 2d4ff02b..00000000 --- a/public/images/icons/download-log.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - diff --git a/public/images/icons/end-of-log-icon.svg b/public/images/icons/end-of-log-icon.svg new file mode 100644 index 00000000..a044c7f5 --- /dev/null +++ b/public/images/icons/end-of-log-icon.svg @@ -0,0 +1,7 @@ + + + + + + diff --git a/public/images/icons/remove-log-icon.svg b/public/images/icons/remove-log-icon.svg new file mode 100644 index 00000000..a75c8bd8 --- /dev/null +++ b/public/images/icons/remove-log-icon.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + +