mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-19 01:17:18 +02:00
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:

40 lines
1.5 KiB
TypeScript
40 lines
1.5 KiB
TypeScript
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 project’s activity level over time.',
|
||
properties: {
|
||
activityCountByDate: {
|
||
$ref: '#/components/schemas/projectActivitySchema',
|
||
description:
|
||
'Array of activity records with date and count, representing the project’s 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>;
|