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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
4b2ff003
Commit
4b2ff003
authored
Apr 16, 2018
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable try again button while fetching the API
parent
8f189df8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
3 deletions
+35
-3
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+14
-2
app/assets/stylesheets/pages/merge_requests.scss
app/assets/stylesheets/pages/merge_requests.scss
+20
-0
app/views/discussions/_diff_with_notes.html.haml
app/views/discussions/_diff_with_notes.html.haml
+1
-1
No files found.
app/assets/javascripts/notes.js
View file @
4b2ff003
...
@@ -197,7 +197,7 @@ export default class Notes {
...
@@ -197,7 +197,7 @@ export default class Notes {
);
);
this
.
$wrapperEl
.
on
(
'
click
'
,
'
.js-toggle-lazy-diff
'
,
this
.
loadLazyDiff
);
this
.
$wrapperEl
.
on
(
'
click
'
,
'
.js-toggle-lazy-diff
'
,
this
.
loadLazyDiff
);
this
.
$wrapperEl
.
on
(
'
click
'
,
'
.js-toggle-lazy-diff-retry-button
'
,
this
.
loadLazyDiff
);
this
.
$wrapperEl
.
on
(
'
click
'
,
'
.js-toggle-lazy-diff-retry-button
'
,
this
.
onClickRetryLazyLoad
.
bind
(
this
)
);
// fetch notes when tab becomes visible
// fetch notes when tab becomes visible
this
.
$wrapperEl
.
on
(
'
visibilitychange
'
,
this
.
visibilityChange
);
this
.
$wrapperEl
.
on
(
'
visibilitychange
'
,
this
.
visibilityChange
);
...
@@ -1433,6 +1433,17 @@ export default class Notes {
...
@@ -1433,6 +1433,17 @@ export default class Notes {
syntaxHighlight
(
fileHolder
);
syntaxHighlight
(
fileHolder
);
}
}
onClickRetryLazyLoad
(
e
)
{
const
$retryButton
=
$
(
e
.
currentTarget
);
$retryButton
.
prop
(
'
disabled
'
,
true
);
return
this
.
loadLazyDiff
(
e
)
.
then
(()
=>
{
$retryButton
.
prop
(
'
disabled
'
,
false
);
});
}
loadLazyDiff
(
e
)
{
loadLazyDiff
(
e
)
{
const
$container
=
$
(
e
.
currentTarget
).
closest
(
'
.js-toggle-container
'
);
const
$container
=
$
(
e
.
currentTarget
).
closest
(
'
.js-toggle-container
'
);
Notes
.
renderPlaceholderComponent
(
$container
);
Notes
.
renderPlaceholderComponent
(
$container
);
...
@@ -1453,7 +1464,7 @@ export default class Notes {
...
@@ -1453,7 +1464,7 @@ export default class Notes {
* Unresolved discussions don't have an endpoint being provided.
* Unresolved discussions don't have an endpoint being provided.
*/
*/
if
(
url
)
{
if
(
url
)
{
axios
return
axios
.
get
(
url
)
.
get
(
url
)
.
then
(({
data
})
=>
{
.
then
(({
data
})
=>
{
// Reset state in case last request returned error
// Reset state in case last request returned error
...
@@ -1467,6 +1478,7 @@ export default class Notes {
...
@@ -1467,6 +1478,7 @@ export default class Notes {
$errorContainer
.
removeClass
(
'
hidden
'
);
$errorContainer
.
removeClass
(
'
hidden
'
);
});
});
}
}
return
Promise
.
resolve
();
}
}
toggleCommitList
(
e
)
{
toggleCommitList
(
e
)
{
...
...
app/assets/stylesheets/pages/merge_requests.scss
View file @
4b2ff003
...
@@ -762,3 +762,23 @@
...
@@ -762,3 +762,23 @@
max-width
:
100%
;
max-width
:
100%
;
}
}
}
}
// Hack alert: we've rewritten `btn` class in a way that
// we've broken it and it is not possible to use with `btn-link`
// wich causes a blank button when it's disabled and hovering
// The css in here is the boostrap one
.btn-link-retry
{
&
[
disabled
]
{
cursor
:
not
-
allowed
;
filter
:
alpha
(
opacity
=
65
);
-webkit-box-shadow
:
none
;
box-shadow
:
none
;
opacity
:
.65
;
&
:hover
{
color
:
#777
;
text-decoration
:
none
;
}
}
}
\ No newline at end of file
app/views/discussions/_diff_with_notes.html.haml
View file @
4b2ff003
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
%td
.line_content.js-success-lazy-load
%td
.line_content.js-success-lazy-load
.js-code-placeholder
.js-code-placeholder
%td
.line_content.js-error-lazy-load-diff.hidden
%td
.line_content.js-error-lazy-load-diff.hidden
-
button
=
button_tag
(
_
(
"Try again"
),
class:
"btn-link btn-no-padding js-toggle-lazy-diff-retry-button"
)
-
button
=
button_tag
(
_
(
"Try again"
),
class:
"btn-link btn-
link-retry btn-
no-padding js-toggle-lazy-diff-retry-button"
)
=
_
(
"Unable to load the diff. %{button_try_again}"
).
html_safe
%
{
button_try_again:
button
}
=
_
(
"Unable to load the diff. %{button_try_again}"
).
html_safe
%
{
button_try_again:
button
}
=
render
"discussions/diff_discussion"
,
discussions:
[
discussion
],
expanded:
true
=
render
"discussions/diff_discussion"
,
discussions:
[
discussion
],
expanded:
true
-
else
-
else
...
...
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