UNPKG

@alauda-fe/common

Version:

Alauda frontend team common codes.

17 lines (16 loc) 998 B
import { AbstractControl, AsyncValidatorFn, ValidatorFn } from '@angular/forms'; import { Observable } from 'rxjs'; import { LimitRange, LimitRangeItem, RESOURCE_MAC_TYPES } from '../../core/public-api'; import { TranslateService } from '../../translate/public-api'; export type AvailableResourceType = (typeof RESOURCE_MAC_TYPES)[number]; export interface ResourceControl { value: string; unit: string; } export declare function setupErrorMapper(resource: LimitRange, translate: TranslateService): { cpu_max: string; memory_max: string; }; export declare const getResourceLimitValidatorFn: (type: AvailableResourceType, limitRange: Omit<LimitRangeItem, "type">, unit?: string) => ValidatorFn; export declare function getResourceLimitAsyncValidatorFn(type: AvailableResourceType, limitRange$: Observable<LimitRange>, unit?: string): AsyncValidatorFn; export declare const initGreaterValidator: (type: AvailableResourceType, control: AbstractControl) => import("rxjs").Subscription;