UNPKG

@c8y/ngx-components

Version:

Angular modules for Cumulocity IoT applications

317 lines (303 loc) 14.3 kB
import * as i0 from '@angular/core'; import { InjectionToken, OnInit, ElementRef, ModuleWithProviders } from '@angular/core'; import * as i2 from '@c8y/ngx-components'; import { NavigatorNode, TenantUiService, AppStateService, Permissions, DisplayOptions, Column, Pagination, ActionControl, AlertService, ModalService, PasswordService, GainsightService, FilteringFormRendererContext, DatePipe, FilterChip, NewPassword, NavigatorNodeFactory } from '@c8y/ngx-components'; import * as i1 from 'ngx-bootstrap/datepicker'; import * as i3 from '@angular/router'; import { ActivatedRoute } from '@angular/router'; import { ITenant, ICurrentTenant, TenantStatus, TenantService, UserService, ITenantPolicy, InventoryService } from '@c8y/client'; import { Location } from '@angular/common'; import { TranslateService } from '@ngx-translate/core'; import { BehaviorSubject } from 'rxjs'; import { ValidatorFn, NgForm, FormGroup, AbstractControl } from '@angular/forms'; import { Ng1TenantPoliciesService } from '@c8y/ngx-components/upgrade/upgraded-services'; import { JSONSchema7TypeName } from 'json-schema'; declare const TENANTS_MODULE_CONFIG: InjectionToken<TenantsModuleConfig>; /** * Configuration object for `TenantsModule`. */ interface TenantsModuleConfig { /** * Allows for hiding or customizing "Subtenants" navigator node: * - `subtenantsNavigatorNode: true` - shows the default navigator node (default), * - `subtenantsNavigatorNode: false` - hides the navigator node, * - `subtenantsNavigatorNode: { label: 'My subtenants' }` - overrides default navigator node, * - `subtenantsNavigatorNode: new NavigatorNode({ label: 'My subtenants' })` - overrides default navigator node. */ subtenantsNavigatorNode?: boolean | Partial<NavigatorNode>; } declare const PRODUCT_EXPERIENCE_TENANT_MANAGEMENT: { readonly EVENTS: { readonly TENANT_MANAGEMENT: "tenantManagement"; }; readonly COMPONENTS: { readonly TENANT_LIST: "tenant-list"; readonly TENANT_FORM: "tenant-form"; readonly TENANT_CUSTOM_PROPERTIES: "tenant-custom-properties"; readonly TENANT_LIMITS: "tenant-limits"; }; readonly ACTIONS: { readonly TENANT_CREATION_INITIALIZED: "tenantCreationInitialized"; readonly TENANT_CREATION_STARTED_FILLING: "tenantCreationStartedFilling"; readonly TENANT_CREATION_SAVED: "tenantCreationSaved"; readonly TENANT_PROPERTIES_OPENED: "tenantPropertiesOpened"; readonly TENANT_PROPERTIES_STARTED_CHANGING: "tenantPropertiesStartedChanging"; readonly TENANT_PROPERTIES_SAVED: "tenantPropertiesSaved"; readonly TENANT_CUSTOM_PROPERTIES_OPENED: "tenantCustomPropertiesOpened"; readonly TENANT_CUSTOM_PROPERTIES_STARTED_CHANGING: "tenantCustomPropertiesStartedChanging"; readonly TENANT_CUSTOM_PROPERTIES_SAVED: "tenantCustomPropertiesSaved"; readonly TENANT_LIMITS_OPENED: "tenantLimitsOpened"; readonly TENANT_LIMITS_STARTED_CHANGING: "tenantLimitsStartedChanging"; readonly TENANT_LIMITS_SAVED: "tenantLimitsSaved"; }; readonly RESULTS: { readonly SUCCESS: "success"; readonly FAILURE: "failure"; }; }; type TenantManagementActionType = (typeof PRODUCT_EXPERIENCE_TENANT_MANAGEMENT.ACTIONS)[keyof typeof PRODUCT_EXPERIENCE_TENANT_MANAGEMENT.ACTIONS]; type TenantManagementResultType = (typeof PRODUCT_EXPERIENCE_TENANT_MANAGEMENT.RESULTS)[keyof typeof PRODUCT_EXPERIENCE_TENANT_MANAGEMENT.RESULTS]; declare class SupportUserAccessComponent implements OnInit { private tenantUiService; private appState; private permissions; tenant: ITenant; isTopTenant: boolean; supportUserLogin: string; constructor(tenantUiService: TenantUiService, appState: AppStateService, permissions: Permissions); ngOnInit(): Promise<void>; private getSupportUserLogin; static ɵfac: i0.ɵɵFactoryDeclaration<SupportUserAccessComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<SupportUserAccessComponent, "c8y-support-user-access", never, { "tenant": { "alias": "tenant"; "required": false; }; }, {}, never, never, true, never>; } declare class TenantListComponent implements OnInit { appState: AppStateService; private alertService; private modalService; private translateService; private tenantService; private tenantUiService; private location; private passwordService; private userService; private permissionsService; private gainsightService; tenants$: BehaviorSubject<ITenant[]>; isPermittedToCreateTenanant: boolean; currentTenant: ICurrentTenant; isManagementTenant: boolean; TOP_TENANT_NAME: string; title: string; loadMoreItemsLabel: string; loadingItemsLabel: string; displayOptions: DisplayOptions; columns: Column[]; pagination: Pagination; showSearch: boolean; actionControls: ActionControl[]; noResultsMessage: "No tenants to display."; noDataMessage: "There are no tenants defined."; noResultsSubtitle: "Refine your search terms or check your spelling."; noDataSubtitle: "Create the first tenant."; TenantStatus: typeof TenantStatus; constructor(appState: AppStateService, alertService: AlertService, modalService: ModalService, translateService: TranslateService, tenantService: TenantService, tenantUiService: TenantUiService, location: Location, passwordService: PasswordService, userService: UserService, permissionsService: Permissions, gainsightService: GainsightService); ngOnInit(): Promise<void>; loadTenants(): void; getColumns(): Column[]; getPagination(): Pagination; getActionControls(): ActionControl[]; createTenant(options?: { sendGainsightEvent: boolean; }): void; goToDetails(tenant: ITenant): void; activateTenant(tenant: any): Promise<void>; suspendTenant(tenant: any): Promise<void>; delete(tenant: any): Promise<void>; isActive(tenant: ITenant): boolean; isSuspended(tenant: ITenant): boolean; downloadNewsletterEmails(): Promise<void>; static ɵfac: i0.ɵɵFactoryDeclaration<TenantListComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<TenantListComponent, "c8y-tenant-list", never, {}, {}, never, never, true, never>; } interface Model { dateFrom: Date; dateTo: Date; } declare class CreationTimeFilteringFormRendererComponent { context: FilteringFormRendererContext; private c8yDate; private translateService; model: Model; constructor(context: FilteringFormRendererContext, c8yDate: DatePipe, translateService: TranslateService); applyFilter(): void; getChipsForModel(model: Model): FilterChip[]; resetFilter(): void; datepickerShown({ _element }: { _element: ElementRef; }): void; static ɵfac: i0.ɵɵFactoryDeclaration<CreationTimeFilteringFormRendererComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<CreationTimeFilteringFormRendererComponent, "c8y-creation-time-filtering-form-renderer", never, {}, {}, never, never, true, never>; } declare class StatusFilteringFormRendererComponent { context: FilteringFormRendererContext; model: { active: boolean; suspended: boolean; }; constructor(context: FilteringFormRendererContext); applyFilter(): void; resetFilter(): void; static ɵfac: i0.ɵɵFactoryDeclaration<StatusFilteringFormRendererComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<StatusFilteringFormRendererComponent, "c8y-status-filtering-form-renderer", never, {}, {}, never, never, true, never>; } interface TenantPropertyDefinition { id: string; defaultValue: number | string | boolean | null; type: 'text' | 'checkbox' | 'number' | 'select'; label: string; validators: ValidatorFn[]; placeholder?: string; } declare class TenantFormComponent implements OnInit { tenantPoliciesServiceProvider: Ng1TenantPoliciesService; private tenantService; private tenantUiService; private location; private alertService; private activatedRoute; private translateService; private gainsightService; passwordForm: NgForm; MANAGEMENT_TENANT_NAME: string; title: string; host: string; isTopTenant: boolean; isNew: boolean; isEnterpriseEditionTenant: boolean; tenant: ITenant | null; tenantPolicies: Array<ITenantPolicy>; tenantPolicyNone: { name: any; }; tenantId: string; passwordStrengthEnforced: boolean; saveInProgress: boolean; showPasswordComponent: boolean; tenantPolicy: ITenantPolicy; fieldKeys: string[]; tenantForm: FormGroup; fieldDefinitions: { domain: TenantPropertyDefinition; contactName: TenantPropertyDefinition; externalReference: TenantPropertyDefinition; tenantID: TenantPropertyDefinition; companyName: TenantPropertyDefinition; contactPhone: TenantPropertyDefinition; administratorEmail: TenantPropertyDefinition; administratorUsername: TenantPropertyDefinition; sendPasswordResetEmail: TenantPropertyDefinition; tenantPolicy: TenantPropertyDefinition; allowCreateTenants: TenantPropertyDefinition; gainsightEnabled: TenantPropertyDefinition; }; initialized: boolean; constructor(tenantPoliciesServiceProvider: Ng1TenantPoliciesService, tenantService: TenantService, tenantUiService: TenantUiService, location: Location, alertService: AlertService, activatedRoute: ActivatedRoute, translateService: TranslateService, gainsightService: GainsightService); ngOnInit(): Promise<void>; onTenantPolicyChange(): Promise<void>; setForm(): void; getTenantId(): void; onSubmit(): Promise<void>; onSave(tenant: ITenant, form: FormGroup): void; setSaveInProgress(value: boolean): void; cancel(): void; shouldDisableSave(): boolean; onNewPasswordChanged(newPassword: NewPassword): void; onCheckboxChange(inputField: any): void; private setDisabledState; private shouldShowSubtenantCheckbox; private removePasswordControl; private getTenant; private loadTenantPolicies; private getHost; private checkIfIsEnterpriseEdition; private onTenantPolicies; private onTenant; private generateForm; private sendGainsightEvent; static ɵfac: i0.ɵɵFactoryDeclaration<TenantFormComponent, [{ optional: true; }, null, null, null, null, null, null, null]>; static ɵcmp: i0.ɵɵComponentDeclaration<TenantFormComponent, "c8y-tenant-form", never, {}, {}, never, never, true, never>; } declare class TenantsModule { static config(config?: TenantsModuleConfig): ModuleWithProviders<TenantsModule>; static ɵfac: i0.ɵɵFactoryDeclaration<TenantsModule, never>; static ɵmod: i0.ɵɵNgModuleDeclaration<TenantsModule, never, [typeof i1.BsDatepickerModule, typeof i2.CoreModule, typeof i3.RouterModule, typeof SupportUserAccessComponent, typeof TenantListComponent, typeof CreationTimeFilteringFormRendererComponent, typeof StatusFilteringFormRendererComponent, typeof TenantFormComponent], never>; static ɵinj: i0.ɵɵInjectorDeclaration<TenantsModule>; } declare class TenantListGuard { private tenantUiService; private active; constructor(tenantUiService: TenantUiService); /** * Checks if tenant list should be active, * i.e. whether the current tenant can read other tenants. * **Note: the check is executed only once in the runtime.** * * @returns True, if the feature should be active. */ canActivate(): boolean; static ɵfac: i0.ɵɵFactoryDeclaration<TenantListGuard, never>; static ɵprov: i0.ɵɵInjectableDeclaration<TenantListGuard>; } declare class TenantsNavigationFactory implements NavigatorNodeFactory { private tenantListGuard; private config; private navs; constructor(tenantListGuard: TenantListGuard, config: TenantsModuleConfig); get(): Promise<NavigatorNode[]>; static ɵfac: i0.ɵɵFactoryDeclaration<TenantsNavigationFactory, [null, { optional: true; }]>; static ɵprov: i0.ɵɵInjectableDeclaration<TenantsNavigationFactory>; } interface TenantCustomPropertyField { id: string; label: string; type: JSONSchema7TypeName | JSONSchema7TypeName[]; format?: 'datetime' | string; formControlReference: AbstractControl; } declare class CustomPropertiesService { private inventoryService; constructor(inventoryService: InventoryService); getFormAndFieldList(): Promise<{ form: FormGroup; fields: TenantCustomPropertyField[]; }>; private getCustomProperties; private buildFormGroup; private applyValidators; private buildFieldList; static ɵfac: i0.ɵɵFactoryDeclaration<CustomPropertiesService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<CustomPropertiesService>; } declare class CustomPropertiesComponent implements OnInit { private tenantService; private alertService; private activatedRoute; private customPropertiesService; private gainsightService; fieldDefinitions: TenantCustomPropertyField[]; customPropsForm: FormGroup; tenant: ITenant | null; initialized: boolean; constructor(tenantService: TenantService, alertService: AlertService, activatedRoute: ActivatedRoute, customPropertiesService: CustomPropertiesService, gainsightService: GainsightService); ngOnInit(): Promise<void>; onSubmit(): Promise<void>; private loadTenantDetails; private applyValuesFromTenant; private getDirtyValues; private sendGainsightEvent; static ɵfac: i0.ɵɵFactoryDeclaration<CustomPropertiesComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<CustomPropertiesComponent, "c8y-custom-properties", never, {}, {}, never, never, true, never>; } export { CreationTimeFilteringFormRendererComponent, CustomPropertiesComponent, PRODUCT_EXPERIENCE_TENANT_MANAGEMENT, StatusFilteringFormRendererComponent, SupportUserAccessComponent, TENANTS_MODULE_CONFIG, TenantFormComponent, TenantListComponent, TenantListGuard, TenantsModule, TenantsNavigationFactory }; export type { Model, TenantManagementActionType, TenantManagementResultType, TenantsModuleConfig }; //# sourceMappingURL=index.d.ts.map