snmp-device-transport-configuration.component.html
7.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<!--
Copyright © 2016-2024 The Thingsboard Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<form [formGroup]="snmpDeviceTransportConfigurationFormGroup" style="padding-bottom: 16px;" fxLayoutGap="8px" fxLayout="column">
<div fxLayout="row" fxLayoutGap="8px" fxLayout.xs="column">
<mat-form-field fxFlex>
<mat-label translate>device-profile.snmp.host</mat-label>
<input matInput formControlName="host" required>
<mat-error *ngIf="snmpDeviceTransportConfigurationFormGroup.get('host').hasError('required') ||
snmpDeviceTransportConfigurationFormGroup.get('host').hasError('pattern')">
{{ 'device-profile.snmp.host-required' | translate }}
</mat-error>
</mat-form-field>
<mat-form-field fxFlex>
<mat-label translate>device-profile.snmp.port</mat-label>
<input matInput formControlName="port" type="number" min="0" required>
<mat-error *ngIf="snmpDeviceTransportConfigurationFormGroup.get('port').hasError('required')">
{{ 'device-profile.snmp.port-required' | translate }}
</mat-error>
<mat-error *ngIf="snmpDeviceTransportConfigurationFormGroup.get('port').hasError('pattern') ||
snmpDeviceTransportConfigurationFormGroup.get('port').hasError('min')">
{{ 'device-profile.snmp.port-format' | translate }}
</mat-error>
</mat-form-field>
</div>
<mat-form-field class="mat-block" floatLabel="always" hideRequiredMarker>
<mat-label translate>device-profile.snmp.protocol-version</mat-label>
<mat-select formControlName="protocolVersion" required>
<mat-option *ngFor="let snmpDeviceProtocolVersion of snmpDeviceProtocolVersions" [value]="snmpDeviceProtocolVersion">
{{ snmpDeviceProtocolVersion | lowercase }}
</mat-option>
</mat-select>
<mat-error *ngIf="snmpDeviceTransportConfigurationFormGroup.get('protocolVersion').hasError('required')">
{{ 'device-profile.snmp.protocol-version-required' | translate }}
</mat-error>
</mat-form-field>
<section *ngIf="!isV3protocolVersion()">
<mat-form-field class="mat-block">
<mat-label translate>device-profile.snmp.community</mat-label>
<input matInput formControlName="community" required>
<mat-error *ngIf="snmpDeviceTransportConfigurationFormGroup.get('community').hasError('required') ||
snmpDeviceTransportConfigurationFormGroup.get('community').hasError('pattern')">
{{ 'device-profile.snmp.community-required' | translate }}
</mat-error>
</mat-form-field>
</section>
<section *ngIf="isV3protocolVersion()">
<div fxLayout="row" fxLayoutGap="8px" fxLayout.xs="column">
<mat-form-field fxFlex>
<mat-label translate>device-profile.snmp.user-name</mat-label>
<input matInput formControlName="username" required>
<mat-error *ngIf="snmpDeviceTransportConfigurationFormGroup.get('username').hasError('required') ||
snmpDeviceTransportConfigurationFormGroup.get('username').hasError('pattern')">
{{ 'device-profile.snmp.user-name-required' | translate }}
</mat-error>
</mat-form-field>
<mat-form-field fxFlex>
<mat-label translate>device-profile.snmp.security-name</mat-label>
<input matInput formControlName="securityName" required>
<mat-error *ngIf="snmpDeviceTransportConfigurationFormGroup.get('securityName').hasError('required') ||
snmpDeviceTransportConfigurationFormGroup.get('securityName').hasError('pattern')">
{{ 'device-profile.snmp.security-name-required' | translate }}
</mat-error>
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutGap="8px" fxLayout.xs="column">
<mat-form-field fxFlex floatLabel="always" hideRequiredMarker>
<mat-label translate>device-profile.snmp.authentication-protocol</mat-label>
<mat-select formControlName="authenticationProtocol" required>
<mat-option *ngFor="let snmpAuthenticationProtocol of snmpAuthenticationProtocols" [value]="snmpAuthenticationProtocol">
{{ snmpAuthenticationProtocolTranslation.get(snmpAuthenticationProtocol) }}
</mat-option>
</mat-select>
<mat-error *ngIf="snmpDeviceTransportConfigurationFormGroup.get('authenticationProtocol').hasError('required')">
{{ 'device-profile.snmp.authentication-protocol-required' | translate }}
</mat-error>
</mat-form-field>
<mat-form-field fxFlex>
<mat-label translate>device-profile.snmp.authentication-passphrase</mat-label>
<input matInput formControlName="authenticationPassphrase" required>
<mat-error *ngIf="snmpDeviceTransportConfigurationFormGroup.get('authenticationPassphrase').hasError('required') ||
snmpDeviceTransportConfigurationFormGroup.get('authenticationPassphrase').hasError('pattern')">
{{ 'device-profile.snmp.authentication-passphrase-required' | translate }}
</mat-error>
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutGap="8px" fxLayout.xs="column">
<mat-form-field fxFlex floatLabel="always" hideRequiredMarker>
<mat-label translate>device-profile.snmp.privacy-protocol</mat-label>
<mat-select formControlName="privacyProtocol" required>
<mat-option *ngFor="let snmpPrivacyProtocol of snmpPrivacyProtocols" [value]="snmpPrivacyProtocol">
{{ snmpPrivacyProtocolTranslation.get(snmpPrivacyProtocol) }}
</mat-option>
</mat-select>
<mat-error *ngIf="snmpDeviceTransportConfigurationFormGroup.get('privacyProtocol').hasError('required')">
{{ 'device-profile.snmp.privacy-protocol-required' | translate }}
</mat-error>
</mat-form-field>
<mat-form-field fxFlex>
<mat-label translate>device-profile.snmp.privacy-passphrase</mat-label>
<input matInput formControlName="privacyPassphrase" required>
<mat-error *ngIf="snmpDeviceTransportConfigurationFormGroup.get('privacyPassphrase').hasError('required') ||
snmpDeviceTransportConfigurationFormGroup.get('privacyPassphrase').hasError('pattern')">
{{ 'device-profile.snmp.privacy-passphrase-required' | translate }}
</mat-error>
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutGap="8px" fxLayout.xs="column">
<mat-form-field fxFlex>
<mat-label translate>device-profile.snmp.context-name</mat-label>
<input matInput formControlName="contextName">
</mat-form-field>
<mat-form-field fxFlex>
<mat-label translate>device-profile.snmp.engine-id</mat-label>
<input matInput formControlName="engineId">
</mat-form-field>
</div>
</section>
</form>