File

global-context/core/global-context-inline.component.ts

Implements

OnInit AfterViewInit OnDestroy

Metadata

Index

Properties
Methods
Inputs
Outputs

Constructor

constructor()

Inputs

config
Type : GlobalContextState | null
Default value : null
dashboardChildForLegacy
Type : DashboardChildComponent
isLoading
Default value : false
widgetControls
Type : WidgetControls
Required :  true

Outputs

globalContextChange
Type : Partial<GlobalContextState>
refresh
Type : Partial<DateTimeContext> | null

Methods

getAutoRefreshSeconds
getAutoRefreshSeconds()
Returns : number | null
getDisabledAggregations
getDisabledAggregations()
Returns : Partial<Record<aggregationType, boolean>>
getIntervalDisableConfig
getIntervalDisableConfig()
Returns : Record<string, boolean>
handleLinkToggle
handleLinkToggle(event: LinkToggleEvent, options?: literal type)
Parameters :
Name Type Optional
event LinkToggleEvent No
options literal type Yes
Returns : boolean
ngAfterViewInit
ngAfterViewInit()
Returns : void
ngOnDestroy
ngOnDestroy()
Returns : void
ngOnInit
ngOnInit()
Returns : void
onLocalRefreshTrigger
onLocalRefreshTrigger()
Returns : void
pauseAutoRefresh
pauseAutoRefresh()

Pause auto-refresh: sets isAutoRefreshEnabled to false and unlinks all controls. This stops the auto-refresh timer and prevents the widget from receiving updates from the global context.

NOTE: Does NOT trigger any refresh or emit - data is already loaded, no updates needed.

Returns : void
resumeAutoRefresh
resumeAutoRefresh()

Resume auto-refresh: sets isAutoRefreshEnabled to true and links all controls. This starts the auto-refresh timer and allows the widget to receive updates from the global context.

NOTE: Triggers emissions and refresh to sync with the current global context state.

Returns : void
shouldRenderHeaderInline
shouldRenderHeaderInline()
Returns : boolean
shouldShowHeaderLinks
shouldShowHeaderLinks()
Returns : boolean
toggleAllLinks
toggleAllLinks(isLinked: boolean, suppressRefresh?: boolean, suppressEmit?: boolean)
Parameters :
Name Type Optional
isLinked boolean No
suppressRefresh boolean Yes
suppressEmit boolean Yes
Returns : void
triggerHandler
triggerHandler(handlerName: string, configOverride?: GlobalContextState | null)
Parameters :
Name Type Optional
handlerName string No
configOverride GlobalContextState | null Yes
Returns : void
updateDateTimeContext
updateDateTimeContext(dateTimeContext: any)
Parameters :
Name Type Optional
dateTimeContext any No
Returns : void

Properties

Readonly controlLinksConfig
Type : ControlConfigsMap
Default value : LINK_BTNS_CONFIG
Readonly controlLinkStatus
Type : unknown
Default value : computed(() => this.visibilityContext()?.links ?? {})
Readonly dashboardControlSettings
Type : unknown
Default value : computed(() => { const base = this.visibilityContext()?.dashboardControls ?? {}; return { ...base, ...this.dashboardOverrides() }; })
Readonly disabledAggregations
Type : unknown
Default value : computed(() => deriveDisabledAggregationsHelper(this.getRefreshContext()) )
Readonly effectiveConfig
Type : unknown
Default value : computed(() => this.orchestrator.computeEffectiveConfig(this.config()) )
form
Type : FormGroup
Readonly GLOBAL_CONTEXT_DISPLAY_MODE
Type : unknown
Default value : GLOBAL_CONTEXT_DISPLAY_MODE
Readonly inlineSettings
Type : unknown
Default value : computed(() => { const base = this.visibilityContext()?.settings ?? {}; return { ...base, ...this.inlineOverrides() }; })
Readonly linkDisplayModel
Type : unknown
Default value : computed(() => { const settings = this.inlineSettings() ?? {}; const linkStates = this.controlLinkStatus() ?? {}; const { controlConfig, filteredStates } = buildControlLinkConfigHelper( this.getLinkContext(), settings, Object.keys(linkStates).length ? linkStates : null ); return { controlConfig, linkStates: filteredStates, showHeaderLinks: this.effectiveConfig().displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD }; })
Readonly REFRESH_OPTION
Type : unknown
Default value : REFRESH_OPTION
shouldDisableCounter
Type : unknown
Default value : false
<ng-template #headerContent>
  @let linkModel = linkDisplayModel();
  <ng-content select="#header"></ng-content>

  @if (shouldShowHeaderLinks()) {
    <c8y-global-context-link-controls
      [linkStates]="linkModel.linkStates"
      [controlConfigs]="linkModel.controlConfig"
      (allLinksToggled)="toggleAllLinks($event)"
    ></c8y-global-context-link-controls>
  }
</ng-template>

<ng-template #inlineContent>
  @let settings = inlineSettings();
  @let linkModel = linkDisplayModel();

  @if (form && settings) {
    <form
      class="d-flex gap-16 p-l-16 p-r-16 inner-scroll"
      [ngClass]="{
        'p-b-8':
          settings.showTimeContext ||
          settings.showRefresh ||
          settings.showAutoRefresh ||
          settings.showAggregation
      }"
      [formGroup]="form"
    >
      <div class="input-group w-auto input-group-sm">
        @if (settings.showAggregation) {
          <c8y-aggregation-picker
            data-cy="global-inline-date-context--Aggregation-display"
            [disabledAggregations]="getDisabledAggregations()"
            formControlName="aggregation"
            [resetToDefault]="true"
          ></c8y-aggregation-picker>
        }

        @if (settings.showAutoRefresh) {
          <c8y-auto-refresh-control
            [isLoading]="isLoading()"
            [disableCounter]="shouldDisableCounter"
            formControlName="isAutoRefreshEnabled"
            [autoRefreshSeconds]="getAutoRefreshSeconds()"
            [isAutoRefreshConnected]="linkModel.linkStates.isAutoRefreshEnabled ?? false"
            (refresh)="onLocalRefreshTrigger()"
          ></c8y-auto-refresh-control>
        }

        @if (settings.showTimeContext) {
          @let isHistoryMode = form.get('refreshOption')?.value === REFRESH_OPTION.HISTORY;
          <c8y-date-time-context-picker
            style="margin-left: -1px"
            formControlName="dateTimeContext"
            [shouldDisableInterval]="getIntervalDisableConfig()"
            [config]="
              isHistoryMode
                ? { showDateTo: true, showDateFrom: true }
                : { showDateTo: false, showDateFrom: true }
            "
          ></c8y-date-time-context-picker>
        }

        @if (settings.showRefresh) {
          <div class="input-group-btn">
            <button
              class="btn btn-default"
              [attr.aria-label]="'Refresh' | translate"
              [tooltip]="'Refresh' | translate"
              placement="bottom"
              container="body"
              type="button"
              data-cy="global-inline-date-context--reload-button"
              [adaptivePosition]="false"
              [delay]="500"
              [disabled]="isLoading()"
              (click)="refresh.emit(null)"
            >
              <i
                [class.icon-spin]="isLoading()"
                [c8yIcon]="'refresh'"
              ></i>
            </button>
          </div>
        }
      </div>
    </form>
  }

  <ng-content select="#body"></ng-content>
</ng-template>

@switch (effectiveConfig().displayMode) {
  @case (GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG) {
    <ng-container [ngTemplateOutlet]="inlineContent"></ng-container>
  }
  @case (GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG) {
    <ng-container [ngTemplateOutlet]="headerContent"></ng-container>
    <ng-container [ngTemplateOutlet]="inlineContent"></ng-container>
  }
  @default {
    @if (shouldRenderHeaderInline()) {
      <ng-container [ngTemplateOutlet]="headerContent"></ng-container>
    }
    <ng-container [ngTemplateOutlet]="inlineContent"></ng-container>
  }
}

results matching ""

    No results matching ""