@@ -5,11 +5,12 @@ import {
5
5
groupIdpSyncSettings ,
6
6
roleIdpSyncSettings ,
7
7
} from "api/queries/organizations" ;
8
- import { ErrorAlert } from "components/Alert/ErrorAlert " ;
8
+ import { ChooseOne , Cond } from "components/Conditionals/ChooseOne " ;
9
9
import { EmptyState } from "components/EmptyState/EmptyState" ;
10
- import { Loader } from "components/Loader/Loader " ;
10
+ import { Paywall } from "components/Paywall/Paywall " ;
11
11
import { SettingsHeader } from "components/SettingsHeader/SettingsHeader" ;
12
12
import { Stack } from "components/Stack/Stack" ;
13
+ import { useFeatureVisibility } from "modules/dashboard/useFeatureVisibility" ;
13
14
import type { FC } from "react" ;
14
15
import { Helmet } from "react-helmet-async" ;
15
16
import { useQueries } from "react-query" ;
@@ -24,6 +25,8 @@ export const IdpSyncPage: FC = () => {
24
25
const { organization : organizationName } = useParams ( ) as {
25
26
organization : string ;
26
27
} ;
28
+ // IdP sync does not have its own entitlement and is based on templace_rbac
29
+ const { template_rbac : isIdpSyncEnabled } = useFeatureVisibility ( ) ;
27
30
const { organizations } = useOrganizationSettings ( ) ;
28
31
const organization = organizations ?. find ( ( o ) => o . name === organizationName ) ;
29
32
@@ -40,26 +43,10 @@ export const IdpSyncPage: FC = () => {
40
43
return < EmptyState message = "Organization not found" /> ;
41
44
}
42
45
43
- if (
44
- groupsQuery . isLoading ||
45
- groupIdpSyncSettingsQuery . isLoading ||
46
- roleIdpSyncSettingsQuery . isLoading
47
- ) {
48
- return < Loader /> ;
49
- }
50
-
51
46
const error =
52
47
groupIdpSyncSettingsQuery . error ||
53
48
roleIdpSyncSettingsQuery . error ||
54
49
groupsQuery . error ;
55
- if (
56
- error ||
57
- ! groupIdpSyncSettingsQuery . data ||
58
- ! roleIdpSyncSettingsQuery . data ||
59
- ! groupsQuery . data
60
- ) {
61
- return < ErrorAlert error = { error } /> ;
62
- }
63
50
64
51
const groupsMap = new Map < string , string > ( ) ;
65
52
if ( groupsQuery . data ) {
@@ -84,25 +71,34 @@ export const IdpSyncPage: FC = () => {
84
71
description = "Group and role sync mappings (configured using Coder CLI)."
85
72
tooltip = { < IdpSyncHelpTooltip /> }
86
73
/>
87
- < Stack direction = "row" spacing = { 2 } >
88
- < Button
89
- startIcon = { < LaunchOutlined /> }
90
- component = "a"
91
- href = { docs ( "/admin/auth#group-sync-enterprise" ) }
92
- target = "_blank"
93
- >
94
- Setup IdP Sync
95
- </ Button >
96
- </ Stack >
74
+ < Button
75
+ startIcon = { < LaunchOutlined /> }
76
+ component = "a"
77
+ href = { docs ( "/admin/auth#group-sync-enterprise" ) }
78
+ target = "_blank"
79
+ >
80
+ Setup IdP Sync
81
+ </ Button >
97
82
</ Stack >
98
-
99
- < IdpSyncPageView
100
- groupSyncSettings = { groupIdpSyncSettingsQuery . data }
101
- roleSyncSettings = { roleIdpSyncSettingsQuery . data }
102
- groups = { groupsQuery . data }
103
- groupsMap = { groupsMap }
104
- organization = { organization }
105
- />
83
+ < ChooseOne >
84
+ < Cond condition = { ! isIdpSyncEnabled } >
85
+ < Paywall
86
+ message = "IdP Sync"
87
+ description = "Configure group and role mappings to manage permissions outside of Coder. You need an Premium license to use this feature."
88
+ documentationLink = { docs ( "/admin/groups" ) }
89
+ />
90
+ </ Cond >
91
+ < Cond >
92
+ < IdpSyncPageView
93
+ groupSyncSettings = { groupIdpSyncSettingsQuery . data }
94
+ roleSyncSettings = { roleIdpSyncSettingsQuery . data }
95
+ groups = { groupsQuery . data }
96
+ groupsMap = { groupsMap }
97
+ organization = { organization }
98
+ error = { error }
99
+ />
100
+ </ Cond >
101
+ </ ChooseOne >
106
102
</ >
107
103
) ;
108
104
} ;
0 commit comments