Skip to content

Commit

Permalink
obproxy management (#451)
Browse files Browse the repository at this point in the history
  • Loading branch information
yang1666204 authored Jun 17, 2024
1 parent f2df051 commit 5e9bbc5
Show file tree
Hide file tree
Showing 20 changed files with 893 additions and 150 deletions.
199 changes: 166 additions & 33 deletions ui/src/api/generated/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,31 @@ export interface ListOBProxies200Response {
*/
'successful': boolean;
}
/**
*
* @export
* @interface ListOBProxyParameters200Response
*/
export interface ListOBProxyParameters200Response {
/**
*
* @type {Array<ObproxyConfigItem>}
* @memberof ListOBProxyParameters200Response
*/
'data': Array<ObproxyConfigItem>;
/**
*
* @type {string}
* @memberof ListOBProxyParameters200Response
*/
'message': string;
/**
*
* @type {boolean}
* @memberof ListOBProxyParameters200Response
*/
'successful': boolean;
}
/**
*
* @export
Expand Down Expand Up @@ -1796,6 +1821,43 @@ export interface ModelsStorageSpec {
*/
'storageSize'?: number;
}
/**
*
* @export
* @interface ObproxyConfigItem
*/
export interface ObproxyConfigItem {
/**
*
* @type {string}
* @memberof ObproxyConfigItem
*/
'info'?: string;
/**
*
* @type {string}
* @memberof ObproxyConfigItem
*/
'name'?: string;
/**
*
* @type {boolean}
* @memberof ObproxyConfigItem
*/
'needReboot'?: boolean;
/**
*
* @type {string}
* @memberof ObproxyConfigItem
*/
'value'?: string;
/**
*
* @type {string}
* @memberof ObproxyConfigItem
*/
'visibleLevel'?: string;
}
/**
*
* @export
Expand Down Expand Up @@ -2052,22 +2114,16 @@ export interface ObproxyOBProxyOverview {
export interface ObproxyPatchOBProxyParam {
/**
*
* @type {Array<CommonKVPair>}
* @memberof ObproxyPatchOBProxyParam
*/
'addedParameters'?: Array<CommonKVPair>;
/**
*
* @type {Array<string>}
* @type {string}
* @memberof ObproxyPatchOBProxyParam
*/
'deletedParameters'?: Array<string>;
'image'?: string;
/**
*
* @type {string}
* @type {Array<CommonKVPair>}
* @memberof ObproxyPatchOBProxyParam
*/
'image'?: string;
'parameters'?: Array<CommonKVPair>;
/**
*
* @type {number}
Expand Down Expand Up @@ -5043,51 +5099,51 @@ export interface ResponseStorageSpec {
/**
*
* @export
* @interface RouteRoute
* @interface RouteRouteParam
*/
export interface RouteRoute {
export interface RouteRouteParam {
/**
*
* @type {Array<string>}
* @memberof RouteRoute
* @memberof RouteRouteParam
*/
'aggregateLabels': Array<string>;
/**
*
* @type {number}
* @memberof RouteRoute
* @memberof RouteRouteParam
*/
'groupInterval': number;
/**
*
* @type {number}
* @memberof RouteRoute
* @memberof RouteRouteParam
*/
'groupWait': number;
/**
*
* @type {string}
* @memberof RouteRouteParam
*/
'id'?: string;
/**
*
* @type {Array<AlarmMatcher>}
* @memberof RouteRoute
* @memberof RouteRouteParam
*/
'matchers': Array<AlarmMatcher>;
/**
*
* @type {string}
* @memberof RouteRoute
* @memberof RouteRouteParam
*/
'receiver': string;
/**
*
* @type {number}
* @memberof RouteRoute
* @memberof RouteRouteParam
*/
'repeatInterval': number;
/**
*
* @type {string}
* @memberof RouteRoute
*/
'id'?: string;
}
/**
*
Expand Down Expand Up @@ -5592,11 +5648,11 @@ export const AlarmApiAxiosParamCreator = function (configuration?: Configuration
/**
* Create or update alarm route.
* @summary Create or update alarm route
* @param {RouteRoute} body route
* @param {RouteRouteParam} body route
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createOrUpdateRoute: async (body: RouteRoute, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
createOrUpdateRoute: async (body: RouteRouteParam, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'body' is not null or undefined
assertParamExists('createOrUpdateRoute', 'body', body)
const localVarPath = `/api/v1/alarm/route/routes`;
Expand Down Expand Up @@ -6275,11 +6331,11 @@ export const AlarmApiFp = function(configuration?: Configuration) {
/**
* Create or update alarm route.
* @summary Create or update alarm route
* @param {RouteRoute} body route
* @param {RouteRouteParam} body route
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async createOrUpdateRoute(body: RouteRoute, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateOrUpdateRoute200Response>> {
async createOrUpdateRoute(body: RouteRouteParam, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateOrUpdateRoute200Response>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.createOrUpdateRoute(body, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['AlarmApi.createOrUpdateRoute']?.[localVarOperationServerIndex]?.url;
Expand Down Expand Up @@ -6526,11 +6582,11 @@ export const AlarmApiFactory = function (configuration?: Configuration, basePath
/**
* Create or update alarm route.
* @summary Create or update alarm route
* @param {RouteRoute} body route
* @param {RouteRouteParam} body route
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createOrUpdateRoute(body: RouteRoute, options?: any): AxiosPromise<CreateOrUpdateRoute200Response> {
createOrUpdateRoute(body: RouteRouteParam, options?: any): AxiosPromise<CreateOrUpdateRoute200Response> {
return localVarFp.createOrUpdateRoute(body, options).then((request) => request(axios, basePath));
},
/**
Expand Down Expand Up @@ -6725,12 +6781,12 @@ export class AlarmApi extends BaseAPI {
/**
* Create or update alarm route.
* @summary Create or update alarm route
* @param {RouteRoute} body route
* @param {RouteRouteParam} body route
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof AlarmApi
*/
public createOrUpdateRoute(body: RouteRoute, options?: RawAxiosRequestConfig) {
public createOrUpdateRoute(body: RouteRouteParam, options?: RawAxiosRequestConfig) {
return AlarmApiFp(this.configuration).createOrUpdateRoute(body, options).then((request) => request(this.axios, this.basePath));
}

Expand Down Expand Up @@ -7347,7 +7403,8 @@ export class ClusterApi extends BaseAPI {
export const ListK8sEventsObjectTypeEnum = {
OBCLUSTER: 'OBCLUSTER',
OBTENANT: 'OBTENANT',
OBBACKUPPOLICY: 'OBBACKUPPOLICY'
OBBACKUPPOLICY: 'OBBACKUPPOLICY',
OBPROXY: 'OBPROXY'
} as const;
export type ListK8sEventsObjectTypeEnum = typeof ListK8sEventsObjectTypeEnum[keyof typeof ListK8sEventsObjectTypeEnum];
/**
Expand Down Expand Up @@ -8791,6 +8848,44 @@ export const OBProxyApiAxiosParamCreator = function (configuration?: Configurati



setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* List OBProxy Parameters by namespace and name
* @summary List OBProxy Parameters
* @param {string} namespace namespace of obproxy deployment
* @param {string} name name of obproxy deployment
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listOBProxyParameters: async (namespace: string, name: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'namespace' is not null or undefined
assertParamExists('listOBProxyParameters', 'namespace', namespace)
// verify required parameter 'name' is not null or undefined
assertParamExists('listOBProxyParameters', 'name', name)
const localVarPath = `/api/v1/obproxies/{namespace}/{name}/parameters`
.replace(`{${"namespace"}}`, encodeURIComponent(String(namespace)))
.replace(`{${"name"}}`, encodeURIComponent(String(name)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}

const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;



setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
Expand Down Expand Up @@ -8911,6 +9006,20 @@ export const OBProxyApiFp = function(configuration?: Configuration) {
const localVarOperationServerBasePath = operationServerMap['OBProxyApi.listOBProxies']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* List OBProxy Parameters by namespace and name
* @summary List OBProxy Parameters
* @param {string} namespace namespace of obproxy deployment
* @param {string} name name of obproxy deployment
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async listOBProxyParameters(namespace: string, name: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListOBProxyParameters200Response>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.listOBProxyParameters(namespace, name, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['OBProxyApi.listOBProxyParameters']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Patch OBProxy with the specified parameters
* @summary Patch OBProxy
Expand Down Expand Up @@ -8978,6 +9087,17 @@ export const OBProxyApiFactory = function (configuration?: Configuration, basePa
listOBProxies(ns?: string, options?: any): AxiosPromise<ListOBProxies200Response> {
return localVarFp.listOBProxies(ns, options).then((request) => request(axios, basePath));
},
/**
* List OBProxy Parameters by namespace and name
* @summary List OBProxy Parameters
* @param {string} namespace namespace of obproxy deployment
* @param {string} name name of obproxy deployment
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listOBProxyParameters(namespace: string, name: string, options?: any): AxiosPromise<ListOBProxyParameters200Response> {
return localVarFp.listOBProxyParameters(namespace, name, options).then((request) => request(axios, basePath));
},
/**
* Patch OBProxy with the specified parameters
* @summary Patch OBProxy
Expand Down Expand Up @@ -9050,6 +9170,19 @@ export class OBProxyApi extends BaseAPI {
return OBProxyApiFp(this.configuration).listOBProxies(ns, options).then((request) => request(this.axios, this.basePath));
}

/**
* List OBProxy Parameters by namespace and name
* @summary List OBProxy Parameters
* @param {string} namespace namespace of obproxy deployment
* @param {string} name name of obproxy deployment
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof OBProxyApi
*/
public listOBProxyParameters(namespace: string, name: string, options?: RawAxiosRequestConfig) {
return OBProxyApiFp(this.configuration).listOBProxyParameters(namespace, name, options).then((request) => request(this.axios, this.basePath));
}

/**
* Patch OBProxy with the specified parameters
* @summary Patch OBProxy
Expand Down
33 changes: 33 additions & 0 deletions ui/src/components/CustomFormItem/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { intl } from '@/utils/intl';
import type { FormItemProps } from 'antd';
import { Form } from 'antd';

export const CustomFormItem = (prop: FormItemProps & { message?: string }) => {
const { label, message } = prop;
return (
<Form.Item
{...prop}
rules={[
{
required: true,
message:
message ||
(typeof label === 'string'
? intl.formatMessage(
{
id: 'Dashboard.Cluster.New.Observer.EnterLabel',
defaultMessage: '请输入{{label}}',
},
{ label: label as string },
)
: intl.formatMessage({
id: 'src.components.CustomFormItem.2C6315A1',
defaultMessage: '请输入',
})),
},
]}
>
{prop.children}
</Form.Item>
);
};
Loading

0 comments on commit 5e9bbc5

Please sign in to comment.