1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-20 00:08:02 +01:00

refactor: not used cleanup (#3347)

This commit is contained in:
Jaanus Sellin 2023-03-21 11:10:07 +02:00 committed by GitHub
parent 2f4c618292
commit 9969433f8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 122 additions and 73 deletions

View File

@ -1,4 +1,4 @@
import { AttachMoneyRounded, MonetizationOn } from '@mui/icons-material';
import { AttachMoneyRounded } from '@mui/icons-material';
import { styled, Tooltip } from '@mui/material';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import { TextCell } from 'component/common/Table/cells/TextCell/TextCell';

View File

@ -1,6 +1,5 @@
import Settings from '@mui/icons-material/Settings';
import { Typography, IconButton, styled, Box } from '@mui/material';
import { flexRow } from 'themes/themeStyles';
import { Typography, styled, Box } from '@mui/material';
import { FC } from 'react';
const StyledOuterContainerBox = styled(Box)(({ theme }) => ({
padding: theme.spacing(1.5, 3, 0.5, 3),
@ -15,7 +14,7 @@ const StyledInnerBox = styled(Box)(({ theme }) => ({
height: '4px',
}));
export const NotificationsHeader: React.FC = ({ children }) => {
export const NotificationsHeader: FC = ({ children }) => {
return (
<>
<StyledOuterContainerBox>

View File

@ -11,7 +11,6 @@ import {
Switch,
styled,
Theme,
Box,
} from '@mui/material';
import MenuIcon from '@mui/icons-material/Menu';
import SettingsIcon from '@mui/icons-material/Settings';

View File

@ -1,39 +0,0 @@
import { colors } from 'themes/colors';
import { Alert, styled } from '@mui/material';
import { SdkContextSchema } from 'openapi';
interface IContextBannerProps {
environment: string;
projects?: string | string[];
context: SdkContextSchema;
}
const StyledContextFieldList = styled('ul')(({ theme }) => ({
color: theme.palette.text.primary,
listStyleType: 'none',
padding: theme.spacing(2),
}));
export const ContextBanner = ({
environment,
projects = [],
context,
}: IContextBannerProps) => {
return (
<Alert severity="info" sx={{ mt: 4, mb: 2, mx: 4 }}>
Your results are generated based on this configuration:
<StyledContextFieldList>
<li>environment: {environment}</li>
<li>
projects:{' '}
{Array.isArray(projects) ? projects.join(', ') : projects}
</li>
{Object.entries(context).map(([key, value]) => (
<li key={key}>
<span>{key}:</span> {value}
</li>
))}
</StyledContextFieldList>
</Alert>
);
};

View File

@ -52,7 +52,6 @@ export const ProjectStats = ({ stats }: IProjectStatsProps) => {
const {
avgTimeToProdCurrentWindow,
avgTimeToProdPastWindow,
projectActivityCurrentWindow,
projectActivityPastWindow,
createdCurrentWindow,
@ -61,15 +60,6 @@ export const ProjectStats = ({ stats }: IProjectStatsProps) => {
archivedPastWindow,
} = stats;
const calculatePercentage = (partial: number, total: number) => {
const percentage = (partial * 100) / total;
if (Number.isInteger(percentage)) {
return percentage;
}
return 0;
};
return (
<StyledBox>
<StyledWidget>

View File

@ -1,4 +1,3 @@
import { NotificationsSchemaItem } from 'openapi';
import useAPI from '../useApi/useApi';
export const useNotificationsApi = () => {

View File

@ -1,5 +1,5 @@
import useSWR, { SWRConfiguration } from 'swr';
import { useCallback, useMemo } from 'react';
import { useCallback } from 'react';
import { formatApiPath } from 'utils/formatPath';
import handleErrorResponses from '../httpErrorResponseHandler';
import { NotificationsSchema } from 'openapi';

View File

@ -17,7 +17,6 @@ const fallbackProject: IProject = {
archivedCurrentWindow: 0,
archivedPastWindow: 0,
avgTimeToProdCurrentWindow: 0,
avgTimeToProdPastWindow: 0,
createdCurrentWindow: 0,
createdPastWindow: 0,
projectActivityCurrentWindow: 0,

View File

@ -11,4 +11,6 @@ export interface CreateFeatureStrategySchema {
sortOrder?: number;
constraints?: ConstraintSchema[];
parameters?: ParametersSchema;
/** Ids of segments to use for this strategy */
segments?: number[];
}

View File

@ -3,6 +3,8 @@
* Do not edit manually.
* See `gen:api` script in package.json
*/
import type { HealthOverviewSchemaDefaultStickiness } from './healthOverviewSchemaDefaultStickiness';
import type { HealthOverviewSchemaMode } from './healthOverviewSchemaMode';
import type { FeatureSchema } from './featureSchema';
import type { ProjectStatsSchema } from './projectStatsSchema';
@ -10,6 +12,10 @@ export interface HealthOverviewSchema {
version: number;
name: string;
description?: string | null;
/** A default stickiness for the project affecting the default stickiness value for variants and Gradual Rollout strategy */
defaultStickiness?: HealthOverviewSchemaDefaultStickiness;
/** A mode of the project affecting what actions are possible in this project. During a rollout of project modes this feature can be optional or `null` */
mode?: HealthOverviewSchemaMode;
members?: number;
health?: number;
environments?: string[];

View File

@ -0,0 +1,19 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
/**
* A default stickiness for the project affecting the default stickiness value for variants and Gradual Rollout strategy
*/
export type HealthOverviewSchemaDefaultStickiness =
typeof HealthOverviewSchemaDefaultStickiness[keyof typeof HealthOverviewSchemaDefaultStickiness];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const HealthOverviewSchemaDefaultStickiness = {
default: 'default',
userId: 'userId',
sessionId: 'sessionId',
random: 'random',
} as const;

View File

@ -0,0 +1,18 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
/**
* A mode of the project affecting what actions are possible in this project. During a rollout of project modes this feature can be optional or `null`
*/
export type HealthOverviewSchemaMode =
typeof HealthOverviewSchemaMode[keyof typeof HealthOverviewSchemaMode];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const HealthOverviewSchemaMode = {
open: 'open',
protected: 'protected',
null: null,
} as const;

View File

@ -3,6 +3,8 @@
* Do not edit manually.
* See `gen:api` script in package.json
*/
import type { HealthReportSchemaDefaultStickiness } from './healthReportSchemaDefaultStickiness';
import type { HealthReportSchemaMode } from './healthReportSchemaMode';
import type { FeatureSchema } from './featureSchema';
import type { ProjectStatsSchema } from './projectStatsSchema';
@ -10,6 +12,10 @@ export interface HealthReportSchema {
version: number;
name: string;
description?: string | null;
/** A default stickiness for the project affecting the default stickiness value for variants and Gradual Rollout strategy */
defaultStickiness?: HealthReportSchemaDefaultStickiness;
/** A mode of the project affecting what actions are possible in this project. During a rollout of project modes this feature can be optional or `null` */
mode?: HealthReportSchemaMode;
members?: number;
health?: number;
environments?: string[];

View File

@ -0,0 +1,19 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
/**
* A default stickiness for the project affecting the default stickiness value for variants and Gradual Rollout strategy
*/
export type HealthReportSchemaDefaultStickiness =
typeof HealthReportSchemaDefaultStickiness[keyof typeof HealthReportSchemaDefaultStickiness];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const HealthReportSchemaDefaultStickiness = {
default: 'default',
userId: 'userId',
sessionId: 'sessionId',
random: 'random',
} as const;

View File

@ -0,0 +1,18 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
/**
* A mode of the project affecting what actions are possible in this project. During a rollout of project modes this feature can be optional or `null`
*/
export type HealthReportSchemaMode =
typeof HealthReportSchemaMode[keyof typeof HealthReportSchemaMode];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const HealthReportSchemaMode = {
open: 'open',
protected: 'protected',
null: null,
} as const;

View File

@ -120,7 +120,11 @@ export * from './groupsSchema';
export * from './healthCheckSchema';
export * from './healthCheckSchemaHealth';
export * from './healthOverviewSchema';
export * from './healthOverviewSchemaDefaultStickiness';
export * from './healthOverviewSchemaMode';
export * from './healthReportSchema';
export * from './healthReportSchemaDefaultStickiness';
export * from './healthReportSchemaMode';
export * from './idSchema';
export * from './importTogglesSchema';
export * from './importTogglesValidateItemSchema';
@ -178,6 +182,7 @@ export * from './projectCreatedSchema';
export * from './projectEnvironmentSchema';
export * from './projectOverviewSchema';
export * from './projectSchema';
export * from './projectSchemaDefaultStickiness';
export * from './projectSchemaMode';
export * from './projectStatsSchema';
export * from './projectUsers';
@ -223,7 +228,6 @@ export * from './setUiConfigSchemaFrontendSettings';
export * from './sortOrderSchema';
export * from './splashSchema';
export * from './stateSchema';
export * from './stickinessSchema';
export * from './strategiesSchema';
export * from './strategySchema';
export * from './strategySchemaParametersItem';

View File

@ -4,6 +4,7 @@
* See `gen:api` script in package.json
*/
import type { ProjectSchemaMode } from './projectSchemaMode';
import type { ProjectSchemaDefaultStickiness } from './projectSchemaDefaultStickiness';
/**
* A definition of the project used for projects listing purposes
@ -25,6 +26,8 @@ export interface ProjectSchema {
updatedAt?: string | null;
/** `true` if the project was favorited, otherwise `false`. */
favorite?: boolean;
/** A mode of the project affecting what actions are possible in this project. During a rollout of project modes this feature can be optional or `null` */
/** A mode of the project affecting what actions are possible in this project */
mode?: ProjectSchemaMode;
/** A default stickiness for the project affecting the default stickiness value for variants and Gradual Rollout strategy */
defaultStickiness?: ProjectSchemaDefaultStickiness;
}

View File

@ -0,0 +1,19 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
/**
* A default stickiness for the project affecting the default stickiness value for variants and Gradual Rollout strategy
*/
export type ProjectSchemaDefaultStickiness =
typeof ProjectSchemaDefaultStickiness[keyof typeof ProjectSchemaDefaultStickiness];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const ProjectSchemaDefaultStickiness = {
default: 'default',
userId: 'userId',
sessionId: 'sessionId',
random: 'random',
} as const;

View File

@ -5,7 +5,7 @@
*/
/**
* A mode of the project affecting what actions are possible in this project. During a rollout of project modes this feature can be optional or `null`
* A mode of the project affecting what actions are possible in this project
*/
export type ProjectSchemaMode =
typeof ProjectSchemaMode[keyof typeof ProjectSchemaMode];
@ -14,5 +14,4 @@ export type ProjectSchemaMode =
export const ProjectSchemaMode = {
open: 'open',
protected: 'protected',
null: null,
} as const;

View File

@ -14,8 +14,6 @@ Stats are divided into current and previous **windows**.
export interface ProjectStatsSchema {
/** The average time from when a feature was created to when it was enabled in the "production" environment during the current window */
avgTimeToProdCurrentWindow: number;
/** The average time from when a feature was created to when it was enabled in the "production" environment during the previous window */
avgTimeToProdPastWindow: number;
/** The number of feature toggles created during the current window */
createdCurrentWindow: number;
/** The number of feature toggles created during the previous window */

View File

@ -1,9 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export interface StickinessSchema {
stickiness: string;
}