File
Constructor
constructor(modal: BsModalRef, trustedCertificateService: TrustedCertificateService, alertService: AlertService)
|
Parameters :
Name |
Type |
Optional |
modal |
BsModalRef
|
No
|
trustedCertificateService |
TrustedCertificateService
|
No
|
alertService |
AlertService
|
No
|
|
AUTO_REGISTRATION_POPOVER
|
Default value : gettext('All devices with credentials signed by this certificate will be able to communicate with the platform without a prior registration.')
|
fileIsUploaded
|
Default value : false
|
maxAllowedFiles
|
Type : number
|
Default value : 1
|
result
|
Type : Promise<any>
|
Default value : new Promise((resolve, reject) => {
this._save = resolve;
this._cancel = reject;
})
|
trustedCertificate
|
Type : Partial<ITrustedCertificate>
|
Default value : {
status: 'DISABLED'
}
|
<div class="viewport-modal">
<div class="modal-header dialog-header">
<i c8yIcon="certificate"></i>
<h4 translate>Add trusted certificate</h4>
</div>
<div class="modal-inner-scroll">
<div class="modal-body">
<form #addTrustedCertificateForm="ngForm">
<c8y-form-group>
<label translate for="certificateName">Certificate name</label>
<input
id="certificateName"
type="text"
class="form-control"
autocomplete="off"
name="certificateName"
[(ngModel)]="trustedCertificate.name"
placeholder="{{ 'e.g. My certificate' | translate }}"
required
/>
</c8y-form-group>
<c8y-form-group>
<label translate for="certificate">Certificate</label>
<c8y-drop-area
class="drop-area-sm"
(dropped)="uploadFile($event)"
[loadingMessage]="'Importing, please wait.' | translate"
[title]="'Paste the certificate in PEM format.' | translate"
[maxAllowedFiles]="maxAllowedFiles"
>
</c8y-drop-area>
</c8y-form-group>
<c8y-form-group>
<label title="{{ 'Auto registration' | translate }}" class="c8y-checkbox">
<input
id="autoRegistration"
type="checkbox"
name="autoRegistration"
[(ngModel)]="trustedCertificate.autoRegistrationEnabled"
/><span></span>
<span>{{ 'Auto registration' | translate }}</span>
<button
class="btn btn-clean"
popover="{{ AUTO_REGISTRATION_POPOVER | translate }}"
triggers="focus"
>
<i [c8yIcon]="'question-circle-o'"></i>
</button>
</label>
</c8y-form-group>
<button
type="button"
class="btn"
name="certificateStatus"
[(ngModel)]="trustedCertificate.status"
btnCheckbox
btnCheckboxTrue="ENABLED"
btnCheckboxFalse="DISABLED"
>
<span
title="{{ 'Disabled`trusted certificate status`' | translate }}"
[hidden]="trustedCertificate.status !== 'DISABLED'"
>
{{ 'Disabled`trusted certificate status`' | translate }}
</span>
<span
title="{{ 'Enabled`trusted certificate status`' | translate }}"
[hidden]="trustedCertificate.status !== 'ENABLED'"
>
{{ 'Enabled`trusted certificate status`' | translate }}
</span>
</button>
</form>
</div>
</div>
<div class="modal-footer">
<button title="{{ 'Cancel' | translate }}" class="btn btn-default" (click)="close()">
{{ 'Cancel' | translate }}
</button>
<button
title="{{ 'Add certificate' | translate }}"
class="btn btn-primary"
(click)="save()"
[disabled]="
addTrustedCertificateForm.form.invalid ||
addTrustedCertificateForm.form.pristine ||
!fileIsUploaded
"
>
{{ 'Add certificate' | translate }}
</button>
</div>
</div>