Skip to content

Commit 32c2b62

Browse files
authored
Service accounts: Remove feature toggle check on API keys page (grafana#52048)
* Service accounts: Remove feature toggle check on API keys page * Increase a11y threshold
1 parent 1f3ff08 commit 32c2b62

File tree

4 files changed

+9
-21
lines changed

4 files changed

+9
-21
lines changed

.pa11yci-pr.conf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ var config = {
9696
url: '${HOST}/org/apikeys',
9797
wait: 500,
9898
rootElement: '.main-view',
99-
threshold: 0,
99+
threshold: 4,
100100
},
101101
{
102102
url: '${HOST}/dashboards',

public/app/features/api-keys/ApiKeysPage.tsx

+2-7
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,8 @@ export class ApiKeysPageUnconnected extends PureComponent<Props, State> {
177177
const showTable = apiKeysCount > 0;
178178
return (
179179
<>
180-
{/* TODO: remove feature flag check before GA */}
181-
{config.featureToggles.serviceAccounts && !apiKeysMigrated && (
182-
<MigrateToServiceAccountsCard onMigrate={this.onMigrateAll} />
183-
)}
184-
{config.featureToggles.serviceAccounts && apiKeysMigrated && (
185-
<APIKeysMigratedCard onHideApiKeys={this.onHideApiKeys} />
186-
)}
180+
{!apiKeysMigrated && <MigrateToServiceAccountsCard onMigrate={this.onMigrateAll} />}
181+
{apiKeysMigrated && <APIKeysMigratedCard onHideApiKeys={this.onHideApiKeys} />}
187182
{showCTA ? (
188183
<EmptyListCTA
189184
title="You haven't added any API keys yet."

public/app/features/api-keys/ApiKeysTable.tsx

+3-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { css } from '@emotion/css';
22
import React, { FC } from 'react';
33

44
import { dateTimeFormat, GrafanaTheme2, TimeZone } from '@grafana/data';
5-
import { config } from '@grafana/runtime';
65
import { Button, DeleteButton, HorizontalGroup, Icon, IconName, Tooltip, useTheme2 } from '@grafana/ui';
76
import { contextSrv } from 'app/core/core';
87
import { AccessControlAction } from 'app/types';
@@ -50,11 +49,9 @@ export const ApiKeysTable: FC<Props> = ({ apiKeys, timeZone, onDelete, onMigrate
5049
</td>
5150
<td>
5251
<HorizontalGroup justify="flex-end">
53-
{config.featureToggles.serviceAccounts && (
54-
<Button size="sm" onClick={() => onMigrate(key)}>
55-
Migrate
56-
</Button>
57-
)}
52+
<Button size="sm" onClick={() => onMigrate(key)}>
53+
Migrate
54+
</Button>
5855
<DeleteButton
5956
aria-label="Delete API key"
6057
size="sm"

public/app/features/api-keys/state/actions.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { config } from '@grafana/runtime';
2-
import { getBackendSrv } from 'app/core/services/backend_srv';
1+
import { getBackendSrv } from 'app/core/services/backend_srv';
32
import store from 'app/core/store';
43
import { API_KEYS_MIGRATION_INFO_STORAGE_KEY } from 'app/features/serviceaccounts/constants';
54
import { ApiKey, ThunkResult } from 'app/types';
@@ -64,11 +63,8 @@ export function migrateAll(): ThunkResult<void> {
6463

6564
export function getApiKeysMigrationStatus(): ThunkResult<void> {
6665
return async (dispatch) => {
67-
// TODO: remove when service account enabled by default (or use another way to detect if it's enabled)
68-
if (config.featureToggles.serviceAccounts) {
69-
const result = await getBackendSrv().get('/api/serviceaccounts/migrationstatus');
70-
dispatch(apiKeysMigrationStatusLoaded(!!result?.migrated));
71-
}
66+
const result = await getBackendSrv().get('/api/serviceaccounts/migrationstatus');
67+
dispatch(apiKeysMigrationStatusLoaded(!!result?.migrated));
7268
};
7369
}
7470

0 commit comments

Comments
 (0)