hide the version check image if internet connection is broken
This commit is contained in:
parent
8c0e358a97
commit
d5f34b3771
4 changed files with 19 additions and 1 deletions
|
@ -261,6 +261,9 @@
|
||||||
case 'projects:artifacts:browse':
|
case 'projects:artifacts:browse':
|
||||||
new BuildArtifacts();
|
new BuildArtifacts();
|
||||||
break;
|
break;
|
||||||
|
case 'help:index':
|
||||||
|
gl.VersionCheckImage.bindErrorEvent($('img.js-version-status-badge'));
|
||||||
|
break;
|
||||||
case 'search:show':
|
case 'search:show':
|
||||||
new Search();
|
new Search();
|
||||||
break;
|
break;
|
||||||
|
|
10
app/assets/javascripts/version_check_image.js.es6
Normal file
10
app/assets/javascripts/version_check_image.js.es6
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
(() => {
|
||||||
|
class VersionCheckImage {
|
||||||
|
static bindErrorEvent(imageElement) {
|
||||||
|
imageElement.off('error').on('error', () => imageElement.hide());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.gl = window.gl || {};
|
||||||
|
gl.VersionCheckImage = VersionCheckImage;
|
||||||
|
})();
|
|
@ -1,7 +1,8 @@
|
||||||
module VersionCheckHelper
|
module VersionCheckHelper
|
||||||
def version_status_badge
|
def version_status_badge
|
||||||
if Rails.env.production? && current_application_settings.version_check_enabled
|
if Rails.env.production? && current_application_settings.version_check_enabled
|
||||||
image_tag VersionCheck.new.url
|
image_url = VersionCheck.new.url
|
||||||
|
image_tag image_url, class: 'js-version-status-badge'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
title: Hide version check image if there is no internet connection
|
||||||
|
merge_request: 8355
|
||||||
|
author: Ken Ding
|
Loading…
Reference in a new issue