File

widgets/implementations/info-gauge/info-gauge-widget-config/info-gauge-widget-config.component.ts

Implements

OnInit OnBeforeSave OnDestroy

Metadata

Index

Properties
Methods
Inputs
Accessors

Constructor

constructor(formBuilder: FormBuilder, form: NgForm, widgetConfig: WidgetConfigComponent, widgetConfigService: WidgetConfigService, dynamicComponent?: DynamicComponentComponent)
Parameters :
Name Type Optional
formBuilder FormBuilder No
form NgForm No
widgetConfig WidgetConfigComponent No
widgetConfigService WidgetConfigService No
dynamicComponent DynamicComponentComponent Yes

Inputs

config
Type : InfoGaugeWidgetConfig

Methods

Async assignSchema
assignSchema()
Returns : Promise<void>
gaugeJSONChange
gaugeJSONChange(value: string)
Parameters :
Name Type Optional
value string No
Returns : void
ngOnDestroy
ngOnDestroy()
Returns : void
ngOnInit
ngOnInit()
Returns : void
onBeforeSave
onBeforeSave(config?: InfoGaugeWidgetConfigComponent)
Parameters :
Name Type Optional
config InfoGaugeWidgetConfigComponent Yes
Returns : boolean | Promise | Observable
onRadioPresetChange
onRadioPresetChange(presetId: string)
Parameters :
Name Type Optional
presetId string No
Returns : void
trackByFn
trackByFn(_index: number, item: GaugeOptions)
Parameters :
Name Type Optional
_index number No
item GaugeOptions No
Returns : string

Properties

activeDatapointGauge
Type : KPIDetails
ALL_GAUGE_PRESETS
Type : []
Default value : [...GAUGE_PRESETS]
datapointSelectionConfig
Type : Partial<DatapointSelectorModalOptions>
Default value : {}
defaultFormOptions
Type : Partial<DatapointAttributesFormConfig>
Default value : { showRedRange: true, showYellowRange: true, showRange: true, selectableChartRenderTypes: [] }
editorComponent
Type : EditorComponent
Decorators :
@ViewChild(EditorComponent)
formGroup
Type : ReturnType<>
Readonly GAUGE_PRESETS
Default value : GAUGE_PRESETS
gaugeOptions
Type : GaugeOptions
gaugeOptionsString
Type : string
Default value : ''
hideAdvancedOptionsLabel
Default value : gettext('Hide advanced options')
isInfoGauge
Type : boolean
showAdvancedOptions
Default value : false
showAdvancedOptionsLabel
Default value : gettext('Show advanced options')

Accessors

previewMapSet
setpreviewMapSet(template: TemplateRef)
Parameters :
Name Type Optional
template TemplateRef<any> No
Returns : void
<form
  class="fit-h"
  [formGroup]="formGroup"
>
  <div
    class="m-l-16 m-r-16"
    *ngIf="isInfoGauge; else radialGauge"
  >
    <div class="row">
      <div class="col-md-6">
        <c8y-form-group class="p-t-8">
          <label translate>Decimal places</label>
          <input
            class="form-control"
            name="fractionSize"
            type="number"
            formControlName="fractionSize"
            step="1"
          />
          <c8y-messages [show]="formGroup.controls.fractionSize.errors"></c8y-messages>
        </c8y-form-group>
      </div>
      <div class="col-md-6 p-t-8">
        <div
          class="alert alert-info"
          role="alert"
          *ngIf="formGroup.errors?.noActiveDatapoint"
          translate
        >
          At least one data point for the labels or the gauge needs to be selected.
        </div>
      </div>
    </div>

    <div class="row">
      <div class="col-md-6">
        <c8y-datapoint-selection-list
          class="bg-inherit separator-top p-t-16 d-block"
          listTitle="{{ 'Multiple label and value pairs' | translate }}"
          name="datapoints"
          [defaultFormOptions]="defaultFormOptions"
          [config]="datapointSelectionConfig"
          [minActiveCount]="0"
          formControlName="datapointsLabels"
        ></c8y-datapoint-selection-list>
      </div>
      <div class="col-md-6">
        <c8y-datapoint-selection-list
          class="bg-inherit separator-top p-t-16 d-block"
          listTitle="{{ 'Gauge`display`' | translate }}"
          name="datapoints"
          [defaultFormOptions]="defaultFormOptions"
          [config]="datapointSelectionConfig"
          [minActiveCount]="0"
          [maxActiveCount]="1"
          formControlName="datapointsGauge"
        ></c8y-datapoint-selection-list>
      </div>
    </div>
  </div>

  <ng-template #radialGauge>
    <c8y-datapoint-selection-list
      class="bg-inherit d-block"
      listTitle="{{ 'Data points`display`' | translate }}"
      name="datapoints"
      [defaultFormOptions]="defaultFormOptions"
      [config]="datapointSelectionConfig"
      [minActiveCount]="0"
      [maxActiveCount]="1"
      formControlName="datapointsGauge"
    ></c8y-datapoint-selection-list>

    <c8y-form-group class="p-t-8 p-r-16 p-l-16">
      <label translate>Decimal places</label>
      <input
        class="form-control"
        name="fractionSize"
        type="number"
        formControlName="fractionSize"
        step="1"
      />
      <c8y-messages [show]="formGroup.controls.fractionSize.errors"></c8y-messages>
    </c8y-form-group>

    <div class="form-group p-r-16 p-l-16 m-b-0">
      <legend>
        {{ 'Presets' | translate }}
      </legend>
      <c8y-preset-preview
        formControlName="gaugePresetId"
        [ALL_GAUGE_PRESETS]="ALL_GAUGE_PRESETS"
        (onPresetChange)="onRadioPresetChange($event)"
      ></c8y-preset-preview>
    </div>

    <div class="p-16">
      <button
        class="btn btn-default"
        aria-controls="advancedCollapse"
        [attr.aria-expanded]="showAdvancedOptions"
        type="button"
        (click)="showAdvancedOptions = !showAdvancedOptions"
      >
        {{ showAdvancedOptions ? hideAdvancedOptionsLabel : showAdvancedOptionsLabel }}
      </button>
    </div>

    <div
      class="collapse"
      id="advancedCollapse"
      [collapse]="!showAdvancedOptions"
      [isAnimated]="true"
    >
      <div
        class="fit-h"
        style="min-height: 400px"
      >
        <c8y-editor
          [ngModel]="gaugeOptionsString"
          (ngModelChange)="gaugeJSONChange($event)"
          (editorInit)="assignSchema()"
          [ngModelOptions]="{ standalone: true }"
          monacoEditorMarkerValidator
        ></c8y-editor>
      </div>
    </div>

    <ng-template #radialGaugePreview>
      <div
        *ngIf="
          this.formGroup.value.datapointsGauge.length > 0 && activeDatapointGauge;
          else emptyState
        "
      >
        <!-- Radial Gauge -->
        <c8y-radial-gauge
          class="c8y-radial-gauge"
          *ngIf="activeDatapointGauge | infoGaugeCurrentMeasurement | async as measurement"
          [activeDatapointGauge]="activeDatapointGauge"
          [measurement]="measurement"
          [fractionSize]="formGroup.value.fractionSize"
          [gaugeOptions]="gaugeOptions"
          [selectedPresetId]="formGroup.value.gaugePresetId"
        ></c8y-radial-gauge>
      </div>
      <ng-template #emptyState>
        <div class="col-md-6 d-col a-i-start j-c-center">
          <c8y-ui-empty-state
            [icon]="'c8y-data-points'"
            [title]="'Please select a data point first.' | translate"
            [horizontal]="false"
          ></c8y-ui-empty-state>
        </div>
      </ng-template>
    </ng-template>
  </ng-template>
</form>

results matching ""

    No results matching ""