summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-06-09 11:58:52 +0000
committerPhil Hughes <me@iamphill.com>2017-06-09 11:58:52 +0000
commit481040e2295bbb655673752a7b4c90622eb3ccb8 (patch)
treec8602bccede4b64cf06f73d628c6e5ba51e15fd8
parent2368ffd9efb9ae6f56266ca7dbacc0772701a6a7 (diff)
downloadgitlab-ce-481040e2295bbb655673752a7b4c90622eb3ccb8.tar.gz
Remove nicescroll from job trace
-rw-r--r--app/assets/javascripts/build.js52
-rw-r--r--app/assets/stylesheets/pages/builds.scss28
-rw-r--r--app/views/projects/jobs/show.html.haml27
3 files changed, 59 insertions, 48 deletions
diff --git a/app/assets/javascripts/build.js b/app/assets/javascripts/build.js
index 3b2bb6f082f..d80b7f5bd42 100644
--- a/app/assets/javascripts/build.js
+++ b/app/assets/javascripts/build.js
@@ -20,6 +20,7 @@ window.Build = (function () {
this.$document = $(document);
this.logBytes = 0;
this.scrollOffsetPadding = 30;
+ this.hasBeenScrolled = false;
this.updateDropdown = this.updateDropdown.bind(this);
this.getBuildTrace = this.getBuildTrace.bind(this);
@@ -62,6 +63,15 @@ window.Build = (function () {
.off('click')
.on('click', this.scrollToBottom.bind(this));
+ const scrollThrottled = _.throttle(this.toggleScroll.bind(this), 100);
+
+ this.$scrollContainer
+ .off('scroll')
+ .on('scroll', () => {
+ this.hasBeenScrolled = true;
+ scrollThrottled();
+ });
+
$(window)
.off('resize.build')
.on('resize.build', _.throttle(this.sidebarOnResize.bind(this), 100));
@@ -70,25 +80,16 @@ window.Build = (function () {
// eslint-disable-next-line
this.getBuildTrace()
- .then(() => this.makeTraceScrollable())
- .then(() => this.scrollToBottom());
+ .then(() => this.toggleScroll())
+ .then(() => {
+ if (!this.hasBeenScrolled) {
+ this.scrollToBottom();
+ }
+ });
this.verifyTopPosition();
}
- Build.prototype.makeTraceScrollable = function () {
- this.$scrollContainer.niceScroll({
- cursorcolor: '#fff',
- cursoropacitymin: 1,
- cursorwidth: '7px',
- railpadding: { top: 5, bottom: 5, right: 5 },
- });
-
- this.$scrollContainer.on('scroll', _.throttle(this.toggleScroll.bind(this), 100));
-
- this.toggleScroll();
- };
-
Build.prototype.canScroll = function () {
return (this.$scrollContainer.prop('scrollHeight') - this.scrollOffsetPadding) > this.$scrollContainer.height();
};
@@ -104,12 +105,11 @@ window.Build = (function () {
*
*/
Build.prototype.toggleScroll = function () {
- const bottomScroll = this.$scrollContainer.scrollTop() +
- this.scrollOffsetPadding +
- this.$scrollContainer.height();
+ const currentPosition = this.$scrollContainer.scrollTop();
+ const bottomScroll = currentPosition + this.$scrollContainer.innerHeight();
if (this.canScroll()) {
- if (this.$scrollContainer.scrollTop() === 0) {
+ if (currentPosition === 0) {
this.toggleDisableButton(this.$scrollTopBtn, true);
this.toggleDisableButton(this.$scrollBottomBtn, false);
} else if (bottomScroll === this.$scrollContainer.prop('scrollHeight')) {
@@ -123,12 +123,14 @@ window.Build = (function () {
};
Build.prototype.scrollToTop = function () {
- this.$scrollContainer.getNiceScroll(0).doScrollTop(0);
+ this.hasBeenScrolled = true;
+ this.$scrollContainer.scrollTop(0);
this.toggleScroll();
};
Build.prototype.scrollToBottom = function () {
- this.$scrollContainer.getNiceScroll(0).doScrollTo(this.$scrollContainer.prop('scrollHeight'));
+ this.hasBeenScrolled = true;
+ this.$scrollContainer.scrollTop(this.$scrollContainer.prop('scrollHeight'));
this.toggleScroll();
};
@@ -216,7 +218,11 @@ window.Build = (function () {
Build.timeout = setTimeout(() => {
//eslint-disable-next-line
this.getBuildTrace()
- .then(() => this.scrollToBottom());
+ .then(() => {
+ if (!this.hasBeenScrolled) {
+ this.scrollToBottom();
+ }
+ });
}, 4000);
} else {
this.$buildRefreshAnimation.remove();
@@ -253,7 +259,7 @@ window.Build = (function () {
this.verifyTopPosition();
- if (this.$scrollContainer.getNiceScroll(0)) {
+ if (this.canScroll()) {
this.toggleScroll();
}
};
diff --git a/app/assets/stylesheets/pages/builds.scss b/app/assets/stylesheets/pages/builds.scss
index e35558ad8e8..d931a78e112 100644
--- a/app/assets/stylesheets/pages/builds.scss
+++ b/app/assets/stylesheets/pages/builds.scss
@@ -71,7 +71,9 @@
height: 35px;
display: flex;
justify-content: flex-end;
- border-bottom: 1px outset $white-light;
+ background: $gray-light;
+ border: 1px solid $gray-normal;
+ color: $gl-text-color;
.truncated-info {
margin: 0 auto;
@@ -82,7 +84,7 @@
}
.raw-link {
- color: inherit;
+ color: $gl-text-color;
margin-left: 5px;
text-decoration: underline;
}
@@ -93,17 +95,25 @@
display: flex;
align-self: center;
font-size: 15px;
+ margin-bottom: 4px;
svg {
height: 15px;
display: block;
- fill: $white-light;
+ fill: $gl-text-color;
}
- a,
+ .controllers-buttons,
.btn-scroll {
- margin: 0 8px;
- color: $white-light;
+ color: $gl-text-color;
+ height: 15px;
+ vertical-align: middle;
+ padding: 0;
+ width: 12px;
+ }
+
+ .controllers-buttons {
+ margin: 1px 10px;
}
.btn-scroll.animate {
@@ -137,9 +147,9 @@
top: 35px;
left: 10px;
bottom: 0;
- overflow-y: hidden;
- padding-bottom: 20px;
- padding-right: 20px;
+ overflow-y: scroll;
+ overflow-x: hidden;
+ padding: 10px 20px 20px 5px;
}
.environment-information {
diff --git a/app/views/projects/jobs/show.html.haml b/app/views/projects/jobs/show.html.haml
index 0d10dfcef70..987068dc18e 100644
--- a/app/views/projects/jobs/show.html.haml
+++ b/app/views/projects/jobs/show.html.haml
@@ -66,29 +66,24 @@
.controllers
- if @build.has_trace?
= link_to raw_namespace_project_job_path(@project.namespace, @project, @build),
- title: 'Open raw trace',
+ title: 'Show complete raw',
data: { placement: 'top', container: 'body' },
- class: 'js-raw-link-controller has-tooltip' do
- = icon('download')
+ class: 'js-raw-link-controller has-tooltip controllers-buttons' do
+ = icon('file-text-o')
- if can?(current_user, :update_build, @project) && @build.erasable?
= link_to erase_namespace_project_job_path(@project.namespace, @project, @build),
method: :post,
data: { confirm: 'Are you sure you want to erase this build?', placement: 'top', container: 'body' },
- title: 'Erase Build',
- class: 'has-tooltip js-erase-link' do
+ title: 'Erase job log',
+ class: 'has-tooltip js-erase-link controllers-buttons' do
= icon('trash')
-
- %button.js-scroll-up.btn-scroll.btn-transparent.btn-blank.has-tooltip{ type: 'button',
- disabled: true,
- title: 'Scroll Up',
- data: { placement: 'top', container: 'body'} }
- = custom_icon('scroll_up')
- %button.js-scroll-down.btn-scroll.btn-transparent.btn-blank.has-tooltip{ type: 'button',
- disabled: true,
- title: 'Scroll Down',
- data: { placement: 'top', container: 'body'} }
- = custom_icon('scroll_down')
+ .has-tooltip.controllers-buttons{ title: 'Scroll to top', data: { placement: 'top', container: 'body'} }
+ %button.js-scroll-up.btn-scroll.btn-transparent.btn-blank{ type: 'button', disabled: true }
+ = custom_icon('scroll_up')
+ .has-tooltip.controllers-buttons{ title: 'Scroll to bottom', data: { placement: 'top', container: 'body'} }
+ %button.js-scroll-down.btn-scroll.btn-transparent.btn-blank{ type: 'button', disabled: true }
+ = custom_icon('scroll_down')
.bash.sticky.js-scroll-container
%code.js-build-output
.build-loader-animation.js-build-refresh