1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-24 01:18:01 +02:00

Update front end schemas for new event search (#7758)

Updates the orval spec for the new event search.
This commit is contained in:
Thomas Heartman 2024-08-05 14:48:01 +02:00 committed by GitHub
parent 00f4c67c17
commit dd71fe32bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 94 additions and 11 deletions

View File

@ -14,6 +14,7 @@ import {
} from 'utils/serializeQueryParams'; } from 'utils/serializeQueryParams';
import { usePersistentTableState } from 'hooks/usePersistentTableState'; import { usePersistentTableState } from 'hooks/usePersistentTableState';
import mapValues from 'lodash.mapvalues'; import mapValues from 'lodash.mapvalues';
import type { SearchFeaturesParams } from 'openapi';
export const useGlobalFeatureSearch = (pageLimit = DEFAULT_PAGE_LIMIT) => { export const useGlobalFeatureSearch = (pageLimit = DEFAULT_PAGE_LIMIT) => {
const storageKey = 'features-list-table'; const storageKey = 'features-list-table';
@ -55,7 +56,7 @@ export const useGlobalFeatureSearch = (pageLimit = DEFAULT_PAGE_LIMIT) => {
} = useFeatureSearch( } = useFeatureSearch(
mapValues(encodeQueryParams(stateConfig, tableState), (value) => mapValues(encodeQueryParams(stateConfig, tableState), (value) =>
value ? `${value}` : undefined, value ? `${value}` : undefined,
), ) as SearchFeaturesParams,
); );
return { return {

View File

@ -16,6 +16,7 @@ import {
import { usePersistentTableState } from 'hooks/usePersistentTableState'; import { usePersistentTableState } from 'hooks/usePersistentTableState';
import mapValues from 'lodash.mapvalues'; import mapValues from 'lodash.mapvalues';
import { useUiFlag } from 'hooks/useUiFlag'; import { useUiFlag } from 'hooks/useUiFlag';
import type { SearchFeaturesParams } from 'openapi';
type Attribute = type Attribute =
| { key: 'tag'; operator: 'INCLUDE' } | { key: 'tag'; operator: 'INCLUDE' }
@ -55,7 +56,7 @@ export const useProjectFeatureSearch = (
project: `IS:${projectId}`, project: `IS:${projectId}`,
}, },
(value) => (value ? `${value}` : undefined), (value) => (value ? `${value}` : undefined),
), ) as SearchFeaturesParams,
{ {
refreshInterval, refreshInterval,
}, },

View File

@ -3,7 +3,7 @@
* Do not edit manually. * Do not edit manually.
* See `gen:api` script in package.json * See `gen:api` script in package.json
*/ */
import type { SearchEventsSchemaType } from './searchEventsSchemaType'; import type { DeprecatedSearchEventsSchemaType } from './deprecatedSearchEventsSchemaType';
/** /**
* *
@ -11,7 +11,7 @@ import type { SearchEventsSchemaType } from './searchEventsSchemaType';
or a combination thereof. Pass an empty object to fetch all events. or a combination thereof. Pass an empty object to fetch all events.
*/ */
export interface SearchEventsSchema { export interface DeprecatedSearchEventsSchema {
/** Find events by feature flag name (case-sensitive). */ /** Find events by feature flag name (case-sensitive). */
feature?: string; feature?: string;
/** /**
@ -30,5 +30,5 @@ export interface SearchEventsSchema {
/** Find events by a free-text search query. The query will be matched against the event type, the username or email that created the event (if any), and the event data payload (if any). */ /** Find events by a free-text search query. The query will be matched against the event type, the username or email that created the event (if any), and the event data payload (if any). */
query?: string; query?: string;
/** Find events by event type (case-sensitive). */ /** Find events by event type (case-sensitive). */
type?: SearchEventsSchemaType; type?: DeprecatedSearchEventsSchemaType;
} }

View File

@ -7,11 +7,11 @@
/** /**
* Find events by event type (case-sensitive). * Find events by event type (case-sensitive).
*/ */
export type SearchEventsSchemaType = export type DeprecatedSearchEventsSchemaType =
(typeof SearchEventsSchemaType)[keyof typeof SearchEventsSchemaType]; (typeof DeprecatedSearchEventsSchemaType)[keyof typeof DeprecatedSearchEventsSchemaType];
// eslint-disable-next-line @typescript-eslint/no-redeclare // eslint-disable-next-line @typescript-eslint/no-redeclare
export const SearchEventsSchemaType = { export const DeprecatedSearchEventsSchemaType = {
'application-created': 'application-created', 'application-created': 'application-created',
'feature-created': 'feature-created', 'feature-created': 'feature-created',
'feature-deleted': 'feature-deleted', 'feature-deleted': 'feature-deleted',

View File

@ -0,0 +1,19 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
import type { EventSchema } from './eventSchema';
/**
* A list of events that have been registered by the system
*/
export interface EventSearchResponseSchema {
/** The list of events */
events: EventSchema[];
/**
* The total count of events
* @minimum 0
*/
total: number;
}

View File

@ -503,6 +503,8 @@ export * from './deprecateStrategy403';
export * from './deprecateStrategy404'; export * from './deprecateStrategy404';
export * from './deprecatedProjectOverviewSchema'; export * from './deprecatedProjectOverviewSchema';
export * from './deprecatedProjectOverviewSchemaMode'; export * from './deprecatedProjectOverviewSchemaMode';
export * from './deprecatedSearchEventsSchema';
export * from './deprecatedSearchEventsSchemaType';
export * from './disableBanner401'; export * from './disableBanner401';
export * from './disableBanner403'; export * from './disableBanner403';
export * from './disableBanner404'; export * from './disableBanner404';
@ -522,6 +524,7 @@ export * from './eventSchema';
export * from './eventSchemaData'; export * from './eventSchemaData';
export * from './eventSchemaPreData'; export * from './eventSchemaPreData';
export * from './eventSchemaType'; export * from './eventSchemaType';
export * from './eventSearchResponseSchema';
export * from './eventsSchema'; export * from './eventsSchema';
export * from './eventsSchemaVersion'; export * from './eventsSchemaVersion';
export * from './exportFeatures404'; export * from './exportFeatures404';
@ -1020,13 +1023,13 @@ export * from './scimTokenSchema';
export * from './sdkContextSchema'; export * from './sdkContextSchema';
export * from './sdkContextSchemaProperties'; export * from './sdkContextSchemaProperties';
export * from './sdkFlatContextSchema'; export * from './sdkFlatContextSchema';
export * from './searchEventsSchema'; export * from './searchEventsParams';
export * from './searchEventsSchemaType';
export * from './searchFeatures401'; export * from './searchFeatures401';
export * from './searchFeatures403'; export * from './searchFeatures403';
export * from './searchFeatures404'; export * from './searchFeatures404';
export * from './searchFeaturesParams'; export * from './searchFeaturesParams';
export * from './searchFeaturesSchema'; export * from './searchFeaturesSchema';
export * from './searchFeaturesSortOrder';
export * from './searchUsers401'; export * from './searchUsers401';
export * from './searchUsersParams'; export * from './searchUsersParams';
export * from './segmentSchema'; export * from './segmentSchema';

View File

@ -0,0 +1,44 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type SearchEventsParams = {
/**
* Find events by a free-text search query. The query will be matched against the event data payload (if any).
*/
query?: string;
/**
* Filter by feature name using supported operators: IS, IS_ANY_OF
*/
feature?: string;
/**
* Filter by projects ID using supported operators: IS, IS_ANY_OF.
*/
project?: string;
/**
* Filter by event type using supported operators: IS, IS_ANY_OF.
*/
type?: string;
/**
* Filter by the ID of the event creator, using supported operators: IS, IS_ANY_OF.
*/
createdBy?: string;
/**
* The starting date of the creation date range in IS:yyyy-MM-dd format
*/
createdAtFrom?: string;
/**
* The ending date of the creation date range in IS:yyyy-MM-dd format
*/
createdAtTo?: string;
/**
* The number of features to skip when returning a page. By default it is set to 0.
*/
offset?: string;
/**
* The number of feature environments to return in a page. By default it is set to 50. The maximum is 1000.
*/
limit?: string;
};

View File

@ -3,6 +3,7 @@
* Do not edit manually. * Do not edit manually.
* See `gen:api` script in package.json * See `gen:api` script in package.json
*/ */
import type { SearchFeaturesSortOrder } from './searchFeaturesSortOrder';
export type SearchFeaturesParams = { export type SearchFeaturesParams = {
/** /**
@ -52,7 +53,7 @@ export type SearchFeaturesParams = {
/** /**
* The sort order for the sortBy. By default it is det to "asc". * The sort order for the sortBy. By default it is det to "asc".
*/ */
sortOrder?: string; sortOrder?: SearchFeaturesSortOrder;
/** /**
* The flag to indicate if the favorite features should be returned first. By default it is set to false. * The flag to indicate if the favorite features should be returned first. By default it is set to false.
*/ */

View File

@ -0,0 +1,14 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type SearchFeaturesSortOrder =
(typeof SearchFeaturesSortOrder)[keyof typeof SearchFeaturesSortOrder];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const SearchFeaturesSortOrder = {
asc: 'asc',
desc: 'desc',
} as const;