mirror of
https://github.com/grafana/grafana.git
synced 2025-02-10 23:55:47 -06:00
* ServiceAccounts: able to get upgrade status * Banner with API keys migration info * Show API keys migration info on Service accounts page * Migrate individual API keys * Use transaction for key migration * Migrate all api keys to service accounts * Hide api keys after migration * Migrate API keys separately for each org * Revert API key * Revert key API method * Rename migration actions and reducers * Fix linter errors * Tests for migrating single API key * Tests for migrating all api keys * More tests * Fix reverting tokens * API: rename convert to migrate * Add api route descriptions to methods * rearrange methods in api.go * Refactor: rename and move some methods * Prevent assigning tokens to non-existing service accounts * Refactor: ID TO Id * Refactor: fix error message * Delete service account if migration failed * Fix linter errors
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { css } from '@emotion/css';
|
|
import React from 'react';
|
|
|
|
import { GrafanaTheme2 } from '@grafana/data';
|
|
import { Alert, Button, useStyles2 } from '@grafana/ui';
|
|
|
|
interface Props {
|
|
onMigrate: () => void;
|
|
disabled?: boolean;
|
|
}
|
|
|
|
export const MigrateToServiceAccountsCard = ({ onMigrate, disabled }: Props): JSX.Element => {
|
|
const styles = useStyles2(getStyles);
|
|
|
|
return (
|
|
<Alert title="Switch from API keys to Service accounts" severity="info">
|
|
<div className={styles.text}>
|
|
Service accounts give you more control. API keys will be automatically migrated into tokens inside respective
|
|
service accounts. The current API keys will still work, but will be called tokens and you will find them in the
|
|
detail view of a respective service account.
|
|
</div>
|
|
<div className={styles.actionRow}>
|
|
{!disabled && (
|
|
<Button className={styles.actionButton} onClick={onMigrate}>
|
|
Migrate now
|
|
</Button>
|
|
)}
|
|
<span>Read more about Service accounts and how to turn them on</span>
|
|
</div>
|
|
</Alert>
|
|
);
|
|
};
|
|
|
|
export const getStyles = (theme: GrafanaTheme2) => ({
|
|
text: css`
|
|
margin-bottom: ${theme.spacing(2)};
|
|
`,
|
|
actionRow: css`
|
|
display: flex;
|
|
align-items: center;
|
|
`,
|
|
actionButton: css`
|
|
margin-right: ${theme.spacing(2)};
|
|
`,
|
|
});
|