File

reports/export-schedules.component.ts

Implements

OnInit OnChanges

Metadata

Index

Properties
Methods
Inputs
Outputs
Accessors

Constructor

constructor(reportsService: ReportsService, bsModalService: BsModalService, cronService: CronService, translateService: TranslateService, userService: UserService, optionsService: OptionsService)
Parameters :
Name Type Optional
reportsService ReportsService No
bsModalService BsModalService No
cronService CronService No
translateService TranslateService No
userService UserService No
optionsService OptionsService No

Inputs

exportId

Outputs

onSchedulesUpdate
Type : EventEmitter

Methods

addSchedule
addSchedule()
Returns : void
Async checkRole
checkRole()
Returns : unknown
duplicateSchedule
duplicateSchedule(schedule: Schedule, event: any)
Parameters :
Name Type Optional
schedule Schedule No
event any No
Returns : void
editSchedule
editSchedule(schedule: Schedule, index: number, event: any)
Parameters :
Name Type Optional
schedule Schedule No
index number No
event any No
Returns : void
Async getCurrentUserEmail
getCurrentUserEmail()
Returns : unknown
getMessageFromModal
getMessageFromModal(payload: EmitterPayload, index?: number)
Parameters :
Name Type Optional
payload EmitterPayload No
index number Yes
Returns : void
Async getScheduleList
getScheduleList(withProgress: boolean)
Parameters :
Name Type Optional
withProgress boolean No
Returns : any
ngOnChanges
ngOnChanges()
Returns : void
Async ngOnInit
ngOnInit()
Returns : any
openAddEditModal
openAddEditModal(exportId: IdReference, schedule: Schedule, actionType: ActionType, index?: number)
Parameters :
Name Type Optional
exportId IdReference No
schedule Schedule No
actionType ActionType No
index number Yes
Returns : void
removeSchedule
removeSchedule(schedule: Schedule, index: number, event: any)
Parameters :
Name Type Optional
schedule Schedule No
index number No
event any No
Returns : void
translateButtonTitles
translateButtonTitles()
Returns : void

Properties

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

Accessors

exportId
setexportId(exportId: IdReference)
Parameters :
Name Type Optional
exportId IdReference No
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>

results matching ""

    No results matching ""