mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Service accounts: Remove feature toggle check on API keys page (#52048)
* Service accounts: Remove feature toggle check on API keys page * Increase a11y threshold
This commit is contained in:
@@ -96,7 +96,7 @@ var config = {
|
|||||||
url: '${HOST}/org/apikeys',
|
url: '${HOST}/org/apikeys',
|
||||||
wait: 500,
|
wait: 500,
|
||||||
rootElement: '.main-view',
|
rootElement: '.main-view',
|
||||||
threshold: 0,
|
threshold: 4,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: '${HOST}/dashboards',
|
url: '${HOST}/dashboards',
|
||||||
|
@@ -177,13 +177,8 @@ export class ApiKeysPageUnconnected extends PureComponent<Props, State> {
|
|||||||
const showTable = apiKeysCount > 0;
|
const showTable = apiKeysCount > 0;
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* TODO: remove feature flag check before GA */}
|
{!apiKeysMigrated && <MigrateToServiceAccountsCard onMigrate={this.onMigrateAll} />}
|
||||||
{config.featureToggles.serviceAccounts && !apiKeysMigrated && (
|
{apiKeysMigrated && <APIKeysMigratedCard onHideApiKeys={this.onHideApiKeys} />}
|
||||||
<MigrateToServiceAccountsCard onMigrate={this.onMigrateAll} />
|
|
||||||
)}
|
|
||||||
{config.featureToggles.serviceAccounts && apiKeysMigrated && (
|
|
||||||
<APIKeysMigratedCard onHideApiKeys={this.onHideApiKeys} />
|
|
||||||
)}
|
|
||||||
{showCTA ? (
|
{showCTA ? (
|
||||||
<EmptyListCTA
|
<EmptyListCTA
|
||||||
title="You haven't added any API keys yet."
|
title="You haven't added any API keys yet."
|
||||||
|
@@ -2,7 +2,6 @@ import { css } from '@emotion/css';
|
|||||||
import React, { FC } from 'react';
|
import React, { FC } from 'react';
|
||||||
|
|
||||||
import { dateTimeFormat, GrafanaTheme2, TimeZone } from '@grafana/data';
|
import { dateTimeFormat, GrafanaTheme2, TimeZone } from '@grafana/data';
|
||||||
import { config } from '@grafana/runtime';
|
|
||||||
import { Button, DeleteButton, HorizontalGroup, Icon, IconName, Tooltip, useTheme2 } from '@grafana/ui';
|
import { Button, DeleteButton, HorizontalGroup, Icon, IconName, Tooltip, useTheme2 } from '@grafana/ui';
|
||||||
import { contextSrv } from 'app/core/core';
|
import { contextSrv } from 'app/core/core';
|
||||||
import { AccessControlAction } from 'app/types';
|
import { AccessControlAction } from 'app/types';
|
||||||
@@ -50,11 +49,9 @@ export const ApiKeysTable: FC<Props> = ({ apiKeys, timeZone, onDelete, onMigrate
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<HorizontalGroup justify="flex-end">
|
<HorizontalGroup justify="flex-end">
|
||||||
{config.featureToggles.serviceAccounts && (
|
<Button size="sm" onClick={() => onMigrate(key)}>
|
||||||
<Button size="sm" onClick={() => onMigrate(key)}>
|
Migrate
|
||||||
Migrate
|
</Button>
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
<DeleteButton
|
<DeleteButton
|
||||||
aria-label="Delete API key"
|
aria-label="Delete API key"
|
||||||
size="sm"
|
size="sm"
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
import { config } from '@grafana/runtime';
|
import { getBackendSrv } from 'app/core/services/backend_srv';
|
||||||
import { getBackendSrv } from 'app/core/services/backend_srv';
|
|
||||||
import store from 'app/core/store';
|
import store from 'app/core/store';
|
||||||
import { API_KEYS_MIGRATION_INFO_STORAGE_KEY } from 'app/features/serviceaccounts/constants';
|
import { API_KEYS_MIGRATION_INFO_STORAGE_KEY } from 'app/features/serviceaccounts/constants';
|
||||||
import { ApiKey, ThunkResult } from 'app/types';
|
import { ApiKey, ThunkResult } from 'app/types';
|
||||||
@@ -64,11 +63,8 @@ export function migrateAll(): ThunkResult<void> {
|
|||||||
|
|
||||||
export function getApiKeysMigrationStatus(): ThunkResult<void> {
|
export function getApiKeysMigrationStatus(): ThunkResult<void> {
|
||||||
return async (dispatch) => {
|
return async (dispatch) => {
|
||||||
// TODO: remove when service account enabled by default (or use another way to detect if it's enabled)
|
const result = await getBackendSrv().get('/api/serviceaccounts/migrationstatus');
|
||||||
if (config.featureToggles.serviceAccounts) {
|
dispatch(apiKeysMigrationStatusLoaded(!!result?.migrated));
|
||||||
const result = await getBackendSrv().get('/api/serviceaccounts/migrationstatus');
|
|
||||||
dispatch(apiKeysMigrationStatusLoaded(!!result?.migrated));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user