-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dashboard]: create a settings tab inside admin
- Loading branch information
Showing
14 changed files
with
192 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
* Licensed under the GNU Affero General Public License (AGPL). | ||
* See License-AGPL.txt in the project root for license information. | ||
*/ | ||
|
||
import React, { createContext, useState } from 'react'; | ||
import { InstallationAdminSettings } from "@gitpod/gitpod-protocol"; | ||
|
||
const AdminContext = createContext<{ | ||
adminSettings?: InstallationAdminSettings, | ||
setAdminSettings: React.Dispatch<InstallationAdminSettings>, | ||
}>({ | ||
setAdminSettings: () => null, | ||
}); | ||
|
||
const AdminContextProvider: React.FC = ({ children }) => { | ||
const [adminSettings, setAdminSettings] = useState<InstallationAdminSettings>(); | ||
return ( | ||
<AdminContext.Provider value={{ adminSettings, setAdminSettings }}> | ||
{children} | ||
</AdminContext.Provider> | ||
); | ||
}; | ||
|
||
export { AdminContext, AdminContextProvider }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
* Licensed under the GNU Affero General Public License (AGPL). | ||
* See License-AGPL.txt in the project root for license information. | ||
*/ | ||
|
||
import { useContext } from "react"; | ||
import { InstallationAdminSettings } from "@gitpod/gitpod-protocol"; | ||
import { AdminContext } from "../admin-context"; | ||
import CheckBox from "../components/CheckBox"; | ||
import { PageWithSubMenu } from "../components/PageWithSubMenu"; | ||
import { getGitpodService } from "../service/service"; | ||
import { adminMenu } from "./admin-menu"; | ||
|
||
export default function Settings() { | ||
const { adminSettings, setAdminSettings } = useContext(AdminContext); | ||
|
||
const actuallySetTelemetryPrefs = async (value: InstallationAdminSettings) => { | ||
await getGitpodService().server.adminUpdateSettings(value); | ||
setAdminSettings(value); | ||
} | ||
|
||
return ( | ||
<div> | ||
<PageWithSubMenu subMenu={adminMenu} title="Settings" subtitle="Configure settings for your Gitpod cluster."> | ||
<h3>Usage Statistics</h3> | ||
<CheckBox | ||
title="Enable Service Ping" | ||
desc={<span>This is used to provide insights on how you use your cluster so we can provide a better overall experience. <a className="gp-link" href="https://www.gitpod.io/privacy">Read our Privacy Policy</a></span>} | ||
checked={adminSettings?.sendTelemetry ?? false} | ||
onChange={(evt) => actuallySetTelemetryPrefs({ | ||
sendTelemetry: evt.target.checked, | ||
})} /> | ||
</PageWithSubMenu> | ||
</div > | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.