UNPKG

@c8y/ngx-components

Version:

Angular modules for Cumulocity IoT applications

246 lines (234 loc) 9.42 kB
import * as i0 from '@angular/core'; import { OnInit, OnChanges, EventEmitter } from '@angular/core'; import * as i1 from '@c8y/ngx-components'; import { AlertService, OptionsService } from '@c8y/ngx-components'; import * as i2 from 'ngx-bootstrap/dropdown'; import * as i3 from 'ngx-bootstrap/tooltip'; import { IManagedObject, InventoryService, FetchClient, IdReference, IIdentified, IFetchResponse, UserService } from '@c8y/client'; import { TranslateService } from '@ngx-translate/core'; import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal'; interface Export extends IManagedObject { c8y_ScheduleConfiguration: Schedule[]; } interface Schedule { timestamp: number; emailConfig: EmailConfig; cronConfig: CronConfig; } interface EmailConfig { to: string[]; cc: string[]; bcc: string[]; replyTo: string; text: string; subject: string; } interface CronConfig { month: string; hour: string; weekday: string; day: string; minute: string; } interface EmittedCron { cron: string; valid: boolean; } interface EmitterPayload { success: boolean; message: string; schedule: Schedule; } declare enum ActionType { CREATE = "create", EDIT = "edit", DUPLICATE = "duplicate" } declare enum Base { Initial = 1, Hour = 2, Day = 3, Week = 4, Month = 5, Year = 6 } declare class ReportsService { private alertService; private inventoryService; private client; private translateService; microserviceUrl: string; headers: any; isReportAgentSubscribed: boolean; REPORT_AGENT_NOT_SUBSCRIBED_EXPECTED_ERROR_LOWER_CASE: string; constructor(alertService: AlertService, inventoryService: InventoryService, client: FetchClient, translateService: TranslateService); getExport(exportId: IdReference): Promise<Export>; getScheduleList(exportId: IdReference): Promise<any>; extractScheduleListFromExport(exp: Export): any; addSchedule(schedule: Schedule, exportId: IdReference): Promise<boolean>; updateSchedule(oldSchedule: Schedule, schedule: Schedule, exportId: IdReference): Promise<boolean>; updateSchedules(exportId: IdReference, schedulesToRemove?: Schedule[], schedulesToAdd?: Schedule[]): Promise<boolean>; reschedule(exportId: IdReference): Promise<boolean>; deleteSchedule(schedule: Schedule, exportId: IdReference): Promise<boolean>; /** * Removes report configuration. * * Note: fallback strategy is based on error code returned by backend * in case of missing subscription for report-agent microservice. * @param config entity of report configuration * @returns Response wrapped in [[IFetchResponse]] */ removeConfiguration(config: IIdentified): Promise<IFetchResponse>; normalConfigurationRemoval(config: IIdentified): Promise<IFetchResponse>; fallbackConfigurationRemoval(config: IIdentified): Promise<IFetchResponse>; requestExport(config: IIdentified): Promise<void>; static ɵfac: i0.ɵɵFactoryDeclaration<ReportsService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<ReportsService>; } declare class CronService { private translateService; daysOfWeekPosix: any[]; daysOfMonth: { value: string; label: string; }[]; months: any[]; hours: any[]; minutes: any[]; intervals: ({ value: number; label: "Hour"; } | { value: number; label: "Day"; } | { value: number; label: "Week"; } | { value: number; label: "Month"; } | { value: number; label: "Year"; })[]; constructor(translateService: TranslateService); generateCron(cronConfig: CronConfig): string; generateCronConfig(cron: string): CronConfig; getBase(cronConfig: CronConfig): Base; validateModels(base: Base, cronConfig: CronConfig): boolean; clearNextModels(base: Base, cronConfig: CronConfig): void; getWeekDayName(cronConfig: CronConfig): string; getMonthDayName(cronConfig: CronConfig): string; getMonthName(cronConfig: CronConfig): string; static ɵfac: i0.ɵɵFactoryDeclaration<CronService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<CronService>; } declare class ExportSchedulesComponent implements OnInit, OnChanges { private reportsService; private bsModalService; cronService: CronService; private translateService; private userService; private optionsService; set exportId(exportId: IdReference); onSchedulesUpdate: EventEmitter<Schedule[]>; exp: Export; scheduleList: Schedule[]; initialSchedule: Schedule; buttonLabels: any; listClass: string; loadingStatus: any; sortType: string; sortReverse: boolean; isOpen: any; isFlipped: boolean; isEditMenuOpen: boolean; modalRef: BsModalRef; currentUserEmail: string; hasRequiredRole: boolean; private _exportId; private defaultExportEmailTemplate; constructor(reportsService: ReportsService, bsModalService: BsModalService, cronService: CronService, translateService: TranslateService, userService: UserService, optionsService: OptionsService); ngOnInit(): Promise<void>; ngOnChanges(): void; translateButtonTitles(): void; getCurrentUserEmail(): Promise<string[]>; checkRole(): Promise<boolean>; getScheduleList(withProgress: boolean): Promise<void>; addSchedule(): void; editSchedule(schedule: Schedule, index: number, event: any): void; duplicateSchedule(schedule: Schedule, event: any): void; openAddEditModal(exportId: IdReference, schedule: Schedule, actionType: ActionType, index?: number): void; getMessageFromModal(payload: EmitterPayload, index?: number): void; removeSchedule(schedule: Schedule, index: number, event: any): void; static ɵfac: i0.ɵɵFactoryDeclaration<ExportSchedulesComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<ExportSchedulesComponent, "export-schedules", never, { "exportId": { "alias": "exportId"; "required": false; }; }, { "onSchedulesUpdate": "onSchedulesUpdate"; }, never, never, true, never>; } declare class ScheduleModalComponent implements OnInit { reportsService: ReportsService; modalRef: BsModalRef; private cronService; schedule: Schedule; oldSchedule: Schedule; emitter: EventEmitter<EmitterPayload>; exportId: number; actionType: ActionType; ActionType: typeof ActionType; cronExpression: string; validCron: boolean; emitterPayload: EmitterPayload; emailTo: string; emailCc: string; emailBcc: string; emailReplyTo: string; emailSubject: string; emailText: string; placeholdersInfo: "Available placeholders: {tenant-domain}, {host}, {binaryId}. Whole link to downloadable file is: {tenant-domain}/inventory/binaries/{binaryId}."; constructor(reportsService: ReportsService, modalRef: BsModalRef, cronService: CronService); ngOnInit(): void; populateEmailFieldsFromSchedule(schedule: Schedule): void; save(): void; cancel(): void; getCron(cron: EmittedCron): void; populateScheduleFromCronExpression(): void; convertStringOfEmailsToArray(stringOfEmails: string): any[]; populateScheduleFromEmailFields(): void; static ɵfac: i0.ɵɵFactoryDeclaration<ScheduleModalComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<ScheduleModalComponent, "schedule-modal", never, {}, { "emitter": "emitter"; }, never, never, true, never>; } declare class CronComponent implements OnInit { private cronService; cronIn: string; emitter: EventEmitter<EmittedCron>; emittedCron: EmittedCron; base: Base; cronConfig: CronConfig; daysOfWeekPosix: any[]; daysOfMonth: any[]; months: any[]; hours: any[]; minutes: any[]; intervals: any[]; constructor(cronService: CronService); ngOnInit(): void; onChangeSelect(): void; static ɵfac: i0.ɵɵFactoryDeclaration<CronComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<CronComponent, "cron", never, { "cronIn": { "alias": "cronIn"; "required": false; }; }, { "emitter": "emitter"; }, never, never, true, never>; } /** * The angular module definition for reports. * @exports ExportSchedulesComponent * @exports ScheduleModalComponent * @exports CronComponent */ declare class ReportsModule { static ɵfac: i0.ɵɵFactoryDeclaration<ReportsModule, never>; static ɵmod: i0.ɵɵNgModuleDeclaration<ReportsModule, never, [typeof i1.CoreModule, typeof i1.FormsModule, typeof i2.BsDropdownModule, typeof i3.TooltipModule, typeof ExportSchedulesComponent, typeof ScheduleModalComponent, typeof CronComponent], [typeof ExportSchedulesComponent, typeof ScheduleModalComponent, typeof CronComponent]>; static ɵinj: i0.ɵɵInjectorDeclaration<ReportsModule>; } declare const exportSchedulesComponentDowngradedComponent: any; declare const reportsServiceDowngradedInjectable: Function; declare const ng1ModulesReports: string[]; export { ActionType, Base, CronComponent, CronService, ExportSchedulesComponent, ReportsModule, ReportsService, ScheduleModalComponent, exportSchedulesComponentDowngradedComponent, ng1ModulesReports, reportsServiceDowngradedInjectable }; export type { CronConfig, EmailConfig, EmittedCron, EmitterPayload, Export, Schedule }; //# sourceMappingURL=index.d.ts.map