File

repository/software/device-tab/installed-software.component.ts

Implements

OnDestroy OnInit

Metadata

Index

Properties
Methods
Inputs
Outputs

Constructor

constructor(repository: RepositoryService, bsModal: BsModalService)
Parameters :
Name Type Optional
repository RepositoryService No
bsModal BsModalService No

Inputs

device
Type : IManagedObject
deviceSoftwareChanges
Type : DeviceSoftwareChange[]
deviceSoftwareChangesInProgress
Type : boolean
softwareList
Type : DeviceSoftware[]
typesQuery
Type : object

Outputs

changes
Type : EventEmitter
showSoftwareChanges
Type : EventEmitter

Methods

attachVersions
attachVersions(softwareList: IManagedObject[])
Parameters :
Name Type Optional
softwareList IManagedObject[] No
Returns : {}
displaySoftwareSelectModal
displaySoftwareSelectModal(initialStateOverrides)
Parameters :
Name Optional
initialStateOverrides No
Returns : { resultEmitter: any; choiceEmitter: any; updateInstallableList$: any; }
emitSoftwareInstall
emitSoftwareInstall(items: DeviceSoftware[])
Parameters :
Name Type Optional
items DeviceSoftware[] No
Returns : void
emitSoftwareRemoval
emitSoftwareRemoval(items: DeviceSoftware[])
Parameters :
Name Type Optional
items DeviceSoftware[] No
Returns : void
getInstallableSoftwareListWithVersions$
getInstallableSoftwareListWithVersions$(searchTerm$: BehaviorSubject)
Parameters :
Name Type Optional
searchTerm$ BehaviorSubject<FilterCriteria> No
Returns : any
getSingleSoftwareWithVersions$
getSingleSoftwareWithVersions$(software: DeviceSoftware)
Parameters :
Name Type Optional
software DeviceSoftware No
Returns : any
installSoftware
installSoftware()
Returns : void
ngOnDestroy
ngOnDestroy()
Returns : void
ngOnInit
ngOnInit()
Returns : void
removeSoftware
removeSoftware(softwareToRemove)
Parameters :
Name Optional
softwareToRemove No
Returns : void
search
search(filterCriteria: FilterCriteria)
Parameters :
Name Type Optional
filterCriteria FilterCriteria No
Returns : void
updateSoftware
updateSoftware(softwareToUpdate)
Parameters :
Name Optional
softwareToUpdate No
Returns : void

Properties

alreadyInstalledMessage
Default value : gettext( '{{ name }} (v. {{ version }}) is already installed on this device' )
alreadyInstalledWarningTemplate
Type : TemplateRef<any>
Decorators :
@ViewChild('alreadyInstalledWarning', {static: true})
filterCriteria$
Type : Observable<FilterCriteria>
loadingTemplate
Type : TemplateRef<any>
Decorators :
@ViewChild('loading', {static: true})
PRODUCT_EXPERIENCE
Default value : PRODUCT_EXPERIENCE_REPOSITORY_SHARED
showFilter
Default value : false
softwareTypeFilter$
Type : BehaviorSubject<string>
Default value : new BehaviorSubject('')
softwareTypeTemplate
Type : TemplateRef<any>
Decorators :
@ViewChild('softwareType', {static: true})
supportsSoftwareOperations
Default value : false
textFilter$
Type : BehaviorSubject<string>
Default value : new BehaviorSubject('')
<div class="d-flex d-col flex-grow">
  <div class="card-header large-padding separator sticky-top">
    <div
      class="card-title"
      translate
    >
      Installed software
    </div>
  </div>
  <div class="flex-grow">
    <fieldset
      class="card-block large-padding overflow-visible separator-bottom"
      *ngIf="showFilter"
    >
      <div class="row">
        <div class="col-xs-6">
          <div class="input-group input-group-search">
            <label
              class="sr-only"
              for="filter"
            >
              {{ 'Filter…' | translate }}
            </label>
            <input
              class="form-control"
              title="{{ 'Filter…' | translate }}"
              id="filter"
              placeholder="{{ 'Filter…' | translate }}"
              type="search"
              [ngModel]="textFilter$ | async"
              (ngModelChange)="textFilter$.next($event)"
            />
            <span class="input-group-addon">
              <i
                c8yIcon="search"
                *ngIf="(textFilter$ | async).length === 0"
              ></i>
              <i
                class="text-muted"
                c8yIcon="times"
                *ngIf="(textFilter$ | async).length > 0"
                (click)="textFilter$.next('')"
              ></i>
            </span>
            <span
              class="sr-only"
              for="search"
              translate
            >
              Filter…
            </span>
          </div>
        </div>
        <div class="col-xs-6">
          <c8y-software-type
            [required]="false"
            [emitResultsOnly]="true"
            [showBtnInNotFoundMessage]="false"
            [allowFreeEntries]="false"
            [placeholder]="'Filter by software type…' | translate"
            [showClearSelectionOption]="true"
            [presetSoftwareTypes]="device.c8y_SupportedSoftwareTypes"
            (onSelectSoftware)="softwareTypeFilter$.next($event?.softwareType)"
          ></c8y-software-type>
        </div>
      </div>
    </fieldset>

    <fieldset
      class="flex-grow inner-scroll"
      id="software-list"
      [disabled]="deviceSoftwareChangesInProgress"
    >
      <!-- NOT EMPTY STATE -->
      <c8y-device-software-list
        class="d-block p-l-16 p-r-16"
        container="body"
        [device]="device"
        [filterCriteria$]="filterCriteria$"
        [softwareList]="softwareList"
        [deviceSoftwareChanges]="deviceSoftwareChanges"
        (update)="updateSoftware($event)"
        (remove)="removeSoftware($event)"
        (onListEmpty)="showFilter = !$event"
      >
        <!-- EMPTY STATE -->
        <div class="c8y-empty-state text-center">
          <div class="h1 c8y-icon c8y-icon-tools c8y-icon-duocolor"></div>
          <p>
            <strong translate>No software installed.</strong>
            <br />
            <small translate>Click below to install software into this device.</small>
          </p>
        </div>
        <!-- NO SEARCH RESULTS STATE -->
        <div class="c8y-empty-state c8y-no-results-state text-center">
          <div class="h1 c8y-icon c8y-icon-tools c8y-icon-duocolor"></div>
          <p>
            <strong translate>No software matches your filter criteria.</strong>
            <br />
            <small translate>Try changing your search criteria.</small>
          </p>
        </div>
      </c8y-device-software-list>
    </fieldset>
  </div>
  <!-- INSTALL SOFTWARE-->
  <div
    class="card-footer large-padding separator sticky-bottom d-flex j-c-between bg-level-0"
    [ngClass]="{ 'visible-sm visible-xs': !supportsSoftwareOperations }"
  >
    <button
      class="btn btn-default"
      title="{{ 'Install software' | translate }}"
      *ngIf="supportsSoftwareOperations"
      (click)="installSoftware()"
      [disabled]="deviceSoftwareChangesInProgress"
      c8yProductExperience
      [actionName]="PRODUCT_EXPERIENCE.SOFTWARE.EVENTS.DEVICE_TAB"
      [actionData]="{
        component: PRODUCT_EXPERIENCE.SOFTWARE.COMPONENTS.DEVICE_SOFTWARE_LIST,
        action: PRODUCT_EXPERIENCE.SOFTWARE.ACTIONS.OPEN_INSTALL_SOFTWARE
      }"
    >
      <i c8yIcon="plus-circle"></i>
      {{ 'Install software' | translate }}
    </button>
    <button
      class="btn btn-clean text-primary visible-sm visible-xs"
      [title]="'Show &quot;Software changes&quot;' | translate"
      (click)="showSoftwareChanges.emit()"
    >
      <span translate>Show "Software changes"</span>
      <i c8yIcon="chevron-right"></i>
    </button>
  </div>
</div>

<ng-template
  #alreadyInstalledWarning
  let-item
  let-option="option"
>
  <i
    class="text-warning a-s-center"
    c8yIcon="warning"
    [tooltip]="
      alreadyInstalledMessage
        | translate: { name: item.body[0].value, version: option.body[0].value }
    "
  ></i>
</ng-template>

<ng-template #loading>
  <div class="p-relative d-flex m-l-auto">
    <i
      class="icon-spin"
      c8yIcon="circle-o-notch"
    ></i>
  </div>
</ng-template>

<ng-template #softwareType>
  <c8y-software-type
    additionalFilter
    [required]="false"
    [placeholder]="'Filter by software type…' | translate"
    (onSelectSoftware)="search({ softwareType: $event?.softwareType })"
    [emitResultsOnly]="true"
    [showBtnInNotFoundMessage]="false"
    [allowFreeEntries]="false"
    [showClearSelectionOption]="true"
    [presetSoftwareTypes]="device.c8y_SupportedSoftwareTypes"
  ></c8y-software-type>
</ng-template>

results matching ""

    No results matching ""