repository/configuration/list/configuration-detail.component.ts
selector | c8y-configuration-detail |
templateUrl | ./configuration-detail.component.html |
Properties |
Methods |
constructor(repositoryService: RepositoryService, bsModalRef: BsModalRef, alert: AlertService)
|
||||||||||||
Parameters :
|
cancel |
cancel()
|
Returns :
void
|
Async ngOnInit |
ngOnInit()
|
Returns :
any
|
onFile | ||||||
onFile(dropped: PickedFiles)
|
||||||
Parameters :
Returns :
void
|
Async save |
save()
|
Returns :
any
|
setPipe | ||||||
setPipe(filterStr: string)
|
||||||
Parameters :
Returns :
void
|
binary |
Type : literal type
|
Default value : {
file: undefined,
url: undefined
}
|
configs |
configurationForm |
Type : NgForm
|
Decorators :
@ViewChild('configurationForm', {static: true})
|
description |
Type : string
|
deviceType |
Type : string
|
existingBinary |
Type : File
|
filterPipe |
mo |
Type : Partial<IManagedObject>
|
Default value : {}
|
pattern |
Type : string
|
Default value : ''
|
result |
Type : Promise<void>
|
Default value : new Promise((resolve, reject) => {
this._save = resolve;
this._cancel = reject;
})
|
saving |
Default value : false
|
selected |
Type : literal type
|
submitButtonTitle |
Type : string
|
textForConfigurationUrlPopover |
Type : string
|
Default value : gettext(`Path for binaries can vary depending on device agent implementation, for example:
/configuration/binaries/configuration1.bin
https://configuration/binary/123
ftp://configuration/binary/123.tar.gz
Configurations with external URLs only work with the configuration typed devices, not with legacy ones.
`)
|
uploadChoice |
Type : "uploadBinary" | "uploadUrl"
|
Default value : 'uploadBinary'
|
version |
Type : string
|
<div class="viewport-modal">
<div class="modal-header dialog-header">
<i [c8yIcon]="'cogs'"></i>
<h4 translate *ngIf="mo.id">Update configuration</h4>
<h4 translate *ngIf="!mo.id">Add configuration</h4>
</div>
<form
class="d-contents"
#configurationForm="ngForm"
(ngSubmit)="configurationForm.form.valid && save()"
>
<div class="modal-inner-scroll">
<div class="modal-body">
<c8y-form-group>
<label translate>Name</label>
<input
type="text"
class="form-control"
placeholder="{{ 'e.g.' | translate }} hosts"
autocomplete="off"
required
maxlength="254"
[(ngModel)]="version"
name="version"
/>
</c8y-form-group>
<c8y-form-group>
<label translate>Device type</label>
<input
type="text"
class="form-control"
placeholder="{{ 'e.g.' | translate }} c8y_Linux"
maxlength="254"
autocomplete="off"
[(ngModel)]="deviceType"
name="deviceType"
/>
</c8y-form-group>
<c8y-form-group>
<label translate>Description</label>
<input
type="text"
class="form-control"
placeholder="{{ 'e.g. Host configuration' | translate }} c8y_Linux"
maxlength="254"
autocomplete="off"
[(ngModel)]="description"
name="description"
/>
</c8y-form-group>
<c8y-form-group>
<label translate>Configuration type</label>
<c8y-typeahead
[(ngModel)]="selected"
name="confType"
placeholder="{{ 'e.g.' | translate }} ssh"
maxlength="254"
(onSearch)="setPipe($event)"
displayProperty="configurationType"
>
<c8y-li
*c8yFor="let config of configs; pipe: filterPipe; notFound: notFoundTemplate"
class="p-l-8 p-r-8 c8y-list__item--link"
(click)="selected = config; setPipe('')"
[active]="selected === config"
>
<c8y-highlight
[text]="config.configurationType || '--'"
[pattern]="pattern"
></c8y-highlight>
</c8y-li>
<ng-template #notFoundTemplate>
<c8y-li class="bg-gray-lighter p-8" *ngIf="pattern.length > 0">
<span translate>No match found.</span>
<button
title="{{ 'Add new`configuration type`' | translate }}"
type="button"
class="btn btn-primary btn-xs m-l-8"
translate
>
Add new`configuration type`
</button>
</c8y-li>
</ng-template>
</c8y-typeahead>
</c8y-form-group>
<c8y-form-group>
<div class="legend form-block m-t-40" translate>Configuration file</div>
<c8y-file-picker
[maxAllowedFiles]="1"
(onFilesPicked)="onFile($event)"
[uploadChoice]="uploadChoice"
[fileUrl]="binary.url"
[fileBinary]="binary.file"
[fileUrlPopover]="textForConfigurationUrlPopover"
>
</c8y-file-picker>
</c8y-form-group>
</div>
</div>
<div class="modal-footer">
<button
(click)="cancel()"
type="button"
class="btn btn-default"
title="{{ 'Cancel' | translate }}"
[disabled]="saving"
>
<span translate>Cancel</span>
</button>
<button
class="btn btn-primary"
type="submit"
title="{{ submitButtonTitle | translate }}"
[ngClass]="{ 'btn-pending': saving }"
[disabled]="
!configurationForm.valid ||
configurationForm.pristine ||
(!binary?.url && !binary?.file) ||
saving
"
>
{{ submitButtonTitle | translate }}
</button>
</div>
</form>
</div>