File

ecosystem/shared/package-version-select/package-version-select.component.ts

Implements

OnChanges ControlValueAccessor

Metadata

Index

Properties
Methods
Inputs

Constructor

constructor(applicationService: ApplicationService, pluginsService: PluginsService)
Parameters :
Name Type Optional
applicationService ApplicationService No
pluginsService PluginsService No

Inputs

label
Type : any
Default value : gettext('Use plugin version')
packageContextPath
Type : string
packageId
Type : string | number

Methods

Async getPackageVersions
getPackageVersions(packageId: string | number)
Parameters :
Name Type Optional
packageId string | number No
Returns : Promise<IResultList<IApplicationVersion>>
ngOnChanges
ngOnChanges(changes: SimpleChanges)
Parameters :
Name Type Optional
changes SimpleChanges No
Returns : void
onVersionSelect
onVersionSelect(version: IApplicationVersion)
Parameters :
Name Type Optional
version IApplicationVersion No
Returns : void
registerOnChange
registerOnChange(fn: any)
Parameters :
Name Type Optional
fn any No
Returns : void
registerOnTouched
registerOnTouched(fn: any)
Parameters :
Name Type Optional
fn any No
Returns : void
Optional setDisabledState
setDisabledState(isDisabled: boolean)
Parameters :
Name Type Optional
isDisabled boolean No
Returns : void
writeValue
writeValue(obj: any)
Parameters :
Name Type Optional
obj any No
Returns : void

Properties

isDisabled
Default value : false
onInput$
Type : BehaviorSubject<string>
Default value : new BehaviorSubject<string>('')
selectedVersion
Type : IApplicationVersion
versions$
Type : Observable<IResultList<IApplicationVersion>>
<label for="packageVersion">{{ label | translate }}</label>
<c8y-form-group>
  <c8y-typeahead
    [(ngModel)]="selectedVersion"
    name="packageVersion"
    (onSearch)="onInput$.next($event)"
    placeholder="{{ 'Select below or start typing' | translate }}"
    [displayProperty]="'version'"
    [required]="true"
    [disabled]="isDisabled"
    [hideNew]="true"
    [container]="'body'"
  >
    <c8y-li
      *c8yFor="let appVersion of versions$; loadMore: 'auto'; notFound: notFoundTemplate"
      (click)="onVersionSelect(appVersion)"
      class="p-l-8 p-r-8 c8y-list__item--link"
      [active]="selectedVersion === appVersion"
    >
      <c8y-li-icon icon="big-parcel"></c8y-li-icon>
      <span
        [ngStyle]="{
          display: 'flex',
          'flex-direction': 'row',
          'align-content': 'center',
          'justify-content': 'space-between',
          'align-items': 'center'
        }"
      >
        <c8y-highlight
          [text]="appVersion.version || '--'"
          [pattern]="onInput$ | async"
        ></c8y-highlight>
        <span>
          <span *ngFor="let tag of appVersion.tags" class="label label-info m-l-4">
            {{ tag }}
          </span>
        </span>
      </span>
    </c8y-li>
    <ng-template #notFoundTemplate>
      <c8y-li
        class="bg-gray-lighter p-8"
        *ngIf="(onInput$ | async)?.length > 0 && (versions$ | async)?.data?.length === 0"
      >
        <span translate>No match found.</span>
      </c8y-li>
    </ng-template>
  </c8y-typeahead>
</c8y-form-group>

results matching ""

    No results matching ""