Commit 6f902c70 authored by Alexander Hendrich's avatar Alexander Hendrich Committed by Commit Bot

Remove unused 'editable' variable for ip config and nameservers

This CL removes the unused |editable| variable in the ip config and
nameserver settings page. It was always set to true and probably left
over from some refactoring in the past.

Bug: 919066
Change-Id: I13a1305b1a2d87f413ced4400b5a337ba37952f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1539660Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Alexander Hendrich <hendrich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#644718}
parent 3192c3b0
......@@ -224,8 +224,7 @@
<template is="dom-if" if="[[showCellularSim_(networkProperties_)]]"
restamp>
<div class="settings-box single-column stretch">
<network-siminfo
editable on-siminfo-change="onNetworkPropertyChange_"
<network-siminfo on-siminfo-change="onNetworkPropertyChange_"
network-properties="[[networkProperties_]]"
networking-private="[[networkingPrivate]]">
</network-siminfo>
......@@ -309,7 +308,7 @@
<!-- APN -->
<template is="dom-if" if="[[isCellular_(networkProperties_)]]">
<network-apnlist editable on-apn-change="onNetworkPropertyChange_"
<network-apnlist on-apn-change="onNetworkPropertyChange_"
network-properties="[[networkProperties_]]">
</network-apnlist>
</template>
......@@ -317,11 +316,10 @@
<!-- IP Config, Nameservers -->
<template is="dom-if"
if="[[isRememberedOrConnected_(networkProperties_)]]">
<network-ip-config editable on-ip-change="onIPConfigChange_"
<network-ip-config on-ip-change="onIPConfigChange_"
network-properties="[[networkProperties_]]">
</network-ip-config>
<network-nameservers editable
on-nameservers-change="onIPConfigChange_"
<network-nameservers on-nameservers-change="onIPConfigChange_"
network-properties="[[networkProperties_]]">
</network-nameservers>
</template>
......
......@@ -23,16 +23,16 @@
networkProperties, 'IPAddressConfigType')]]">
</cr-policy-indicator>
<cr-toggle checked="{{automatic_}}"
disabled="[[!canChangeIPConfigType_(editable, networkProperties)]]"
disabled="[[!canChangeIPConfigType_(networkProperties)]]"
on-change="onAutomaticChange_"
aria-labelledby="autoIPConfigLabel">
</cr-toggle>
</div>
<template is="dom-if" if="[[hasIpConfigFields_(ipConfig_)]]">
<div class="property-box single-column indented stretch">
<network-property-list editable
fields="[[ipConfigFields_]]" property-dict="[[ipConfig_]]"
edit-field-types="[[getIPEditFields_(editable, automatic_)]]"
<network-property-list fields="[[ipConfigFields_]]"
property-dict="[[ipConfig_]]"
edit-field-types="[[getIPEditFields_(automatic_)]]"
on-property-change="onIPChange_">
</network-property-list>
</div>
......
......@@ -4,8 +4,7 @@
/**
* @fileoverview Polymer element for displaying the IP Config properties for
* a network state. TODO(stevenjb): Allow editing of static IP configurations
* when 'editable' is true.
* a network state.
*/
Polymer({
is: 'network-ip-config',
......@@ -23,14 +22,6 @@ Polymer({
observer: 'networkPropertiesChanged_',
},
/**
* Whether or not the IP Address can be edited.
*/
editable: {
type: Boolean,
value: false,
},
/**
* State of 'Configure IP Addresses Automatically'.
* @private
......@@ -112,16 +103,12 @@ Polymer({
/**
* Checks whether IP address config type can be changed.
* @param {boolean} editable
* @param {!CrOnc.NetworkProperties} networkProperties
* @return {boolean} true only if 'IPAddressConfigType' as well as all other
* IP address config related fields are editable.
* @private
*/
canChangeIPConfigType_: function(editable, networkProperties) {
if (!editable) {
return false;
}
canChangeIPConfigType_: function(networkProperties) {
const controlledProps = [
'IPAddressConfigType', 'StaticIPConfig.IPAddress',
'StaticIPConfig.RoutingPrefix', 'StaticIPConfig.Gateway'
......@@ -226,7 +213,7 @@ Polymer({
* @private
*/
getIPEditFields_: function() {
if (!this.editable || this.automatic_) {
if (this.automatic_) {
return {};
}
return {
......
......@@ -103,8 +103,8 @@
<template is="dom-repeat" items="[[nameservers_]]">
<cr-input id="nameserver[[index]]" value="[[item]]"
on-change="onValueChange_"
disabled="[[!canEditCustomNameServers_(editable,
nameserversType_, networkProperties)]]">
disabled="[[!canEditCustomNameServers_(nameserversType_,
networkProperties)]]">
</cr-input>
</template>
</div>
......
......@@ -21,12 +21,6 @@ Polymer({
observer: 'networkPropertiesChanged_',
},
/** Whether or not the nameservers can be edited. */
editable: {
type: Boolean,
value: false,
},
/**
* Array of nameserver addresses stored as strings.
* @private {!Array<string>}
......@@ -59,7 +53,7 @@ Polymer({
/** @private */
canChangeConfigType_: {
type: Boolean,
computed: 'computeCanChangeConfigType_(editable, networkProperties)',
computed: 'computeCanChangeConfigType_(networkProperties)',
}
},
......@@ -139,16 +133,11 @@ Polymer({
},
/**
* @param {boolean} editable
* @param {!CrOnc.NetworkProperties} networkProperties
* @return {boolean} True if the nameservers config type type can be changed.
* @private
*/
computeCanChangeConfigType_: function(editable, networkProperties) {
if (!editable) {
return false;
}
computeCanChangeConfigType_: function(networkProperties) {
return !this.isNetworkPolicyPathEnforced(
networkProperties, 'NameServersConfigType') &&
!this.isNetworkPolicyPathEnforced(
......@@ -156,15 +145,13 @@ Polymer({
},
/**
* @param {boolean} editable
* @param {string} nameserversType
* @param {!CrOnc.NetworkProperties} networkProperties
* @return {boolean} True if the nameservers are editable.
* @private
*/
canEditCustomNameServers_: function(
editable, nameserversType, networkProperties) {
return editable && nameserversType == 'custom' &&
canEditCustomNameServers_: function(nameserversType, networkProperties) {
return nameserversType == 'custom' &&
!this.isNetworkPolicyEnforced(
networkProperties.NameServersConfigType) &&
!!networkProperties.StaticIPConfig &&
......
......@@ -13,16 +13,6 @@ Polymer({
behaviors: [I18nBehavior, CrPolicyNetworkBehavior],
properties: {
/**
* If true, all fields are shown as editable. Fields without an edit type
* or that are policy enforced will be shown as 'readonly'. Used for lists
* with dynamic edit types (e.g. network-ip-config).
*/
editable: {
type: Boolean,
value: false,
},
/**
* The dictionary containing the properties to display.
* @type {!Object|undefined}
......@@ -182,7 +172,7 @@ Polymer({
* @private
*/
showEditable_: function(key, propertyDict, editFieldTypes) {
return this.isEditable_(key, propertyDict, editFieldTypes) || this.editable;
return this.isEditable_(key, propertyDict, editFieldTypes);
},
/**
......
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