1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00
unleash.unleash/frontend/src/interfaces/featureToggle.ts
Tymoteusz Czech 50ab2c9d61
feat: rename lifecycle stages (#9102)
Name names for "lifecycle" stages, and aligning frontend types.
2025-01-16 08:41:11 +00:00

144 lines
3.0 KiB
TypeScript

import type { CreateFeatureSchemaType, FeatureSchema } from 'openapi';
import type { IFeatureStrategy } from './strategy';
import type { ITag } from './tags';
/**
* @deprecated use FeatureSchema from openapi
*/
export interface IFeatureFlagListItem {
type: string;
name: string;
stale?: boolean;
lastSeenAt?: string;
createdAt: string;
environments: IEnvironments[];
tags?: ITag[];
favorite?: boolean;
}
export interface IEnvironments {
name: string;
enabled: boolean;
variantCount: number;
lastSeenAt?: string | null;
type?: string;
hasStrategies?: boolean;
hasEnabledStrategies?: boolean;
yes?: number;
no?: number;
}
export type ILastSeenEnvironments = Pick<
IEnvironments,
'name' | 'enabled' | 'lastSeenAt' | 'yes' | 'no'
>;
export type Lifecycle = {
stage: Required<FeatureSchema>['lifecycle']['stage'];
status?: string;
enteredStageAt: string;
};
export type Collaborator = {
id: number;
name: string;
imageUrl: string;
};
export type CollaboratorData = {
users: Collaborator[];
};
/**
* @deprecated use FeatureSchema from openapi
*/
export interface IFeatureToggle {
stale: boolean;
archived: boolean;
enabled?: boolean;
createdAt: string;
lastSeenAt?: string;
description?: string;
environments: IFeatureEnvironment[];
name: string;
favorite: boolean;
project: string;
type: CreateFeatureSchemaType;
variants: IFeatureVariant[];
impressionData: boolean;
strategies?: IFeatureStrategy[];
dependencies: Array<IDependency>;
lifecycle?: Lifecycle;
children: Array<string>;
createdBy?: {
id: number;
name: string;
imageUrl: string;
};
collaborators?: CollaboratorData;
}
export interface IDependency {
feature: string;
enabled?: boolean;
variants?: string[];
}
export interface IFeatureEnvironment {
type: string;
name: string;
enabled: boolean;
strategies: IFeatureStrategy[];
variants?: IFeatureVariant[];
lastSeenAt?: string;
yes?: number;
no?: number;
}
export interface IFeatureEnvironmentWithCrEnabled extends IFeatureEnvironment {
crEnabled?: boolean;
}
export interface IFeatureVariant {
name: string;
stickiness: string;
weight: number;
weightType: 'fix' | 'variable';
overrides?: IOverride[];
payload?: IPayload;
}
export interface IOverride {
contextName: string;
values: string[];
}
export interface IPayload {
type: string;
value: string;
}
export interface IFeatureEnvironmentMetrics {
environment: string;
timestamp: string;
yes: number;
no: number;
}
export interface IFeatureMetrics {
version?: number;
maturity?: string;
lastHourUsage: IFeatureEnvironmentMetrics[];
seenApplications: string[];
}
export interface IFeatureMetricsRaw {
featureName: string;
appName: string;
environment: string;
timestamp: string;
yes: number;
no: number;
variants?: Record<string, number>;
}