File

operations/stepper-bulk-type-firmware/version-or-patch.component.ts

Metadata

Index

Properties
Methods
Inputs
Outputs

Constructor

constructor(repositoryService: RepositoryService, inventoryService: InventoryService, bulkOpsService: BulkOperationsService)
Parameters :
Name Type Optional
repositoryService RepositoryService No
inventoryService InventoryService No
bulkOpsService BulkOperationsService No

Inputs

selected
Type : IManagedObject

Outputs

versionOrPatch
Type : EventEmitter<IManagedObject>

Methods

getBaseVersionAndPatches$
getBaseVersionAndPatches$(baseVersion)
Decorators :
@memoize(undefined)
Parameters :
Name Optional
baseVersion No
Returns : any
getBinaryName$
getBinaryName$(binaryUrl)
Decorators :
@memoize()
Parameters :
Name Optional
binaryUrl No
Returns : any
getPatchVersionsCount$
getPatchVersionsCount$(baseVersion: FirmwareBinary)
Decorators :
@memoize(undefined)
Parameters :
Name Type Optional
baseVersion FirmwareBinary No
Returns : any
selectVersionOrPatch
selectVersionOrPatch(selected: boolean, versionOrPatch: IManagedObject)
Parameters :
Name Type Optional
selected boolean No
versionOrPatch IManagedObject No
Returns : void

Properties

baseVersions$
Type : Observable<IResultList<IManagedObject>>
Default value : this.firmware$.pipe( distinctUntilKeyChanged('id'), switchMap(firmware => this.repositoryService.listBaseVersions(firmware)), tap(resp => { this.elementCount = resp.data ? resp.data.length : 0; }), shareReplay(1) )
DD_LOW_COUNT
Type : number
Default value : 10
elementCount
Type : number
Default value : 0
expanded
Type : literal type
Default value : {}
firmware$
Type : Observable<IManagedObject>
Default value : this.bulkOpsService.firmwareId.pipe( distinctUntilChanged(), switchMap(id => defer(() => this.inventoryService.detail(id).then(result => result.data)).pipe( catchError(error => of(error)) ) ), shareReplay(1) )
isLegacy$
Type : Observable<boolean>
Default value : this.firmware$.pipe( map(firmware => this.repositoryService.isLegacyEntry(firmware)), shareReplay(1) )
<c8y-list-group
  class="m-b-16"
  [ngClass]="{ 'dd-low': elementCount <= DD_LOW_COUNT }"
  *ngIf="(baseVersions$ | async)?.data.length > 0"
>
  <c8y-li *c8yFor="let baseVersion of baseVersions$ | async; let i = index; loadMore: 'auto'">
    <c8y-li-icon>
      <i c8yIcon="c8y-firmware"></i>
    </c8y-li-icon>

    <c8y-li-body class="content-flex-50">
      <div class="col-10">
        <p>{{ baseVersion.c8y_Firmware.version }}</p>
      </div>
      <div class="col-2">
        <span *ngIf="isLegacy$ | async" class="label label-warning">
          {{ 'Legacy' | translate }}
        </span>

        <span *ngIf="!(isLegacy$ | async)">
          <span *ngIf="(getPatchVersionsCount$(baseVersion) | async) === null">
            <span class="label label-info">
              <i c8yIcon="circle-o-notch" class="icon-spin"></i>
            </span>
          </span>

          <span *ngIf="(getPatchVersionsCount$(baseVersion) | async) !== null">
            <span [ngPlural]="getPatchVersionsCount$(baseVersion) | async">
              <ng-template ngPluralCase="=0">
                <span class="label label-default"> <span translate>No patches</span></span>
              </ng-template>
              <ng-template ngPluralCase="=1">
                <span class="label label-info">
                  <span translate>1 patch</span>
                </span>
              </ng-template>
              <ng-template ngPluralCase="other">
                <span class="label label-info">
                  <span
                    ngNonBindable
                    translate
                    [translateParams]="{ count: getPatchVersionsCount$(baseVersion) | async }"
                    >{{ count }} patches</span
                  ></span
                >
              </ng-template>
            </span>
          </span>
        </span>
      </div>
    </c8y-li-body>

    <c8y-li-collapse>
      <c8y-list-group>
        <c8y-li
          *c8yFor="
            let patchVersion of getBaseVersionAndPatches$(baseVersion) | async;
            let i = index;
            loadMore: 'auto'
          "
        >
          <c8y-li-radio
            (onSelect)="selectVersionOrPatch($event, patchVersion)"
            [selected]="patchVersion === selected"
          ></c8y-li-radio>
          <c8y-li-icon>
            <i c8yIcon="c8y-firmware"></i>
          </c8y-li-icon>
          <c8y-li-body class="content-flex-50">
            <div class="col-3">
              {{ patchVersion.c8y_Firmware.version }}
            </div>
            <div class="col-3">
              <span *ngIf="patchVersion.c8y_Patch; else version" translate class="label label-info"
                >patch</span
              >
              <ng-template #version
                ><span translate class="label label-primary">version</span></ng-template
              >
            </div>
            <div class="col-6 text-truncate">
              <span class="text-label-small m-r-4" translate>
                File
              </span>
              <span title="{{ getBinaryName$(patchVersion.c8y_Firmware.url) | async }}">
                {{ getBinaryName$(patchVersion.c8y_Firmware.url) | async }}
              </span>
            </div>
          </c8y-li-body>
        </c8y-li>
      </c8y-list-group>
    </c8y-li-collapse>
  </c8y-li>
</c8y-list-group>

results matching ""

    No results matching ""