Commit 52645836 authored by Steven Bennetts's avatar Steven Bennetts Committed by Commit Bot

Settings > Internet > Config: Update dialog to match UX

This CL:
* Resizes the dialogs to better match the mocks
* Modifies the dialog title and layout to better match the mocks
* Updates the style of the inputs to match dialog input style
* Renames internet-config-dialog in internet_config.html to
  internet-config match the filename and reduce confusion
  with internet_config_dialog.html (stand alone dialog).

Bug: 380937
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I7086e18be6d2bd627c8038de39f7e89dc16d0ea7
Reviewed-on: https://chromium-review.googlesource.com/742341
Commit-Queue: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarToni Barzic <tbarzic@chromium.org>
Reviewed-by: default avatarMichael Giuffrida <michaelpg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#512722}
parent ea7baae1
...@@ -1288,9 +1288,15 @@ ...@@ -1288,9 +1288,15 @@
<message name="IDS_SETTINGS_INTERNET" desc="Name of the settings page which displays internet preferences."> <message name="IDS_SETTINGS_INTERNET" desc="Name of the settings page which displays internet preferences.">
Network Network
</message> </message>
<message name="IDS_SETTINGS_INTERNET_CONFIG" desc="Name of the settings page for configuring a network."> <message name="IDS_SETTINGS_INTERNET_CONFIG" desc="Title for the network configuration dialog.">
Configure network Configure network
</message> </message>
<message name="IDS_SETTINGS_INTERNET_CONFIG_NAME" desc="Title for the network configuration dialog for an existing network.">
Configure <ph name="NAME">$1<ex>My WiFi network</ex></ph>
</message>
<message name="IDS_SETTINGS_INTERNET_JOIN_TYPE" desc="Title for the network configuration dialog for a new network.">
Join <ph name="TYPE">$1<ex>WiFi</ex></ph> network
</message>
<message name="IDS_SETTINGS_INTERNET_DETAIL" desc="Name of the settings page which displays network details."> <message name="IDS_SETTINGS_INTERNET_DETAIL" desc="Name of the settings page which displays network details.">
Network Details Network Details
</message> </message>
......
...@@ -28,16 +28,14 @@ ...@@ -28,16 +28,14 @@
<template> <template>
<style include="network-shared iron-flex"> <style include="network-shared iron-flex">
.button-strip { .button-strip {
border-top: var(--cr-separator-line);
justify-content: flex-end; justify-content: flex-end;
} }
.section { .section {
@apply(--cr-section); @apply(--cr-section);
margin-bottom: 10px;
}
.section.first {
border-top: none; border-top: none;
margin-bottom: 10px;
} }
.section.single-column { .section.single-column {
...@@ -56,15 +54,18 @@ ...@@ -56,15 +54,18 @@
font-size: 107.69%; /* 14px / 13px */ font-size: 107.69%; /* 14px / 13px */
font-weight: 500; font-weight: 500;
} }
network-config {
/* Give the network-config section some extra padding for the dialog. */
-webkit-padding-start: 20px;
}
</style> </style>
<!-- Title section: Icon + name. --> <!-- Title section: Icon + name. -->
<div class="section first"> <div class="section layout horizontal center">
<div class="start layout horizontal center"> <cr-network-icon network-state="[[networkProperties_]]" is-list-item>
<cr-network-icon network-state="[[networkProperties_]]" is-list-item> </cr-network-icon>
</cr-network-icon> <div class="title">[[getDialogTitle_(networkProperties_)]]</div>
<div class="title">[[getTitle_(networkProperties_.*)]]</div>
</div>
</div> </div>
<div class="section single-column"> <div class="section single-column">
......
...@@ -84,9 +84,9 @@ Polymer({ ...@@ -84,9 +84,9 @@ Polymer({
* @return {string} * @return {string}
* @private * @private
*/ */
getTitle_: function() { getDialogTitle_: function() {
return this.networkProperties_.Name || var type = this.i18n('OncType' + this.networkProperties_.Type);
this.i18n('OncType' + this.networkProperties_.Type); return this.i18n('internetJoinType', type);
}, },
/** @private */ /** @private */
......
...@@ -9,25 +9,24 @@ ...@@ -9,25 +9,24 @@
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="internet_shared_css.html"> <link rel="import" href="internet_shared_css.html">
<dom-module id="internet-config-dialog"> <dom-module id="internet-config">
<template> <template>
<style include="internet-shared iron-flex"> <style include="internet-shared iron-flex">
dialog {
width: 460px;
}
</style> </style>
<dialog is="cr-dialog" id="dialog" close-text="$i18n{close}"> <dialog is="cr-dialog" id="dialog" close-text="$i18n{close}">
<div slot="title">$i18n{internetConfigTitle}</div> <div slot="title">
<div class="layout horizontal center">
<cr-network-icon network-state="[[networkProperties_]]" is-list-item>
</cr-network-icon>
<div class="title">[[getDialogTitle_(networkProperties_)]]</div>
</div>
</div>
<div slot="body"> <div slot="body">
<!-- Icon + name. -->
<div class="settings-box first"> <div class="settings-box first">
<div class="start layout horizontal center">
<cr-network-icon network-state="[[networkProperties_]]"
is-list-item>
</cr-network-icon>
<div class="title">[[getTitle_(networkProperties_.*)]]</div>
</div>
</div>
<div class="settings-box">
<network-config id="networkConfig" class="flex" <network-config id="networkConfig" class="flex"
networking-private="[[networkingPrivate]]" networking-private="[[networkingPrivate]]"
network-properties="{{networkProperties_}}" network-properties="{{networkProperties_}}"
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
/** /**
* @fileoverview * @fileoverview
* 'internet-config-dialog' is a Settings dialog wrapper for network-config. * 'internet-config' is a Settings dialog wrapper for network-config.
*/ */
Polymer({ Polymer({
is: 'internet-config-dialog', is: 'internet-config',
behaviors: [I18nBehavior], behaviors: [I18nBehavior],
...@@ -94,9 +94,12 @@ Polymer({ ...@@ -94,9 +94,12 @@ Polymer({
* @return {string} * @return {string}
* @private * @private
*/ */
getTitle_: function() { getDialogTitle_: function() {
return this.networkProperties_.Name || var name = this.networkProperties_.Name;
this.i18n('OncType' + this.networkProperties_.Type); if (name)
return this.i18n('internetConfigName', name);
var type = this.i18n('OncType' + this.networkProperties_.Type);
return this.i18n('internetJoinType', type);
}, },
/** /**
......
...@@ -120,9 +120,9 @@ ...@@ -120,9 +120,9 @@
</settings-animated-pages> </settings-animated-pages>
<internet-config-dialog id="configDialog" <internet-config id="configDialog"
networking-private="[[networkingPrivate]]"> networking-private="[[networkingPrivate]]">
</internet-config-dialog> </internet-config>
</template> </template>
<script src="internet_page.js"></script> <script src="internet_page.js"></script>
......
...@@ -234,7 +234,7 @@ Polymer({ ...@@ -234,7 +234,7 @@ Polymer({
*/ */
showConfig_: function(type, guid, name) { showConfig_: function(type, guid, name) {
var configDialog = var configDialog =
/** @type {!InternetConfigDialogElement} */ (this.$.configDialog); /** @type {!InternetConfigElement} */ (this.$.configDialog);
configDialog.type = configDialog.type =
/** @type {chrome.networkingPrivate.NetworkType} */ (type); /** @type {chrome.networkingPrivate.NetworkType} */ (type);
configDialog.guid = guid || ''; configDialog.guid = guid || '';
......
...@@ -24,6 +24,10 @@ namespace chromeos { ...@@ -24,6 +24,10 @@ namespace chromeos {
namespace { namespace {
// Width matches the internet config dialog in Settings UI (including margins).
constexpr int kInternetConfigDialogWidth = 500;
constexpr int kInternetConfigDialogHeight = 480;
void AddInternetStrings(content::WebUIDataSource* html_source) { void AddInternetStrings(content::WebUIDataSource* html_source) {
// Add default strings first. // Add default strings first.
chromeos::network_element::AddLocalizedStrings(html_source); chromeos::network_element::AddLocalizedStrings(html_source);
...@@ -35,6 +39,7 @@ void AddInternetStrings(content::WebUIDataSource* html_source) { ...@@ -35,6 +39,7 @@ void AddInternetStrings(content::WebUIDataSource* html_source) {
const char* name; const char* name;
int id; int id;
} localized_strings[] = { } localized_strings[] = {
{"internetJoinType", IDS_SETTINGS_INTERNET_JOIN_TYPE},
{"networkButtonConnect", IDS_SETTINGS_INTERNET_BUTTON_CONNECT}, {"networkButtonConnect", IDS_SETTINGS_INTERNET_BUTTON_CONNECT},
{"cancel", IDS_CANCEL}, {"cancel", IDS_CANCEL},
{"save", IDS_SAVE}, {"save", IDS_SAVE},
...@@ -72,6 +77,10 @@ InternetConfigDialog::InternetConfigDialog(const std::string& network_type, ...@@ -72,6 +77,10 @@ InternetConfigDialog::InternetConfigDialog(const std::string& network_type,
InternetConfigDialog::~InternetConfigDialog() {} InternetConfigDialog::~InternetConfigDialog() {}
void InternetConfigDialog::GetDialogSize(gfx::Size* size) const {
size->SetSize(kInternetConfigDialogWidth, kInternetConfigDialogHeight);
}
std::string InternetConfigDialog::GetDialogArgs() const { std::string InternetConfigDialog::GetDialogArgs() const {
base::DictionaryValue args; base::DictionaryValue args;
args.SetKey("type", base::Value(network_type_)); args.SetKey("type", base::Value(network_type_));
......
...@@ -29,6 +29,7 @@ class InternetConfigDialog : public SystemWebDialogDelegate { ...@@ -29,6 +29,7 @@ class InternetConfigDialog : public SystemWebDialogDelegate {
~InternetConfigDialog() override; ~InternetConfigDialog() override;
// ui::WebDialogDelegate // ui::WebDialogDelegate
void GetDialogSize(gfx::Size* size) const override;
std::string GetDialogArgs() const override; std::string GetDialogArgs() const override;
private: private:
......
...@@ -898,10 +898,11 @@ void AddInternetStrings(content::WebUIDataSource* html_source) { ...@@ -898,10 +898,11 @@ void AddInternetStrings(content::WebUIDataSource* html_source) {
{"internetAddThirdPartyVPN", IDS_SETTINGS_INTERNET_ADD_THIRD_PARTY_VPN}, {"internetAddThirdPartyVPN", IDS_SETTINGS_INTERNET_ADD_THIRD_PARTY_VPN},
{"internetAddVPN", IDS_SETTINGS_INTERNET_ADD_VPN}, {"internetAddVPN", IDS_SETTINGS_INTERNET_ADD_VPN},
{"internetAddWiFi", IDS_SETTINGS_INTERNET_ADD_WIFI}, {"internetAddWiFi", IDS_SETTINGS_INTERNET_ADD_WIFI},
{"internetConfigTitle", IDS_SETTINGS_INTERNET_CONFIG}, {"internetConfigName", IDS_SETTINGS_INTERNET_CONFIG_NAME},
{"internetDetailPageTitle", IDS_SETTINGS_INTERNET_DETAIL}, {"internetDetailPageTitle", IDS_SETTINGS_INTERNET_DETAIL},
{"internetDeviceEnabling", IDS_SETTINGS_INTERNET_DEVICE_ENABLING}, {"internetDeviceEnabling", IDS_SETTINGS_INTERNET_DEVICE_ENABLING},
{"internetDeviceInitializing", IDS_SETTINGS_INTERNET_DEVICE_INITIALIZING}, {"internetDeviceInitializing", IDS_SETTINGS_INTERNET_DEVICE_INITIALIZING},
{"internetJoinType", IDS_SETTINGS_INTERNET_JOIN_TYPE},
{"internetKnownNetworksPageTitle", IDS_SETTINGS_INTERNET_KNOWN_NETWORKS}, {"internetKnownNetworksPageTitle", IDS_SETTINGS_INTERNET_KNOWN_NETWORKS},
{"internetMobileSearching", IDS_SETTINGS_INTERNET_MOBILE_SEARCH}, {"internetMobileSearching", IDS_SETTINGS_INTERNET_MOBILE_SEARCH},
{"internetNoNetworks", IDS_SETTINGS_INTERNET_NO_NETWORKS}, {"internetNoNetworks", IDS_SETTINGS_INTERNET_NO_NETWORKS},
......
...@@ -10,9 +10,10 @@ ...@@ -10,9 +10,10 @@
<dom-module id="network-config"> <dom-module id="network-config">
<template> <template>
<style include="network-shared"> <style include="network-shared">
paper-toggle-button { .property-box {
-webkit-margin-end: calc( /* Align the toggle controls with the show/hide password icon. */
var(--network-control-margin) - var(--cr-icon-ripple-padding)); width: calc(var(--network-control-width) +
var(--network-control-margin) + 4px);
} }
#error { #error {
...@@ -21,18 +22,6 @@ ...@@ -21,18 +22,6 @@
} }
</style> </style>
<!-- Share (WiFi and WiMAX) -->
<template is="dom-if" if="[[shareIsVisible_(type)]]">
<div class="property-box hr">
<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>
<!-- SSID (WiFi) --> <!-- SSID (WiFi) -->
<template is="dom-if" if="[[isType_(NetworkType_.WI_FI, type)]]"> <template is="dom-if" if="[[isType_(NetworkType_.WI_FI, type)]]">
<network-config-input id="ssid" label="[[i18n('OncWiFi-SSID')]]" <network-config-input id="ssid" label="[[i18n('OncWiFi-SSID')]]"
...@@ -108,7 +97,7 @@ ...@@ -108,7 +97,7 @@
cert-list> cert-list>
</network-config-select> </network-config-select>
</template> </template>
<div class="property-box hr"> <div class="property-box">
<div id="vpnSaveCredentialsLabel" class="start"> <div id="vpnSaveCredentialsLabel" class="start">
[[i18n('networkConfigSaveCredentials')]] [[i18n('networkConfigSaveCredentials')]]
</div> </div>
...@@ -152,7 +141,7 @@ ...@@ -152,7 +141,7 @@
value="{{eapProperties_.AnonymousIdentity}}" value="{{eapProperties_.AnonymousIdentity}}"
hidden="[[!showEap_.AnonymousIdentity]]"> hidden="[[!showEap_.AnonymousIdentity]]">
</network-config-input> </network-config-input>
<div class="property-box hr"> <div class="property-box">
<div id="eapSaveCredentialsLabel" class="start"> <div id="eapSaveCredentialsLabel" class="start">
[[i18n('networkConfigSaveCredentials')]] [[i18n('networkConfigSaveCredentials')]]
</div> </div>
...@@ -162,6 +151,18 @@ ...@@ -162,6 +151,18 @@
</div> </div>
</template> </template>
<!-- Share (WiFi and WiMAX) -->
<template is="dom-if" if="[[shareIsVisible_(type)]]">
<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="[[error_]]"> <template is="dom-if" if="[[error_]]">
<div class="property-box"> <div class="property-box">
<div id="error" class="start"> <div id="error" class="start">
......
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
<template> <template>
<style include="network-shared"> <style include="network-shared">
paper-input-container { paper-input-container {
--paper-input-container-color: var(--secondary-text-color);
--paper-input-container-focus-color: var(--secondary-text-color);
--paper-input-container-input-color: var(--primary-text-color);
-webkit-margin-end: var(--network-control-margin); -webkit-margin-end: var(--network-control-margin);
} }
...@@ -19,9 +22,9 @@ ...@@ -19,9 +22,9 @@
} }
</style> </style>
<div class="property-box hr"> <div class="property-box two-line">
<div id="label" class="start">[[label]]</div> <paper-input-container always-float-label>
<paper-input-container no-label-float> <label id="label">[[label]]</label>
<input is="iron-input" value="{{value::change}}" <input is="iron-input" value="{{value::change}}"
disabled="[[disabled]]" aria-label$="[[label]]" disabled="[[disabled]]" aria-label$="[[label]]"
type="[[getInputType_(password, showPassword)]]"> type="[[getInputType_(password, showPassword)]]">
......
...@@ -5,23 +5,33 @@ ...@@ -5,23 +5,33 @@
<dom-module id="network-config-select"> <dom-module id="network-config-select">
<template> <template>
<style include="network-shared md-select"> <style include="network-shared md-select">
#label {
color: var(--secondary-text-color);
}
.md-select { .md-select {
-webkit-margin-end: calc( color: var(--primary-text-color);
var(--network-control-margin) - var(--cr-icon-ripple-padding) * 2); }
.md-select-wrapper {
-webkit-margin-start: calc(var(--md-select-side-padding) * -1);
} }
</style> </style>
<div class="property-box hr"> <div class="property-box two-line single-column">
<div id="label" class="start">[[label]]</div> <div id="label">[[label]]</div>
<select class="md-select" disabled="[[disabled]]" <div class="md-select-wrapper">
value="{{value::change}}" aria-label$="[[label]]"> <select class="md-select" disabled="[[disabled]]"
<template is="dom-repeat" items="[[items]]"> value="{{value::change}}" aria-label$="[[label]]">
<option value="[[getItemValue_(item)]]" <template is="dom-repeat" items="[[items]]">
disabled="[[!getItemEnabled_(item)]]"> <option value="[[getItemValue_(item)]]"
[[getItemLabel_(item, oncPrefix)]] disabled="[[!getItemEnabled_(item)]]">
</option> [[getItemLabel_(item, oncPrefix)]]
</template> </option>
</select> </template>
</select>
<span class="md-select-underline"></span>
</div>
</div> </div>
</template> </template>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<template> <template>
<style include="cr-shared-style md-select"> <style include="cr-shared-style md-select">
:root { :root {
--network-control-width: 250px; --network-control-width: 350px;
/* Margin for the show/hide password icon */ /* Margin for the show/hide password icon */
--network-control-margin: 40px; --network-control-margin: 40px;
} }
...@@ -62,10 +62,10 @@ ...@@ -62,10 +62,10 @@
paper-input-container { paper-input-container {
--paper-input-container-input: { --paper-input-container-input: {
color: var(--paper-grey-600);
font-size: inherit; font-size: inherit;
font-weight: 400; font-weight: 400;
}; };
--paper-input-container-input-color: var(--secondary-text-color);
margin-bottom: 0; margin-bottom: 0;
margin-top: -9px; margin-top: -9px;
width: var(--network-control-width); width: var(--network-control-width);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment