summaryrefslogtreecommitdiff
path: root/chromium/ui/webui/resources/cr_components/chromeos/network/network_config.html
blob: 5902a64a6626bc62d52429a2a3da132b4b9b97a6 (plain)
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<link rel="import" href="chrome://resources/html/polymer.html">

<link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_network_icon.html">
<link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_onc_types.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-a11y-keys/iron-a11y-keys.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-toggle-button/paper-toggle-button.html">
<link rel="import" href="network_shared_css.html">
<link rel="import" href="network_config_input.html">
<link rel="import" href="network_config_select.html">

<dom-module id="network-config">
  <template>
    <style include="network-shared iron-flex">
      #error {
        color: red;
        font-weight: 500;
      }

      cr-network-icon {
        -webkit-margin-end: 10px;
      }
    </style>

    <!-- SSID (WiFi) -->
    <template is="dom-if" if="[[isType_(NetworkType_.WI_FI, type)]]">
      <network-config-input id="ssid" label="[[i18n('OncWiFi-SSID')]]"
          value="{{configProperties_.WiFi.SSID}}" disabled="[[hasGuid_(guid)]]">
      </network-config-input>
    </template>

    <!-- Security (WiFi and Ethernet) -->
    <template is="dom-if" if="[[securityIsVisible_(type)]]">
      <network-config-select id="security" label="[[i18n('OncWiFi-Security')]]"
          value="{{security_}}"
          disabled="[[!securityIsEnabled_(guid, type)]]"
          items="[[getSecurityItems_(type)]]"
          onc-prefix="WiFi.Security">
      </network-config-select>
    </template>

    <!-- Passphrase (WiFi) -->
    <template is="dom-if" if="[[configRequiresPassphrase_(type, security_)]]">
      <network-config-input label="[[i18n('OncWiFi-Passphrase')]]"
          value="{{configProperties_.WiFi.Passphrase}}" password>
        <iron-a11y-keys keys="enter" on-keys-pressed="connectIfConfigured_">
        </iron-a11y-keys>
      </network-config-input>
    </template>

    <!-- VPN -->
    <template is="dom-if" if="[[showVpn_]]">
      <network-config-input label="[[i18n('OncVPN-Host')]]"
          value="{{configProperties_.VPN.Host}}">
      </network-config-input>
      <network-config-input label="[[i18n('OncName')]]"
          value="{{configProperties_.Name}}" disabled="[[hasGuid_(guid)]]">
      </network-config-input>
      <network-config-select id="outer" label="[[i18n('OncVPN-Type')]]"
          value="{{vpnType_}}" items="[[vpnTypeItems_]]"
          onc-prefix="VPN.Type" disabled="[[hasGuid_(guid)]]">
      </network-config-select>
      <template is="dom-if" if="[[!showVpn_.OpenVPN]]">
        <network-config-input label="[[i18n('OncVPN-Username')]]"
            value="{{configProperties_.VPN.L2TP.Username}}">
        </network-config-input>
        <network-config-input label="[[i18n('OncVPN-Password')]]"
            value="{{configProperties_.VPN.L2TP.Password}}" password>
        </network-config-input>
        <network-config-input label="[[i18n('OncVPN-IPsec-Group')]]"
            value="{{configProperties_.VPN.IPsec.Group}}">
        </network-config-input>
        <template is="dom-if" if="[[!showVpn_.Cert]]">
          <network-config-input label="[[i18n('OncVPN-IPsec-PSK')]]"
              value="{{configProperties_.VPN.IPsec.PSK}}" password>
          </network-config-input>
        </template>
      </template>
      <template is="dom-if" if="[[showVpn_.OpenVPN]]">
        <network-config-input label="[[i18n('OncVPN-Username')]]"
            value="{{configProperties_.VPN.OpenVPN.Username}}">
        </network-config-input>
        <network-config-input label="[[i18n('OncVPN-Password')]]"
            value="{{configProperties_.VPN.OpenVPN.Password}}" password>
        </network-config-input>
        <network-config-input label="[[i18n('OncVPN-OpenVPN-OTP')]]"
            value="{{configProperties_.VPN.OpenVPN.OTP}}">
        </network-config-input>
      </template>
      <template is="dom-if" if="[[showVpn_.Cert]]">
        <network-config-select id="vpnServerCa"
            label="[[i18n('OncEAP-ServerCA')]]"
            value="{{selectedServerCaHash_}}" items="[[serverCaCerts_]]"
            cert-list>
        </network-config-select>
        <network-config-select id="vpnUserCert"
            label="[[i18n('OncEAP-UserCert')]]"
            value="{{selectedUserCertHash_}}" items="[[userCerts_]]"
            cert-list>
        </network-config-select>
      </template>
      <div class="property-box">
        <div id="vpnSaveCredentialsLabel" class="start">
          [[i18n('networkConfigSaveCredentials')]]
        </div>
        <paper-toggle-button checked="{{vpnSaveCredentials_}}"
            aria-labelledby="vpnSaveCredentialsLabel">
        </paper-toggle-button>
      </div>
    </template>

    <!-- EAP (WiFi, WiMAX, Ethernet) -->
    <template is="dom-if" if="[[showEap_]]">
      <network-config-select id="outer" label="[[i18n('OncEAP-Outer')]]"
          value="{{eapProperties_.Outer}}" items="[[eapOuterItems_]]"
          onc-prefix="EAP.Outer" hidden="[[!showEap_.Outer]]">
      </network-config-select>
      <network-config-select id="inner" label="[[i18n('OncEAP-Inner')]]"
          value="{{eapProperties_.Inner}}"
          items="[[getEapInnerItems_(eapProperties_.Outer)]]"
          onc-prefix="EAP.Inner" hidden="[[!showEap_.Inner]]">
      </network-config-select>
      <network-config-select id="serverCa" label="[[i18n('OncEAP-ServerCA')]]"
          value="{{selectedServerCaHash_}}" items="[[serverCaCerts_]]"
          hidden="[[!showEap_.ServerCA]]" cert-list>
      </network-config-select>
      <network-config-input label="[[i18n('OncEAP-SubjectMatch')]]"
          value="{{eapProperties_.SubjectMatch}}"
          hidden="[[!showEap_.SubjectMatch]]">
      </network-config-input>
      <network-config-select id="userCert" label="[[i18n('OncEAP-UserCert')]]"
          value="{{selectedUserCertHash_}}" items="[[userCerts_]]"
          hidden="[[!showEap_.UserCert]]" cert-list>
      </network-config-select>
      <network-config-input label="[[i18n('OncEAP-Identity')]]"
          value="{{eapProperties_.Identity}}" hidden="[[!showEap_.Identity]]">
      </network-config-input>
      <network-config-input label="[[i18n('OncEAP-Password')]]"
          value="{{eapProperties_.Password}}" hidden="[[!showEap_.Password]]"
          password>
      </network-config-input>
      <network-config-input label="[[i18n('OncEAP-AnonymousIdentity')]]"
          value="{{eapProperties_.AnonymousIdentity}}"
          hidden="[[!showEap_.AnonymousIdentity]]">
      </network-config-input>
      <div class="property-box">
        <div id="eapSaveCredentialsLabel" class="start">
          [[i18n('networkConfigSaveCredentials')]]
        </div>
        <paper-toggle-button checked="{{eapProperties_.SaveCredentials}}"
            aria-labelledby="eapSaveCredentialsLabel">
        </paper-toggle-button>
      </div>
    </template>

    <!-- Share (WiFi and WiMAX) -->
    <template is="dom-if"
        if="[[shareIsVisible_(guid, type, networkProperties)]]">
      <div class="property-box">
        <div id="shareLabel" class="start">[[i18n('networkConfigShare')]]</div>
        <paper-toggle-button id="share" checked="{{shareNetwork_}}"
            disabled="[[!shareIsEnabled_(guid, configProperties_.*,
                      security_, eapProperties_.*, shareAllowEnable)]]"
            aria-label="[[i18n('networkConfigShare')]]">
        </paper-toggle-button>
      </div>
    </template>

    <template is="dom-if"
        if="[[connectingIsVisible_(propertiesSent_, error_)]]">
      <div class="property-box">
        <div class="start layout horizontal center">
          <cr-network-icon is-list-item
              network-state="[[getIconState_(configProperties_)]]">
          </cr-network-icon>
          <div>[[i18n('OncConnecting')]]</div>
        </div>
      </div>
    </template>

    <template is="dom-if" if="[[error_]]">
      <div class="property-box">
        <div id="error" class="start">
          [[getError_(error_)]]
        </div>
      </div>
    </template>

  </template>
  <script src="network_config.js"></script>
</dom-module>