use navId and subtitle on api keys page (#54247)

This commit is contained in:
Leo 2022-08-26 09:28:17 +02:00 committed by GitHub
parent cd617b6520
commit e27769da9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 14 deletions

View File

@ -2,7 +2,6 @@ import { render, screen, within } from '@testing-library/react';
import userEvent, { PointerEventsCheckLevel } from '@testing-library/user-event';
import React from 'react';
import { NavModel } from '@grafana/data';
import { selectors } from '@grafana/e2e-selectors';
import { ApiKey, OrgRole } from 'app/types';
@ -33,14 +32,6 @@ const setup = (propOverrides: Partial<Props>) => {
const getApiKeysMigrationStatusMock = jest.fn();
const hideApiKeysMock = jest.fn();
const props: Props = {
navModel: {
main: {
text: 'Configuration',
},
node: {
text: 'Api Keys',
},
} as NavModel,
apiKeys: [] as ApiKey[],
searchQuery: '',
hasFetched: false,

View File

@ -10,7 +10,6 @@ import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA';
import { Page } from 'app/core/components/Page/Page';
import config from 'app/core/config';
import { contextSrv } from 'app/core/core';
import { getNavModel } from 'app/core/selectors/navModel';
import { getTimeZone } from 'app/features/profile/state/selectors';
import { AccessControlAction, ApiKey, NewApiKey, StoreState } from 'app/types';
import { ShowModalReactEvent } from 'app/types/events';
@ -39,7 +38,6 @@ function mapStateToProps(state: StoreState) {
const canCreate = contextSrv.hasAccess(AccessControlAction.ActionAPIKeysCreate, true);
return {
navModel: getNavModel(state.navIndex, 'apikeys'),
apiKeys: getApiKeys(state.apiKeys),
searchQuery: state.apiKeys.searchQuery,
apiKeysCount: getApiKeysCount(state.apiKeys),
@ -52,6 +50,11 @@ function mapStateToProps(state: StoreState) {
};
}
const defaultPageProps = {
navId: 'apikeys',
subTitle: 'Manage and create API keys that are used to interact with Grafana HTTP APIs.',
};
const mapDispatchToProps = {
loadApiKeys,
deleteApiKey,
@ -156,7 +159,6 @@ export class ApiKeysPageUnconnected extends PureComponent<Props, State> {
render() {
const {
hasFetched,
navModel,
apiKeysCount,
apiKeys,
searchQuery,
@ -169,14 +171,14 @@ export class ApiKeysPageUnconnected extends PureComponent<Props, State> {
if (!hasFetched) {
return (
<Page navModel={navModel}>
<Page {...defaultPageProps}>
<Page.Contents isLoading={true}>{}</Page.Contents>
</Page>
);
}
return (
<Page navModel={navModel}>
<Page {...defaultPageProps}>
<Page.Contents isLoading={false}>
<ApiKeysController>
{({ isAdding, toggleIsAdding }) => {