2021-01-19 13:19:01 +01:00
|
|
|
import React from 'react';
|
2022-04-22 14:33:13 +01:00
|
|
|
|
2022-10-24 17:12:36 +02:00
|
|
|
import { Stack } from '@grafana/experimental';
|
|
|
|
|
import { Tooltip, Button } from '@grafana/ui';
|
2021-01-19 13:19:01 +01:00
|
|
|
|
|
|
|
|
type VersionsButtonsType = {
|
|
|
|
|
hasMore: boolean;
|
|
|
|
|
canCompare: boolean;
|
|
|
|
|
getVersions: (append: boolean) => void;
|
2021-03-25 11:51:09 +01:00
|
|
|
getDiff: () => void;
|
2021-01-19 13:19:01 +01:00
|
|
|
isLastPage: boolean;
|
|
|
|
|
};
|
2023-03-15 07:56:09 -07:00
|
|
|
export const VersionsHistoryButtons = ({
|
2021-01-19 13:19:01 +01:00
|
|
|
hasMore,
|
|
|
|
|
canCompare,
|
|
|
|
|
getVersions,
|
|
|
|
|
getDiff,
|
|
|
|
|
isLastPage,
|
2023-03-15 07:56:09 -07:00
|
|
|
}: VersionsButtonsType) => (
|
2022-08-24 18:05:12 +02:00
|
|
|
<Stack>
|
2021-01-19 13:19:01 +01:00
|
|
|
{hasMore && (
|
|
|
|
|
<Button type="button" onClick={() => getVersions(true)} variant="secondary" disabled={isLastPage}>
|
|
|
|
|
Show more versions
|
|
|
|
|
</Button>
|
|
|
|
|
)}
|
2021-04-01 08:42:57 -07:00
|
|
|
<Tooltip content="Select two versions to start comparing" placement="bottom">
|
2022-05-24 08:51:37 +01:00
|
|
|
<Button type="button" disabled={!canCompare} onClick={getDiff} icon="code-branch">
|
2021-01-19 13:19:01 +01:00
|
|
|
Compare versions
|
|
|
|
|
</Button>
|
|
|
|
|
</Tooltip>
|
2022-08-24 18:05:12 +02:00
|
|
|
</Stack>
|
2021-01-19 13:19:01 +01:00
|
|
|
);
|