1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00

add lastupdate to health report

This commit is contained in:
Youssef 2021-11-30 14:05:44 +01:00
parent 991a4a8634
commit 10c1b56e38
4 changed files with 16 additions and 2 deletions

View File

@ -11,7 +11,14 @@ import {
} from '../types/stores/project-store'; } from '../types/stores/project-store';
import { DEFAULT_ENV } from '../util/constants'; import { DEFAULT_ENV } from '../util/constants';
const COLUMNS = ['id', 'name', 'description', 'created_at', 'health']; const COLUMNS = [
'id',
'name',
'description',
'created_at',
'health',
'last_update',
];
const TABLE = 'projects'; const TABLE = 'projects';
class ProjectStore implements IProjectStore { class ProjectStore implements IProjectStore {
@ -30,6 +37,7 @@ class ProjectStore implements IProjectStore {
id: data.id, id: data.id,
name: data.name, name: data.name,
description: data.description, description: data.description,
lastUpdate: data.lastUpdate,
}; };
} }
@ -74,7 +82,7 @@ class ProjectStore implements IProjectStore {
async updateHealth(healthUpdate: IProjectHealthUpdate): Promise<void> { async updateHealth(healthUpdate: IProjectHealthUpdate): Promise<void> {
await this.db(TABLE) await this.db(TABLE)
.where({ id: healthUpdate.id }) .where({ id: healthUpdate.id })
.update({ health: healthUpdate.health }); .update({ health: healthUpdate.health, last_update: new Date() });
} }
async create(project: IProjectInsert): Promise<IProject> { async create(project: IProjectInsert): Promise<IProject> {
@ -197,6 +205,7 @@ class ProjectStore implements IProjectStore {
description: row.description, description: row.description,
createdAt: row.created_at, createdAt: row.created_at,
health: row.health || 100, health: row.health || 100,
lastUpdate: row.last_update || new Date(),
}; };
} }
} }

View File

@ -72,6 +72,7 @@ export default class ProjectHealthService {
name: project.name, name: project.name,
description: project.description, description: project.description,
health: project.health, health: project.health,
lastUpdate: project.lastUpdate,
environments, environments,
features, features,
members, members,

View File

@ -143,6 +143,7 @@ export interface IProjectOverview {
members: number; members: number;
version: number; version: number;
health: number; health: number;
lastUpdate?: Date;
} }
export interface IProjectHealthReport extends IProjectOverview { export interface IProjectHealthReport extends IProjectOverview {
@ -309,6 +310,7 @@ export interface IProject {
description: string; description: string;
health?: number; health?: number;
createdAt?: Date; createdAt?: Date;
lastUpdate?: Date;
} }
export interface IProjectWithCount extends IProject { export interface IProjectWithCount extends IProject {

View File

@ -1,3 +1,4 @@
import { DateFileAppender } from 'log4js';
import { IProject } from '../model'; import { IProject } from '../model';
import { Store } from './store'; import { Store } from './store';
@ -5,6 +6,7 @@ export interface IProjectInsert {
id: string; id: string;
name: string; name: string;
description: string; description: string;
lastUpdate?: Date;
} }
export interface IProjectArchived { export interface IProjectArchived {