1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-19 01:17:18 +02:00
unleash.unleash/src/lib/openapi/spec/project-status-schema.ts
Thomas Heartman 2b13aff4f1
feat: hook up project resources API to resources widget ()
This PR wires up the connectedenvironments data from the API to the
resources widget.

Additionally, it adjusts the orval schema to add the new
connectedEnvironments property, and adds a loading state indicator for
the resource values based on the project status endpoint response.

As was discussed in a previous PR, I think this is a good time to update
the API to include all the information required for this view. This
would get rid of three hooks, lots of loading state indicators (because
we **can** do them individually; check out
0a334f9892)
and generally simplify this component a bit.

Here's the loading state:

![image](https://github.com/user-attachments/assets/c9938383-afcd-4f4b-92df-c64b83f5b1df)
2024-11-05 14:50:51 +01:00

40 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import type { FromSchema } from 'json-schema-to-ts';
import { projectActivitySchema } from './project-activity-schema';
export const projectStatusSchema = {
$id: '#/components/schemas/projectStatusSchema',
type: 'object',
additionalProperties: false,
required: ['activityCountByDate', 'resources'],
description:
'Schema representing the overall status of a project, including an array of activity records. Each record in the activity array contains a date and a count, providing a snapshot of the projects activity level over time.',
properties: {
activityCountByDate: {
$ref: '#/components/schemas/projectActivitySchema',
description:
'Array of activity records with date and count, representing the projects daily activity statistics.',
},
resources: {
type: 'object',
additionalProperties: false,
required: ['connectedEnvironments'],
description: 'Key resources within the project',
properties: {
connectedEnvironments: {
type: 'number',
minimum: 0,
description:
'The number of environments that have received SDK traffic in this project.',
},
},
},
},
components: {
schemas: {
projectActivitySchema,
},
},
} as const;
export type ProjectStatusSchema = FromSchema<typeof projectStatusSchema>;