diff options
author | Phil Hughes <me@iamphill.com> | 2018-01-26 15:04:44 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-01-29 09:06:58 +0000 |
commit | cf4fb53f560721ff6c5713886132d6678a62673d (patch) | |
tree | 2a4c99b3d53f33727d2e011af92502d0db38d99a /app/assets/javascripts | |
parent | c49fecdea5c3e638986be6f683f169bcaa2f973b (diff) | |
download | gitlab-ce-cf4fb53f560721ff6c5713886132d6678a62673d.tar.gz |
normalize headers correctly
i18n flash message
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r-- | app/assets/javascripts/compare.js | 2 | ||||
-rw-r--r-- | app/assets/javascripts/compare_autocomplete.js | 3 | ||||
-rw-r--r-- | app/assets/javascripts/groups/groups_filterable_list.js | 13 |
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)); } } |