mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: add overview
This commit is contained in:
		
							parent
							
								
									3e73a8cfd8
								
							
						
					
					
						commit
						577f7a2824
					
				@ -6,7 +6,6 @@ import {
 | 
				
			|||||||
    FeatureToggle,
 | 
					    FeatureToggle,
 | 
				
			||||||
    IFeatureOverview,
 | 
					    IFeatureOverview,
 | 
				
			||||||
    IProjectHealthReport,
 | 
					    IProjectHealthReport,
 | 
				
			||||||
    IProjectOverview,
 | 
					 | 
				
			||||||
} from '../types/model';
 | 
					} from '../types/model';
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
    MILLISECONDS_IN_DAY,
 | 
					    MILLISECONDS_IN_DAY,
 | 
				
			||||||
@ -55,12 +54,22 @@ export default class ProjectHealthService {
 | 
				
			|||||||
        projectId: string,
 | 
					        projectId: string,
 | 
				
			||||||
    ): Promise<IProjectHealthReport> {
 | 
					    ): Promise<IProjectHealthReport> {
 | 
				
			||||||
        //const overview = await this.getProjectOverview(projectId, false);
 | 
					        //const overview = await this.getProjectOverview(projectId, false);
 | 
				
			||||||
        const features = await this.featureToggleStore.getFeatures();
 | 
					        const features = await this.featureToggleStore.getFeatures({
 | 
				
			||||||
 | 
					            projectId,
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        const overview = {
 | 
				
			||||||
 | 
					            name: 'test',
 | 
				
			||||||
 | 
					            description: '',
 | 
				
			||||||
 | 
					            features: features,
 | 
				
			||||||
 | 
					            members: 1,
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
            // ...overview,
 | 
					            ...overview,
 | 
				
			||||||
            potentiallyStaleCount: await this.potentiallyStaleCount(features),
 | 
					            potentiallyStaleCount: await this.potentiallyStaleCount(
 | 
				
			||||||
            activeCount: this.activeCount(features),
 | 
					                overview.features,
 | 
				
			||||||
            staleCount: this.staleCount(features),
 | 
					            ),
 | 
				
			||||||
 | 
					            activeCount: this.activeCount(overview.features),
 | 
				
			||||||
 | 
					            staleCount: this.staleCount(overview.features),
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,134 @@
 | 
				
			|||||||
 | 
					import { IFeatureStrategy } from '../db/feature-strategy-store';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface IConstraint {
 | 
				
			||||||
 | 
					    contextName: string;
 | 
				
			||||||
 | 
					    operator: string;
 | 
				
			||||||
 | 
					    values: string[];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface IStrategyConfig {
 | 
				
			||||||
 | 
					    id?: string;
 | 
				
			||||||
 | 
					    name: string;
 | 
				
			||||||
 | 
					    constraints: IConstraint[];
 | 
				
			||||||
 | 
					    parameters: Object;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface FeatureToggleDTO {
 | 
				
			||||||
 | 
					    name: string;
 | 
				
			||||||
 | 
					    description?: string;
 | 
				
			||||||
 | 
					    type?: string;
 | 
				
			||||||
 | 
					    stale?: boolean;
 | 
				
			||||||
 | 
					    archived?: boolean;
 | 
				
			||||||
 | 
					    variants?: IVariant[];
 | 
				
			||||||
 | 
					    createdAt?: Date;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					export interface FeatureToggle extends FeatureToggleDTO {
 | 
				
			||||||
 | 
					    project: string;
 | 
				
			||||||
 | 
					    lastSeenAt?: Date;
 | 
				
			||||||
 | 
					    createdAt?: Date;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface IFeatureToggleClient {
 | 
				
			||||||
 | 
					    name: string;
 | 
				
			||||||
 | 
					    description: string;
 | 
				
			||||||
 | 
					    type: string;
 | 
				
			||||||
 | 
					    project: string;
 | 
				
			||||||
 | 
					    stale: boolean;
 | 
				
			||||||
 | 
					    variants: IVariant[];
 | 
				
			||||||
 | 
					    enabled: boolean;
 | 
				
			||||||
 | 
					    strategies: IStrategyConfig[];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface IFeatureEnvironmentInfo {
 | 
				
			||||||
 | 
					    name: string;
 | 
				
			||||||
 | 
					    environment: string;
 | 
				
			||||||
 | 
					    enabled: boolean;
 | 
				
			||||||
 | 
					    strategies: IFeatureStrategy[];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface FeatureToggleWithEnvironment extends FeatureToggle {
 | 
				
			||||||
 | 
					    environments: IEnvironmentDetail[];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface IEnvironmentDetail extends IEnvironmentOverview {
 | 
				
			||||||
 | 
					    strategies: IStrategyConfig[];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface IFeatureEnvironment {
 | 
				
			||||||
 | 
					    environment: string;
 | 
				
			||||||
 | 
					    featureName: string;
 | 
				
			||||||
 | 
					    enabled: boolean;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface IVariant {
 | 
				
			||||||
 | 
					    name: string;
 | 
				
			||||||
 | 
					    weight: number;
 | 
				
			||||||
 | 
					    weightType: string;
 | 
				
			||||||
 | 
					    payload: {
 | 
				
			||||||
 | 
					        type: string;
 | 
				
			||||||
 | 
					        value: string;
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					    stickiness: string;
 | 
				
			||||||
 | 
					    overrides: {
 | 
				
			||||||
 | 
					        contextName: string;
 | 
				
			||||||
 | 
					        values: string[];
 | 
				
			||||||
 | 
					    }[];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface IEnvironment {
 | 
				
			||||||
 | 
					    name: string;
 | 
				
			||||||
 | 
					    displayName: string;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface IEnvironmentOverview {
 | 
				
			||||||
 | 
					    name: string;
 | 
				
			||||||
 | 
					    displayName: string;
 | 
				
			||||||
 | 
					    enabled: boolean;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface IFeatureOverview {
 | 
				
			||||||
 | 
					    name: string;
 | 
				
			||||||
 | 
					    type: string;
 | 
				
			||||||
 | 
					    stale: boolean;
 | 
				
			||||||
 | 
					    createdAt: Date;
 | 
				
			||||||
 | 
					    lastSeenAt: Date;
 | 
				
			||||||
 | 
					    environments: IEnvironmentOverview[];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface IProjectOverview {
 | 
				
			||||||
 | 
					    name: string;
 | 
				
			||||||
 | 
					    description: string;
 | 
				
			||||||
 | 
					    features: IFeatureOverview[];
 | 
				
			||||||
 | 
					    members: number;
 | 
				
			||||||
 | 
					    version: number;
 | 
				
			||||||
 | 
					    health: number;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface IProjectHealthReport extends IProjectOverview {
 | 
				
			||||||
 | 
					    staleCount: number;
 | 
				
			||||||
 | 
					    potentiallyStaleCount: number;
 | 
				
			||||||
 | 
					    activeCount: number;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface IProjectParam {
 | 
					export interface IProjectParam {
 | 
				
			||||||
    projectId: string;
 | 
					    projectId: string;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface IArchivedQuery {
 | 
				
			||||||
 | 
					    archived: boolean;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					export interface ITagQuery {
 | 
				
			||||||
 | 
					    tagType: string;
 | 
				
			||||||
 | 
					    tagValue: string;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					export interface IFeatureToggleQuery {
 | 
				
			||||||
 | 
					    tag?: string[][];
 | 
				
			||||||
 | 
					    project?: string[];
 | 
				
			||||||
 | 
					    namePrefix?: string;
 | 
				
			||||||
 | 
					    environment?: string;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface ITag {
 | 
				
			||||||
 | 
					    value: string;
 | 
				
			||||||
 | 
					    type: string;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user