Skip to content

Commit

Permalink
copy update and test update
Browse files Browse the repository at this point in the history
  • Loading branch information
jloleysens committed Jan 15, 2021
1 parent 64878d3 commit 80ee68f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ describe('Conversion of absolute policy timing to relative timing', () => {
)
).toEqual({
total: 'Forever',
hot: 'At least 30 days',
warm: 'At least 4 days',
hot: '30 days',
warm: '4 days',
cold: 'Forever',
});
});
Expand All @@ -349,7 +349,7 @@ describe('Conversion of absolute policy timing to relative timing', () => {
},
})
)
).toEqual({ total: 'Forever', hot: 'At least 34 days', warm: undefined, cold: 'Forever' });
).toEqual({ total: 'Forever', hot: '34 days', warm: undefined, cold: 'Forever' });
});
});

Expand All @@ -372,8 +372,8 @@ describe('Conversion of absolute policy timing to relative timing', () => {
})
)
).toEqual({
total: 'At least 30 days',
hot: 'At least 30 days',
total: '30 days',
hot: '30 days',
warm: undefined,
cold: undefined,
});
Expand Down Expand Up @@ -401,9 +401,9 @@ describe('Conversion of absolute policy timing to relative timing', () => {
})
)
).toEqual({
total: 'At least 30 days',
hot: 'At least 24 days',
warm: 'At least 6 days',
total: '30 days',
hot: '24 days',
warm: '6 days',
cold: undefined,
});
});
Expand Down Expand Up @@ -434,9 +434,9 @@ describe('Conversion of absolute policy timing to relative timing', () => {
})
)
).toEqual({
total: 'At least 61 days',
hot: 'At least 24 days',
warm: 'At least 37 days',
total: '61 days',
hot: '24 days',
warm: '37 days',
cold: 'Less than a day',
});
});
Expand All @@ -463,8 +463,8 @@ describe('Conversion of absolute policy timing to relative timing', () => {
})
)
).toEqual({
total: 'At least 61 days',
hot: 'At least 61 days',
total: '61 days',
hot: '61 days',
warm: undefined,
cold: 'Less than a day',
});
Expand Down Expand Up @@ -496,8 +496,8 @@ describe('Conversion of absolute policy timing to relative timing', () => {
})
)
).toEqual({
total: 'At least 61 days',
hot: 'At least 61 days',
total: '61 days',
hot: '61 days',
warm: 'Less than a day',
cold: 'Less than a day',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ const getPhaseMinAgeInMilliseconds = (phase: { min_age: string }): number => {
let milliseconds: number;
const { units, size } = splitSizeAndUnits(phase.min_age);
if (units === 'micros') {
milliseconds = parseInt(size, 10) * 1e3;
milliseconds = parseInt(size, 10) / 1e3;
} else if (units === 'nanos') {
milliseconds = parseInt(size, 10) * 1e6;
milliseconds = parseInt(size, 10) / 1e6;
} else {
milliseconds = moment.duration(size, units as any).asMilliseconds();
}
Expand Down Expand Up @@ -161,13 +161,7 @@ const millisecondsToDays = (milliseconds?: number): string | undefined => {
const days = milliseconds / 8.64e7;
return days < 1
? i18nTexts.lessThanADay
: i18n.translate('xpack.indexLifecycleMgmt.relativeTiming.amountOfDays', {
defaultMessage: 'At least {amount} {plurualisedDay}',
values: {
amount: Math.floor(days),
plurualisedDay: days === 1 ? i18nTexts.day : i18nTexts.days,
},
});
: `${Math.floor(days)} ${days === 1 ? i18nTexts.day : i18nTexts.days}`;
};

export const normalizeTimingsToHumanReadable = ({
Expand Down

0 comments on commit 80ee68f

Please sign in to comment.