Merge branch '59232-add-storage-counter-ce' into 'master'
CE backport for Storage Counter changes Closes #59232 See merge request gitlab-org/gitlab-ce!29206
This commit is contained in:
commit
7d47ec540d
3 changed files with 25 additions and 1 deletions
|
@ -51,6 +51,7 @@ export default class LinkedTabs {
|
||||||
|
|
||||||
this.defaultAction = this.options.defaultAction;
|
this.defaultAction = this.options.defaultAction;
|
||||||
this.action = this.options.action || this.defaultAction;
|
this.action = this.options.action || this.defaultAction;
|
||||||
|
this.hashedTabs = this.options.hashedTabs || false;
|
||||||
|
|
||||||
if (this.action === 'show') {
|
if (this.action === 'show') {
|
||||||
this.action = this.defaultAction;
|
this.action = this.defaultAction;
|
||||||
|
@ -58,6 +59,10 @@ export default class LinkedTabs {
|
||||||
|
|
||||||
this.currentLocation = window.location;
|
this.currentLocation = window.location;
|
||||||
|
|
||||||
|
if (this.hashedTabs) {
|
||||||
|
this.action = this.currentLocation.hash || this.action;
|
||||||
|
}
|
||||||
|
|
||||||
const tabSelector = `${this.options.parentEl} a[data-toggle="tab"]`;
|
const tabSelector = `${this.options.parentEl} a[data-toggle="tab"]`;
|
||||||
|
|
||||||
// since this is a custom event we need jQuery :(
|
// since this is a custom event we need jQuery :(
|
||||||
|
@ -91,7 +96,9 @@ export default class LinkedTabs {
|
||||||
|
|
||||||
copySource.replace(/\/+$/, '');
|
copySource.replace(/\/+$/, '');
|
||||||
|
|
||||||
const newState = `${copySource}${this.currentLocation.search}${this.currentLocation.hash}`;
|
const newState = this.hashedTabs
|
||||||
|
? copySource
|
||||||
|
: `${copySource}${this.currentLocation.search}${this.currentLocation.hash}`;
|
||||||
|
|
||||||
window.history.replaceState(
|
window.history.replaceState(
|
||||||
{
|
{
|
||||||
|
|
|
@ -100,3 +100,9 @@ export function numberToHumanSize(size) {
|
||||||
* @returns {Float} The summed value
|
* @returns {Float} The summed value
|
||||||
*/
|
*/
|
||||||
export const sum = (a = 0, b = 0) => a + b;
|
export const sum = (a = 0, b = 0) => a + b;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the provided number is odd
|
||||||
|
* @param {Int} number
|
||||||
|
*/
|
||||||
|
export const isOdd = (number = 0) => number % 2;
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
bytesToGiB,
|
bytesToGiB,
|
||||||
numberToHumanSize,
|
numberToHumanSize,
|
||||||
sum,
|
sum,
|
||||||
|
isOdd,
|
||||||
} from '~/lib/utils/number_utils';
|
} from '~/lib/utils/number_utils';
|
||||||
|
|
||||||
describe('Number Utils', () => {
|
describe('Number Utils', () => {
|
||||||
|
@ -98,4 +99,14 @@ describe('Number Utils', () => {
|
||||||
expect([1, 2, 3, 4, 5].reduce(sum)).toEqual(15);
|
expect([1, 2, 3, 4, 5].reduce(sum)).toEqual(15);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('isOdd', () => {
|
||||||
|
it('should return 0 with a even number', () => {
|
||||||
|
expect(isOdd(2)).toEqual(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return 1 with a odd number', () => {
|
||||||
|
expect(isOdd(1)).toEqual(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue