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

Conversation

alalamav
Copy link
Contributor

@alalamav alalamav commented Jun 17, 2020

shadowbox

  • Moves the access key data limits endpoints to /server/access-key-data-limits from experimental/access-key-data-limits.
  • Redirects the experimental endpoint to the new endpoint with a 301 for backwards compatibility.
  • Increases the server's minor version to v1.4.0.

Outline Manager

  • Moves the data limits UI out of the experiments section. Retains the experiments UI for the future.
  • Configures the data limits API endpoint based on the server version.
  • Removes the data limits availability date and associated surveys. Retains the survey code for the future.

Screen Shot 2020-06-16 at 8 50 23 PM

Screen Shot 2020-06-16 at 8 50 37 PM

@@ -546,7 +546,7 @@ export class ServerView extends DirMixin(PolymerElement) {
</div>
</div>
<div name="settings">
<outline-server-settings id="serverSettings" server-id="[[serverId]]" server-hostname="[[serverHostname]]" server-name="[[serverName]]" server-version="[[serverVersion]]" is-hostname-editable="[[isHostnameEditable]]" server-management-api-url="[[serverManagementApiUrl]]" server-port-for-new-access-keys="[[serverPortForNewAccessKeys]]" is-access-key-port-editable="[[isAccessKeyPortEditable]]" access-key-data-limit="{{accessKeyDataLimit}}" is-access-key-data-limit-enabled="{{isAccessKeyDataLimitEnabled}}" data-limits-availability-date="[[dataLimitsAvailabilityDate]]" supports-access-key-data-limit="[[supportsAccessKeyDataLimit]]" server-creation-date="[[serverCreationDate]]" server-monthly-cost="[[monthlyCost]]" server-monthly-transfer-limit="[[_formatBytesTransferred(monthlyOutboundTransferBytes)]]" is-server-managed="[[isServerManaged]]" server-location="[[serverLocation]]" metrics-enabled="[[metricsEnabled]]" localize="[[localize]]">
<outline-server-settings id="serverSettings" server-id="[[serverId]]" server-hostname="[[serverHostname]]" server-name="[[serverName]]" server-version="[[serverVersion]]" is-hostname-editable="[[isHostnameEditable]]" server-management-api-url="[[serverManagementApiUrl]]" server-port-for-new-access-keys="[[serverPortForNewAccessKeys]]" is-access-key-port-editable="[[isAccessKeyPortEditable]]" access-key-data-limit="{{accessKeyDataLimit}}" is-access-key-data-limit-enabled="{{isAccessKeyDataLimitEnabled}}" supports-access-key-data-limit="[[supportsAccessKeyDataLimit]]" server-creation-date="[[serverCreationDate]]" server-monthly-cost="[[monthlyCost]]" server-monthly-transfer-limit="[[_formatBytesTransferred(monthlyOutboundTransferBytes)]]" is-server-managed="[[isServerManaged]]" server-location="[[serverLocation]]" metrics-enabled="[[metricsEnabled]]" localize="[[localize]]">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: should we reformat this across across several lines? It's difficult for me to read on my laptop screen.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We lost the formatting during the polymer upgrade. We should look into a way of automating formatting for these mixed (html + css + js) files.

apiServer.put(
`${apiPrefix}/server/access-key-data-limit`, service.setAccessKeyDataLimit.bind(service));
apiServer.del(
`${apiPrefix}/server/access-key-data-limit`, service.removeAccessKeyDataLimit.bind(service));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it's good to model features as a resource like we do with access keys (/server/features/). That would be similar to /experimental/ url part we have.

Ideally, I think it would be nice to have something broken down by component like:

  • /server/access-key/keys/:id
  • /server/access-key/features/:id
  • /server/access-key/custom-methods

But that might not be possible to shoehorn to our current scheme.

https://google.aip.dev/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a way we already do this: the access key data limit is a property of the server (resource). I like the idea of formalizing the hierarchy.

Copy link
Collaborator

@fortuna fortuna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor important change to the redirect code.

}

// Returns a request handler that redirects a bound request path to `url` with HTTP status `code`.
function redirect(url: string, code = 301): restify.RequestHandlerType {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use 308 instead to preserve the HTTP method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}

// Returns a request handler that redirects a bound request path to `url` with HTTP status `code`.
function redirect(url: string, code = 301): restify.RequestHandlerType {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you never pass a different code, maybe remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@alalamav
Copy link
Contributor Author

alalamav commented Jul 7, 2020

We now display a disclaimer for feature metrics data collection for users with metrics reporting enabled who haven't opened up the app since before the experimental data limits feature was released (video).

Screen Shot 2020-07-08 at 1 09 00 PM

cc @cjhenck

@alalamav alalamav requested a review from fortuna July 7, 2020 23:41
Copy link
Collaborator

@fortuna fortuna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I have some minor readability tweaks.

@@ -649,6 +650,7 @@ export class ServerView extends DirMixin(PolymerElement) {
this.isAccessKeyDataLimitEnabled = false;
/** Whether the server supports data limits. */
this.supportsAccessKeyDataLimit = false;
this.shouldShowFeatureMetricsDisclaimer = false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can be shorter: this.showFeatureMetricsDisclaimer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -262,6 +272,7 @@ Polymer({
accessKeyDataLimit: {type: Object, value: null}, // type: app.DisplayDataAmount
supportsAccessKeyDataLimit:
{type: Boolean, value: false}, // Whether the server supports data limits.
shouldShowFeatureMetricsDisclaimer: {type: Boolean, value: false},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can be shorter: showFeatureMetricsDisclaimer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

// - opt-in metrics are enabled
// - user has not previously seen the data limits help bubble
// - user has not previously seen this disclaimer
function shouldShowFeatureMetricsDisclaimer(server: server.Server): boolean {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's have a hasConsentForFeatureMetrics or something along those lines. I think it's easier to reason about than having to understand the flows.

It should return dataLimits-feature-collection-consent || dataLimitsHelpBubble-dismissed. Notice it's independent of the server.

Then you can have

view.showFeatureMetricsDisclaimer = 
    server.getMetricsEnabled() &&
    !server.getAccessKeyDataLimit() &&
    !this.hasConsentForFeatureMetrics()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -1024,6 +1037,9 @@ export class App {
this.appRoot.showNotification(this.appRoot.localize('saved'));
serverView.accessKeyDataLimit = dataLimitToDisplayDataAmount(limit);
this.refreshTransferStats(this.selectedServer, serverView);
// Don't display the feature collection disclaimer anymore.
serverView.shouldShowFeatureMetricsDisclaimer = false;
window.localStorage.setItem('dataLimits-feature-collection-disclaimer', 'true');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename -disclaimer to -consent. Consent is really what we want to track.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@alalamav alalamav requested a review from fortuna July 20, 2020 20:10
@@ -88,6 +85,13 @@ async function computeDefaultAccessKeyDataLimit(
}
}

// Returns whether the user has seen a disclaimer for the updated feature metrics data collection
// policy.
function hasFeatureMetricsConsent(): boolean {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, I misunderstood on first read. So it's not really consent, because we can't collect the metric unless the metrics sharing is enabled. It's really about notification.
So maybe call it something like notifiedOfFeatureMetrics()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

this.surveys.presentDataLimitsEnabledSurvey();
// Don't display the feature collection disclaimer anymore.
serverView.showFeatureMetricsDisclaimer = false;
window.localStorage.setItem('dataLimits-feature-collection-consent', 'true');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then this would be dataLimits-feature-collection-notification or something similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@alalamav alalamav merged commit b63606e into master Jul 20, 2020
@alalamav alalamav deleted the alalama-permanent-data-limits branch July 20, 2020 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants