summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-01-26 15:04:44 +0000
committerPhil Hughes <me@iamphill.com>2018-01-26 16:49:32 +0000
commite09c332de8b3e009e392b84fd2441c9395e36d93 (patch)
tree1b30c5111fce0229352e1b987d83f743b0bb74e0
parente73150907b0280f0a13f13d5e109c5a3569a7b85 (diff)
downloadgitlab-ce-ph-more-axios.tar.gz
normalize headers correctlyph-more-axios
i18n flash message
-rw-r--r--app/assets/javascripts/compare.js2
-rw-r--r--app/assets/javascripts/compare_autocomplete.js3
-rw-r--r--app/assets/javascripts/groups/groups_filterable_list.js13
3 files changed, 5 insertions, 13 deletions
diff --git a/app/assets/javascripts/compare.js b/app/assets/javascripts/compare.js
index 4c04fb40f31..e2a008e8904 100644
--- a/app/assets/javascripts/compare.js
+++ b/app/assets/javascripts/compare.js
@@ -77,7 +77,7 @@ export default class Compare {
}).then(({ data }) => {
loading.hide();
$target.html(data);
- var className = '.' + $target[0].className.replace(' ', '.');
+ const className = '.' + $target[0].className.replace(' ', '.');
localTimeAgo($('.js-timeago', className));
});
}
diff --git a/app/assets/javascripts/compare_autocomplete.js b/app/assets/javascripts/compare_autocomplete.js
index 0787400e862..59899e97be1 100644
--- a/app/assets/javascripts/compare_autocomplete.js
+++ b/app/assets/javascripts/compare_autocomplete.js
@@ -1,4 +1,5 @@
/* eslint-disable func-names, space-before-function-paren, one-var, no-var, one-var-declaration-per-line, object-shorthand, comma-dangle, prefer-arrow-callback, no-else-return, newline-per-chained-call, wrap-iife, max-len */
+import { __ } from './locale';
import axios from './lib/utils/axios_utils';
import flash from './flash';
@@ -19,7 +20,7 @@ export default function initCompareAutocomplete() {
},
}).then(({ data }) => {
callback(data);
- }).catch(() => flash('Error fetching refs'));
+ }).catch(() => flash(__('Error fetching refs')));
},
selectable: true,
filterable: true,
diff --git a/app/assets/javascripts/groups/groups_filterable_list.js b/app/assets/javascripts/groups/groups_filterable_list.js
index 3f65853508e..31d56d15c23 100644
--- a/app/assets/javascripts/groups/groups_filterable_list.js
+++ b/app/assets/javascripts/groups/groups_filterable_list.js
@@ -1,6 +1,6 @@
import FilterableList from '~/filterable_list';
import eventHub from './event_hub';
-import { getParameterByName } from '../lib/utils/common_utils';
+import { normalizeHeaders, getParameterByName } from '../lib/utils/common_utils';
export default class GroupFilterableList extends FilterableList {
constructor({ form, filter, holder, filterEndpoint, pagePath, dropdownSel, filterInputField }) {
@@ -97,20 +97,11 @@ export default class GroupFilterableList extends FilterableList {
onFilterSuccess(res, queryData) {
const currentPath = this.getPagePath(queryData);
- const paginationData = {
- 'X-Per-Page': res.headers['x-per-page'],
- 'X-Page': res.headers['x-page'],
- 'X-Total': res.headers['x-total'],
- 'X-Total-Pages': res.headers['x-total-pages'],
- 'X-Next-Page': res.headers['x-next-page'],
- 'X-Prev-Page': res.headers['x-prev-page'],
- };
-
window.history.replaceState({
page: currentPath,
}, document.title, currentPath);
eventHub.$emit('updateGroups', res.data, Object.prototype.hasOwnProperty.call(queryData, this.filterInputField));
- eventHub.$emit('updatePagination', paginationData);
+ eventHub.$emit('updatePagination', normalizeHeaders(res.headers));
}
}