diff --git a/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlan.tsx b/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlan.tsx index cd344c1f15..0f55fc4294 100644 --- a/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlan.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlan.tsx @@ -32,6 +32,8 @@ import Add from '@mui/icons-material/Add'; import { StyledActionButton } from './ReleasePlanMilestoneItem/StyledActionButton.tsx'; import { SafeguardForm } from './SafeguardForm/SafeguardForm.tsx'; +import { useSafeguardsApi } from 'hooks/api/actions/useSafeguardsApi/useSafeguardsApi'; +import type { CreateSafeguardSchema } from 'openapi/models/createSafeguardSchema'; const StyledContainer = styled('div')(({ theme }) => ({ padding: theme.spacing(2), @@ -129,6 +131,7 @@ export const ReleasePlan = ({ const { removeReleasePlanFromFeature, startReleasePlanMilestone } = useReleasePlansApi(); const { deleteMilestoneProgression } = useMilestoneProgressionsApi(); + const { createOrUpdateSafeguard } = useSafeguardsApi(); const { setToastData, setToastApiError } = useToast(); const { trackEvent } = usePlausibleTracker(); @@ -377,24 +380,24 @@ export const ReleasePlan = ({ (milestone) => milestone.id === activeMilestoneId, ); - const handleSafeguardSubmit = (data: { - impactMetric: { - metricName: string; - timeRange: string; - aggregationMode: string; - labelSelectors: { - appName: string[]; - }; - }; - operator: string; - threshold: number; - }) => { - console.log('Safeguard data:', data); - setSafeguardFormOpen(false); - setToastData({ - type: 'success', - text: 'Safeguard added successfully', - }); + const handleSafeguardSubmit = async (data: CreateSafeguardSchema) => { + try { + await createOrUpdateSafeguard({ + projectId, + featureName, + environment, + planId: id, + body: data, + }); + setSafeguardFormOpen(false); + setToastData({ + type: 'success', + text: 'Safeguard added successfully', + }); + refetch(); + } catch (error: unknown) { + setToastApiError(formatUnknownError(error)); + } }; return ( diff --git a/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/SafeguardForm/SafeguardForm.tsx b/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/SafeguardForm/SafeguardForm.tsx index 79d3546227..38a816f97b 100644 --- a/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/SafeguardForm/SafeguardForm.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/SafeguardForm/SafeguardForm.tsx @@ -4,13 +4,13 @@ import type { FormEvent } from 'react'; import { useEffect, useMemo, useState } from 'react'; import { useImpactMetricsNames } from 'hooks/api/getters/useImpactMetricsMetadata/useImpactMetricsMetadata'; import { useImpactMetricsData } from 'hooks/api/getters/useImpactMetricsData/useImpactMetricsData'; -import { - RangeSelector, - type TimeRange, -} from 'component/impact-metrics/ChartConfigModal/ImpactMetricsControls/RangeSelector/RangeSelector'; +import { RangeSelector } from 'component/impact-metrics/ChartConfigModal/ImpactMetricsControls/RangeSelector/RangeSelector'; import { ModeSelector } from 'component/impact-metrics/ChartConfigModal/ImpactMetricsControls/ModeSelector/ModeSelector'; import { SeriesSelector } from 'component/impact-metrics/ChartConfigModal/ImpactMetricsControls/SeriesSelector/SeriesSelector'; -import type { AggregationMode } from 'component/impact-metrics/types'; +import type { CreateSafeguardSchema } from 'openapi/models/createSafeguardSchema'; +import type { MetricQuerySchemaTimeRange } from 'openapi/models/metricQuerySchemaTimeRange'; +import type { MetricQuerySchemaAggregationMode } from 'openapi/models/metricQuerySchemaAggregationMode'; +import type { CreateSafeguardSchemaOperator } from 'openapi/models/createSafeguardSchemaOperator'; import { createStyledIcon, StyledButtonGroup, @@ -25,18 +25,7 @@ import { const StyledIcon = createStyledIcon(ShieldIcon); interface ISafeguardFormProps { - onSubmit: (data: { - impactMetric: { - metricName: string; - timeRange: TimeRange; - aggregationMode: AggregationMode; - labelSelectors: { - appName: string[]; - }; - }; - operator: string; - threshold: number; - }) => void; + onSubmit: (data: CreateSafeguardSchema) => void; onCancel: () => void; } @@ -46,10 +35,12 @@ export const SafeguardForm = ({ onSubmit, onCancel }: ISafeguardFormProps) => { const [selectedMetric, setSelectedMetric] = useState(''); const [application, setApplication] = useState('*'); const [aggregationMode, setAggregationMode] = - useState('rps'); - const [operator, setOperator] = useState('>'); + useState('rps'); + const [operator, setOperator] = + useState('>'); const [threshold, setThreshold] = useState(0); - const [timeRange, setTimeRange] = useState('day'); + const [timeRange, setTimeRange] = + useState('day'); const { data: metricsData } = useImpactMetricsData( selectedMetric @@ -96,7 +87,7 @@ export const SafeguardForm = ({ onSubmit, onCancel }: ISafeguardFormProps) => { const handleSubmit = (e: FormEvent) => { e.preventDefault(); if (!Number.isNaN(Number(threshold))) { - onSubmit({ + const data: CreateSafeguardSchema = { impactMetric: { metricName: selectedMetric, timeRange, @@ -107,7 +98,8 @@ export const SafeguardForm = ({ onSubmit, onCancel }: ISafeguardFormProps) => { }, operator, threshold: Number(threshold), - }); + }; + onSubmit(data); } }; @@ -146,7 +138,11 @@ export const SafeguardForm = ({ onSubmit, onCancel }: ISafeguardFormProps) => { is setOperator(String(e.target.value))} + onChange={(e) => + setOperator( + e.target.value as CreateSafeguardSchemaOperator, + ) + } variant='outlined' size='small' > diff --git a/frontend/src/hooks/api/actions/useSafeguardsApi/useSafeguardsApi.ts b/frontend/src/hooks/api/actions/useSafeguardsApi/useSafeguardsApi.ts new file mode 100644 index 0000000000..688a0d5ee3 --- /dev/null +++ b/frontend/src/hooks/api/actions/useSafeguardsApi/useSafeguardsApi.ts @@ -0,0 +1,43 @@ +import useAPI from '../useApi/useApi.js'; +import type { CreateSafeguardSchema } from 'openapi/models/createSafeguardSchema'; + +export interface CreateSafeguardParams { + projectId: string; + featureName: string; + environment: string; + planId: string; + body: CreateSafeguardSchema; +} + +export const useSafeguardsApi = () => { + const { makeRequest, createRequest, errors, loading } = useAPI({ + propagateErrors: true, + }); + + const createOrUpdateSafeguard = async ({ + projectId, + featureName, + environment, + planId, + body, + }: CreateSafeguardParams): Promise => { + const requestId = 'createOrUpdateSafeguard'; + const path = `api/admin/projects/${projectId}/features/${featureName}/environments/${environment}/release_plans/${planId}/safeguards`; + const req = createRequest( + path, + { + method: 'PUT', + body: JSON.stringify(body), + }, + requestId, + ); + + await makeRequest(req.caller, req.id); + }; + + return { + createOrUpdateSafeguard, + errors, + loading, + }; +}; diff --git a/frontend/src/openapi/models/applicationSchema.ts b/frontend/src/openapi/models/applicationSchema.ts index aa119bf954..0eb4caddf7 100644 --- a/frontend/src/openapi/models/applicationSchema.ts +++ b/frontend/src/openapi/models/applicationSchema.ts @@ -19,7 +19,7 @@ export interface ApplicationSchema { icon?: string; /** Which SDK and version the application reporting uses. Typically represented as `:` */ sdkVersion?: string; - /** Which [strategies](https://docs.getunleash.io/topics/the-anatomy-of-unleash#activation-strategies) the application has loaded. Useful when trying to figure out if your [custom strategy](https://docs.getunleash.io/reference/custom-activation-strategies) has been loaded in the SDK */ + /** Which [strategies](https://docs.getunleash.io/topics/the-anatomy-of-unleash#activation-strategies) the application has loaded. Useful when trying to figure out if your [custom strategy](https://docs.getunleash.io/reference/activation-strategies#custom-strategies) has been loaded in the SDK */ strategies?: string[]; /** A link to reference the application reporting the metrics. Could for instance be a GitHub link to the repository of the application */ url?: string; diff --git a/frontend/src/openapi/models/changeSafeguard401.ts b/frontend/src/openapi/models/changeSafeguard401.ts new file mode 100644 index 0000000000..0e2b52d872 --- /dev/null +++ b/frontend/src/openapi/models/changeSafeguard401.ts @@ -0,0 +1,14 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ + +export type ChangeSafeguard401 = { + /** The ID of the error instance */ + id?: string; + /** A description of what went wrong. */ + message?: string; + /** The name of the error kind */ + name?: string; +}; diff --git a/frontend/src/openapi/models/changeSafeguard403.ts b/frontend/src/openapi/models/changeSafeguard403.ts new file mode 100644 index 0000000000..4b42a9a480 --- /dev/null +++ b/frontend/src/openapi/models/changeSafeguard403.ts @@ -0,0 +1,14 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ + +export type ChangeSafeguard403 = { + /** The ID of the error instance */ + id?: string; + /** A description of what went wrong. */ + message?: string; + /** The name of the error kind */ + name?: string; +}; diff --git a/frontend/src/openapi/models/createApplicationSchema.ts b/frontend/src/openapi/models/createApplicationSchema.ts index a45f8326cf..30ef2cc191 100644 --- a/frontend/src/openapi/models/createApplicationSchema.ts +++ b/frontend/src/openapi/models/createApplicationSchema.ts @@ -12,7 +12,7 @@ export interface CreateApplicationSchema { color?: string; /** An URL to an icon file to be used for the applications's entry in the application list */ icon?: string; - /** Which [strategies](https://docs.getunleash.io/topics/the-anatomy-of-unleash#activation-strategies) the application has loaded. Useful when trying to figure out if your [custom strategy](https://docs.getunleash.io/reference/custom-activation-strategies) has been loaded in the SDK */ + /** Which [strategies](https://docs.getunleash.io/topics/the-anatomy-of-unleash#activation-strategies) the application has loaded. Useful when trying to figure out if your [custom strategy](https://docs.getunleash.io/reference/activation-strategies#custom-strategies) has been loaded in the SDK */ strategies?: string[]; /** A link to reference the application reporting the metrics. Could for instance be a GitHub link to the repository of the application */ url?: string; diff --git a/frontend/src/openapi/models/createImpactMetricsConfigSchema.ts b/frontend/src/openapi/models/createImpactMetricsConfigSchema.ts index 8dc2ac8bfb..8d8abbf32c 100644 --- a/frontend/src/openapi/models/createImpactMetricsConfigSchema.ts +++ b/frontend/src/openapi/models/createImpactMetricsConfigSchema.ts @@ -18,7 +18,7 @@ export interface CreateImpactMetricsConfigSchema { id?: string; /** The selected labels and their values for filtering the metric data. */ labelSelectors: CreateImpactMetricsConfigSchemaLabelSelectors; - /** The Prometheus metric series to display. It includes both unleash prefix and metric type and display name */ + /** The Prometheus metric series to query. It includes both unleash prefix and metric type and display name */ metricName: string; /** The time range for the metric data. */ timeRange: CreateImpactMetricsConfigSchemaTimeRange; diff --git a/frontend/src/openapi/models/createSafeguardSchema.ts b/frontend/src/openapi/models/createSafeguardSchema.ts new file mode 100644 index 0000000000..4d0afcd3cb --- /dev/null +++ b/frontend/src/openapi/models/createSafeguardSchema.ts @@ -0,0 +1,19 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ +import type { MetricQuerySchema } from './metricQuerySchema.js'; +import type { CreateSafeguardSchemaOperator } from './createSafeguardSchemaOperator.js'; + +/** + * Request body to create a safeguard with metric-based alert condition. + */ +export interface CreateSafeguardSchema { + /** Metric configuration that should be evaluated for the safeguard. */ + impactMetric: MetricQuerySchema; + /** The comparison operator for the threshold check. */ + operator: CreateSafeguardSchemaOperator; + /** The threshold value to compare against. */ + threshold: number; +} diff --git a/frontend/src/openapi/models/createSafeguardSchemaOperator.ts b/frontend/src/openapi/models/createSafeguardSchemaOperator.ts new file mode 100644 index 0000000000..1d3495afcf --- /dev/null +++ b/frontend/src/openapi/models/createSafeguardSchemaOperator.ts @@ -0,0 +1,17 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ + +/** + * The comparison operator for the threshold check. + */ +export type CreateSafeguardSchemaOperator = + (typeof CreateSafeguardSchemaOperator)[keyof typeof CreateSafeguardSchemaOperator]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const CreateSafeguardSchemaOperator = { + '>': '>', + '<': '<', +} as const; diff --git a/frontend/src/openapi/models/createStrategySchema.ts b/frontend/src/openapi/models/createStrategySchema.ts index 981a1e909c..332b0e40d7 100644 --- a/frontend/src/openapi/models/createStrategySchema.ts +++ b/frontend/src/openapi/models/createStrategySchema.ts @@ -6,7 +6,7 @@ import type { CreateStrategySchemaParametersItem } from './createStrategySchemaParametersItem.js'; /** - * The data required to create a strategy type. Refer to the docs on [custom strategy types](https://docs.getunleash.io/reference/custom-activation-strategies) for more information. + * The data required to create a strategy type. Refer to the docs on [custom strategy types](https://docs.getunleash.io/reference/activation-strategies#custom-strategies) for more information. */ export interface CreateStrategySchema { /** Whether the strategy type is deprecated or not. Defaults to `false`. */ diff --git a/frontend/src/openapi/models/createStrategySchemaParametersItem.ts b/frontend/src/openapi/models/createStrategySchemaParametersItem.ts index 3b04bd0d3b..4fc918e194 100644 --- a/frontend/src/openapi/models/createStrategySchemaParametersItem.ts +++ b/frontend/src/openapi/models/createStrategySchemaParametersItem.ts @@ -12,6 +12,6 @@ export type CreateStrategySchemaParametersItem = { name: string; /** Whether this parameter must be configured when using the strategy. Defaults to `false` */ required?: boolean; - /** The [type of the parameter](https://docs.getunleash.io/reference/custom-activation-strategies#parameter-types) */ + /** The [type of the parameter](https://docs.getunleash.io/reference/activation-strategies#parameters) */ type: CreateStrategySchemaParametersItemType; }; diff --git a/frontend/src/openapi/models/createStrategySchemaParametersItemType.ts b/frontend/src/openapi/models/createStrategySchemaParametersItemType.ts index 33e89ecf3e..cc54ddafd9 100644 --- a/frontend/src/openapi/models/createStrategySchemaParametersItemType.ts +++ b/frontend/src/openapi/models/createStrategySchemaParametersItemType.ts @@ -5,7 +5,7 @@ */ /** - * The [type of the parameter](https://docs.getunleash.io/reference/custom-activation-strategies#parameter-types) + * The [type of the parameter](https://docs.getunleash.io/reference/activation-strategies#parameters) */ export type CreateStrategySchemaParametersItemType = (typeof CreateStrategySchemaParametersItemType)[keyof typeof CreateStrategySchemaParametersItemType]; diff --git a/frontend/src/openapi/models/edgeInstanceDataSchema.ts b/frontend/src/openapi/models/edgeInstanceDataSchema.ts index 714366a7fa..55db1ca875 100644 --- a/frontend/src/openapi/models/edgeInstanceDataSchema.ts +++ b/frontend/src/openapi/models/edgeInstanceDataSchema.ts @@ -28,7 +28,7 @@ export interface EdgeInstanceDataSchema { connectionConsumptionSinceLastReport?: ConnectionConsumptionSchema; /** Which version (semver) of Edge is the Edge instance running. */ edgeVersion: string; - /** A marker that tells Unleash whether this Edge instance is self-hosted or hosted by Unleash. */ + /** A marker that tells Unleash whether this Edge instance is self-hosted, enterprise self-hosted, or hosted by Unleash. */ hosting?: EdgeInstanceDataSchemaHosting; /** The ID of the Edge process, typically a ULID. Newly generated for each restart of the instance. */ identifier: string; diff --git a/frontend/src/openapi/models/edgeInstanceDataSchemaHosting.ts b/frontend/src/openapi/models/edgeInstanceDataSchemaHosting.ts index f98c857b0a..af7d8563ab 100644 --- a/frontend/src/openapi/models/edgeInstanceDataSchemaHosting.ts +++ b/frontend/src/openapi/models/edgeInstanceDataSchemaHosting.ts @@ -5,7 +5,7 @@ */ /** - * A marker that tells Unleash whether this Edge instance is self-hosted or hosted by Unleash. + * A marker that tells Unleash whether this Edge instance is self-hosted, enterprise self-hosted, or hosted by Unleash. */ export type EdgeInstanceDataSchemaHosting = (typeof EdgeInstanceDataSchemaHosting)[keyof typeof EdgeInstanceDataSchemaHosting]; @@ -14,4 +14,5 @@ export type EdgeInstanceDataSchemaHosting = export const EdgeInstanceDataSchemaHosting = { hosted: 'hosted', 'self-hosted': 'self-hosted', + 'enterprise-self-hosted': 'enterprise-self-hosted', } as const; diff --git a/frontend/src/openapi/models/impactMetricsConfigSchema.ts b/frontend/src/openapi/models/impactMetricsConfigSchema.ts index 3c53f2d3b0..9971eca44b 100644 --- a/frontend/src/openapi/models/impactMetricsConfigSchema.ts +++ b/frontend/src/openapi/models/impactMetricsConfigSchema.ts @@ -21,7 +21,7 @@ export interface ImpactMetricsConfigSchema { id: string; /** The selected labels and their values for filtering the metric data. */ labelSelectors: ImpactMetricsConfigSchemaLabelSelectors; - /** The Prometheus metric series to display. It includes both unleash prefix and metric type and display name */ + /** The Prometheus metric series to query. It includes both unleash prefix and metric type and display name */ metricName: string; /** The time range for the metric data. */ timeRange: ImpactMetricsConfigSchemaTimeRange; diff --git a/frontend/src/openapi/models/index.ts b/frontend/src/openapi/models/index.ts index 5d33d8bab9..509c87cf72 100644 --- a/frontend/src/openapi/models/index.ts +++ b/frontend/src/openapi/models/index.ts @@ -349,6 +349,8 @@ export * from './changeRequestsSchemaItemOneOfFour.js'; export * from './changeRequestsSchemaItemOneOfFourCreatedBy.js'; export * from './changeRequestsSchemaItemOneOfFourState.js'; export * from './changeRequestsSchemaItemOneOfState.js'; +export * from './changeSafeguard401.js'; +export * from './changeSafeguard403.js'; export * from './changeUserPassword400.js'; export * from './changeUserPassword401.js'; export * from './changeUserPassword403.js'; @@ -496,6 +498,8 @@ export * from './createRoleWithPermissionsSchemaAnyOfFourPermissionsItem.js'; export * from './createRoleWithPermissionsSchemaAnyOfFourType.js'; export * from './createRoleWithPermissionsSchemaAnyOfPermissionsItem.js'; export * from './createRoleWithPermissionsSchemaAnyOfType.js'; +export * from './createSafeguardSchema.js'; +export * from './createSafeguardSchemaOperator.js'; export * from './createSegment400.js'; export * from './createSegment401.js'; export * from './createSegment403.js'; @@ -1039,6 +1043,10 @@ export * from './meteredRequestsSchemaApiDataItem.js'; export * from './meteredRequestsSchemaApiDataItemDataPointsItem.js'; export * from './meteredRequestsSchemaDateRange.js'; export * from './meteredRequestsSchemaGrouping.js'; +export * from './metricQuerySchema.js'; +export * from './metricQuerySchemaAggregationMode.js'; +export * from './metricQuerySchemaLabelSelectors.js'; +export * from './metricQuerySchemaTimeRange.js'; export * from './milestoneProgressionSchema.js'; export * from './nameSchema.js'; export * from './notificationsSchema.js'; @@ -1206,6 +1214,8 @@ export * from './pushVariantsSchema.js'; export * from './reactivateStrategy401.js'; export * from './reactivateStrategy403.js'; export * from './reactivateStrategy404.js'; +export * from './readyCheckSchema.js'; +export * from './readyCheckSchemaHealth.js'; export * from './recordUiErrorSchema.js'; export * from './registerClientMetrics400.js'; export * from './registerFrontendClient400.js'; @@ -1283,6 +1293,9 @@ export * from './roleWithPermissionsSchema.js'; export * from './roleWithVersionSchema.js'; export * from './rolesSchema.js'; export * from './rolesWithVersionSchema.js'; +export * from './safeguardSchema.js'; +export * from './safeguardSchemaTriggerCondition.js'; +export * from './safeguardSchemaTriggerConditionOperator.js'; export * from './samlSettingsResponseSchema.js'; export * from './samlSettingsResponseSchemaDefaultRootRole.js'; export * from './samlSettingsSchema.js'; diff --git a/frontend/src/openapi/models/metricQuerySchema.ts b/frontend/src/openapi/models/metricQuerySchema.ts new file mode 100644 index 0000000000..2d3636e03f --- /dev/null +++ b/frontend/src/openapi/models/metricQuerySchema.ts @@ -0,0 +1,22 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ +import type { MetricQuerySchemaAggregationMode } from './metricQuerySchemaAggregationMode.js'; +import type { MetricQuerySchemaLabelSelectors } from './metricQuerySchemaLabelSelectors.js'; +import type { MetricQuerySchemaTimeRange } from './metricQuerySchemaTimeRange.js'; + +/** + * Common metric query configuration for selecting and filtering metric data. + */ +export interface MetricQuerySchema { + /** The aggregation mode for the metric data. */ + aggregationMode: MetricQuerySchemaAggregationMode; + /** The selected labels and their values for filtering the metric data. */ + labelSelectors: MetricQuerySchemaLabelSelectors; + /** The Prometheus metric series to query. It includes both unleash prefix and metric type and display name */ + metricName: string; + /** The time range for the metric data. */ + timeRange: MetricQuerySchemaTimeRange; +} diff --git a/frontend/src/openapi/models/metricQuerySchemaAggregationMode.ts b/frontend/src/openapi/models/metricQuerySchemaAggregationMode.ts new file mode 100644 index 0000000000..1f06b02f6c --- /dev/null +++ b/frontend/src/openapi/models/metricQuerySchemaAggregationMode.ts @@ -0,0 +1,22 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ + +/** + * The aggregation mode for the metric data. + */ +export type MetricQuerySchemaAggregationMode = + (typeof MetricQuerySchemaAggregationMode)[keyof typeof MetricQuerySchemaAggregationMode]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const MetricQuerySchemaAggregationMode = { + rps: 'rps', + count: 'count', + avg: 'avg', + sum: 'sum', + p95: 'p95', + p99: 'p99', + p50: 'p50', +} as const; diff --git a/frontend/src/openapi/models/metricQuerySchemaLabelSelectors.ts b/frontend/src/openapi/models/metricQuerySchemaLabelSelectors.ts new file mode 100644 index 0000000000..08f8b86ef3 --- /dev/null +++ b/frontend/src/openapi/models/metricQuerySchemaLabelSelectors.ts @@ -0,0 +1,10 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ + +/** + * The selected labels and their values for filtering the metric data. + */ +export type MetricQuerySchemaLabelSelectors = { [key: string]: string[] }; diff --git a/frontend/src/openapi/models/metricQuerySchemaTimeRange.ts b/frontend/src/openapi/models/metricQuerySchemaTimeRange.ts new file mode 100644 index 0000000000..c02fbce84b --- /dev/null +++ b/frontend/src/openapi/models/metricQuerySchemaTimeRange.ts @@ -0,0 +1,19 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ + +/** + * The time range for the metric data. + */ +export type MetricQuerySchemaTimeRange = + (typeof MetricQuerySchemaTimeRange)[keyof typeof MetricQuerySchemaTimeRange]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const MetricQuerySchemaTimeRange = { + hour: 'hour', + day: 'day', + week: 'week', + month: 'month', +} as const; diff --git a/frontend/src/openapi/models/milestoneProgressionSchema.ts b/frontend/src/openapi/models/milestoneProgressionSchema.ts index e9cb107646..03b49f3522 100644 --- a/frontend/src/openapi/models/milestoneProgressionSchema.ts +++ b/frontend/src/openapi/models/milestoneProgressionSchema.ts @@ -9,8 +9,6 @@ import type { TransitionConditionSchema } from './transitionConditionSchema.js'; * A milestone progression configuration */ export interface MilestoneProgressionSchema { - /** The unique identifier for this progression */ - id: string; /** The ID of the source milestone */ sourceMilestone: string; /** The ID of the target milestone */ diff --git a/frontend/src/openapi/models/permissionSchema.ts b/frontend/src/openapi/models/permissionSchema.ts index 830d91387f..0c1620b238 100644 --- a/frontend/src/openapi/models/permissionSchema.ts +++ b/frontend/src/openapi/models/permissionSchema.ts @@ -10,7 +10,7 @@ export interface PermissionSchema { /** The environment this permission applies to */ environment?: string; - /** [Project](https://docs.getunleash.io/reference/rbac#project-permissions) or [environment](https://docs.getunleash.io/reference/rbac#environment-permissions) permission name */ + /** [Project](https://docs.getunleash.io/reference/rbac#project-level-permissions) or [environment](https://docs.getunleash.io/reference/rbac#environment-level-permissions) permission name */ permission: string; /** The project this permission applies to */ project?: string; diff --git a/frontend/src/openapi/models/readyCheckSchema.ts b/frontend/src/openapi/models/readyCheckSchema.ts new file mode 100644 index 0000000000..dc392a5901 --- /dev/null +++ b/frontend/src/openapi/models/readyCheckSchema.ts @@ -0,0 +1,14 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ +import type { ReadyCheckSchemaHealth } from './readyCheckSchemaHealth.js'; + +/** + * Used by service orchestrators to decide whether this Unleash instance should be considered ready to serve requests. + */ +export interface ReadyCheckSchema { + /** The readiness state this Unleash instance is in. GOOD if the server is up and running. If the server is unhealthy you will get an unsuccessful http response. */ + health: ReadyCheckSchemaHealth; +} diff --git a/frontend/src/openapi/models/readyCheckSchemaHealth.ts b/frontend/src/openapi/models/readyCheckSchemaHealth.ts new file mode 100644 index 0000000000..09d26f5e40 --- /dev/null +++ b/frontend/src/openapi/models/readyCheckSchemaHealth.ts @@ -0,0 +1,16 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ + +/** + * The readiness state this Unleash instance is in. GOOD if the server is up and running. If the server is unhealthy you will get an unsuccessful http response. + */ +export type ReadyCheckSchemaHealth = + (typeof ReadyCheckSchemaHealth)[keyof typeof ReadyCheckSchemaHealth]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const ReadyCheckSchemaHealth = { + GOOD: 'GOOD', +} as const; diff --git a/frontend/src/openapi/models/safeguardSchema.ts b/frontend/src/openapi/models/safeguardSchema.ts new file mode 100644 index 0000000000..8b09de2b30 --- /dev/null +++ b/frontend/src/openapi/models/safeguardSchema.ts @@ -0,0 +1,18 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ +import type { SafeguardSchemaTriggerCondition } from './safeguardSchemaTriggerCondition.js'; + +/** + * A safeguard configuration for release plan automation + */ +export interface SafeguardSchema { + /** The unique ULID identifier for this safeguard */ + id: string; + /** The impact metric id */ + impactMetric: string; + /** The condition that triggers the safeguard action */ + triggerCondition: SafeguardSchemaTriggerCondition; +} diff --git a/frontend/src/openapi/models/safeguardSchemaTriggerCondition.ts b/frontend/src/openapi/models/safeguardSchemaTriggerCondition.ts new file mode 100644 index 0000000000..f6ea6cd9a7 --- /dev/null +++ b/frontend/src/openapi/models/safeguardSchemaTriggerCondition.ts @@ -0,0 +1,16 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ +import type { SafeguardSchemaTriggerConditionOperator } from './safeguardSchemaTriggerConditionOperator.js'; + +/** + * The condition that triggers the safeguard action + */ +export type SafeguardSchemaTriggerCondition = { + /** The comparison operator for the threshold check. */ + operator: SafeguardSchemaTriggerConditionOperator; + /** The threshold value to compare against. */ + threshold: number; +}; diff --git a/frontend/src/openapi/models/safeguardSchemaTriggerConditionOperator.ts b/frontend/src/openapi/models/safeguardSchemaTriggerConditionOperator.ts new file mode 100644 index 0000000000..420ef14162 --- /dev/null +++ b/frontend/src/openapi/models/safeguardSchemaTriggerConditionOperator.ts @@ -0,0 +1,17 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ + +/** + * The comparison operator for the threshold check. + */ +export type SafeguardSchemaTriggerConditionOperator = + (typeof SafeguardSchemaTriggerConditionOperator)[keyof typeof SafeguardSchemaTriggerConditionOperator]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const SafeguardSchemaTriggerConditionOperator = { + '>': '>', + '<': '<', +} as const; diff --git a/frontend/src/openapi/models/updateStrategySchemaParametersItem.ts b/frontend/src/openapi/models/updateStrategySchemaParametersItem.ts index 33be4156b5..d311e8c38b 100644 --- a/frontend/src/openapi/models/updateStrategySchemaParametersItem.ts +++ b/frontend/src/openapi/models/updateStrategySchemaParametersItem.ts @@ -12,6 +12,6 @@ export type UpdateStrategySchemaParametersItem = { name: string; /** Whether this parameter must be configured when using the strategy. Defaults to `false` */ required?: boolean; - /** The [type of the parameter](https://docs.getunleash.io/reference/custom-activation-strategies#parameter-types) */ + /** The [type of the parameter](https://docs.getunleash.io/reference/activation-strategies#parameters) */ type: UpdateStrategySchemaParametersItemType; }; diff --git a/frontend/src/openapi/models/updateStrategySchemaParametersItemType.ts b/frontend/src/openapi/models/updateStrategySchemaParametersItemType.ts index eafd3e2ecb..0e32e6b19a 100644 --- a/frontend/src/openapi/models/updateStrategySchemaParametersItemType.ts +++ b/frontend/src/openapi/models/updateStrategySchemaParametersItemType.ts @@ -5,7 +5,7 @@ */ /** - * The [type of the parameter](https://docs.getunleash.io/reference/custom-activation-strategies#parameter-types) + * The [type of the parameter](https://docs.getunleash.io/reference/activation-strategies#parameters) */ export type UpdateStrategySchemaParametersItemType = (typeof UpdateStrategySchemaParametersItemType)[keyof typeof UpdateStrategySchemaParametersItemType];