mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-20 00:08:02 +01:00
feat: connect dashboard static widgets to data (#6062)
This PR connects the static widgets to actual data
This commit is contained in:
parent
832884b4f5
commit
7d6d4064a8
@ -18,6 +18,19 @@ const StyledGrid = styled(Box)(({ theme }) => ({
|
|||||||
export const ExecutiveDashboard: VFC = () => {
|
export const ExecutiveDashboard: VFC = () => {
|
||||||
const { executiveDashboardData, loading, error } = useExecutiveDashboard();
|
const { executiveDashboardData, loading, error } = useExecutiveDashboard();
|
||||||
|
|
||||||
|
const calculateFlagPerUsers = () => {
|
||||||
|
if (
|
||||||
|
executiveDashboardData.users.total === 0 ||
|
||||||
|
executiveDashboardData.flags.total === 0
|
||||||
|
)
|
||||||
|
return '0';
|
||||||
|
|
||||||
|
return (
|
||||||
|
executiveDashboardData.flags.total /
|
||||||
|
executiveDashboardData.users.total
|
||||||
|
).toFixed(1);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Box sx={(theme) => ({ paddingBottom: theme.spacing(4) })}>
|
<Box sx={(theme) => ({ paddingBottom: theme.spacing(4) })}>
|
||||||
@ -30,14 +43,13 @@ export const ExecutiveDashboard: VFC = () => {
|
|||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
<StyledGrid>
|
<StyledGrid>
|
||||||
<UserStats />
|
<UserStats count={executiveDashboardData.users.total} />
|
||||||
<UsersChart
|
<FlagStats
|
||||||
userTrends={executiveDashboardData?.userTrends ?? []}
|
count={executiveDashboardData.flags.total}
|
||||||
/>
|
flagsPerUser={calculateFlagPerUsers()}
|
||||||
<FlagStats />
|
|
||||||
<FlagsChart
|
|
||||||
flagsTrends={executiveDashboardData?.flagsTrends ?? []}
|
|
||||||
/>
|
/>
|
||||||
|
<UsersChart userTrends={executiveDashboardData.userTrends} />
|
||||||
|
<FlagsChart flagTrends={executiveDashboardData.flagTrends} />
|
||||||
</StyledGrid>
|
</StyledGrid>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -78,7 +78,15 @@ const StyledSettingsIcon = styled(Settings)(({ theme }) => ({
|
|||||||
marginRight: theme.spacing(0.5),
|
marginRight: theme.spacing(0.5),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const FlagStats = () => {
|
interface IFlagStatsProps {
|
||||||
|
count: number;
|
||||||
|
flagsPerUser: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const FlagStats: React.FC<IFlagStatsProps> = ({
|
||||||
|
count,
|
||||||
|
flagsPerUser,
|
||||||
|
}) => {
|
||||||
return (
|
return (
|
||||||
<StyledContent>
|
<StyledContent>
|
||||||
<StyledHeader variant='h1'>
|
<StyledHeader variant='h1'>
|
||||||
@ -98,7 +106,7 @@ export const FlagStats = () => {
|
|||||||
</StyledHeader>
|
</StyledHeader>
|
||||||
<StyledRingContainer>
|
<StyledRingContainer>
|
||||||
<StyledRing>
|
<StyledRing>
|
||||||
<StyledRingContent>9999</StyledRingContent>
|
<StyledRingContent>{count}</StyledRingContent>
|
||||||
</StyledRing>
|
</StyledRing>
|
||||||
</StyledRingContainer>
|
</StyledRingContainer>
|
||||||
|
|
||||||
@ -116,7 +124,7 @@ export const FlagStats = () => {
|
|||||||
</StyledHeaderContainer>
|
</StyledHeaderContainer>
|
||||||
<Typography variant='body2'>Flags per user</Typography>
|
<Typography variant='body2'>Flags per user</Typography>
|
||||||
</StyledTextContainer>
|
</StyledTextContainer>
|
||||||
<StyledFlagCountPerUser>3.5</StyledFlagCountPerUser>
|
<StyledFlagCountPerUser>{flagsPerUser}</StyledFlagCountPerUser>
|
||||||
</StyledInsightsContainer>
|
</StyledInsightsContainer>
|
||||||
</StyledContent>
|
</StyledContent>
|
||||||
);
|
);
|
||||||
|
@ -22,27 +22,27 @@ import { ExecutiveSummarySchema } from 'openapi';
|
|||||||
|
|
||||||
const createData = (
|
const createData = (
|
||||||
theme: Theme,
|
theme: Theme,
|
||||||
flagsTrends: ExecutiveSummarySchema['flagsTrends'] = [],
|
flagTrends: ExecutiveSummarySchema['flagTrends'] = [],
|
||||||
) => ({
|
) => ({
|
||||||
labels: flagsTrends.map((item) => item.date),
|
labels: flagTrends.map((item) => item.date),
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
label: 'Total flags',
|
label: 'Total flags',
|
||||||
data: flagsTrends.map((item) => item.total),
|
data: flagTrends.map((item) => item.total),
|
||||||
borderColor: theme.palette.primary.main,
|
borderColor: theme.palette.primary.main,
|
||||||
backgroundColor: theme.palette.primary.main,
|
backgroundColor: theme.palette.primary.main,
|
||||||
fill: true,
|
fill: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Archived flags',
|
label: 'Stale',
|
||||||
data: flagsTrends.map((item) => item.archived),
|
data: flagTrends.map((item) => item.stale),
|
||||||
borderColor: theme.palette.error.main,
|
borderColor: theme.palette.warning.main,
|
||||||
backgroundColor: theme.palette.error.main,
|
backgroundColor: theme.palette.warning.main,
|
||||||
fill: true,
|
fill: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Active flags',
|
label: 'Active flags',
|
||||||
data: flagsTrends.map((item) => item.active),
|
data: flagTrends.map((item) => item.active),
|
||||||
borderColor: theme.palette.success.main,
|
borderColor: theme.palette.success.main,
|
||||||
backgroundColor: theme.palette.success.main,
|
backgroundColor: theme.palette.success.main,
|
||||||
fill: true,
|
fill: true,
|
||||||
@ -102,17 +102,17 @@ const createOptions = (theme: Theme, locationSettings: ILocationSettings) =>
|
|||||||
}) as const;
|
}) as const;
|
||||||
|
|
||||||
interface IFlagsChartComponentProps {
|
interface IFlagsChartComponentProps {
|
||||||
flagsTrends: ExecutiveSummarySchema['flagsTrends'];
|
flagTrends: ExecutiveSummarySchema['flagTrends'];
|
||||||
}
|
}
|
||||||
|
|
||||||
const FlagsChartComponent: VFC<IFlagsChartComponentProps> = ({
|
const FlagsChartComponent: VFC<IFlagsChartComponentProps> = ({
|
||||||
flagsTrends,
|
flagTrends,
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { locationSettings } = useLocationSettings();
|
const { locationSettings } = useLocationSettings();
|
||||||
const data = useMemo(
|
const data = useMemo(
|
||||||
() => createData(theme, flagsTrends),
|
() => createData(theme, flagTrends),
|
||||||
[theme, flagsTrends],
|
[theme, flagTrends],
|
||||||
);
|
);
|
||||||
const options = createOptions(theme, locationSettings);
|
const options = createOptions(theme, locationSettings);
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
import { ChevronRight } from '@mui/icons-material';
|
import { ChevronRight } from '@mui/icons-material';
|
||||||
import { Box, Typography, styled } from '@mui/material';
|
import { Box, Typography, styled } from '@mui/material';
|
||||||
|
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||||
|
import { useUiFlag } from 'hooks/useUiFlag';
|
||||||
|
import React from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
const StyledContent = styled(Box)(({ theme }) => ({
|
const StyledContent = styled(Box)(({ theme }) => ({
|
||||||
@ -73,17 +76,31 @@ const StyledLink = styled(Link)({
|
|||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
});
|
});
|
||||||
|
|
||||||
export const UserStats = () => {
|
interface IUserStatsProps {
|
||||||
|
count: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const UserStats: React.FC<IUserStatsProps> = ({ count }) => {
|
||||||
|
const showInactiveUsers = useUiFlag('showInactiveUsers');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
|
<Box sx={{ display: 'flex', flexDirection: 'column' }}>
|
||||||
<StyledContent>
|
<StyledContent>
|
||||||
<StyledHeader variant='h1'>Total users</StyledHeader>
|
<StyledHeader variant='h1'>Total users</StyledHeader>
|
||||||
<StyledUserContainer>
|
<StyledUserContainer>
|
||||||
<StyledUserBox>
|
<StyledUserBox>
|
||||||
<StyledUserCount variant='h2'>9999</StyledUserCount>
|
<StyledUserCount variant='h2'>
|
||||||
|
{count}
|
||||||
|
</StyledUserCount>
|
||||||
</StyledUserBox>
|
</StyledUserBox>
|
||||||
<StyledCustomShadow />
|
<StyledCustomShadow />
|
||||||
</StyledUserContainer>
|
</StyledUserContainer>
|
||||||
|
|
||||||
|
<ConditionallyRender
|
||||||
|
condition={showInactiveUsers}
|
||||||
|
show={
|
||||||
|
<>
|
||||||
<StyledUserDistributionContainer>
|
<StyledUserDistributionContainer>
|
||||||
<UserDistribution />
|
<UserDistribution />
|
||||||
</StyledUserDistributionContainer>
|
</StyledUserDistributionContainer>
|
||||||
@ -100,6 +117,9 @@ export const UserStats = () => {
|
|||||||
count='9999'
|
count='9999'
|
||||||
/>
|
/>
|
||||||
</StyledDistInfoContainer>
|
</StyledDistInfoContainer>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
<StyledLinkContainer>
|
<StyledLinkContainer>
|
||||||
<StyledLink to='/admin/users'>
|
<StyledLink to='/admin/users'>
|
||||||
@ -107,6 +127,8 @@ export const UserStats = () => {
|
|||||||
</StyledLink>
|
</StyledLink>
|
||||||
</StyledLinkContainer>
|
</StyledLinkContainer>
|
||||||
</StyledContent>
|
</StyledContent>
|
||||||
|
</Box>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import handleErrorResponses from '../httpErrorResponseHandler';
|
|||||||
import { ExecutiveSummarySchema } from 'openapi';
|
import { ExecutiveSummarySchema } from 'openapi';
|
||||||
|
|
||||||
interface IUseExecutiveDashboardDataOutput {
|
interface IUseExecutiveDashboardDataOutput {
|
||||||
executiveDashboardData: ExecutiveSummarySchema | undefined;
|
executiveDashboardData: ExecutiveSummarySchema;
|
||||||
refetchExecutiveDashboard: () => void;
|
refetchExecutiveDashboard: () => void;
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
error?: Error;
|
error?: Error;
|
||||||
@ -27,7 +27,12 @@ export const useExecutiveDashboard = (
|
|||||||
}, [path]);
|
}, [path]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
executiveDashboardData: data,
|
executiveDashboardData: data || {
|
||||||
|
users: { total: 0, inactive: 0, active: 0 },
|
||||||
|
flags: { total: 0 },
|
||||||
|
userTrends: [],
|
||||||
|
flagTrends: [],
|
||||||
|
},
|
||||||
refetchExecutiveDashboard,
|
refetchExecutiveDashboard,
|
||||||
loading: !error && !data,
|
loading: !error && !data,
|
||||||
error,
|
error,
|
||||||
|
@ -80,6 +80,7 @@ export type UiFlags = {
|
|||||||
changeRequestConflictHandling?: boolean;
|
changeRequestConflictHandling?: boolean;
|
||||||
feedbackComments?: Variant;
|
feedbackComments?: Variant;
|
||||||
displayUpgradeEdgeBanner?: boolean;
|
displayUpgradeEdgeBanner?: boolean;
|
||||||
|
showInactiveUsers?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface IVersionInfo {
|
export interface IVersionInfo {
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
* Do not edit manually.
|
* Do not edit manually.
|
||||||
* See `gen:api` script in package.json
|
* See `gen:api` script in package.json
|
||||||
*/
|
*/
|
||||||
import type { CreateActionsSchema } from './createActionsSchema';
|
import type { ActionsSchema } from './actionsSchema';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A response model with a list of action sets.
|
* A response model with a list of action sets.
|
||||||
*/
|
*/
|
||||||
export interface ActionsListSchema {
|
export interface ActionsListSchema {
|
||||||
/** A list of action sets. */
|
/** A list of action sets. */
|
||||||
actions: CreateActionsSchema[];
|
actions: ActionsSchema[];
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,8 @@ export interface ActionsSchema {
|
|||||||
createdAt?: string;
|
createdAt?: string;
|
||||||
/** The id of user that created this action set */
|
/** The id of user that created this action set */
|
||||||
createdByUserId?: number;
|
createdByUserId?: number;
|
||||||
|
/** Whether this action set is enabled or not */
|
||||||
|
enabled?: boolean;
|
||||||
/** The id of the action set */
|
/** The id of the action set */
|
||||||
id: number;
|
id: number;
|
||||||
/** Defines a matching rule for the observable event that will trigger the action set */
|
/** Defines a matching rule for the observable event that will trigger the action set */
|
||||||
|
@ -14,6 +14,8 @@ export interface CreateActionsSchema {
|
|||||||
actions: CreateActionSchema[];
|
actions: CreateActionSchema[];
|
||||||
/** The id of the service account that will execute the action */
|
/** The id of the service account that will execute the action */
|
||||||
actorId: number;
|
actorId: number;
|
||||||
|
/** Whether this action set is enabled or not */
|
||||||
|
enabled?: boolean;
|
||||||
/** Defines a matching rule for the observable event that will trigger the action set */
|
/** Defines a matching rule for the observable event that will trigger the action set */
|
||||||
match: CreateActionsSchemaMatch;
|
match: CreateActionsSchemaMatch;
|
||||||
/** The name of the action set */
|
/** The name of the action set */
|
||||||
|
@ -3,20 +3,21 @@
|
|||||||
* Do not edit manually.
|
* Do not edit manually.
|
||||||
* See `gen:api` script in package.json
|
* See `gen:api` script in package.json
|
||||||
*/
|
*/
|
||||||
import type { ExecutiveSummarySchemaFlagsTrendsItem } from './executiveSummarySchemaFlagsTrendsItem';
|
import type { ExecutiveSummarySchemaFlags } from './executiveSummarySchemaFlags';
|
||||||
import type { ExecutiveSummarySchemaUserStats } from './executiveSummarySchemaUserStats';
|
import type { ExecutiveSummarySchemaFlagTrendsItem } from './executiveSummarySchemaFlagTrendsItem';
|
||||||
|
import type { ExecutiveSummarySchemaUsers } from './executiveSummarySchemaUsers';
|
||||||
import type { ExecutiveSummarySchemaUserTrendsItem } from './executiveSummarySchemaUserTrendsItem';
|
import type { ExecutiveSummarySchemaUserTrendsItem } from './executiveSummarySchemaUserTrendsItem';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executive summary of Unleash usage
|
* Executive summary of Unleash usage
|
||||||
*/
|
*/
|
||||||
export interface ExecutiveSummarySchema {
|
export interface ExecutiveSummarySchema {
|
||||||
|
/** High level flag count statistics */
|
||||||
|
flags: ExecutiveSummarySchemaFlags;
|
||||||
/** How number of flags changed over time */
|
/** How number of flags changed over time */
|
||||||
flagsTrends: ExecutiveSummarySchemaFlagsTrendsItem[];
|
flagTrends: ExecutiveSummarySchemaFlagTrendsItem[];
|
||||||
/** The type of single-sign option configured for the Unleash instance */
|
|
||||||
ssoType?: string;
|
|
||||||
/** High level user count statistics */
|
/** High level user count statistics */
|
||||||
userStats: ExecutiveSummarySchemaUserStats;
|
users: ExecutiveSummarySchemaUsers;
|
||||||
/** How number of users changed over time */
|
/** How number of users changed over time */
|
||||||
userTrends: ExecutiveSummarySchemaUserTrendsItem[];
|
userTrends: ExecutiveSummarySchemaUserTrendsItem[];
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* Generated by Orval
|
||||||
|
* Do not edit manually.
|
||||||
|
* See `gen:api` script in package.json
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type ExecutiveSummarySchemaFlagTrendsItem = {
|
||||||
|
/** The number of active flags on a particular day */
|
||||||
|
active: number;
|
||||||
|
/** A UTC date when the stats were captured. Time is the very end of a given day. */
|
||||||
|
date: string;
|
||||||
|
/** The number of time calculated potentially stale flags on a particular day */
|
||||||
|
potentiallyStale?: number;
|
||||||
|
/** The number of user marked stale flags on a particular day */
|
||||||
|
stale: number;
|
||||||
|
/** The number of all flags on a particular day */
|
||||||
|
total: number;
|
||||||
|
};
|
13
frontend/src/openapi/models/executiveSummarySchemaFlags.ts
Normal file
13
frontend/src/openapi/models/executiveSummarySchemaFlags.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* Generated by Orval
|
||||||
|
* Do not edit manually.
|
||||||
|
* See `gen:api` script in package.json
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* High level flag count statistics
|
||||||
|
*/
|
||||||
|
export type ExecutiveSummarySchemaFlags = {
|
||||||
|
/** The number of non-archived flags */
|
||||||
|
total: number;
|
||||||
|
};
|
@ -1,16 +0,0 @@
|
|||||||
/**
|
|
||||||
* Generated by Orval
|
|
||||||
* Do not edit manually.
|
|
||||||
* See `gen:api` script in package.json
|
|
||||||
*/
|
|
||||||
|
|
||||||
export type ExecutiveSummarySchemaFlagsTrendsItem = {
|
|
||||||
/** The number of non-archived flags on a particular day */
|
|
||||||
active: number;
|
|
||||||
/** The number of archived flags on a particular day */
|
|
||||||
archived: number;
|
|
||||||
/** A UTC date when the stats were captured. Time is the very end of a given day. */
|
|
||||||
date: string;
|
|
||||||
/** The number of all flags on a particular day */
|
|
||||||
total: number;
|
|
||||||
};
|
|
@ -1,22 +0,0 @@
|
|||||||
/**
|
|
||||||
* Generated by Orval
|
|
||||||
* Do not edit manually.
|
|
||||||
* See `gen:api` script in package.json
|
|
||||||
*/
|
|
||||||
import type { ExecutiveSummarySchemaUserStatsRoles } from './executiveSummarySchemaUserStatsRoles';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* High level user count statistics
|
|
||||||
*/
|
|
||||||
export type ExecutiveSummarySchemaUserStats = {
|
|
||||||
/** The number of active Unleash users who have logged in in the past 90 days */
|
|
||||||
active: number;
|
|
||||||
/** The number of inactive Unleash users who have not logged in in the past 90 days. */
|
|
||||||
inactive: number;
|
|
||||||
/** The number of users licensed to use Unleash */
|
|
||||||
licensed: number;
|
|
||||||
/** The number of users with a given [root role](https://docs.getunleash.io/reference/rbac#predefined-roles) */
|
|
||||||
roles: ExecutiveSummarySchemaUserStatsRoles;
|
|
||||||
/** The number of actual Unleash users */
|
|
||||||
total: number;
|
|
||||||
};
|
|
@ -1,17 +0,0 @@
|
|||||||
/**
|
|
||||||
* Generated by Orval
|
|
||||||
* Do not edit manually.
|
|
||||||
* See `gen:api` script in package.json
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The number of users with a given [root role](https://docs.getunleash.io/reference/rbac#predefined-roles)
|
|
||||||
*/
|
|
||||||
export type ExecutiveSummarySchemaUserStatsRoles = {
|
|
||||||
/** The number of users with the `admin` root role */
|
|
||||||
admin: number;
|
|
||||||
/** The number of users with the `editor` root role */
|
|
||||||
editor: number;
|
|
||||||
/** The number of users with the `viewer` root role */
|
|
||||||
viewer: number;
|
|
||||||
};
|
|
17
frontend/src/openapi/models/executiveSummarySchemaUsers.ts
Normal file
17
frontend/src/openapi/models/executiveSummarySchemaUsers.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* Generated by Orval
|
||||||
|
* Do not edit manually.
|
||||||
|
* See `gen:api` script in package.json
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* High level user count statistics
|
||||||
|
*/
|
||||||
|
export type ExecutiveSummarySchemaUsers = {
|
||||||
|
/** The number of active Unleash users who have user Unleash in the past 60 days */
|
||||||
|
active: number;
|
||||||
|
/** The number of inactive Unleash users who have not used Unleash in the past 60 days. */
|
||||||
|
inactive: number;
|
||||||
|
/** The number of actual Unleash users */
|
||||||
|
total: number;
|
||||||
|
};
|
@ -495,10 +495,10 @@ export * from './eventSchemaType';
|
|||||||
export * from './eventsSchema';
|
export * from './eventsSchema';
|
||||||
export * from './eventsSchemaVersion';
|
export * from './eventsSchemaVersion';
|
||||||
export * from './executiveSummarySchema';
|
export * from './executiveSummarySchema';
|
||||||
export * from './executiveSummarySchemaFlagsTrendsItem';
|
export * from './executiveSummarySchemaFlagTrendsItem';
|
||||||
export * from './executiveSummarySchemaUserStats';
|
export * from './executiveSummarySchemaFlags';
|
||||||
export * from './executiveSummarySchemaUserStatsRoles';
|
|
||||||
export * from './executiveSummarySchemaUserTrendsItem';
|
export * from './executiveSummarySchemaUserTrendsItem';
|
||||||
|
export * from './executiveSummarySchemaUsers';
|
||||||
export * from './exportFeatures404';
|
export * from './exportFeatures404';
|
||||||
export * from './exportQuerySchema';
|
export * from './exportQuerySchema';
|
||||||
export * from './exportQuerySchemaAnyOf';
|
export * from './exportQuerySchemaAnyOf';
|
||||||
|
@ -14,6 +14,13 @@ import type { PlaygroundFeatureSchemaVariantPayload } from './playgroundFeatureS
|
|||||||
export type PlaygroundFeatureSchemaVariant = {
|
export type PlaygroundFeatureSchemaVariant = {
|
||||||
/** Whether the variant is enabled or not. If the feature is disabled or if it doesn't have variants, this property will be `false` */
|
/** Whether the variant is enabled or not. If the feature is disabled or if it doesn't have variants, this property will be `false` */
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
|
/** Use `featureEnabled` instead. */
|
||||||
|
feature_enabled?: boolean;
|
||||||
|
/**
|
||||||
|
* Whether the feature is enabled or not.
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
featureEnabled?: boolean;
|
||||||
/** The variant's name. If there is no variant or if the toggle is disabled, this will be `disabled` */
|
/** The variant's name. If there is no variant or if the toggle is disabled, this will be `disabled` */
|
||||||
name: string;
|
name: string;
|
||||||
/** An optional payload attached to the variant. */
|
/** An optional payload attached to the variant. */
|
||||||
|
@ -29,6 +29,10 @@ export interface ProjectSchema {
|
|||||||
mode?: ProjectSchemaMode;
|
mode?: ProjectSchemaMode;
|
||||||
/** The name of this project */
|
/** The name of this project */
|
||||||
name: string;
|
name: string;
|
||||||
|
/** The number of potentially stale features this project has */
|
||||||
|
potentiallyStaleFeatureCount?: number;
|
||||||
|
/** The number of stale features this project has */
|
||||||
|
staleFeatureCount?: number;
|
||||||
/** When this project was last updated. */
|
/** When this project was last updated. */
|
||||||
updatedAt?: string | null;
|
updatedAt?: string | null;
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,11 @@ export type ProxyFeatureSchemaVariant = {
|
|||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
/** Whether the feature is enabled or not. */
|
/** Whether the feature is enabled or not. */
|
||||||
feature_enabled?: boolean;
|
feature_enabled?: boolean;
|
||||||
|
/**
|
||||||
|
* Use `feature_enabled` instead.
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
featureEnabled?: boolean;
|
||||||
/** The variants name. Is unique for this feature toggle */
|
/** The variants name. Is unique for this feature toggle */
|
||||||
name: string;
|
name: string;
|
||||||
/** Extra data configured for this variant */
|
/** Extra data configured for this variant */
|
||||||
|
@ -13,6 +13,11 @@ export interface VariantFlagSchema {
|
|||||||
enabled?: boolean;
|
enabled?: boolean;
|
||||||
/** Whether the feature is enabled or not. */
|
/** Whether the feature is enabled or not. */
|
||||||
feature_enabled?: boolean;
|
feature_enabled?: boolean;
|
||||||
|
/**
|
||||||
|
* Use `feature_enabled` instead.
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
featureEnabled?: boolean;
|
||||||
/** The name of the variant. Will always be disabled if `enabled` is false. */
|
/** The name of the variant. Will always be disabled if `enabled` is false. */
|
||||||
name?: string;
|
name?: string;
|
||||||
/** Additional data associated with this variant. */
|
/** Additional data associated with this variant. */
|
||||||
|
@ -127,6 +127,7 @@ exports[`should create default config 1`] = `
|
|||||||
"proPlanAutoCharge": false,
|
"proPlanAutoCharge": false,
|
||||||
"responseTimeWithAppNameKillSwitch": false,
|
"responseTimeWithAppNameKillSwitch": false,
|
||||||
"scheduledConfigurationChanges": false,
|
"scheduledConfigurationChanges": false,
|
||||||
|
"showInactiveUsers": false,
|
||||||
"strictSchemaValidation": false,
|
"strictSchemaValidation": false,
|
||||||
"stripClientHeadersOn304": false,
|
"stripClientHeadersOn304": false,
|
||||||
},
|
},
|
||||||
|
@ -47,7 +47,8 @@ export type IFlagKey =
|
|||||||
| 'changeRequestConflictHandling'
|
| 'changeRequestConflictHandling'
|
||||||
| 'executiveDashboard'
|
| 'executiveDashboard'
|
||||||
| 'feedbackComments'
|
| 'feedbackComments'
|
||||||
| 'createdByUserIdDataMigration';
|
| 'createdByUserIdDataMigration'
|
||||||
|
| 'showInactiveUsers';
|
||||||
|
|
||||||
export type IFlags = Partial<{ [key in IFlagKey]: boolean | Variant }>;
|
export type IFlags = Partial<{ [key in IFlagKey]: boolean | Variant }>;
|
||||||
|
|
||||||
@ -227,6 +228,10 @@ const flags: IFlags = {
|
|||||||
process.env.CREATED_BY_USERID_DATA_MIGRATION,
|
process.env.CREATED_BY_USERID_DATA_MIGRATION,
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
|
showInactiveUsers: parseEnvVarBoolean(
|
||||||
|
process.env.UNLEASH_EXPERIMENTAL_SHOW_INACTIVE_USERS,
|
||||||
|
false,
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
export const defaultExperimentalOptions: IExperimentalOptions = {
|
export const defaultExperimentalOptions: IExperimentalOptions = {
|
||||||
|
Loading…
Reference in New Issue
Block a user