UNPKG

@alauda-fe/custom-resource-quota

Version:

custom resource

73 lines (72 loc) 4.13 kB
import { TranslateKey, TranslateService, ValidateRowDuplicateService, StringMap, ResourceRequirements } from '@alauda-fe/common'; import { AfterViewInit, Injector } from '@angular/core'; import { ControlContainer, FormControl, FormGroup, Validators } from '@angular/forms'; import { BaseResourceFormArrayComponent } from 'ng-resource-form-util'; import { BehaviorSubject, Observable } from 'rxjs'; import { ActionType, CustomResourceData, K8sQuotaItem, K8sQuotaType, QuotaItemType } from '../types'; import * as i0 from "@angular/core"; declare const QuotaTypes: readonly ["StorageQuota", "ExtendedResource", "OtherQuota"]; type QuotaType = (typeof QuotaTypes)[number]; interface ResourceQuotaFormModel { type: QuotaType; key: string; value?: string | StringMap; groupResources?: ResourceQuotaFormModel[]; } interface QuotaContext { projectLimit?: string; limitText?: string; unit?: string; resourceUnit?: string; label?: TranslateKey; description?: TranslateKey; groupResources?: QuotaContext[]; excludeResources?: string; } interface DisabledState { isDisabled: boolean; excludesTypes?: TranslateKey[]; } export declare class CustomResourceQuotaFormComponent extends BaseResourceFormArrayComponent<any, ResourceQuotaFormModel, FormGroup> implements AfterViewInit { controlContainer: ControlContainer; readonly translate: TranslateService; private readonly rowDupService; maxLimits: K8sQuotaItem; maxLimits$: Observable<K8sQuotaItem>; actionType: ActionType; customResourceLimits: CustomResourceData[]; customResourceLimits$: Observable<CustomResourceData[]>; podContainersResources: ResourceRequirements[]; podContainerIndex: number; kindDisabledStateTrigger$$: BehaviorSubject<number>; customResourceLimitsWithGroup: K8sQuotaType[]; excludeCustomResourceConfigs: StringMap; customResourceLimitsWithGroup$: Observable<K8sQuotaType[]>; customResourceLimitsWithNoGroup$: Observable<K8sQuotaType[]>; customResourceLimitsMixed$: Observable<K8sQuotaType[]>; convertCustomResourceData: ({ key, descriptionEn, descriptionZh, labelEn, labelZh, groupResources, resourceUnit, excludeResources, groupI18n, }: CustomResourceData) => K8sQuotaType; constructor(controlContainer: ControlContainer, injector: Injector, translate: TranslateService, rowDupService: ValidateRowDuplicateService); ngAfterViewInit(): void; getOnFormArrayResizeFn(): () => FormGroup<{ key: FormControl<string>; value: FormControl<FormGroup<{ [x: string]: FormControl<any>; }> | (string | StringMap | (typeof Validators.required)[])[]>; }>; adaptFormModel(formModel: ResourceQuotaFormModel[]): any; adaptResourceModel(resource: any): ResourceQuotaFormModel[]; selfAdaptResourceModel(resource: StringMap, needCache?: boolean): ResourceQuotaFormModel[]; refreshKindDisabledState(): void; getKindDisabledState(models: ResourceQuotaFormModel[], currQuotaType: K8sQuotaType, quotaTypes: K8sQuotaType[], inModelIndex: number, podContainerIndex: number, _SELF_REFRESH_NUMBER: number): DisabledState; getResourceQuotaContext(key: QuotaItemType, _locale: string, customResourceLimits: K8sQuotaType[], control: FormGroup): QuotaContext; private createNewQuotaItemControl; private keyDuplicateValidator; private keyValidator; private getFormModel; private getQuotaContext; private getQuotaType; private getDefaultQuotaItemsModel; static ɵfac: i0.ɵɵFactoryDeclaration<CustomResourceQuotaFormComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<CustomResourceQuotaFormComponent, "acl-custom-resource-quota-form", never, { "maxLimits": { "alias": "maxLimits"; "required": false; }; "actionType": { "alias": "actionType"; "required": false; }; "customResourceLimits": { "alias": "customResourceLimits"; "required": false; }; "podContainersResources": { "alias": "podContainersResources"; "required": false; }; "podContainerIndex": { "alias": "podContainerIndex"; "required": false; }; }, {}, never, never, true, never>; } export {};