mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	feat: expose project time to production for project flag trends (#6068)
This commit is contained in:
		
							parent
							
								
									82e84ec14d
								
							
						
					
					
						commit
						55b2bb4813
					
				@ -133,6 +133,7 @@ class ProjectStore implements IProjectStore {
 | 
				
			|||||||
                'project_settings.project',
 | 
					                'project_settings.project',
 | 
				
			||||||
                'projects.id',
 | 
					                'projects.id',
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
 | 
					            .leftJoin('project_stats', 'project_stats.project', 'projects.id')
 | 
				
			||||||
            .orderBy('projects.name', 'asc');
 | 
					            .orderBy('projects.name', 'asc');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (query) {
 | 
					        if (query) {
 | 
				
			||||||
@ -148,12 +149,14 @@ class ProjectStore implements IProjectStore {
 | 
				
			|||||||
            ),
 | 
					            ),
 | 
				
			||||||
            'project_settings.default_stickiness',
 | 
					            'project_settings.default_stickiness',
 | 
				
			||||||
            'project_settings.project_mode',
 | 
					            'project_settings.project_mode',
 | 
				
			||||||
 | 
					            'project_stats.avg_time_to_prod_current_window',
 | 
				
			||||||
        ] as (string | Raw<any>)[];
 | 
					        ] as (string | Raw<any>)[];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        let groupByColumns = [
 | 
					        let groupByColumns = [
 | 
				
			||||||
            'projects.id',
 | 
					            'projects.id',
 | 
				
			||||||
            'project_settings.default_stickiness',
 | 
					            'project_settings.default_stickiness',
 | 
				
			||||||
            'project_settings.project_mode',
 | 
					            'project_settings.project_mode',
 | 
				
			||||||
 | 
					            'project_stats.avg_time_to_prod_current_window',
 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (userId) {
 | 
					        if (userId) {
 | 
				
			||||||
@ -214,6 +217,7 @@ class ProjectStore implements IProjectStore {
 | 
				
			|||||||
            createdAt: row.created_at,
 | 
					            createdAt: row.created_at,
 | 
				
			||||||
            mode: row.project_mode || 'open',
 | 
					            mode: row.project_mode || 'open',
 | 
				
			||||||
            defaultStickiness: row.default_stickiness || 'default',
 | 
					            defaultStickiness: row.default_stickiness || 'default',
 | 
				
			||||||
 | 
					            avgTimeToProduction: row.avg_time_to_prod_current_window || 0,
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -83,6 +83,12 @@ export const projectSchema = {
 | 
				
			|||||||
            description:
 | 
					            description:
 | 
				
			||||||
                'A default stickiness for the project affecting the default stickiness value for variants and Gradual Rollout strategy',
 | 
					                'A default stickiness for the project affecting the default stickiness value for variants and Gradual Rollout strategy',
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					        avgTimeToProduction: {
 | 
				
			||||||
 | 
					            type: 'number',
 | 
				
			||||||
 | 
					            example: 10,
 | 
				
			||||||
 | 
					            description:
 | 
				
			||||||
 | 
					                'The average time from when a feature was created to when it was enabled in the "production" environment during the current window',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    components: {},
 | 
					    components: {},
 | 
				
			||||||
} as const;
 | 
					} as const;
 | 
				
			||||||
 | 
				
			|||||||
@ -501,6 +501,7 @@ export interface IProjectWithCount extends IProject {
 | 
				
			|||||||
    potentiallyStaleFeatureCount: number;
 | 
					    potentiallyStaleFeatureCount: number;
 | 
				
			||||||
    memberCount: number;
 | 
					    memberCount: number;
 | 
				
			||||||
    favorite?: boolean;
 | 
					    favorite?: boolean;
 | 
				
			||||||
 | 
					    avgTimeToProduction: number;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface IClientSegment {
 | 
					export interface IClientSegment {
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								src/test/fixtures/fake-project-store.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								src/test/fixtures/fake-project-store.ts
									
									
									
									
										vendored
									
									
								
							@ -48,6 +48,7 @@ export default class FakeProjectStore implements IProjectStore {
 | 
				
			|||||||
                featureCount: 0,
 | 
					                featureCount: 0,
 | 
				
			||||||
                staleFeatureCount: 0,
 | 
					                staleFeatureCount: 0,
 | 
				
			||||||
                potentiallyStaleFeatureCount: 0,
 | 
					                potentiallyStaleFeatureCount: 0,
 | 
				
			||||||
 | 
					                avgTimeToProduction: 0,
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user