mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
use navId over navModel, add page descriptions + create pageNav for child pages (#53936)
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import { connect, ConnectedProps } from 'react-redux';
|
||||
|
||||
import { NavModel } from '@grafana/data';
|
||||
import { NavModelItem } from '@grafana/data';
|
||||
import { featureEnabled } from '@grafana/runtime';
|
||||
import { Page } from 'app/core/components/Page/Page';
|
||||
import { contextSrv } from 'app/core/core';
|
||||
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
|
||||
import { getNavModel } from 'app/core/selectors/navModel';
|
||||
import { StoreState, UserDTO, UserOrg, UserSession, SyncInfo, UserAdminError, AccessControlAction } from 'app/types';
|
||||
|
||||
import { UserLdapSyncInfo } from './UserLdapSyncInfo';
|
||||
@@ -31,7 +30,6 @@ import {
|
||||
} from './state/actions';
|
||||
|
||||
interface OwnProps extends GrafanaRouteComponentProps<{ id: string }> {
|
||||
navModel: NavModel;
|
||||
user?: UserDTO;
|
||||
orgs: UserOrg[];
|
||||
sessions: UserSession[];
|
||||
@@ -103,13 +101,16 @@ export class UserAdminPage extends PureComponent<Props> {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { navModel, user, orgs, sessions, ldapSyncInfo, isLoading } = this.props;
|
||||
const { user, orgs, sessions, ldapSyncInfo, isLoading } = this.props;
|
||||
const isLDAPUser = user && user.isExternal && user.authLabels && user.authLabels.includes('LDAP');
|
||||
const canReadSessions = contextSrv.hasPermission(AccessControlAction.UsersAuthTokenList);
|
||||
const canReadLDAPStatus = contextSrv.hasPermission(AccessControlAction.LDAPStatusRead);
|
||||
const pageNav: NavModelItem = {
|
||||
text: user?.login ?? '',
|
||||
};
|
||||
|
||||
return (
|
||||
<Page navModel={navModel}>
|
||||
<Page navId="global-users" pageNav={pageNav} subTitle="Manage settings for an individual user.">
|
||||
<Page.Contents isLoading={isLoading}>
|
||||
{user && (
|
||||
<>
|
||||
@@ -153,7 +154,6 @@ export class UserAdminPage extends PureComponent<Props> {
|
||||
}
|
||||
|
||||
const mapStateToProps = (state: StoreState) => ({
|
||||
navModel: getNavModel(state.navIndex, 'global-users'),
|
||||
user: state.userAdmin.user,
|
||||
sessions: state.userAdmin.sessions,
|
||||
orgs: state.userAdmin.orgs,
|
||||
|
||||
@@ -18,7 +18,6 @@ import { TagBadge } from 'app/core/components/TagFilter/TagBadge';
|
||||
import { contextSrv } from 'app/core/core';
|
||||
|
||||
import PageLoader from '../../core/components/PageLoader/PageLoader';
|
||||
import { getNavModel } from '../../core/selectors/navModel';
|
||||
import { AccessControlAction, StoreState, Unit, UserDTO, UserFilter } from '../../types';
|
||||
|
||||
import { changeFilter, changePage, changeQuery, fetchUsers } from './state/actions';
|
||||
@@ -41,7 +40,6 @@ const mapDispatchToProps = {
|
||||
};
|
||||
|
||||
const mapStateToProps = (state: StoreState) => ({
|
||||
navModel: getNavModel(state.navIndex, 'global-users'),
|
||||
users: state.userListAdmin.users,
|
||||
query: state.userListAdmin.query,
|
||||
showPaging: state.userListAdmin.showPaging,
|
||||
@@ -59,7 +57,6 @@ type Props = OwnProps & ConnectedProps<typeof connector>;
|
||||
|
||||
const UserListAdminPageUnConnected: React.FC<Props> = ({
|
||||
fetchUsers,
|
||||
navModel,
|
||||
query,
|
||||
changeQuery,
|
||||
users,
|
||||
@@ -80,7 +77,7 @@ const UserListAdminPageUnConnected: React.FC<Props> = ({
|
||||
const showLicensedRole = useMemo(() => users.some((user) => user.licensedRole), [users]);
|
||||
|
||||
return (
|
||||
<Page navModel={navModel}>
|
||||
<Page navId="global-users" subTitle="Manage and create users across the whole Grafana server.">
|
||||
<Page.Contents>
|
||||
<div className="page-action-bar">
|
||||
<div className="gf-form gf-form--grow">
|
||||
|
||||
Reference in New Issue
Block a user