Feature highlights: Highlight team group sync (#44477)

* Highlight team group sync

* Update text
This commit is contained in:
Alex Khomenko 2022-01-27 09:11:57 +02:00 committed by GitHub
parent 6533eb9244
commit 28c51cde3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 9 deletions

View File

@ -15,6 +15,7 @@ import { contextSrv } from 'app/core/services/context_srv';
import { NavModel } from '@grafana/data';
import { featureEnabled } from '@grafana/runtime';
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
import { UpgradeBox } from 'app/core/components/Upgrade/UpgradeBox';
interface TeamPageRouteParams {
id: string;
@ -127,7 +128,17 @@ export class TeamPages extends PureComponent<Props, State> {
case PageTypes.Settings:
return isSignedInUserTeamAdmin && <TeamSettings team={team!} />;
case PageTypes.GroupSync:
return isSignedInUserTeamAdmin && isSyncEnabled && <TeamGroupSync />;
if (isSignedInUserTeamAdmin && isSyncEnabled) {
return <TeamGroupSync />;
} else if (config.featureHighlights.enabled) {
return (
<UpgradeBox
text={
"Team Sync immediately updates each user's Grafana teams and permissions based on their LDAP or Oauth group membership, instead of updating when users sign in."
}
/>
);
}
}
return null;

View File

@ -1,9 +1,11 @@
import { Team, TeamPermissionLevel } from 'app/types';
import { featureEnabled } from '@grafana/runtime';
import { NavModelItem, NavModel } from '@grafana/data';
import config from 'app/core/config';
import { ProBadge } from 'app/core/components/Upgrade/ProBadge';
export function buildNavModel(team: Team): NavModelItem {
const navModel = {
const navModel: NavModelItem = {
img: team.avatarUrl,
id: 'team-' + team.id,
subTitle: 'Manage members and settings',
@ -28,14 +30,18 @@ export function buildNavModel(team: Team): NavModelItem {
],
};
const teamGroupSync = {
active: false,
icon: 'sync',
id: `team-groupsync-${team.id}`,
text: 'External group sync',
url: `org/teams/edit/${team.id}/groupsync`,
};
if (featureEnabled('teamsync')) {
navModel.children.push({
active: false,
icon: 'sync',
id: `team-groupsync-${team.id}`,
text: 'External group sync',
url: `org/teams/edit/${team.id}/groupsync`,
});
navModel.children!.push(teamGroupSync);
} else if (config.featureHighlights.enabled) {
navModel.children!.push({ ...teamGroupSync, tabSuffix: ProBadge });
}
return navModel;