mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
parent
cd734428ff
commit
169b2bd0c5
@ -9,6 +9,7 @@ import {
|
|||||||
import StringTruncator from 'component/common/StringTruncator/StringTruncator';
|
import StringTruncator from 'component/common/StringTruncator/StringTruncator';
|
||||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||||
import { PlaygroundStrategySchema } from 'openapi';
|
import { PlaygroundStrategySchema } from 'openapi';
|
||||||
|
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
||||||
|
|
||||||
interface IStrategyItemContainerProps {
|
interface IStrategyItemContainerProps {
|
||||||
strategy: IFeatureStrategy | PlaygroundStrategySchema;
|
strategy: IFeatureStrategy | PlaygroundStrategySchema;
|
||||||
@ -69,6 +70,7 @@ export const StrategyItemContainer: FC<IStrategyItemContainerProps> = ({
|
|||||||
style = {},
|
style = {},
|
||||||
}) => {
|
}) => {
|
||||||
const Icon = getFeatureStrategyIcon(strategy.name);
|
const Icon = getFeatureStrategyIcon(strategy.name);
|
||||||
|
const { uiConfig } = useUiConfig();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box sx={{ position: 'relative' }}>
|
<Box sx={{ position: 'relative' }}>
|
||||||
@ -105,7 +107,11 @@ export const StrategyItemContainer: FC<IStrategyItemContainerProps> = ({
|
|||||||
<StringTruncator
|
<StringTruncator
|
||||||
maxWidth="150"
|
maxWidth="150"
|
||||||
maxLength={15}
|
maxLength={15}
|
||||||
text={formatStrategyName(strategy.name)}
|
text={formatStrategyName(
|
||||||
|
uiConfig?.flags?.strategyTitle
|
||||||
|
? strategy.title || strategy.name
|
||||||
|
: strategy.name
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
|
@ -29,6 +29,7 @@ import { comparisonModerator } from '../featureStrategy.utils';
|
|||||||
import { useChangeRequestApi } from 'hooks/api/actions/useChangeRequestApi/useChangeRequestApi';
|
import { useChangeRequestApi } from 'hooks/api/actions/useChangeRequestApi/useChangeRequestApi';
|
||||||
import { useChangeRequestsEnabled } from 'hooks/useChangeRequestsEnabled';
|
import { useChangeRequestsEnabled } from 'hooks/useChangeRequestsEnabled';
|
||||||
import { usePendingChangeRequests } from 'hooks/api/getters/usePendingChangeRequests/usePendingChangeRequests';
|
import { usePendingChangeRequests } from 'hooks/api/getters/usePendingChangeRequests/usePendingChangeRequests';
|
||||||
|
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
|
||||||
|
|
||||||
export const FeatureStrategyCreate = () => {
|
export const FeatureStrategyCreate = () => {
|
||||||
const projectId = useRequiredPathParam('projectId');
|
const projectId = useRequiredPathParam('projectId');
|
||||||
@ -52,6 +53,7 @@ export const FeatureStrategyCreate = () => {
|
|||||||
const { isChangeRequestConfigured } = useChangeRequestsEnabled(projectId);
|
const { isChangeRequestConfigured } = useChangeRequestsEnabled(projectId);
|
||||||
const { refetch: refetchChangeRequests } =
|
const { refetch: refetchChangeRequests } =
|
||||||
usePendingChangeRequests(projectId);
|
usePendingChangeRequests(projectId);
|
||||||
|
const { trackEvent } = usePlausibleTracker();
|
||||||
|
|
||||||
const { data, staleDataNotification, forceRefreshCache } =
|
const { data, staleDataNotification, forceRefreshCache } =
|
||||||
useCollaborateData<IFeatureToggle>(
|
useCollaborateData<IFeatureToggle>(
|
||||||
@ -115,6 +117,13 @@ export const FeatureStrategyCreate = () => {
|
|||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
const payload = createStrategyPayload(strategy, segments);
|
const payload = createStrategyPayload(strategy, segments);
|
||||||
|
|
||||||
|
trackEvent('strategyTitle', {
|
||||||
|
props: {
|
||||||
|
hasTitle: Boolean(strategy.title),
|
||||||
|
on: 'create',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (isChangeRequestConfigured(environmentId)) {
|
if (isChangeRequestConfigured(environmentId)) {
|
||||||
await onStrategyRequestAdd(payload);
|
await onStrategyRequestAdd(payload);
|
||||||
|
@ -27,6 +27,7 @@ import { comparisonModerator } from '../featureStrategy.utils';
|
|||||||
import { useChangeRequestsEnabled } from 'hooks/useChangeRequestsEnabled';
|
import { useChangeRequestsEnabled } from 'hooks/useChangeRequestsEnabled';
|
||||||
import { useChangeRequestApi } from 'hooks/api/actions/useChangeRequestApi/useChangeRequestApi';
|
import { useChangeRequestApi } from 'hooks/api/actions/useChangeRequestApi/useChangeRequestApi';
|
||||||
import { usePendingChangeRequests } from 'hooks/api/getters/usePendingChangeRequests/usePendingChangeRequests';
|
import { usePendingChangeRequests } from 'hooks/api/getters/usePendingChangeRequests/usePendingChangeRequests';
|
||||||
|
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
|
||||||
|
|
||||||
export const FeatureStrategyEdit = () => {
|
export const FeatureStrategyEdit = () => {
|
||||||
const projectId = useRequiredPathParam('projectId');
|
const projectId = useRequiredPathParam('projectId');
|
||||||
@ -47,6 +48,7 @@ export const FeatureStrategyEdit = () => {
|
|||||||
const { isChangeRequestConfigured } = useChangeRequestsEnabled(projectId);
|
const { isChangeRequestConfigured } = useChangeRequestsEnabled(projectId);
|
||||||
const { refetch: refetchChangeRequests } =
|
const { refetch: refetchChangeRequests } =
|
||||||
usePendingChangeRequests(projectId);
|
usePendingChangeRequests(projectId);
|
||||||
|
const { trackEvent } = usePlausibleTracker();
|
||||||
|
|
||||||
const { feature, refetchFeature } = useFeature(projectId, featureId);
|
const { feature, refetchFeature } = useFeature(projectId, featureId);
|
||||||
|
|
||||||
@ -101,6 +103,13 @@ export const FeatureStrategyEdit = () => {
|
|||||||
payload
|
payload
|
||||||
);
|
);
|
||||||
|
|
||||||
|
trackEvent('strategyTitle', {
|
||||||
|
props: {
|
||||||
|
hasTitle: Boolean(strategy.title),
|
||||||
|
on: 'edit',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
await refetchSavedStrategySegments();
|
await refetchSavedStrategySegments();
|
||||||
setToastData({
|
setToastData({
|
||||||
title: 'Strategy updated',
|
title: 'Strategy updated',
|
||||||
@ -189,6 +198,7 @@ export const createStrategyPayload = (
|
|||||||
segments: ISegment[]
|
segments: ISegment[]
|
||||||
): IFeatureStrategyPayload => ({
|
): IFeatureStrategyPayload => ({
|
||||||
name: strategy.name,
|
name: strategy.name,
|
||||||
|
title: strategy.title,
|
||||||
constraints: strategy.constraints ?? [],
|
constraints: strategy.constraints ?? [],
|
||||||
parameters: strategy.parameters ?? {},
|
parameters: strategy.parameters ?? {},
|
||||||
segments: segments.map(segment => segment.id),
|
segments: segments.map(segment => segment.id),
|
||||||
|
@ -29,6 +29,7 @@ import { formatFeaturePath } from '../FeatureStrategyEdit/FeatureStrategyEdit';
|
|||||||
import { useChangeRequestInReviewWarning } from 'hooks/useChangeRequestInReviewWarning';
|
import { useChangeRequestInReviewWarning } from 'hooks/useChangeRequestInReviewWarning';
|
||||||
import { usePendingChangeRequests } from 'hooks/api/getters/usePendingChangeRequests/usePendingChangeRequests';
|
import { usePendingChangeRequests } from 'hooks/api/getters/usePendingChangeRequests/usePendingChangeRequests';
|
||||||
import { useHasProjectEnvironmentAccess } from 'hooks/useHasAccess';
|
import { useHasProjectEnvironmentAccess } from 'hooks/useHasAccess';
|
||||||
|
import { FeatureStrategyTitle } from './FeatureStrategyTitle/FeatureStrategyTitle';
|
||||||
|
|
||||||
interface IFeatureStrategyFormProps {
|
interface IFeatureStrategyFormProps {
|
||||||
feature: IFeatureToggle;
|
feature: IFeatureToggle;
|
||||||
@ -217,6 +218,20 @@ export const FeatureStrategyForm = ({
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
<ConditionallyRender
|
||||||
|
condition={Boolean(uiConfig?.flags?.strategyTitle)}
|
||||||
|
show={
|
||||||
|
<FeatureStrategyTitle
|
||||||
|
title={strategy.title || ''}
|
||||||
|
setTitle={title => {
|
||||||
|
setStrategy(prev => ({
|
||||||
|
...prev,
|
||||||
|
title,
|
||||||
|
}));
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
/>
|
||||||
<FeatureStrategyConstraints
|
<FeatureStrategyConstraints
|
||||||
projectId={feature.project}
|
projectId={feature.project}
|
||||||
environmentId={environmentId}
|
environmentId={environmentId}
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
import { Box, Typography } from '@mui/material';
|
||||||
|
import Input from 'component/common/Input/Input';
|
||||||
|
import { VFC } from 'react';
|
||||||
|
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
||||||
|
|
||||||
|
interface IFeatureStrategyTitleProps {
|
||||||
|
title: string;
|
||||||
|
setTitle: (title: string) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const FeatureStrategyTitle: VFC<IFeatureStrategyTitleProps> = ({
|
||||||
|
title,
|
||||||
|
setTitle,
|
||||||
|
}) => {
|
||||||
|
const { uiConfig } = useUiConfig();
|
||||||
|
|
||||||
|
if (!uiConfig.flags.strategyTitle) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box sx={{ paddingBottom: theme => theme.spacing(2) }}>
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
paddingBottom: theme => theme.spacing(2),
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
What would you like to call this strategy? (optional)
|
||||||
|
</Typography>
|
||||||
|
<Input
|
||||||
|
label="Strategy title"
|
||||||
|
id="title-input"
|
||||||
|
value={title}
|
||||||
|
onChange={e => setTitle(e.target.value)}
|
||||||
|
sx={{ width: '100%' }}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
};
|
@ -23,7 +23,8 @@ export type CustomEvents =
|
|||||||
| 'project_api_tokens'
|
| 'project_api_tokens'
|
||||||
| 'project_stickiness_set'
|
| 'project_stickiness_set'
|
||||||
| 'notifications'
|
| 'notifications'
|
||||||
| 'batch_operations';
|
| 'batch_operations'
|
||||||
|
| 'strategyTitle';
|
||||||
|
|
||||||
export const usePlausibleTracker = () => {
|
export const usePlausibleTracker = () => {
|
||||||
const plausible = useContext(PlausibleContext);
|
const plausible = useContext(PlausibleContext);
|
||||||
|
@ -4,6 +4,7 @@ export interface IFeatureStrategy {
|
|||||||
id: string;
|
id: string;
|
||||||
strategyName?: string;
|
strategyName?: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
title?: string;
|
||||||
constraints: IConstraint[];
|
constraints: IConstraint[];
|
||||||
parameters: IFeatureStrategyParameters;
|
parameters: IFeatureStrategyParameters;
|
||||||
featureName?: string;
|
featureName?: string;
|
||||||
@ -19,6 +20,7 @@ export interface IFeatureStrategyParameters {
|
|||||||
export interface IFeatureStrategyPayload {
|
export interface IFeatureStrategyPayload {
|
||||||
id?: string;
|
id?: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
|
title?: string;
|
||||||
constraints: IConstraint[];
|
constraints: IConstraint[];
|
||||||
parameters: IFeatureStrategyParameters;
|
parameters: IFeatureStrategyParameters;
|
||||||
segments?: number[];
|
segments?: number[];
|
||||||
|
@ -52,6 +52,7 @@ export interface IFlags {
|
|||||||
projectScopedStickiness?: boolean;
|
projectScopedStickiness?: boolean;
|
||||||
personalAccessTokensKillSwitch?: boolean;
|
personalAccessTokensKillSwitch?: boolean;
|
||||||
demo?: boolean;
|
demo?: boolean;
|
||||||
|
strategyTitle?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IVersionInfo {
|
export interface IVersionInfo {
|
||||||
|
@ -6,32 +6,11 @@
|
|||||||
import type { _ExportFormat } from './_exportFormat';
|
import type { _ExportFormat } from './_exportFormat';
|
||||||
|
|
||||||
export type _ExportParams = {
|
export type _ExportParams = {
|
||||||
/**
|
|
||||||
* Desired export format. Must be either `json` or `yaml`.
|
|
||||||
*/
|
|
||||||
format?: _ExportFormat;
|
format?: _ExportFormat;
|
||||||
/**
|
download?: boolean | string | number;
|
||||||
* Whether exported data should be downloaded as a file.
|
|
||||||
*/
|
|
||||||
download?: string;
|
|
||||||
/**
|
|
||||||
* Whether strategies should be included in the exported data.
|
|
||||||
*/
|
|
||||||
strategies?: boolean | string | number;
|
strategies?: boolean | string | number;
|
||||||
/**
|
|
||||||
* Whether feature toggles should be included in the exported data.
|
|
||||||
*/
|
|
||||||
featureToggles?: boolean | string | number;
|
featureToggles?: boolean | string | number;
|
||||||
/**
|
|
||||||
* Whether projects should be included in the exported data.
|
|
||||||
*/
|
|
||||||
projects?: boolean | string | number;
|
projects?: boolean | string | number;
|
||||||
/**
|
|
||||||
* Whether tag types, tags, and feature_tags should be included in the exported data.
|
|
||||||
*/
|
|
||||||
tags?: boolean | string | number;
|
tags?: boolean | string | number;
|
||||||
/**
|
|
||||||
* Whether environments should be included in the exported data.
|
|
||||||
*/
|
|
||||||
environments?: boolean | string | number;
|
environments?: boolean | string | number;
|
||||||
};
|
};
|
||||||
|
37
frontend/src/openapi/models/addonCreateUpdateSchema.ts
Normal file
37
frontend/src/openapi/models/addonCreateUpdateSchema.ts
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
/**
|
||||||
|
* Generated by Orval
|
||||||
|
* Do not edit manually.
|
||||||
|
* See `gen:api` script in package.json
|
||||||
|
*/
|
||||||
|
import type { AddonCreateUpdateSchemaParameters } from './addonCreateUpdateSchemaParameters';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data required to create or update an [Unleash addon](https://docs.getunleash.io/reference/addons) instance.
|
||||||
|
*/
|
||||||
|
export interface AddonCreateUpdateSchema {
|
||||||
|
/** The addon provider, such as "webhook" or "slack". This string is **case sensitive** and maps to the provider's `name` property.
|
||||||
|
|
||||||
|
The list of all supported providers and their parameters for a specific Unleash instance can be found by making a GET request to the `api/admin/addons` endpoint: the `providers` property of that response will contain all available providers.
|
||||||
|
|
||||||
|
The default set of providers can be found in the [addons reference documentation](https://docs.getunleash.io/reference/addons). The default supported options are:
|
||||||
|
- `datadog` for [Datadog](https://docs.getunleash.io/reference/addons/datadog)
|
||||||
|
- `slack` for [Slack](https://docs.getunleash.io/reference/addons/slack)
|
||||||
|
- `teams` for [Microsoft Teams](https://docs.getunleash.io/reference/addons/teams)
|
||||||
|
- `webhook` for [webhooks](https://docs.getunleash.io/reference/addons/webhook)
|
||||||
|
|
||||||
|
The provider you choose for your addon dictates what properties the `parameters` object needs. Refer to the documentation for each provider for more information.
|
||||||
|
*/
|
||||||
|
provider: string;
|
||||||
|
/** A description of the addon. */
|
||||||
|
description?: string;
|
||||||
|
/** Whether the addon should be enabled or not. */
|
||||||
|
enabled: boolean;
|
||||||
|
/** Parameters for the addon provider. This object has different required and optional properties depending on the provider you choose. Consult the documentation for details. */
|
||||||
|
parameters: AddonCreateUpdateSchemaParameters;
|
||||||
|
/** The event types that will trigger this specific addon. */
|
||||||
|
events: string[];
|
||||||
|
/** The projects that this addon will listen to events from. An empty list means it will listen to events from **all** projects. */
|
||||||
|
projects?: string[];
|
||||||
|
/** The list of environments that this addon will listen to events from. An empty list means it will listen to events from **all** environments. */
|
||||||
|
environments?: string[];
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* Generated by Orval
|
||||||
|
* Do not edit manually.
|
||||||
|
* See `gen:api` script in package.json
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parameters for the addon provider. This object has different required and optional properties depending on the provider you choose. Consult the documentation for details.
|
||||||
|
*/
|
||||||
|
export type AddonCreateUpdateSchemaParameters = { [key: string]: unknown };
|
@ -4,12 +4,22 @@
|
|||||||
* See `gen:api` script in package.json
|
* See `gen:api` script in package.json
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An addon parameter definition.
|
||||||
|
*/
|
||||||
export interface AddonParameterSchema {
|
export interface AddonParameterSchema {
|
||||||
|
/** The name of the parameter as it is used in code. References to this parameter should use this value. */
|
||||||
name: string;
|
name: string;
|
||||||
|
/** The name of the parameter as it is shown to the end user in the Admin UI. */
|
||||||
displayName: string;
|
displayName: string;
|
||||||
|
/** The type of the parameter. Corresponds roughly to [HTML `input` field types](https://developer.mozilla.org/docs/Web/HTML/Element/Input#input_types). Multi-line inut fields are indicated as `textfield` (equivalent to the HTML `textarea` tag). */
|
||||||
type: string;
|
type: string;
|
||||||
|
/** A description of the parameter. This should explain to the end user what the parameter is used for. */
|
||||||
description?: string;
|
description?: string;
|
||||||
|
/** The default value for this parameter. This value is used if no other value is provided. */
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
|
/** Whether this parameter is required or not. If a parameter is required, you must give it a value when you create the addon. If it is not required it can be left out. It may receive a default value in those cases. */
|
||||||
required: boolean;
|
required: boolean;
|
||||||
|
/** Indicates whether this parameter is **sensitive** or not. Unleash will not return sensitive parameters to API requests. It will instead use a number of asterisks to indicate that a value is set, e.g. "******". The number of asterisks does not correlate to the parameter's value. */
|
||||||
sensitive: boolean;
|
sensitive: boolean;
|
||||||
}
|
}
|
||||||
|
@ -5,14 +5,24 @@
|
|||||||
*/
|
*/
|
||||||
import type { AddonSchemaParameters } from './addonSchemaParameters';
|
import type { AddonSchemaParameters } from './addonSchemaParameters';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An [addon](https://docs.getunleash.io/reference/addons) instance description. Contains data about what kind of provider it uses, whether it's enabled or not, what events it listens for, and more.
|
||||||
|
*/
|
||||||
export interface AddonSchema {
|
export interface AddonSchema {
|
||||||
id?: number;
|
/** The addon's unique identifier. */
|
||||||
createdAt?: string | null;
|
id: number;
|
||||||
|
/** The addon provider, such as "webhook" or "slack". */
|
||||||
provider: string;
|
provider: string;
|
||||||
description?: string;
|
/** A description of the addon. `null` if no description exists. */
|
||||||
|
description: string | null;
|
||||||
|
/** Whether the addon is enabled or not. */
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
|
/** Parameters for the addon provider. This object has different required and optional properties depending on the provider you choose. */
|
||||||
parameters: AddonSchemaParameters;
|
parameters: AddonSchemaParameters;
|
||||||
|
/** The event types that trigger this specific addon. */
|
||||||
events: string[];
|
events: string[];
|
||||||
|
/** The projects that this addon listens to events from. An empty list means it listens to events from **all** projects. */
|
||||||
projects?: string[];
|
projects?: string[];
|
||||||
|
/** The list of environments that this addon listens to events from. An empty list means it listens to events from **all** environments. */
|
||||||
environments?: string[];
|
environments?: string[];
|
||||||
}
|
}
|
||||||
|
@ -4,4 +4,7 @@
|
|||||||
* See `gen:api` script in package.json
|
* See `gen:api` script in package.json
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export type AddonSchemaParameters = { [key: string]: any };
|
/**
|
||||||
|
* Parameters for the addon provider. This object has different required and optional properties depending on the provider you choose.
|
||||||
|
*/
|
||||||
|
export type AddonSchemaParameters = { [key: string]: unknown };
|
||||||
|
@ -6,12 +6,22 @@
|
|||||||
import type { TagTypeSchema } from './tagTypeSchema';
|
import type { TagTypeSchema } from './tagTypeSchema';
|
||||||
import type { AddonParameterSchema } from './addonParameterSchema';
|
import type { AddonParameterSchema } from './addonParameterSchema';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An addon provider. Defines a specific addon type and what the end user must configure when creating a new addon of that type.
|
||||||
|
*/
|
||||||
export interface AddonTypeSchema {
|
export interface AddonTypeSchema {
|
||||||
|
/** The name of the addon type. When creating new addons, this goes in the payload's `type` field. */
|
||||||
name: string;
|
name: string;
|
||||||
|
/** The addon type's name as it should be displayed in the admin UI. */
|
||||||
displayName: string;
|
displayName: string;
|
||||||
|
/** A URL to where you can find more information about using this addon type. */
|
||||||
documentationUrl: string;
|
documentationUrl: string;
|
||||||
|
/** A description of the addon type. */
|
||||||
description: string;
|
description: string;
|
||||||
|
/** A list of [Unleash tag types](https://docs.getunleash.io/reference/tags#tag-types) that this addon uses. These tags will be added to the Unleash instance when an addon of this type is created. */
|
||||||
tagTypes?: TagTypeSchema[];
|
tagTypes?: TagTypeSchema[];
|
||||||
|
/** The addon provider's parameters. Use these to configure an addon of this provider type. Items with `required: true` must be provided. */
|
||||||
parameters?: AddonParameterSchema[];
|
parameters?: AddonParameterSchema[];
|
||||||
|
/** All the [event types](https://docs.getunleash.io/reference/api/legacy/unleash/admin/events#feature-toggle-events) that are available for this addon provider. */
|
||||||
events?: string[];
|
events?: string[];
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,14 @@
|
|||||||
import type { AddonSchema } from './addonSchema';
|
import type { AddonSchema } from './addonSchema';
|
||||||
import type { AddonTypeSchema } from './addonTypeSchema';
|
import type { AddonTypeSchema } from './addonTypeSchema';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An object containing two things:
|
||||||
|
1. A list of all [addons](https://docs.getunleash.io/reference/addons) defined on this Unleash instance
|
||||||
|
2. A list of all addon providers defined on this instance
|
||||||
|
*/
|
||||||
export interface AddonsSchema {
|
export interface AddonsSchema {
|
||||||
|
/** All the addons that exist on this instance of Unleash. */
|
||||||
addons: AddonSchema[];
|
addons: AddonSchema[];
|
||||||
|
/** A list of all available addon providers, along with their parameters and descriptions. */
|
||||||
providers: AddonTypeSchema[];
|
providers: AddonTypeSchema[];
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,15 @@ import type { ConstraintSchema } from './constraintSchema';
|
|||||||
import type { ParametersSchema } from './parametersSchema';
|
import type { ParametersSchema } from './parametersSchema';
|
||||||
|
|
||||||
export interface CreateFeatureStrategySchema {
|
export interface CreateFeatureStrategySchema {
|
||||||
|
/** The name or type of strategy */
|
||||||
name: string;
|
name: string;
|
||||||
|
/** A descriptive title for the strategy */
|
||||||
|
title?: string | null;
|
||||||
|
/** The order of the strategy in the list */
|
||||||
sortOrder?: number;
|
sortOrder?: number;
|
||||||
|
/** A list of the constraints attached to the strategy */
|
||||||
constraints?: ConstraintSchema[];
|
constraints?: ConstraintSchema[];
|
||||||
|
/** An object containing the parameters for the strategy */
|
||||||
parameters?: ParametersSchema;
|
parameters?: ParametersSchema;
|
||||||
/** Ids of segments to use for this strategy */
|
/** Ids of segments to use for this strategy */
|
||||||
segments?: number[];
|
segments?: number[];
|
||||||
|
@ -6,12 +6,23 @@
|
|||||||
import type { ConstraintSchema } from './constraintSchema';
|
import type { ConstraintSchema } from './constraintSchema';
|
||||||
import type { ParametersSchema } from './parametersSchema';
|
import type { ParametersSchema } from './parametersSchema';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A singles activation strategy configuration schema for a feature
|
||||||
|
*/
|
||||||
export interface FeatureStrategySchema {
|
export interface FeatureStrategySchema {
|
||||||
|
/** A uuid for the feature strategy */
|
||||||
id?: string;
|
id?: string;
|
||||||
|
/** The name or type of strategy */
|
||||||
name: string;
|
name: string;
|
||||||
|
/** A descriptive title for the strategy */
|
||||||
|
title?: string | null;
|
||||||
|
/** The name or feature the strategy is attached to */
|
||||||
featureName?: string;
|
featureName?: string;
|
||||||
|
/** The order of the strategy in the list */
|
||||||
sortOrder?: number;
|
sortOrder?: number;
|
||||||
|
/** A list of segment ids attached to the strategy */
|
||||||
segments?: number[];
|
segments?: number[];
|
||||||
|
/** A list of the constraints attached to the strategy */
|
||||||
constraints?: ConstraintSchema[];
|
constraints?: ConstraintSchema[];
|
||||||
parameters?: ParametersSchema;
|
parameters?: ParametersSchema;
|
||||||
}
|
}
|
||||||
|
@ -10,17 +10,17 @@
|
|||||||
export interface FeatureTagSchema {
|
export interface FeatureTagSchema {
|
||||||
/** The name of the feature this tag is applied to */
|
/** The name of the feature this tag is applied to */
|
||||||
featureName: string;
|
featureName: string;
|
||||||
/** The type of tag */
|
/** The [type](https://docs.getunleash.io/reference/tags#tag-types tag types) of the tag */
|
||||||
tagType?: string;
|
tagType?: string;
|
||||||
/** The value of the tag */
|
/** The value of the tag */
|
||||||
tagValue: string;
|
tagValue: string;
|
||||||
/**
|
/**
|
||||||
* This field is deprecated and currently unused, use tagType instead
|
* The [type](https://docs.getunleash.io/reference/tags#tag-types tag types) of the tag. This property is deprecated and will be removed in a future version of Unleash. Superseded by the `tagType` property.
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
type?: string;
|
type?: string;
|
||||||
/**
|
/**
|
||||||
* This field is deprecated and currently unused, use tagValue instead
|
* The value of the tag. This property is deprecated and will be removed in a future version of Unleash. Superseded by the `tagValue` property.
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
value?: string;
|
value?: string;
|
||||||
|
@ -4,9 +4,4 @@
|
|||||||
* See `gen:api` script in package.json
|
* See `gen:api` script in package.json
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export type GetEventsParams = {
|
export type GetEventsParams = { project?: string };
|
||||||
/**
|
|
||||||
* The name of the project whose events you want to retrieve
|
|
||||||
*/
|
|
||||||
project?: string;
|
|
||||||
};
|
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
/**
|
|
||||||
* Generated by Orval
|
|
||||||
* Do not edit manually.
|
|
||||||
* See `gen:api` script in package.json
|
|
||||||
*/
|
|
||||||
|
|
||||||
export * from './_exportFormat';
|
export * from './_exportFormat';
|
||||||
export * from './_exportParams';
|
export * from './_exportParams';
|
||||||
|
export * from './addonCreateUpdateSchema';
|
||||||
|
export * from './addonCreateUpdateSchemaParameters';
|
||||||
export * from './addonParameterSchema';
|
export * from './addonParameterSchema';
|
||||||
export * from './addonSchema';
|
export * from './addonSchema';
|
||||||
export * from './addonSchemaParameters';
|
export * from './addonSchemaParameters';
|
||||||
|
@ -11,6 +11,8 @@ import type { ParametersSchema } from './parametersSchema';
|
|||||||
export interface PlaygroundStrategySchema {
|
export interface PlaygroundStrategySchema {
|
||||||
/** The strategy's name. */
|
/** The strategy's name. */
|
||||||
name: string;
|
name: string;
|
||||||
|
/** Description of the feature's purpose. */
|
||||||
|
title?: string;
|
||||||
/** The strategy's id. */
|
/** The strategy's id. */
|
||||||
id: string;
|
id: string;
|
||||||
/** The strategy's evaluation result. If the strategy is a custom strategy that Unleash can't evaluate, `evaluationStatus` will be `unknown`. Otherwise, it will be `true` or `false` */
|
/** The strategy's evaluation result. If the strategy is a custom strategy that Unleash can't evaluate, `evaluationStatus` will be `unknown`. Otherwise, it will be `true` or `false` */
|
||||||
|
@ -5,11 +5,21 @@
|
|||||||
*/
|
*/
|
||||||
import type { StrategySchemaParametersItem } from './strategySchemaParametersItem';
|
import type { StrategySchemaParametersItem } from './strategySchemaParametersItem';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The [activation strategy](https://docs.getunleash.io/reference/activation-strategies) schema
|
||||||
|
*/
|
||||||
export interface StrategySchema {
|
export interface StrategySchema {
|
||||||
|
/** An optional title for the strategy */
|
||||||
|
title?: string | null;
|
||||||
|
/** The name or type of the strategy */
|
||||||
name: string;
|
name: string;
|
||||||
|
/** A human friendly name for the strategy */
|
||||||
displayName: string | null;
|
displayName: string | null;
|
||||||
|
/** A short description for the strategy */
|
||||||
description: string;
|
description: string;
|
||||||
|
/** Determines whether the strategy allows for editing */
|
||||||
editable: boolean;
|
editable: boolean;
|
||||||
deprecated: boolean;
|
deprecated: boolean;
|
||||||
|
/** A list of relevant parameters for each strategy */
|
||||||
parameters: StrategySchemaParametersItem[];
|
parameters: StrategySchemaParametersItem[];
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Representation of a tag
|
* Representation of a [tag](https://docs.getunleash.io/reference/tags)
|
||||||
*/
|
*/
|
||||||
export interface TagSchema {
|
export interface TagSchema {
|
||||||
/** The value of the tag */
|
/** The value of the tag */
|
||||||
value: string;
|
value: string;
|
||||||
/** The type of the tag */
|
/** The [type](https://docs.getunleash.io/reference/tags#tag-types) of the tag */
|
||||||
type: string;
|
type: string;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
import type { TagSchema } from './tagSchema';
|
import type { TagSchema } from './tagSchema';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a set of changes to tags of a feature.
|
* Represents a set of changes to a feature's tags, such as adding or removing tags.
|
||||||
*/
|
*/
|
||||||
export interface UpdateTagsSchema {
|
export interface UpdateTagsSchema {
|
||||||
/** Tags to add to the feature. */
|
/** Tags to add to the feature. */
|
||||||
|
@ -89,6 +89,7 @@ exports[`should create default config 1`] = `
|
|||||||
"projectScopedSegments": false,
|
"projectScopedSegments": false,
|
||||||
"projectScopedStickiness": false,
|
"projectScopedStickiness": false,
|
||||||
"responseTimeWithAppNameKillSwitch": false,
|
"responseTimeWithAppNameKillSwitch": false,
|
||||||
|
"strategyTitle": false,
|
||||||
"strictSchemaValidation": false,
|
"strictSchemaValidation": false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -116,6 +117,7 @@ exports[`should create default config 1`] = `
|
|||||||
"projectScopedSegments": false,
|
"projectScopedSegments": false,
|
||||||
"projectScopedStickiness": false,
|
"projectScopedStickiness": false,
|
||||||
"responseTimeWithAppNameKillSwitch": false,
|
"responseTimeWithAppNameKillSwitch": false,
|
||||||
|
"strategyTitle": false,
|
||||||
"strictSchemaValidation": false,
|
"strictSchemaValidation": false,
|
||||||
},
|
},
|
||||||
"externalResolver": {
|
"externalResolver": {
|
||||||
|
@ -66,6 +66,11 @@ export const playgroundStrategySchema = {
|
|||||||
description: "The strategy's name.",
|
description: "The strategy's name.",
|
||||||
type: 'string',
|
type: 'string',
|
||||||
},
|
},
|
||||||
|
title: {
|
||||||
|
type: 'string',
|
||||||
|
example: 'Beta rollout',
|
||||||
|
description: "Description of the feature's purpose.",
|
||||||
|
},
|
||||||
id: {
|
id: {
|
||||||
description: "The strategy's id.",
|
description: "The strategy's id.",
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
@ -78,6 +78,10 @@ const flags = {
|
|||||||
),
|
),
|
||||||
migrationLock: parseEnvVarBoolean(process.env.MIGRATION_LOCK, false),
|
migrationLock: parseEnvVarBoolean(process.env.MIGRATION_LOCK, false),
|
||||||
demo: parseEnvVarBoolean(process.env.UNLEASH_DEMO, false),
|
demo: parseEnvVarBoolean(process.env.UNLEASH_DEMO, false),
|
||||||
|
strategyTitle: parseEnvVarBoolean(
|
||||||
|
process.env.UNLEASH_STRATEGY_TITLE,
|
||||||
|
false,
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
export const defaultExperimentalOptions: IExperimentalOptions = {
|
export const defaultExperimentalOptions: IExperimentalOptions = {
|
||||||
|
@ -108,6 +108,7 @@ export default class UnleashClient {
|
|||||||
return {
|
return {
|
||||||
name: strategySelector.name,
|
name: strategySelector.name,
|
||||||
id: strategySelector.id,
|
id: strategySelector.id,
|
||||||
|
title: strategySelector.title,
|
||||||
parameters: strategySelector.parameters,
|
parameters: strategySelector.parameters,
|
||||||
...strategy.isEnabledWithConstraints(
|
...strategy.isEnabledWithConstraints(
|
||||||
strategySelector.parameters,
|
strategySelector.parameters,
|
||||||
|
@ -3297,6 +3297,11 @@ The provider you choose for your addon dictates what properties the \`parameters
|
|||||||
},
|
},
|
||||||
"type": "array",
|
"type": "array",
|
||||||
},
|
},
|
||||||
|
"title": {
|
||||||
|
"description": "Description of the feature's purpose.",
|
||||||
|
"example": "Beta rollout",
|
||||||
|
"type": "string",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"id",
|
"id",
|
||||||
|
Loading…
Reference in New Issue
Block a user