Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make data limits a permanent feature #698

Merged
merged 15 commits into from
Jul 20, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move data limits UI out of experiments section
  • Loading branch information
alalamav committed Jun 17, 2020
commit 64caffc7bea992ae878a4944d3466af178e26f25
2 changes: 1 addition & 1 deletion src/server_manager/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"confirmation-server-remove": "This action removes your server from the Outline Manager, but does not block proxy access to users. You will still need to manually delete the Outline server from your host machine.",
"confirmation-server-remove-title": "Remove Server?",
"data-limits": "Data limits",
"data-limits-description": "Set a 30 day trailing data transfer limit for access keys on this server. Available at least until {date}.",
"data-limits-description": "Set a 30 day trailing data transfer limit for access keys on this server.",
"data-limits-dialog-text": "Go to the Settings tab to set a data transfer limit for access keys on this server.",
"data-limits-dialog-title": "Avoid data overages",
"data-limits-usage": "{used} of {total} used",
Expand Down
10 changes: 2 additions & 8 deletions src/server_manager/messages/master_messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,8 @@
"description": "This string appears as a title in a section to configure access key data transfer limits."
},
"data_limits_description": {
"message": "Set a 30 day trailing data transfer limit for access keys on this server. Available at least until $DATE$.",
"description": "This string appears as an explanation to the access key data transfer limits feature.",
"placeholders": {
"DATE": {
"content": "{date}",
"example": "December 9, 2019"
}
}
"message": "Set a 30 day trailing data transfer limit for access keys on this server.",
"description": "This string appears as an explanation to the access key data transfer limits feature."
},
"data_limits_dialog_text": {
"message": "Go to the Settings tab to set a data transfer limit for access keys on this server.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,9 @@ Polymer({
cursor: pointer;
background-color: #eee;
}
#data-limits-container .selection-container h3 {
font-weight: normal;
margin-bottom: 8px;
}
#data-limits-container .selection-container p {
margin: 0 0 24px 0;
width: 80%;
}
#data-limits-container .selection-container span {
display: block;
Expand Down Expand Up @@ -191,6 +188,35 @@ Polymer({
<paper-input readonly="" value="[[serverVersion]]" label="[[localize('settings-server-version')]]" hidden\$="[[!serverVersion]]" always-float-label="" maxlength="100"></paper-input>
</div>
</div>
<!-- Data limits -->
<div class="setting card-section" hidden\$="[[!supportsAccessKeyDataLimit]]">
<iron-icon class="setting-icon" icon="icons:perm-data-setting"></iron-icon>
<div id="data-limits-container">
<div class="selection-container">
<div class="content">
<h3>[[localize('data-limits')]]</h3>
<p>[[localize('data-limits-description')]]</p>
</div>
<!-- NOTE: The dropdown is not automatically sized to the button's width:
https://github.com/PolymerElements/paper-dropdown-menu/issues/229 -->
<paper-dropdown-menu no-label-float="" horizontal-align="left">
<paper-listbox slot="dropdown-content" selected="{{_computeDataLimitsEnabledName(isAccessKeyDataLimitEnabled)}}" attr-for-selected="name" on-selected-changed="_accessKeyDataLimitEnabledChanged">
<paper-item name="enabled">[[localize('enabled')]]</paper-item>
<paper-item name="disabled">[[localize('disabled')]]</paper-item>
</paper-listbox>
</paper-dropdown-menu>
</div>
<div class="data-limits-input" hidden\$="[[!isAccessKeyDataLimitEnabled]]">
<paper-input id="accessKeyDataLimitInput" value="[[accessKeyDataLimit.value]]" label="Data limit per key" always-float-label="" allowed-pattern="[0-9]+" required="" auto-validate="" maxlength="9" on-keydown="_handleAccessKeyDataLimitInputKeyDown" on-blur="_requestSetAccessKeyDataLimit"></paper-input>
<paper-dropdown-menu no-label-float="">
<paper-listbox id="accessKeyDataLimitUnits" slot="dropdown-content" selected="[[accessKeyDataLimit.unit]]" attr-for-selected="name" on-selected-changed="_requestSetAccessKeyDataLimit">
<paper-item name="MB">MB</paper-item>
<paper-item name="GB">GB</paper-item>
</paper-listbox>
</paper-dropdown-menu>
</div>
</div>
</div>
<!-- Experiments -->
<div id="experiments" class="setting card-section" hidden\$="[[!shouldShowExperiments]]">
<iron-icon class="setting-icon" icon="icons:build"></iron-icon>
Expand All @@ -201,34 +227,6 @@ Polymer({
<iron-icon icon="icons:error-outline"></iron-icon>
<p inner-h-t-m-l="[[localize('experiments-disclaimer', 'openLink', '<a href=https://s3.amazonaws.com/outline-vpn/index.html#/en/support/dataCollection>', 'closeLink', '</a>')]]"></p>
</div>
<div id="data-limits-container" hidden\$="[[!supportsAccessKeyDataLimit]]">
<div class="selection-container">
<div class="content">
<h3>[[localize('data-limits')]]</h3>
<p>
[[localize('data-limits-description', 'date', dataLimitsAvailabilityDate)]]<br>
<span inner-h-t-m-l="[[localize('experiments-feedback', 'openLink', '<a href=https://docs.google.com/forms/d/e/1FAIpQLSfP7q9GnJCQyWMpFTLd9zwCm7cvUa-2NR8a8SznwMSbuRnrWg/viewform>', 'closeLink', '</a>')]]"></span>
</p>
</div>
<!-- NOTE: The dropdown is not automatically sized to the button's width:
https://github.com/PolymerElements/paper-dropdown-menu/issues/229 -->
<paper-dropdown-menu no-label-float="" horizontal-align="left">
<paper-listbox slot="dropdown-content" selected="{{_computeDataLimitsEnabledName(isAccessKeyDataLimitEnabled)}}" attr-for-selected="name" on-selected-changed="_accessKeyDataLimitEnabledChanged">
<paper-item name="enabled">[[localize('enabled')]]</paper-item>
<paper-item name="disabled">[[localize('disabled')]]</paper-item>
</paper-listbox>
</paper-dropdown-menu>
</div>
<div class="data-limits-input" hidden\$="[[!isAccessKeyDataLimitEnabled]]">
<paper-input id="accessKeyDataLimitInput" value="[[accessKeyDataLimit.value]]" label="Data limit per key" always-float-label="" allowed-pattern="[0-9]+" required="" auto-validate="" maxlength="9" on-keydown="_handleAccessKeyDataLimitInputKeyDown" on-blur="_requestSetAccessKeyDataLimit"></paper-input>
<paper-dropdown-menu no-label-float="">
<paper-listbox id="accessKeyDataLimitUnits" slot="dropdown-content" selected="[[accessKeyDataLimit.unit]]" attr-for-selected="name" on-selected-changed="_requestSetAccessKeyDataLimit">
<paper-item name="MB">MB</paper-item>
<paper-item name="GB">GB</paper-item>
</paper-listbox>
</paper-dropdown-menu>
</div>
</div>
</div>
</div>
<!-- Metrics controls -->
Expand Down Expand Up @@ -272,8 +270,7 @@ Polymer({
serverMonthlyCost: {type: String, value: null},
serverMonthlyTransferLimit: {type: String, value: null},
localize: {type: Function, readonly: true},
shouldShowExperiments:
{type: Boolean, computed: '_computeShouldShowExperiments(supportsAccessKeyDataLimit)'},
shouldShowExperiments: {type: Boolean, value: false},
},

setServerName: function(name) {
Expand Down Expand Up @@ -346,10 +343,6 @@ Polymer({
return isAccessKeyDataLimitEnabled ? 'enabled' : 'disabled';
},

_computeShouldShowExperiments: function(supportsAccessKeyDataLimit) {
return supportsAccessKeyDataLimit;
},

_validatePort: function(value) {
const port = Number(value);
const valid = !Number.isNaN(port) && port >= 1 && port <= 65535 && Number.isInteger(port);
Expand Down