Device profile provision X509 Certificate Chain added dynamic readMore for hint; updated text in hint

This commit is contained in:
deaflynx 2023-03-22 17:31:19 +02:00
parent d3803f828d
commit 86423fdc7b
3 changed files with 13 additions and 7 deletions

View File

@ -27,13 +27,13 @@
{{ 'device-profile.provision-strategy-required' | translate }}
</mat-error>
</mat-form-field>
<section *ngIf="(provisionConfigurationFormGroup.get('type').value !== deviceProvisionType.DISABLED) &&
(provisionConfigurationFormGroup.get('type').value !== deviceProvisionType.X509_CERTIFICATE_CHAIN)"
<section *ngIf="provisionConfigurationFormGroup.get('type').value !== deviceProvisionType.DISABLED &&
provisionConfigurationFormGroup.get('type').value !== deviceProvisionType.X509_CERTIFICATE_CHAIN"
fxLayoutGap.gt-xs="8px" fxLayout="row" fxLayout.xs="column">
<mat-form-field fxFlex class="mat-block">
<mat-label translate>device-profile.provision-device-key</mat-label>
<input matInput formControlName="provisionDeviceKey" required/>
<<button mat-button matSuffix mat-icon-button
<button mat-button matSuffix mat-icon-button
ngxClipboard
[cbContent]="provisionConfigurationFormGroup.get('provisionDeviceKey').value"
(cbOnSuccess)="onProvisionCopied(true)"
@ -62,7 +62,10 @@
</mat-form-field>
</section>
<section *ngIf="provisionConfigurationFormGroup.get('type').value === deviceProvisionType.X509_CERTIFICATE_CHAIN">
<div class="tb-hint" [innerHTML]="'device-profile.provision-strategy-x509.hint-certificate-chain' | translate"></div>
<div class="tb-hint">
<span [innerHTML]="readMore ? ('device-profile.provision-strategy-x509.hint-certificate-chain' | translate) : ('device-profile.provision-strategy-x509.hint-certificate-chain' | translate | truncate:true:355:&apos;...&apos;)"></span>
<a (click)="readMore=!readMore">{{ readMore ? ('&nbsp;' + ('action.less' | translate)) : ('action.more' | translate) }}</a>
</div>
<mat-slide-toggle formControlName="allowCreateNewDevicesByX509Certificate">
{{ 'device-profile.provision-strategy-x509.allow-create-new-devices' | translate }}
</mat-slide-toggle>

View File

@ -62,6 +62,7 @@ export class DeviceProfileProvisionConfigurationComponent implements ControlValu
deviceProvisionType = DeviceProvisionType;
deviceProvisionTypes = Object.keys(DeviceProvisionType);
deviceProvisionTypeTranslateMap = deviceProvisionTypeTranslationMap;
readMore: boolean;
private requiredValue: boolean;
get required(): boolean {

View File

@ -61,7 +61,9 @@
"done": "Done",
"print": "Print",
"restore": "Restore",
"confirm": "Confirm"
"confirm": "Confirm",
"more": "More",
"less": "Less"
},
"aggregation": {
"aggregation": "Aggregation",
@ -1497,7 +1499,7 @@
"provision-secret-copied-message": "Provision secret has been copied to clipboard",
"provision-strategy-x509": {
"certificate-chain": "X509 Certificates Chain",
"hint-certificate-chain": "X.509 certificates strategy is used to provision devices by client certificates in two-way TLS communication. This strategy can check for pre-provisioned devices, update X.509 device credentials, or create new devices. The user uploads X.509 certificate to the device profile and sets a regular expression to fetch the device name from Common Name (CN)... <a href='' target='_blank'>More</a>",
"hint-certificate-chain": "X.509 certificates strategy is used to provision devices by client certificates in two-way TLS communication. This strategy can check for pre-provisioned devices, update X.509 device credentials, or create new devices. The user uploads X.509 certificate to the device profile and sets a regular expression to fetch the device name from Common Name (CN).<br><br>Client certificates must be signed by X.509 certificate, pre-uploaded for this device profile to provision devices by the strategy. The client must establish a TLS connection using the entire chain of certificates (this chain must include device profile X.509 certificate on the last level). If a device already exists with outdated X.509 credentials, this strategy automatically updates it with the device certificate's credentials from the chain. <br><br><b>Important:</b> Uploaded certificates should be neither root nor intermediate certificates that are provided by a well-known Certificate Authority (CA).",
"allow-create-new-devices": "Create new devices",
"hint-allow-create-new-devices": "Hint: if selected new devices will be created with correct device credentials from client certificate.",
"certificate-value": "Certificate in PEM format",
@ -1505,7 +1507,7 @@
"cn-regex-variable": "CN Regular Expression variable",
"cn-regex-variable-required": "CN Regular Expression variable is required",
"hint-cn-regex-variable": "Required to fetch device name from device's X509 certificate's common name.",
"regex-examples": "<b>Examples of RegEx usage:</b><ol><li><b>Pattern:</b> <code>.*</code> - matches any character (until line terminators)<br><b>CN sample:</b> <code>DeviceName\\nAdditionalInfo</code><br><b>Pattern matches:</b> <code>DeviceName</code> OR <code>DeviceName\\nAdditionalInfo</code><br><br></li><li><b>Pattern:</b> <code>^([^@]+)</code> - matches any string that starts with one or more characters that are not the <code>@</code> symbol (<code>@</code> could be replaced by any other symbol)<br><b>CN sample:</b> <code>DeviceName@AdditionalInfo</code><br><b>Pattern matches:</b> <code>DeviceName</code><br><br></li><li><b>Pattern:</b> <code>[\\w]*$</code> (equivalent to <code>[a-zA-Z0-9_]*$</code>) - matches zero or more occurences of any word character (letter, digit or underscore) at the end of the string<br><b>CN sample:</b> <code>AdditionalInfo2110#DeviceName_01</code><br><b>Pattern matches:</b> <code>DeviceNane_01</code></li></ol><b>Note:</b> Client will get error response in case regex is failed to match."
"regex-examples": "<b>Examples of RegEx usage:</b><ol><li><b>Pattern:</b> <code>.*</code> - matches any character (until line terminators)<br><b>CN sample:</b> <code>DeviceName\\nAdditionalInfo</code><br><b>Pattern matches:</b> <code>DeviceName</code><br><br></li><li><b>Pattern:</b> <code>^([^@]+)</code> - matches any string that starts with one or more characters that are not the <code>@</code> symbol (<code>@</code> could be replaced by any other symbol)<br><b>CN sample:</b> <code>DeviceName@AdditionalInfo</code><br><b>Pattern matches:</b> <code>DeviceName</code><br><br></li><li><b>Pattern:</b> <code>[\\w]*$</code> (equivalent to <code>[a-zA-Z0-9_]*$</code>) - matches zero or more occurences of any word character (letter, digit or underscore) at the end of the string<br><b>CN sample:</b> <code>AdditionalInfo2110#DeviceName_01</code><br><b>Pattern matches:</b> <code>DeviceName_01</code></li></ol><b>Note:</b> Client will get error response in case regex is failed to match."
},
"condition": "Condition",
"condition-type": "Condition type",