mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-22 01:16:07 +02:00
This PR adds connected environments to the project status payload. It's done by: - adding a new `getConnectedEnvironmentCountForProject` method to the project store (I opted for this approach instead of creating a new view model because it already has a `getEnvironmentsForProject` method) - adding the project store to the project status service - updating the schema For the schema, I opted for adding a `resources` property, under which I put `connectedEnvironments`. My thinking was that if we want to add the rest of the project resources (that go in the resources widget), it'd make sense to group those together inside an object. However, I'd also be happy to place the property on the top level. If you have opinions one way or the other, let me know. As for the count, we're currently only counting environments that have metrics and that are active for the current project.
17 lines
495 B
TypeScript
17 lines
495 B
TypeScript
import { validateSchema } from '../validate';
|
|
import type { ProjectStatusSchema } from './project-status-schema';
|
|
|
|
test('projectStatusSchema', () => {
|
|
const data: ProjectStatusSchema = {
|
|
activityCountByDate: [
|
|
{ date: '2022-12-14', count: 2 },
|
|
{ date: '2022-12-15', count: 5 },
|
|
],
|
|
resources: { connectedEnvironments: 2 },
|
|
};
|
|
|
|
expect(
|
|
validateSchema('#/components/schemas/projectStatusSchema', data),
|
|
).toBeUndefined();
|
|
});
|