Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
dfd15697
Commit
dfd15697
authored
8 years ago
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor build log scroll button logic to prevent icon overlaps
parent
3ed1f6dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
11 deletions
+16
-11
app/assets/javascripts/build.js
app/assets/javascripts/build.js
+16
-11
No files found.
app/assets/javascripts/build.js
View file @
dfd15697
...
...
@@ -28,6 +28,7 @@
this
.
$downBuildTrace
=
$
(
'
#down-build-trace
'
);
this
.
$scrollTopBtn
=
$
(
'
#scroll-top
'
);
this
.
$scrollBottomBtn
=
$
(
'
#scroll-bottom
'
);
this
.
$buildRefreshAnimation
=
$
(
'
.js-build-refresh
'
);
clearInterval
(
Build
.
interval
);
// Init breakpoint checker
...
...
@@ -91,7 +92,7 @@
$
(
'
.js-build-output
'
).
html
(
buildData
.
trace_html
);
if
(
removeRefreshStatuses
.
indexOf
(
buildData
.
status
)
>=
0
)
{
this
.
initScrollMonitor
();
return
$
(
'
.js-build-refresh
'
)
.
remove
();
return
this
.
$buildRefreshAnimation
.
remove
();
}
}.
bind
(
this
)
});
...
...
@@ -157,23 +158,27 @@
// - Show Bottom Arrow button
// - Disable Autoscroll and hide indicator (when build is running)
Build
.
prototype
.
initScrollMonitor
=
function
()
{
if
(
gl
.
utils
.
isInViewport
(
this
.
$upBuildTrace
[
0
]))
{
// User is at Top
of Build Log
this
.
$scrollTopBtn
.
hide
();
if
(
!
gl
.
utils
.
isInViewport
(
this
.
$upBuildTrace
[
0
])
&&
!
gl
.
utils
.
isInViewport
(
this
.
$downBuildTrace
[
0
]))
{
// User is somewhere in middle
of Build Log
this
.
$scrollTopBtn
.
show
();
this
.
$scrollBottomBtn
.
show
();
}
if
(
gl
.
utils
.
isInViewport
(
this
.
$downBuildTrace
[
0
]))
{
// User is at Bottom of Build Log
// Hide Autoscroll Status Indicator
this
.
$autoScrollContainer
.
hide
();
this
.
$autoScrollStatusText
.
removeClass
(
'
animate
'
);
}
else
if
(
gl
.
utils
.
isInViewport
(
this
.
$upBuildTrace
[
0
])
&&
!
gl
.
utils
.
isInViewport
(
this
.
$downBuildTrace
[
0
]))
{
// User is at Top of Build Log
this
.
$scrollTopBtn
.
hide
();
this
.
$scrollBottomBtn
.
show
();
}
else
if
((
!
gl
.
utils
.
isInViewport
(
this
.
$upBuildTrace
[
0
])
&&
gl
.
utils
.
isInViewport
(
this
.
$downBuildTrace
[
0
]))
||
gl
.
utils
.
isInViewport
(
this
.
$buildRefreshAnimation
[
0
]))
{
// User is at Bottom of Build Log
this
.
$scrollTopBtn
.
show
();
this
.
$scrollBottomBtn
.
hide
();
// Show and Reposition Autoscroll Status Indicator
this
.
$autoScrollContainer
.
css
({
top
:
this
.
$body
.
outerHeight
()
-
75
}).
fadeIn
(
100
);
this
.
$autoScrollStatusText
.
addClass
(
'
animate
'
);
}
if
(
!
gl
.
utils
.
isInViewport
(
this
.
$upBuildTrace
[
0
])
&&
!
gl
.
utils
.
isInViewport
(
this
.
$downBuildTrace
[
0
]))
{
// User is somewhere in middle of Build Log
this
.
$scrollTopBtn
.
show
();
this
.
$scrollBottomBtn
.
show
();
}
else
if
(
gl
.
utils
.
isInViewport
(
this
.
$upBuildTrace
[
0
])
&&
gl
.
utils
.
isInViewport
(
this
.
$downBuildTrace
[
0
]))
{
// Build Log height is small
this
.
$scrollTopBtn
.
hide
();
this
.
$scrollBottomBtn
.
hide
();
// Hide Autoscroll Status Indicator
this
.
$autoScrollContainer
.
hide
();
...
...
@@ -182,7 +187,7 @@
if
(
this
.
buildStatus
===
"
running
"
||
this
.
buildStatus
===
"
pending
"
)
{
// Check if Refresh Animation is in Viewport and enable Autoscroll, disable otherwise.
this
.
$autoScrollStatus
.
data
(
"
state
"
,
gl
.
utils
.
isInViewport
(
$
(
'
.js-build-refresh
'
)
[
0
])
?
'
enabled
'
:
'
disabled
'
);
this
.
$autoScrollStatus
.
data
(
"
state
"
,
gl
.
utils
.
isInViewport
(
this
.
$buildRefreshAnimation
[
0
])
?
'
enabled
'
:
'
disabled
'
);
}
};
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment