reports/export-schedules.component.ts
selector | export-schedules |
templateUrl | ./export-schedules.component.html |
Properties |
Methods |
Inputs |
Outputs |
Accessors |
constructor(reportsService: ReportsService, bsModalService: BsModalService, cronService: CronService, translateService: TranslateService, userService: UserService, optionsService: OptionsService)
|
|||||||||||||||||||||
Parameters :
|
exportId |
onSchedulesUpdate |
Type : EventEmitter
|
addSchedule |
addSchedule()
|
Returns :
void
|
Async checkRole |
checkRole()
|
Returns :
unknown
|
duplicateSchedule |
duplicateSchedule(schedule: Schedule, event: any)
|
Returns :
void
|
editSchedule |
editSchedule(schedule: Schedule, index: number, event: any)
|
Returns :
void
|
Async getCurrentUserEmail |
getCurrentUserEmail()
|
Returns :
unknown
|
getMessageFromModal | |||||||||
getMessageFromModal(payload: EmitterPayload, index?: number)
|
|||||||||
Parameters :
Returns :
void
|
Async getScheduleList | ||||||
getScheduleList(withProgress: boolean)
|
||||||
Parameters :
Returns :
any
|
ngOnChanges |
ngOnChanges()
|
Returns :
void
|
Async ngOnInit |
ngOnInit()
|
Returns :
any
|
openAddEditModal | |||||||||||||||
openAddEditModal(exportId: IdReference, schedule: Schedule, actionType: ActionType, index?: number)
|
|||||||||||||||
Parameters :
Returns :
void
|
removeSchedule |
removeSchedule(schedule: Schedule, index: number, event: any)
|
Returns :
void
|
translateButtonTitles |
translateButtonTitles()
|
Returns :
void
|
buttonLabels |
Type : any
|
Public cronService |
Type : CronService
|
currentUserEmail |
Type : string
|
Default value : ''
|
exp |
Type : Export
|
hasRequiredRole |
Type : boolean
|
Default value : false
|
initialSchedule |
Type : Schedule
|
Default value : {
timestamp: null,
emailConfig: {
to: [],
cc: [],
bcc: [],
replyTo: '',
text: '',
subject: ''
},
cronConfig: {
minute: '0',
hour: '0',
day: '1',
month: '1',
weekday: '?'
}
}
|
isEditMenuOpen |
Type : boolean
|
Default value : false
|
isFlipped |
Type : boolean
|
isOpen |
Type : any
|
Default value : {}
|
listClass |
Type : string
|
Default value : 'interact-list'
|
loadingStatus |
Type : any
|
modalRef |
Type : BsModalRef
|
scheduleList |
Type : Schedule[]
|
Default value : []
|
sortReverse |
Type : boolean
|
Default value : false
|
sortType |
Type : string
|
exportId | ||||||
setexportId(exportId: IdReference)
|
||||||
Parameters :
Returns :
void
|
<div>
<div *ngIf="loadingStatus.inProgress" class="flex-row">
<c8y-loading></c8y-loading>
<span translate>Retrieving schedules…</span>
</div>
<div *ngIf="!loadingStatus.inProgress && loadingStatus.done && loadingStatus.error">
<div class="alert alert-warning max-width-100" translate>
Could not load schedules list.
</div>
</div>
<div *ngIf="!loadingStatus.inProgress && !loadingStatus.done && !loadingStatus.error">
<div class="c8y-empty-state text-center max-width-100" *ngIf="!scheduleList.length">
<h1 c8yIcon="c8y-report" class="c8y-icon-duocolor"></h1>
<h3 translate>No export schedules defined.</h3>
</div>
<div class="c8y-list__group" *ngIf="scheduleList.length">
<div class="c8y-list__item hidden-xs">
<div class="c8y-list__item__block">
<div class="c8y-list__item__icon">
<i class="p-l-24"></i>
</div>
<div class="c8y-list__item__body">
<div class="flex-row">
<div class="col-sm-6">
<label class="m-0">
{{ 'Description' | translate }}
</label>
</div>
<div class="col-sm-6 m-r-40">
<label class="m-0">
{{ 'Frequency' | translate }}
</label>
</div>
</div>
</div>
<span></span>
</div>
</div>
<div
class="c8y-list__item flex-row pointer"
*ngFor="let schedule of scheduleList; index as i"
(click)="editSchedule(schedule, i, $event)"
>
<div class="c8y-list__item__block">
<div class="c8y-list__item__icon">
<i c8yIcon="c8y-report" class="c8y-icon-duocolor"></i>
</div>
<div class="c8y-list__item__body flex-row">
<div class="col-sm-6 col-xs-6">
<div class="text-truncate" title="{{ schedule.emailConfig.subject }}">
{{ schedule.emailConfig.subject }}
</div>
</div>
<div class="col-sm-6 col-xs-6">
<div class="flex-row a-i-baseline">
<i c8yIcon="calendar" class="text-muted m-r-4"></i>
<span class="smart-rule-information">
<span
*ngIf="cronService.getBase(schedule.cronConfig) === 2"
ngNonBindable
translate
[translateParams]="{ minutes: schedule.cronConfig.minute | number: '2.0-0' }"
>
Hourly: {{ minutes }} minute(s) past the hour.
</span>
<span
*ngIf="cronService.getBase(schedule.cronConfig) === 3"
ngNonBindable
translate
[translateParams]="{
hour: schedule.cronConfig.hour | number: '2.0-0',
minutes: schedule.cronConfig.minute | number: '2.0-0'
}"
>
Daily: at {{ hour }}:{{ minutes }}.
</span>
<span
*ngIf="cronService.getBase(schedule.cronConfig) === 4"
ngNonBindable
translate
[translateParams]="{
weekDay: cronService.getWeekDayName(schedule.cronConfig),
hour: schedule.cronConfig.hour | number: '2.0-0',
minutes: schedule.cronConfig.minute | number: '2.0-0'
}"
>
Weekly: {{ weekDay }}, at {{ hour }}:{{ minutes }}.
</span>
<span
*ngIf="cronService.getBase(schedule.cronConfig) === 5"
ngNonBindable
translate
[translateParams]="{
monthDay: cronService.getMonthDayName(schedule.cronConfig),
hour: schedule.cronConfig.hour | number: '2.0-0',
minutes: schedule.cronConfig.minute | number: '2.0-0'
}"
>
Monthly: {{ monthDay }} day of the month, at {{ hour }}:{{ minutes }}.
</span>
<span
*ngIf="cronService.getBase(schedule.cronConfig) === 6"
ngNonBindable
translate
[translateParams]="{
month: cronService.getMonthName(schedule.cronConfig),
monthDay: cronService.getMonthDayName(schedule.cronConfig),
hour: schedule.cronConfig.hour | number: '2.0-0',
minutes: schedule.cronConfig.minute | number: '2.0-0'
}"
>
Yearly: {{ month }}, {{ monthDay }} day of the month, at {{ hour }}:{{
minutes
}}.
</span>
</span>
</div>
</div>
</div>
<div class="c8y-list__item__actions" (click)="$event.stopPropagation()">
<div class="settings dropdown" dropdown>
<button
class="dropdown-toggle c8y-dropdown"
dropdownToggle
aria-haspopup="true"
aria-expanded="false"
title="{{ 'Actions' | translate }}"
>
<i [c8yIcon]="'ellipsis-v'"></i>
</button>
<ul class="dropdown-menu dropdown-menu-right" *dropdownMenu>
<li role="menuitem">
<button
[title]="hasRequiredRole ? buttonLabels.edit : buttonLabels.editNoPermission"
(click)="editSchedule(schedule, i, $event)"
[disabled]="!hasRequiredRole"
>
<i [c8yIcon]="'pencil'"></i> {{ 'Edit' | translate }}
</button>
</li>
<li role="menuitem">
<button
[title]="
hasRequiredRole ? buttonLabels.duplicate : buttonLabels.duplicateNoPermission
"
(click)="duplicateSchedule(schedule, $event)"
[disabled]="!hasRequiredRole"
>
<i [c8yIcon]="'copy'"></i> {{ 'Duplicate' | translate }}
</button>
</li>
<li role="menuitem">
<button
[title]="
hasRequiredRole ? buttonLabels.delete : buttonLabels.deleteNoPermission
"
(click)="removeSchedule(schedule, i, $event)"
[disabled]="!hasRequiredRole"
>
<i [c8yIcon]="'trash'"></i> {{ 'Delete' | translate }}
</button>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="alert alert-warning max-width-100" *ngIf="!hasRequiredRole" role="alert" translate>
You don't have the permission required to schedule exports.
</div>
<button
type="button"
class="btn-add-block m-t-16"
title="{{ 'Add schedule' | translate }}"
(click)="addSchedule()"
[disabled]="!hasRequiredRole"
>
<i [c8yIcon]="'plus-circle'"></i>
{{ 'Add schedule' | translate }}
</button>
</div>