summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/main.js
diff options
context:
space:
mode:
authorLuke "Jared" Bennett <lbennett@gitlab.com>2017-04-08 19:13:45 +0100
committerLuke "Jared" Bennett <lbennett@gitlab.com>2017-04-08 19:33:44 +0100
commit53de8bcf7e1288fceb84f62bb2b603cf8b182fbd (patch)
treefa01ce94c5ce05467148d992402beedf2bd7b833 /app/assets/javascripts/main.js
parentdfa264df606e3943026c333c341c05d3d066ab24 (diff)
downloadgitlab-ce-add-promjs.tar.gz
Added prompusheradd-promjs
Diffstat (limited to 'app/assets/javascripts/main.js')
-rw-r--r--app/assets/javascripts/main.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js
index 3f92d4ee6cf..27776290f6e 100644
--- a/app/assets/javascripts/main.js
+++ b/app/assets/javascripts/main.js
@@ -11,6 +11,8 @@ import Pikaday from 'pikaday';
import Dropzone from 'dropzone';
import Sortable from 'vendor/Sortable';
+import PromPusher from './prom/prom_pusher';
+
// libraries with import side-effects
import 'mousetrap';
import 'mousetrap/plugins/pause/mousetrap-pause';
@@ -181,6 +183,11 @@ import './visibility_select';
import './wikis';
import './zen_mode';
+gon.gateway_endpoint = 'https://gatewayEndpoint'; // TEMPORARY
+PromPusher.init({
+ gatewayEndpoint: gon.gateway_endpoint,
+});
+
// eslint-disable-next-line global-require
if (process.env.NODE_ENV !== 'production') require('./test_utils/');
@@ -288,7 +295,15 @@ $(function () {
return buttons.enable();
}
});
+
+ $(document).ajaxSend(function (e, xhrObj, options) {
+ const xhr = xhrObj;
+ xhr.url = options.url;
+ });
+
$(document).ajaxError(function (e, xhrObj) {
+ if (xhrObj.url === gon.gateway_endpoint) return;
+
var ref = xhrObj.status;
if (xhrObj.status === 401) {
return new Flash('You need to be logged in.', 'alert');
@@ -296,6 +311,7 @@ $(function () {
return new Flash('Something went wrong on our end.', 'alert');
}
});
+
$('.account-box').hover(function () {
// Show/Hide the profile menu when hovering the account box
return $(this).toggleClass('hover');