widgets/implementations/alarms/alarm-widget-alarms-reload.component.ts
OnInit
AfterViewInit
OnChanges
OnDestroy
selector | c8y-alarm-widget-alarms-reload |
templateUrl | ./alarm-widget-alarms-reload.component.html |
Properties |
Methods |
Inputs |
Outputs |
constructor(alarmsViewService: AlarmsViewService, cdRef: ChangeDetectorRef, translateService: TranslateService, widgetGlobalAutoRefreshService: WidgetGlobalAutoRefreshService)
|
|||||||||||||||
Parameters :
|
config |
Type : AlarmListWidgetConfig
|
Alarm widgets config. |
isDisabled |
Type : boolean
|
Default value : false
|
isIntervalRefresh |
Type : boolean
|
State of this boolean depends on an Application Options "alarmsRefreshType" setting. |
isLoading |
Type : BehaviorSubject<boolean>
|
Current isLoading state. Based on it next countdown cycle is being started. |
isScrolling |
Type : boolean
|
Indicates whether the alarm list is being scrolled or not. |
refreshInterval |
Type : number
|
Current refresh interval set in a widget config. |
onCountdownEnded |
Type : EventEmitter
|
Indicates that a countdown cycle has ended. |
onRealTimeToggleChanged |
Type : EventEmitter<boolean>
|
Emitted to indicate that the widgets realtime button state has changed. |
autoRefreshList |
autoRefreshList()
|
Stops the countdown and triggers a refresh action.
This function is responsible for halting the countdown interval component's operation.
After stopping the countdown, it emits an
Returns :
void
|
countdownEnded |
countdownEnded()
|
Wrapper method where it's name better describes a context where it was called.
Returns :
void
|
disableCountdown |
disableCountdown()
|
Disables and hides the countdown timer. This method stops the ongoing countdown process by unsubscribing from
Returns :
void
|
enableCountdown |
enableCountdown()
|
Enables and starts the countdown timer. This method makes the countdown visible (
Returns :
void
|
getRealtimeIconTitle |
getRealtimeIconTitle()
|
Sets the tooltip message for a new realtime alarm indicator.
Returns :
string
Tooltip message. |
handleScrolling |
handleScrolling()
|
Manages the countdown timer's visibility and state in response to user scrolling. This method toggles the countdown timer based on the user's scrolling behavior. It uses
the
Returns :
void
|
ngAfterViewInit |
ngAfterViewInit()
|
Returns :
void
|
ngOnChanges | ||||||
ngOnChanges(changes: SimpleChanges)
|
||||||
Parameters :
Returns :
void
|
ngOnDestroy |
ngOnDestroy()
|
Returns :
void
|
ngOnInit |
ngOnInit()
|
Returns :
void
|
onToggleCountdownButtonState | ||||||||
onToggleCountdownButtonState($event: MouseEvent)
|
||||||||
Handles the toggle state of the countdown on button click. This method is triggered by a mouse event, typically a click on the countdown toggle button.
It toggles
Parameters :
Returns :
void
|
reload |
reload()
|
Returns :
void
|
startCountdown |
startCountdown()
|
This function listens for changes in the IMPORTANT: If the widget's configuration (refreshInterval, check template) is not set prior to executing countdownIntervalComponent?.start, the countdown interval will not start!
Returns :
void
|
toggleRealtimeState |
toggleRealtimeState()
|
Toggles the real-time state of the component. This method switches the
Returns :
void
|
countdownIntervalComponent |
Type : CountdownIntervalComponent
|
Decorators :
@ViewChild(CountdownIntervalComponent, {static: false})
|
countdownSubscription |
Type : Subscription
|
Holds the subscription to a countdown observable. |
globalAutoRefreshEnabled |
Type : boolean
|
hideCountdown |
Type : boolean
|
Controls the visibility of the countdown timer component in the current component's UI. |
isIntervalRefreshToggleOn |
Type : boolean
|
Indicates the current state of an interval refresh toggle button. |
isNewAlarmMessageCleared |
Default value : true
|
Indicates whether the countdown has been cleared already. |
isRealtimeToggleOn |
Type : boolean
|
Indicates the current state of an realtime toggle button. |
manuallyDisabledCountdown |
Default value : false
|
Indicates whether the countdown has been manually disabled by the user. |
Readonly REALTIME_UPDATE_ALARMS_MESSAGE |
Default value : this.alarmsViewService.REALTIME_UPDATE_ALARMS_MESSAGE
|
realtimeIconTitle |
Type : string
|
Tooltip for a new realtime alarm indicator. |
toggleCountdownButtonTooltipText |
Type : string
|
<div
class="m-l-auto d-flex p-t-4 p-b-4"
*ngIf="!globalAutoRefreshEnabled"
>
<div class="m-l-auto d-flex a-i-center">
<label
class="m-b-0 m-r-8 text-label-small text-truncate flex-no-shrink"
title=" {{ 'Auto refresh' | translate }}"
*ngIf="isIntervalRefresh && refreshInterval && config.isAutoRefreshEnabled"
>
{{ 'Auto refresh' | translate }}
</label>
<div class="input-group">
<label
class="toggle-countdown"
[class.toggle-countdown-disabled]="isDisabled"
[attr.aria-label]="toggleCountdownButtonTooltipText"
[tooltip]="toggleCountdownButtonTooltipText"
placement="bottom"
*ngIf="isIntervalRefresh && refreshInterval && config.isAutoRefreshEnabled"
[adaptivePosition]="false"
[container]="'body'"
[delay]="500"
>
<input
type="checkbox"
data-cy="c8y-alarms-widget--interval-toggle-button"
(click)="onToggleCountdownButtonState($event)"
/>
<c8y-countdown-interval
*ngIf="isIntervalRefreshToggleOn"
[countdownInterval]="refreshInterval"
(countdownEnded)="countdownEnded()"
></c8y-countdown-interval>
<i
c8yIcon="pause"
*ngIf="!isIntervalRefreshToggleOn"
></i>
</label>
<div class="input-group-btn">
<button
class="btn btn-default"
[attr.aria-label]="'Refresh' | translate"
[tooltip]="
!isNewAlarmMessageCleared
? (REALTIME_UPDATE_ALARMS_MESSAGE | translate)
: ('Refresh' | translate)
"
placement="bottom"
type="button"
[adaptivePosition]="false"
[container]="'body'"
[delay]="500"
[disabled]="isDisabled || (isLoading | async)"
(click)="reload()"
data-cy="c8y-alarms-widget--reload-button"
>
<span
class="tag tag--info m-r-8"
*ngIf="!isNewAlarmMessageCleared"
>
{{ 'New alarms' | translate }}
</span>
<i
c8yIcon="refresh"
[ngClass]="{ 'icon-spin': isLoading | async }"
></i>
</button>
</div>
<div
class="input-group-btn input-group-btn--last"
*ngIf="!isIntervalRefresh"
>
<button
class="c8y-realtime btn btn-default"
[attr.aria-label]="realtimeIconTitle"
[tooltip]="realtimeIconTitle"
placement="bottom"
type="button"
[container]="'body'"
(click)="toggleRealtimeState()"
[disabled]="isDisabled"
>
<span
class="c8y-pulse m-0"
[ngClass]="{
active: isRealtimeToggleOn,
inactive: !isRealtimeToggleOn
}"
></span>
</button>
</div>
</div>
</div>
</div>