4
4
* See License.AGPL.txt in the project root for license information.
5
5
*/
6
6
7
- import { useContext } from "react" ;
7
+ import React , { useContext } from "react" ;
8
8
import { TelemetryData , InstallationAdminSettings } from "@gitpod/gitpod-protocol" ;
9
9
import { AdminContext } from "../admin-context" ;
10
10
import CheckBox from "../components/CheckBox" ;
11
11
import { getGitpodService } from "../service/service" ;
12
12
import { useEffect , useState } from "react" ;
13
13
import InfoBox from "../components/InfoBox" ;
14
14
import { isGitpodIo } from "../utils" ;
15
- import { AdminPageHeader } from "./AdminPageHeader" ;
15
+ import { PageWithSubMenu } from "../components/PageWithSubMenu" ;
16
+ import { getAdminTabs , getAdminSettingsMenu } from "./admin.routes" ;
17
+
18
+ export function SettingsLayout ( props : { children : React . ReactNode } ) {
19
+ return (
20
+ < PageWithSubMenu
21
+ subMenu = { getAdminSettingsMenu ( ) }
22
+ title = "Admin"
23
+ subtitle = "Configure and manage instance settings."
24
+ tabs = { getAdminTabs ( ) }
25
+ >
26
+ { props . children }
27
+ </ PageWithSubMenu >
28
+ ) ;
29
+ }
16
30
17
31
export default function Settings ( ) {
18
32
const { adminSettings, setAdminSettings } = useContext ( AdminContext ) ;
@@ -38,55 +52,53 @@ export default function Settings() {
38
52
39
53
return (
40
54
< div >
41
- < AdminPageHeader title = "Admin" subtitle = "Configure and manage instance settings." >
42
- < div className = "app-container mt-8" >
43
- < h3 > Usage Statistics</ h3 >
44
- < p className = "text-base text-gray-500 pb-4 max-w-2xl" >
45
- We collect usage telemetry to gain insights on how you use your Gitpod instance, so we can
46
- provide a better overall experience.
47
- </ p >
48
- < p >
49
- < a className = "gp-link" href = "https://www.gitpod.io/privacy" >
50
- Read our Privacy Policy
51
- </ a >
52
- </ p >
53
- < CheckBox
54
- title = "Enable usage telemetry"
55
- desc = {
56
- < span >
57
- Enable usage telemetry on your Gitpod instance. A preview of your telemetry is available
58
- below.
59
- </ span >
60
- }
61
- checked = { adminSettings ?. sendTelemetry ?? false }
62
- onChange = { ( evt ) =>
63
- actuallySetTelemetryPrefs ( {
64
- ...adminSettings ,
65
- sendTelemetry : evt . target . checked ,
66
- } as InstallationAdminSettings )
67
- }
68
- />
69
- < CheckBox
70
- title = "Include customer ID in telemetry"
71
- desc = {
72
- < span >
73
- Include an optional customer ID in usage telemetry to provide individualized support.
74
- </ span >
75
- }
76
- checked = { adminSettings ?. sendCustomerID ?? false }
77
- onChange = { ( evt ) =>
78
- actuallySetTelemetryPrefs ( {
79
- ...adminSettings ,
80
- sendCustomerID : evt . target . checked ,
81
- } as InstallationAdminSettings )
82
- }
83
- />
84
- < h3 className = "mt-4" > Telemetry preview</ h3 >
85
- < InfoBox >
86
- < pre > { JSON . stringify ( telemetryData , null , 2 ) } </ pre >
87
- </ InfoBox >
88
- </ div >
89
- </ AdminPageHeader >
55
+ < SettingsLayout >
56
+ < h3 > Usage Statistics</ h3 >
57
+ < p className = "text-base text-gray-500 pb-4 max-w-2xl" >
58
+ We collect usage telemetry to gain insights on how you use your Gitpod instance, so we can provide a
59
+ better overall experience.
60
+ </ p >
61
+ < p >
62
+ < a className = "gp-link" href = "https://www.gitpod.io/privacy" >
63
+ Read our Privacy Policy
64
+ </ a >
65
+ </ p >
66
+ < CheckBox
67
+ title = "Enable usage telemetry"
68
+ desc = {
69
+ < span >
70
+ Enable usage telemetry on your Gitpod instance. A preview of your telemetry is available
71
+ below.
72
+ </ span >
73
+ }
74
+ checked = { adminSettings ?. sendTelemetry ?? false }
75
+ onChange = { ( evt ) =>
76
+ actuallySetTelemetryPrefs ( {
77
+ ...adminSettings ,
78
+ sendTelemetry : evt . target . checked ,
79
+ } as InstallationAdminSettings )
80
+ }
81
+ />
82
+ < CheckBox
83
+ title = "Include customer ID in telemetry"
84
+ desc = {
85
+ < span >
86
+ Include an optional customer ID in usage telemetry to provide individualized support.
87
+ </ span >
88
+ }
89
+ checked = { adminSettings ?. sendCustomerID ?? false }
90
+ onChange = { ( evt ) =>
91
+ actuallySetTelemetryPrefs ( {
92
+ ...adminSettings ,
93
+ sendCustomerID : evt . target . checked ,
94
+ } as InstallationAdminSettings )
95
+ }
96
+ />
97
+ < h3 className = "mt-4" > Telemetry preview</ h3 >
98
+ < InfoBox >
99
+ < pre > { JSON . stringify ( telemetryData , null , 2 ) } </ pre >
100
+ </ InfoBox >
101
+ </ SettingsLayout >
90
102
</ div >
91
103
) ;
92
104
}
0 commit comments