repository/shared/software-type/software-type.component.ts
selector | c8y-software-type |
templateUrl | software-type.component.html |
Properties |
Methods |
Inputs |
Outputs |
constructor(repositoryService: RepositoryService, changeDetectorRef: ChangeDetectorRef, translateService: TranslateService)
|
||||||||||||
Parameters :
|
allowFreeEntries |
Type : boolean
|
Default value : true
|
clearSelectionOptionLabel |
Type : string
|
Default value : gettext('All software types')
|
disabled |
Type : boolean
|
emitResultsOnly |
Type : boolean
|
Default value : false
|
placeholder |
Type : string
|
Default value : this.translateService.instant(gettext('e.g. {{ example }}'), {
example: 'yum'
})
|
required |
Type : boolean
|
Default value : true
|
showBtnInNotFoundMessage |
Type : boolean
|
Default value : true
|
showClearSelectionOption |
Type : boolean
|
Default value : false
|
softwareTypeMO |
Type : IManagedObject
|
style |
Type : any
|
onSelectSoftware |
Type : EventEmitter<IManagedObject>
|
clearSoftware |
clearSoftware()
|
Returns :
void
|
getSoftwareByTypeResult | ||||||
getSoftwareByTypeResult(searchString: string)
|
||||||
Parameters :
Returns :
any
|
ngOnInit |
ngOnInit()
|
Returns :
void
|
resetInput |
resetInput()
|
Returns :
void
|
selectSoftware | ||||
selectSoftware(software)
|
||||
Parameters :
Returns :
void
|
Public changeDetectorRef |
Type : ChangeDetectorRef
|
deviceSoftwareTypeModel |
Type : TypeaheadComponent
|
Decorators :
@ViewChild('deviceSoftwareTypeModel')
|
filterPipe |
Type : UnaryFunction< | >
|
Default value : pipe(tap())
|
notFoundTemplateToUse |
Type : TemplateRef<>
|
notFoundTypeAddNewTemplate |
Type : TemplateRef<>
|
Decorators :
@ViewChild('notFoundTypeAddNewTemplate', {static: true})
|
notFoundTypeTemplate |
Type : TemplateRef<>
|
Decorators :
@ViewChild('notFoundTypeTemplate', {static: true})
|
search$ |
Type : BehaviorSubject<string>
|
Default value : new BehaviorSubject(null)
|
softwaresResult |
Type : IResultList<IManagedObject>
|
softwaresResult$ |
Type : Observable<IResultList<IManagedObject>>
|
<c8y-typeahead
[(ngModel)]="softwareTypeMO"
[required]="required"
[disabled]="disabled"
name="softwareType"
[placeholder]="placeholder"
[allowFreeEntries]="allowFreeEntries"
#deviceSoftwareTypeModel
(onSearch)="search$.next($event)"
displayProperty="softwareType"
[ngStyle]="style"
>
<c8y-li
*ngIf="showClearSelectionOption"
class="p-l-8 p-r-8 c8y-list__item--link"
(click)="clearSoftware()"
[active]="!softwareTypeMO?.softwareType"
>
<span>{{ clearSelectionOptionLabel | translate }}</span>
</c8y-li>
<c8y-li
*c8yFor="
let software of softwaresResult$;
pipe: filterPipe;
loadMore: 'auto';
notFound: notFoundTemplateToUse
"
class="p-l-8 p-r-8 c8y-list__item--link"
(click)="selectSoftware(software)"
[active]="softwareTypeMO?.softwareType === software.softwareType"
>
<c8y-highlight
[text]="software.softwareType || '--'"
[pattern]="search$ | async"
></c8y-highlight>
</c8y-li>
<ng-template #notFoundTypeAddNewTemplate>
<c8y-li class="bg-gray-lighter p-8" *ngIf="(search$ | async)?.length > 0">
<span translate>No match found.</span>
<button
title="{{ 'Add new`software type`' | translate }}"
type="button"
class="btn btn-primary btn-xs m-l-8"
translate
>
Add new`software type`
</button>
</c8y-li>
</ng-template>
<ng-template #notFoundTypeTemplate>
<c8y-li
class="bg-gray-lighter p-8"
*ngIf="(search$ | async)?.length > 0 && (softwaresResult$ | async)?.data?.length === 0"
>
<span translate>No match found. Refine your search terms or check your spelling.</span>
</c8y-li>
</ng-template>
</c8y-typeahead>