Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ NOTE: As semantic versioning states all 0.y.z releases can contain breaking chan
- [#192](https://github.com/kobsio/kobs/pull/192): [clickhouse] Add options to download aggregation results as `.csv` file.
- [#193](https://github.com/kobsio/kobs/pull/193): [elasticsearch] Adjust selected time range via logs chart and allow filtering via fields.
- [#201](https://github.com/kobsio/kobs/pull/201): [sonarqube] Add SonarQube plugin to view projects and their measures within kobs.
- [#202](https://github.com/kobsio/kobs/pull/202): [core] Add tooltip to refresh button to show selected time interval.

### Fixed

Expand Down
23 changes: 20 additions & 3 deletions plugins/core/src/components/misc/Options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
SimpleList,
SimpleListItem,
TextInput,
Tooltip,
TooltipPosition,
} from '@patternfly/react-core';
import React, { useEffect, useState } from 'react';
import { RedoIcon } from '@patternfly/react-icons';
Expand Down Expand Up @@ -186,6 +188,19 @@ export const Options: React.FunctionComponent<IOptionsProps> = ({
);
};

const refreshTimesTooltip = (): React.ReactNode => {
const timeDiff = timeEnd - timeStart;
const time = Object.keys(times)
.map((key) => times[key])
.filter((time) => time.seconds === timeDiff);

if (time.length === 1) {
return <div>{time[0].label}</div>;
}

return <div>Custom</div>;
};

// useEffect is used to update the UI, every time a property changes.
useEffect(() => {
setInternalAdditionalFields(additionalFields);
Expand All @@ -199,9 +214,11 @@ export const Options: React.FunctionComponent<IOptionsProps> = ({
{formatTime(timeStart)} to {formatTime(timeEnd)}
</Button>

<Button variant={ButtonVariant.control} onClick={refreshTimes}>
<RedoIcon />
</Button>
<Tooltip position={TooltipPosition.left} content={refreshTimesTooltip()}>
<Button variant={ButtonVariant.control} onClick={refreshTimes}>
<RedoIcon />
</Button>
</Tooltip>

<Modal
title="Options"
Expand Down