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

Fixes for internet detail page mojo conversion

This fixes the following:
* Fixes an issue where the scanning spinner wasn't showing for cellular
* Fixes logic causing the 'connectable' property to be ignored, except
  for Cellular (where it should be ignored), for 'Connect' button
  visibility.
* Fixes incorrect logic determining when to show 'Allow Shared Proxies'
* Only shows the 'Restricted IP' property when 'True' (matching previous
  logic).

Bug: 853953, 1001996
Change-Id: I2461a4e6520f6016731c6d16920cf34d4ab897f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1799802
Commit-Queue: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#696056}
parent e3516fff
......@@ -284,7 +284,7 @@
$i18n{networkSectionNetwork}
</div>
<template is="dom-if"
if="[[showScanningSpinner_(managedProperties_)]]">
if="[[showScanningSpinner_(managedProperties_, deviceState_)]]">
<paper-spinner-lite active></paper-spinner-lite>
</template>
</div>
......
......@@ -312,15 +312,19 @@ Polymer({
/** CrosNetworkConfigObserver impl */
onNetworkStateListChanged: function() {
if (!this.guid || !this.managedProperties_) {
return;
}
this.checkNetworkExists_();
},
/** CrosNetworkConfigObserver impl */
onDeviceStateListChanged: function() {
this.getDeviceState_();
if (this.guid) {
this.getNetworkDetails_();
if (!this.guid || !this.managedProperties_) {
return;
}
this.getDeviceState_();
this.getNetworkDetails_();
},
/** @private */
......@@ -706,9 +710,9 @@ Polymer({
mojom.ConnectionStateType.kNotConnected) {
return false;
}
// Cellular is not configurable, so we show a disabled connect button of
// connectable is false.
if (managedProperties.type != mojom.NetworkType.kCellular) {
// Cellular is not configurable, so we always show the connect button, and
// disable it if 'connectable' is false.
if (managedProperties.type == mojom.NetworkType.kCellular) {
return true;
}
// If 'connectable' is false we show the configure button.
......@@ -1278,9 +1282,10 @@ Polymer({
/** @type {!Array<string>} */ const fields = [];
const type = this.managedProperties_.type;
if (type == mojom.NetworkType.kCellular) {
fields.push(
'cellular.activationState', 'restrictedConnectivity',
'cellular.servingOperator.name');
fields.push('cellular.activationState', 'cellular.servingOperator.name');
if (this.managedProperties_.restrictedConnectivity) {
fields.push('restrictedConnectivity');
}
} else if (type == mojom.NetworkType.kTether) {
fields.push(
'tether.batteryPercentage', 'tether.signalStrength',
......@@ -1304,7 +1309,9 @@ Polymer({
break;
}
} else if (type == mojom.NetworkType.kWiFi) {
fields.push('restrictedConnectivity');
if (this.managedProperties_.restrictedConnectivity) {
fields.push('restrictedConnectivity');
}
}
return fields;
},
......@@ -1480,14 +1487,15 @@ Polymer({
},
/**
* @param {!mojom.ManagedProperties} managedProperties
* @return {boolean}
* @private
*/
showScanningSpinner_: function(managedProperties) {
return !!managedProperties &&
managedProperties.type == mojom.NetworkType.kCellular &&
managedProperties.cellular.scanning;
showScanningSpinner_: function() {
if (!this.managedProperties_ ||
this.managedProperties_.type != mojom.NetworkType.kCellular) {
return false;
}
return !!this.deviceState_ && this.deviceState_.scanning;
},
/**
......
......@@ -62,8 +62,7 @@
<!-- Allow shared proxies -->
<settings-toggle-button id="allowShared" class="continuation indented"
hidden$="[[!shouldShowAllowShared_(
managedProperties.proxySettings.type)]]"
hidden$="[[!shouldShowAllowShared_(managedProperties.source)]]"
pref="{{prefs.settings.use_shared_proxies}}"
label="$i18n{networkProxyAllowShared}"
on-settings-boolean-control-change="onAllowSharedProxiesChange_"
......
......@@ -55,8 +55,8 @@ Polymer({
* @private
*/
isShared_: function() {
return this.managedProperties.source == 'Device' ||
this.managedProperties.source == 'DevicePolicy';
return this.managedProperties.source == mojom.OncSource.kDevice ||
this.managedProperties.source == mojom.OncSource.kDevicePolicy;
},
/**
......
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