Commit cf4fb53f authored by Phil Hughes's avatar Phil Hughes

normalize headers correctly

i18n flash message
parent c49fecde
......@@ -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));
});
}
......
/* 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,
......
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));
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment