File

repository/configuration-device-tab/configuration-preview.component.ts

Implements

OnInit OnDestroy

Metadata

selector c8y-device-configuration-preview
templateUrl ./configuration-preview.component.html

Index

Properties
Methods
Inputs
Accessors

Constructor

constructor(deviceConfigurationService: DeviceConfigurationService, realtime: Realtime, operationRealtime: OperationRealtimeService, bsModal: BsModalService, user: UserService, appState: AppStateService, repositoryService: RepositoryService, operationService: OperationService, alertService: AlertService)
Parameters :
Name Type Optional
deviceConfigurationService DeviceConfigurationService No
realtime Realtime No
operationRealtime OperationRealtimeService No
bsModal BsModalService No
user UserService No
appState AppStateService No
repositoryService RepositoryService No
operationService OperationService No
alertService AlertService No

Inputs

actionButtonIcon

Type : string

actionButtonText

Type : string

canSaveSnapshot

Type : boolean

configSnapshot

Type : ConfigurationSnapshot

configurationType

Type : string

device

Type : IManagedObject

isLegacy

Type : boolean

Default value : false

operationToTrigger

Type : DeviceConfigurationOperation.UPLOAD_CONFIG | DeviceConfigurationOperation.DOWNLOAD_CONFIG

Methods

Async createDeviceOperation
createDeviceOperation()
Returns : any
download
download()
Returns : void
hasPermission
hasPermission()
Returns : boolean
isCreateOperationDisabled
isCreateOperationDisabled()
Returns : boolean
ngOnDestroy
ngOnDestroy()
Returns : void
Async ngOnInit
ngOnInit()
Returns : any
Async saveToRepository
saveToRepository()
Returns : any
Async setOperation
setOperation(configType)
Parameters :
Name Optional
configType No
Returns : Promise<void>
showBinary
showBinary()
Returns : boolean
showOperation
showOperation()
Returns : boolean
updatePreview
updatePreview(operation: IOperation)
Parameters :
Name Type Optional
operation IOperation No
Returns : void

Properties

canCallAction
canCallAction:
Default value : true
deviceConfigurationOperation
deviceConfigurationOperation:
Default value : DeviceConfigurationOperation
operation
operation: IOperation
Type : IOperation

Accessors

configurationType
getconfigurationType()
setconfigurationType(type: string)
Parameters :
Name Type Optional
type string No
Returns : void
<div class="content-flex-55 p-b-16">
  <div class="col-7 p-t-4">
    <p>
      <span class="text-label-small text-uppercase m-r-4" translate>Configuration</span>
      <span *ngIf="configSnapshot?.name; else emptyText">
        <strong>{{ configSnapshot.name }}</strong>
      </span>
      <ng-template #emptyText> --- </ng-template>
    </p>
    <p>
      <span class="text-label-small text-uppercase m-r-4" translate>Last updated</span>
      <small *ngIf="configSnapshot?.time; else emptyDate">
        {{ configSnapshot.time | c8yDate }}
      </small>
      <ng-template #emptyDate> --- </ng-template>
    </p>
  </div>
  <div class="col-5">
    <button
      class="btn btn-default btn-sm pull-right"
      type="button"
      title="{{ actionButtonText | translate }}"
      (click)="createDeviceOperation()"
      [disabled]="isCreateOperationDisabled()"
      *ngIf="canCallAction"
    >
      <i [c8yIcon]="actionButtonIcon"></i> {{ actionButtonText | translate }}
    </button>
  </div>
</div>
<div class="c8y-empty-state text-left" *ngIf="!configSnapshot?.binary && showBinary()">
  <h1 [c8yIcon]="'file-image-o'"></h1>
  <p>
    <strong translate>No preview available.</strong><br />
    <small *ngIf="configSnapshot?.binary !== ''; else emptyFile" translate
      >The file is not available.</small
    >
    <ng-template #emptyFile>
      <small translate>The file is empty.</small>
    </ng-template>
  </p>
</div>
<div *ngIf="configSnapshot?.binary && showBinary()" class="flex-grow d-flex d-col">
  <c8y-source-code-preview
    [text]="configSnapshot.binary"
    [isDisabled]="true"
    class="d-contents"
  ></c8y-source-code-preview>
  <div *ngIf="canSaveSnapshot" class="p-t-16">
    <button
      type="button"
      class="btn btn-primary btn-sm pull-right m-l-8"
      (click)="download()"
      translate
    >
      Download
    </button>
    <button
      *ngIf="hasPermission()"
      type="button"
      class="btn btn-default btn-sm pull-right"
      (click)="saveToRepository()"
      translate
    >
      Save to repository
    </button>
  </div>
</div>
<div *ngIf="showOperation()">
  <c8y-single-operation [operation]="operation"></c8y-single-operation>
</div>

result-matching ""

    No results matching ""