mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 06:22:56 +08:00

* Update the generator to include version * Add versioned APIs * Update imports * Prettier
32 lines
802 B
TypeScript
32 lines
802 B
TypeScript
import { Trans } from '@grafana/i18n';
|
|
import { Button, Spinner } from '@grafana/ui';
|
|
import { Repository, useCreateRepositoryTestMutation } from 'app/api/clients/provisioning/v0alpha1';
|
|
|
|
interface Props {
|
|
repository: Repository;
|
|
}
|
|
|
|
export function CheckRepository({ repository }: Props) {
|
|
const [testRepo, testQuery] = useCreateRepositoryTestMutation();
|
|
const name = repository.metadata?.name;
|
|
|
|
const onClick = () => {
|
|
if (!name) {
|
|
return;
|
|
}
|
|
testRepo({ name, body: {} });
|
|
};
|
|
|
|
if (testQuery.isLoading) {
|
|
return <Spinner />;
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<Button icon="check-circle" variant={'secondary'} disabled={testQuery.isLoading || !name} onClick={onClick}>
|
|
<Trans i18nKey="provisioning.check-repository.check">Check</Trans>
|
|
</Button>
|
|
</>
|
|
);
|
|
}
|