in packages/eui/src/components/date_picker/auto_refresh/refresh_interval.tsx [162:224]
refreshInterval: toMilliseconds(units, value),
intervalUnits: units,
isPaused: false,
});
}
};
handleKeyDown: KeyboardEventHandler<HTMLElement> = ({ key }) => {
if (key === 'Enter') {
this.startRefresh();
}
};
applyRefreshInterval = () => {
const { onRefreshChange, isPaused, minInterval } = this.props;
const { units, value } = this.state;
if (value === '') {
return;
}
if (!onRefreshChange) {
return;
}
const refreshInterval = Math.max(
toMilliseconds(units, value),
minInterval || 0
);
onRefreshChange({
refreshInterval,
intervalUnits: units,
isPaused: refreshInterval <= 0 ? true : !!isPaused,
});
};
toggleRefresh = () => {
const { onRefreshChange, isPaused } = this.props;
const { units, value } = this.state;
if (!onRefreshChange || value === '') {
return;
}
onRefreshChange({
refreshInterval: toMilliseconds(units, value),
intervalUnits: units,
isPaused: !isPaused,
});
};
renderScreenReaderText = (
refreshUnitsOptions: TimeOptions['refreshUnitsOptions']
) => {
const { isPaused } = this.props;
const { value, units } = this.state;
const options = refreshUnitsOptions.find(({ value }) => value === units);
const optionText = options ? options.text : '';
const fullDescription = isPaused ? (
<EuiI18n
token="euiRefreshInterval.fullDescriptionOff"
default="Refresh is off, interval set to {optionValue} {optionText}."
values={{