1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-05 17:53:12 +02:00

chore: orval feature impact metrics (#10588)

This commit is contained in:
Mateusz Kwasniewski 2025-09-01 16:10:54 +02:00 committed by GitHub
parent 829c2c5bc3
commit bc075a4915
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
38 changed files with 257 additions and 222 deletions

View File

@ -7,6 +7,7 @@ import { type FC, useMemo, useState } from 'react';
import { ChartConfigModal } from '../../../impact-metrics/ChartConfigModal/ChartConfigModal.tsx';
import { useImpactMetricsApi } from 'hooks/api/actions/useImpactMetricsSettingsApi/useImpactMetricsApi.ts';
import { useRequiredPathParam } from 'hooks/useRequiredPathParam.ts';
import { useFeatureImpactMetrics } from 'hooks/api/getters/useFeatureImpactMetrics/useFeatureImpactMetrics.ts';
const StyledHeaderTitle = styled(Typography)(({ theme }) => ({
fontSize: theme.fontSizes.mainHeader,
@ -18,6 +19,7 @@ export const FeatureImpactMetrics: FC = () => {
const feature = useRequiredPathParam('featureId');
const [modalOpen, setModalOpen] = useState(false);
const { createImpactMetric } = useImpactMetricsApi();
useFeatureImpactMetrics(feature);
const {
metadata,

View File

@ -0,0 +1,18 @@
import { fetcher, useApiGetter } from '../useApiGetter/useApiGetter.js';
import { formatApiPath } from 'utils/formatPath';
import type { ImpactMetricsConfigListSchema } from 'openapi';
export const useFeatureImpactMetrics = (feature: string) => {
const PATH = `api/admin/impact-metrics/config/${feature}`;
const { data, refetch, loading, error } =
useApiGetter<ImpactMetricsConfigListSchema>(formatApiPath(PATH), () =>
fetcher(formatApiPath(PATH), 'Feature Impact Metrics'),
);
return {
settings: data || { configs: [] },
refetch,
loading,
error,
};
};

View File

@ -1,14 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type AddMilestoneToReleasePlanTemplate401 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -1,14 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type AddMilestoneToReleasePlanTemplate403 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -1,14 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type AddMilestoneToReleasePlanTemplate404 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -4,7 +4,7 @@
* See `gen:api` script in package.json
*/
export type ArchiveReleasePlanTemplate403 = {
export type AddMilestoneToReleaseTemplate401 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */

View File

@ -4,7 +4,7 @@
* See `gen:api` script in package.json
*/
export type ArchiveReleasePlanTemplate401 = {
export type AddMilestoneToReleaseTemplate403 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */

View File

@ -0,0 +1,14 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type AddMilestoneToReleaseTemplate404 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -4,7 +4,7 @@
* See `gen:api` script in package.json
*/
export type GetReleasePlanTemplate401 = {
export type ArchiveReleaseTemplate401 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */

View File

@ -4,7 +4,7 @@
* See `gen:api` script in package.json
*/
export type CreateReleasePlanTemplate401 = {
export type ArchiveReleaseTemplate403 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */

View File

@ -4,7 +4,7 @@
* See `gen:api` script in package.json
*/
export type CreateReleasePlanTemplate409 = {
export type CreateReleaseTemplate401 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */

View File

@ -4,7 +4,7 @@
* See `gen:api` script in package.json
*/
export type DeleteReleasePlanTemplate403 = {
export type CreateReleaseTemplate409 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */

View File

@ -1,14 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type DeleteReleasePlanTemplate401 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -0,0 +1,14 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type DeleteReleaseTemplate401 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -0,0 +1,14 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type DeleteReleaseTemplate403 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -1,14 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type GetAllReleasePlanTemplates401 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -0,0 +1,14 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type GetReleaseTemplate401 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -0,0 +1,14 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type GetReleaseTemplates401 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -0,0 +1,14 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
import type { ImpactMetricsConfigSchema } from './impactMetricsConfigSchema.js';
/**
* A list of impact metrics configurations for a feature flag.
*/
export interface ImpactMetricsConfigListSchema {
/** The list of impact metrics configurations. */
configs: ImpactMetricsConfigSchema[];
}

View File

@ -47,9 +47,9 @@ export * from './addFeatureDependency404.js';
export * from './addFeatureStrategy401.js';
export * from './addFeatureStrategy403.js';
export * from './addFeatureStrategy404.js';
export * from './addMilestoneToReleasePlanTemplate401.js';
export * from './addMilestoneToReleasePlanTemplate403.js';
export * from './addMilestoneToReleasePlanTemplate404.js';
export * from './addMilestoneToReleaseTemplate401.js';
export * from './addMilestoneToReleaseTemplate403.js';
export * from './addMilestoneToReleaseTemplate404.js';
export * from './addPublicSignupTokenUser400.js';
export * from './addPublicSignupTokenUser409.js';
export * from './addReleasePlan401.js';
@ -116,8 +116,8 @@ export * from './archiveFeatures415.js';
export * from './archiveProject400.js';
export * from './archiveProject401.js';
export * from './archiveProject403.js';
export * from './archiveReleasePlanTemplate401.js';
export * from './archiveReleasePlanTemplate403.js';
export * from './archiveReleaseTemplate401.js';
export * from './archiveReleaseTemplate403.js';
export * from './bannerSchema.js';
export * from './bannersSchema.js';
export * from './batchFeaturesSchema.js';
@ -448,9 +448,9 @@ export * from './createPublicSignupToken401.js';
export * from './createPublicSignupToken403.js';
export * from './createReleasePlanMilestoneSchema.js';
export * from './createReleasePlanMilestoneStrategySchema.js';
export * from './createReleasePlanTemplate401.js';
export * from './createReleasePlanTemplate409.js';
export * from './createReleasePlanTemplateSchema.js';
export * from './createReleaseTemplate401.js';
export * from './createReleaseTemplate409.js';
export * from './createRole400.js';
export * from './createRole401.js';
export * from './createRole403.js';
@ -557,8 +557,8 @@ export * from './deleteProjectApiToken400.js';
export * from './deleteProjectApiToken401.js';
export * from './deleteProjectApiToken403.js';
export * from './deleteProjectApiToken404.js';
export * from './deleteReleasePlanTemplate401.js';
export * from './deleteReleasePlanTemplate403.js';
export * from './deleteReleaseTemplate401.js';
export * from './deleteReleaseTemplate403.js';
export * from './deleteRole400.js';
export * from './deleteRole401.js';
export * from './deleteRole403.js';
@ -700,7 +700,6 @@ export * from './getAllApiTokens403.js';
export * from './getAllEnvironments401.js';
export * from './getAllEnvironments403.js';
export * from './getAllFeatureTypes401.js';
export * from './getAllReleasePlanTemplates401.js';
export * from './getAllStrategies401.js';
export * from './getApiTokensByName401.js';
export * from './getApiTokensByName403.js';
@ -816,8 +815,9 @@ export * from './getPublicSignupToken403.js';
export * from './getRawFeatureMetrics401.js';
export * from './getRawFeatureMetrics403.js';
export * from './getRawFeatureMetrics404.js';
export * from './getReleasePlanTemplate401.js';
export * from './getReleasePlans401.js';
export * from './getReleaseTemplate401.js';
export * from './getReleaseTemplates401.js';
export * from './getRequestsForPeriodGrouping.js';
export * from './getRequestsForPeriodParams.js';
export * from './getRoleById400.js';
@ -887,6 +887,7 @@ export * from './healthReportSchema.js';
export * from './healthReportSchemaMode.js';
export * from './idSchema.js';
export * from './idsSchema.js';
export * from './impactMetricsConfigListSchema.js';
export * from './impactMetricsConfigSchema.js';
export * from './impactMetricsConfigSchemaSelectedLabels.js';
export * from './impactMetricsConfigSchemaSelectedRange.js';
@ -1171,9 +1172,9 @@ export * from './removeGroupAccess403.js';
export * from './removeGroupAccess404.js';
export * from './removeReleasePlan401.js';
export * from './removeReleasePlan403.js';
export * from './removeReleasePlanMilestone401.js';
export * from './removeReleasePlanMilestone403.js';
export * from './removeReleasePlanMilestone404.js';
export * from './removeReleaseTemplateMilestone401.js';
export * from './removeReleaseTemplateMilestone403.js';
export * from './removeReleaseTemplateMilestone404.js';
export * from './removeSegment401.js';
export * from './removeSegment403.js';
export * from './removeSegment409.js';
@ -1453,13 +1454,13 @@ export * from './updatePublicSignupToken401.js';
export * from './updatePublicSignupToken403.js';
export * from './updateReleasePlanMilestoneSchema.js';
export * from './updateReleasePlanMilestoneStrategySchema.js';
export * from './updateReleasePlanTemplate401.js';
export * from './updateReleasePlanTemplate403.js';
export * from './updateReleasePlanTemplate409.js';
export * from './updateReleasePlanTemplateMilestone401.js';
export * from './updateReleasePlanTemplateMilestone403.js';
export * from './updateReleasePlanTemplateMilestone404.js';
export * from './updateReleasePlanTemplateSchema.js';
export * from './updateReleaseTemplate401.js';
export * from './updateReleaseTemplate403.js';
export * from './updateReleaseTemplate409.js';
export * from './updateReleaseTemplateMilestone401.js';
export * from './updateReleaseTemplateMilestone403.js';
export * from './updateReleaseTemplateMilestone404.js';
export * from './updateRole400.js';
export * from './updateRole401.js';
export * from './updateRole403.js';

View File

@ -1,14 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type RemoveReleasePlanMilestone401 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -1,14 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type RemoveReleasePlanMilestone403 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -1,14 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type RemoveReleasePlanMilestone404 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -0,0 +1,14 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type RemoveReleaseTemplateMilestone401 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -0,0 +1,14 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type RemoveReleaseTemplateMilestone403 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -0,0 +1,14 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type RemoveReleaseTemplateMilestone404 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -1,14 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type UpdateReleasePlanTemplate401 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -1,14 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type UpdateReleasePlanTemplate403 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -1,14 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type UpdateReleasePlanTemplate409 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -1,14 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type UpdateReleasePlanTemplateMilestone401 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -1,14 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type UpdateReleasePlanTemplateMilestone403 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -1,14 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type UpdateReleasePlanTemplateMilestone404 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -0,0 +1,14 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type UpdateReleaseTemplate401 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -0,0 +1,14 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type UpdateReleaseTemplate403 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -0,0 +1,14 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type UpdateReleaseTemplate409 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -0,0 +1,14 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type UpdateReleaseTemplateMilestone401 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -0,0 +1,14 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type UpdateReleaseTemplateMilestone403 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -0,0 +1,14 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type UpdateReleaseTemplateMilestone404 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};