1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-28 17:55:15 +02:00
unleash.unleash/frontend/src/component/admin/menu/AdminMenu.tsx
David Leek 3a14b97fdd
feat/telemetry opt out (#4035)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->

## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

Adds a UI that shows current status of version and feature usage
collection configuration, and a presence in the configuration menu +
menu bar.

Configuring these features is done by setting environment variables. The
version info collection is an existing feature that we're making more
visible, the feature usage collection feature is a new feature that has
it's own environment configuration but also depends on version info
collection being active to work.

When version collection is turned off and the experimental feature flag
for feature usage collection is turned off:
<img width="1269" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/435a07da-d238-4b5b-a150-07e3bd6b816f">


When version collection is turned on and the experimental feature flag
is off:
<img width="1249" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/8d1a76c5-99c9-4551-9a4f-86d477bbbf6f">


When the experimental feature flag is enabled, and version+telemetry is
turned off:
<img width="1239" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/e0bc532b-be94-4076-bee1-faef9bc48a5b">


When version collection is turned on, the experimental feature flag is
enabled, and telemetry collection is turned off:
<img width="1234" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/1bd190c1-08fe-4402-bde3-56f863a33289">


When version collection is turned on, the experimental feature flag is
enabled, and telemetry collection is turned on:
<img width="1229" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/848912cd-30bd-43cf-9b81-c58a4cbad1e4">


When version collection is turned off, the experimental feature flag is
enabled, and telemetry collection is turned on:
<img width="1241" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/d2b981f2-033f-4fae-a115-f93e0653729b">

---------

Co-authored-by: sighphyre <liquidwicked64@gmail.com>
Co-authored-by: Nuno Góis <github@nunogois.com>
Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2023-06-30 08:43:58 +02:00

147 lines
4.8 KiB
TypeScript

import { useLocation } from 'react-router-dom';
import { Paper, styled, Tab, Tabs } from '@mui/material';
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
import { useInstanceStatus } from 'hooks/api/getters/useInstanceStatus/useInstanceStatus';
import { CenteredNavLink } from './CenteredNavLink';
const StyledPaper = styled(Paper)(({ theme }) => ({
marginBottom: '1rem',
borderRadius: '12.5px',
boxShadow: 'none',
padding: '0 2rem',
}));
function AdminMenu() {
const { uiConfig, isEnterprise } = useUiConfig();
const { pathname } = useLocation();
const { isBilling } = useInstanceStatus();
const { flags, networkViewEnabled } = uiConfig;
const activeTab = pathname.split('/')[2];
return (
<StyledPaper>
<Tabs
value={activeTab}
variant="scrollable"
scrollButtons="auto"
allowScrollButtonsMobile
>
<Tab
value="users"
label={
<CenteredNavLink to="/admin/users">
<span>Users</span>
</CenteredNavLink>
}
/>
{isEnterprise() && (
<Tab
value="service-accounts"
label={
<CenteredNavLink to="/admin/service-accounts">
<span>Service accounts</span>
</CenteredNavLink>
}
/>
)}
{flags.UG && (
<Tab
value="groups"
label={
<CenteredNavLink to="/admin/groups">
<span>Groups</span>
</CenteredNavLink>
}
/>
)}
{isEnterprise() && (
<Tab
value="roles"
label={
<CenteredNavLink to="/admin/roles">
<span>Roles</span>
</CenteredNavLink>
}
/>
)}
<Tab
value="api"
label={
<CenteredNavLink to="/admin/api">
API access
</CenteredNavLink>
}
/>
{uiConfig.flags.embedProxyFrontend && (
<Tab
value="cors"
label={
<CenteredNavLink to="/admin/cors">
CORS origins
</CenteredNavLink>
}
/>
)}
<Tab
value="auth"
label={
<CenteredNavLink to="/admin/auth">
Single sign-on
</CenteredNavLink>
}
/>
<Tab
value="instance"
label={
<CenteredNavLink to="/admin/instance">
Instance stats
</CenteredNavLink>
}
/>
{networkViewEnabled && (
<Tab
value="network"
label={
<CenteredNavLink to="/admin/network">
Network
</CenteredNavLink>
}
/>
)}
<Tab
value="maintenance"
label={
<CenteredNavLink to="/admin/maintenance">
Maintenance
</CenteredNavLink>
}
/>
<Tab
value="instance-privacy"
label={
<CenteredNavLink to="/admin/instance-privacy">
Instance privacy
</CenteredNavLink>
}
/>
{isBilling && (
<Tab
value="billing"
label={
<CenteredNavLink to="/admin/billing">
Billing
</CenteredNavLink>
}
/>
)}
</Tabs>
</StyledPaper>
);
}
export default AdminMenu;