mirror of
https://github.com/fleetdm/fleet
synced 2026-05-04 13:59:01 +00:00
# Addresses #9349 # Implements https://www.loom.com/share/bbf8d6f97fe74e65a0c9a394f1bda3f1 - New Controls page, only visible to Global|Team Admins|Maintainers - Header for free users is 'Controls', for premium is a teams filter dropdown that defaults to 'No teams,' which filters via updating the URL query param "team_id" - Includes tabs macUpdates (default) and macSettings - Cleaned up how site nav items are conditionally included/excluded based on authorization – see `frontend/components/top_nav/SiteTopNav/navItems.ts` - Updated masthead styles: Removed icons from site nav links; updated colors and spacing; Updated default user avatar TBD in separate PR (waiting on guidance) # Checklist for submitter - [x] Changes file added for user-visible changes in `changes/` - [x] Updated testing suite inventory - [x] Manual QA for all new/changed functionality Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
86 lines
2.5 KiB
TypeScript
86 lines
2.5 KiB
TypeScript
import React, { useState } from "react";
|
|
|
|
import Button from "components/buttons/Button";
|
|
import Checkbox from "components/forms/fields/Checkbox";
|
|
|
|
import CustomLink from "components/CustomLink";
|
|
import { IAppConfigFormProps, IFormField } from "../constants";
|
|
|
|
const baseClass = "app-config-form";
|
|
|
|
const Statistics = ({
|
|
appConfig,
|
|
handleSubmit,
|
|
isUpdatingSettings,
|
|
}: IAppConfigFormProps): JSX.Element => {
|
|
const [formData, setFormData] = useState<any>({
|
|
enableUsageStatistics: appConfig.server_settings.enable_analytics,
|
|
});
|
|
|
|
const { enableUsageStatistics } = formData;
|
|
|
|
const handleInputChange = ({ name, value }: IFormField) => {
|
|
setFormData({ ...formData, [name]: value });
|
|
};
|
|
|
|
const onFormSubmit = (evt: React.MouseEvent<HTMLFormElement>) => {
|
|
evt.preventDefault();
|
|
|
|
// Formatting of API not UI
|
|
const formDataToSubmit = {
|
|
server_settings: {
|
|
server_url: appConfig.server_settings.server_url || "",
|
|
live_query_disabled:
|
|
appConfig.server_settings.live_query_disabled || false,
|
|
enable_analytics: enableUsageStatistics,
|
|
},
|
|
};
|
|
|
|
handleSubmit(formDataToSubmit);
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<form className={baseClass} onSubmit={onFormSubmit} autoComplete="off">
|
|
<div className={`${baseClass}__section`}>
|
|
<h2>Usage statistics</h2>
|
|
<p className={`${baseClass}__section-description`}>
|
|
Help improve Fleet by sending usage statistics.
|
|
<br />
|
|
<br />
|
|
This information helps our team better understand feature adoption
|
|
and usage, and allows us to see how Fleet is adding value, so that
|
|
we can make better product decisions.
|
|
<br />
|
|
<br />
|
|
<CustomLink
|
|
url="https://fleetdm.com/docs/using-fleet/usage-statistics#usage-statistics"
|
|
text="Learn more about usage statistics"
|
|
newTab
|
|
/>
|
|
</p>
|
|
<div className={`${baseClass}__inputs ${baseClass}__inputs--usage`}>
|
|
<Checkbox
|
|
onChange={handleInputChange}
|
|
name="enableUsageStatistics"
|
|
value={enableUsageStatistics}
|
|
parseTarget
|
|
>
|
|
Enable usage statistics
|
|
</Checkbox>
|
|
</div>
|
|
</div>
|
|
<Button
|
|
type="submit"
|
|
variant="brand"
|
|
className="save-loading"
|
|
isLoading={isUpdatingSettings}
|
|
>
|
|
Save
|
|
</Button>
|
|
</form>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default Statistics;
|