-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Redesign Share UI to emphasize difference between Original URLs and Snapshot URLs. #8172
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
Redesign Share UI to emphasize difference between Original URLs and Snapshot URLs. #8172
Conversation
|
I got some design feedback from @alt74 and we updated the UI to look like this: |
|
For the record, I thought the yellow warning text was 💯 . It's seems pretty easy to miss completely now. |
src/ui/public/share/views/share.html
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be more about compatibility with consumers of the URL, rather than sharing it. Maybe something like...
We recommend sharing shortened snapshot urls for maximum compatibility. Internet Explorer has URL length restrictions, and some wiki and markup parsers don't do well with the full-length version of the snapshot URL, but the short URL should work great.
|
If you get a short url, and then the url changes, the short url persists and points to the wrong long-url. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would you feel about putting all the urls under this.urls = { original, snapshot, ... }. Then, in updateUrls() you can just overwrite the this.urls object in order to deal with #8172 (comment)
|
Some notes, only one bug, looking good |
|
Re the warning, I think it's better to present it subdued, since we don't really want to draw the user's attention to it if they're looking elsewhere. If the user is trying to share the Original, they'll be looking in that area already so I think the chances are good that they'll read the warning, despite the subdued presentation. |
68c5c79 to
8b6d383
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a better user experience, but I'm worried that it could create a bunch of never-used short urls (which in turn are elasticsearch docs)
|
I think this is a step in the right direction in most every way, but the user should probably be able to toggle the short flag, rather than it being a one-way click. Right now, the only way to disable short URL creation is to close and re-open the share ui. |
c6e0c6c to
886ef62
Compare
|
Coming to this with semi-fresh eyes, the term Original URL still seems confusing to me. I had to re-read the descriptive text a few times to remember everything we talked about, and users won't have that context. I've been mulling it over and I have a few questions:
Sorry if this is a giant rambling mess, I've been thinking though it as I type. I guess the overall thing I'm trying to get at is, I think we can create a better separation between the two sharing mechanisms and then guide the user to the correct one based on the current context. Rather than display everything all the time and force the user to read and understand a bunch of stuff right off the bat, we can guide them to the correct decision by hiding inappropriate options and providing helpful, dynamic messages. |
Removing reference to original visualization from Snapshot URLsI think your argument makes sense and I think if we want to preserve a reference to the original, we should do that by persisting that reference in a query param, as opposed to part of the URL. This will make it clear that it's simply a reference, and not actually a contributing factor to the way the visualization is rendered. I think we should do this in a subsequent PR though. Share Saved vs Share OriginalI'm down with "Share Saved"! Good idea! Unsaved warning messageAnother good idea. I think this is best tackled in another PR. Showing different UIs based on different statesI think this is worth exploration, but it's also not a blocker for this PR. Are you OK with merging this after I make the change to the "Original" naming pattern, and then we can explore next steps for improving it? |
|
Updated UI per @Bargs suggestion: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about simply $scope.allowEmbed !== 'false' here? It took me a moment to grok what this what was doing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or combine this and the if statement above into a switch()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried the switch idea, but couldn't figure out a case to match the $scope.allowEmbed !== undefined condition.
Re the original suggestion, I think equality comparisons are easier to think about than inequality, especially when comparing booleans. When you see an equality comparison in a ternary, you can associate the happy path with the values and variables in the comparison. But with an inequality comparison, you need to think of the opposite of the compared value to imagine the happy path, which I think is one extra unnecessary step.
Is the ternary the problem? Do you think this is easier to follow @epixa ?
this.allowEmbed = true;
// Default to allowing an embedded IFRAME, unless it's explicitly set to false.
if ($scope.allowEmbed === 'false') {
this.allowEmbed = false;
}I can also make the comment clearer if you have any suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if that makes it clearer or not, but I don't think it's worth splitting this into different statements. Honestly though, I don't feel strongly about it one way or another.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function castAllowEmbedToBoolean(allowEmbed) {
switch (allowEmbed) {
case 'true':
return true;
case undefined:
case 'false':
return false;
default:
throw new TypeError('...');
}
}
this.allowEmbed = castAllowEmbedToBoolean($scope.allowEmbed);There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @spalger , I see what you're saying. I prefer the way it is currently because I think it's clearer that true is the default value unless "false" is passed in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nitpick here: but if you use angular's $document service instead of directly accessing the global document, it makes testing a good deal easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good but how does it make it easier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can mock the service so it doesn't actually require dom access and instead verify that the appropriate selector is being passed.
|
Embedded iframe isn't an option for Saved object sharing? I think this would be the preferred link to share in an iframe. |
|
Do we have copy-writing rules in place? Personally I prefer sentence-casing (capitalizing the first word) over title-casing (capitalizing nouns and verbs) in general, and using capitalized words to indicate special terms, like "Snapshot". |
|
I was sort of thinking of "Saved Dashboard" as a special term, in contrast to "Snapshot". Not sure about copy rules though. @debadair ? |
|
Other than the two things I mentioned above, functionality LGTM |
|
If you rebase this, the build should pass. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be using bonafide url parsing and formatting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How's this:
const parsedUrl = parseUrl(window.location.href);
return formatUrl({
protocol: parsedUrl.protocol,
auth: parsedUrl.auth,
host: parsedUrl.host,
path: parsedUrl.path,
search: {
_g: parsedUrl.search._g,
},
});I can definitely see how this is more consistent with the rest of the codebase. Are there other reasons to write it this way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You actually need to parse the parent url and the url in the hash, beyond that I'm pretty sure that search needs to be query (search is for strings, query for objects, iirc).
As to why, adding a query string param to the non-hash part of the url would completely break this functionality:
https://localhost:5601/cdf/app/kibana?flag=true#/discover/New-Saved-Search?_g=()&_a=(columns:!(_source),filters:!(),index:'logstash-*',interval:auto,query:(query_string:(analyze_wildcard:!t,query:'*')),sort:!('@timestamp',desc))
produces the share url
https://localhost:5601/cdf/app/kibana?_g=()
When it comes to parsing standard formats though, I always urge people to use the proper encoding/decoding tools. While simply splitting on '?' works today, there is good reason to expect that it at some point an edge case will show up that may or may-not be very hard to debug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see what you're saying! I forgot about that gotcha about the way Angular stores stuff after the hash. Great call, thanks.
1bd3525 to
86aad2d
Compare
|
LGTM |
…shot URLs. - Remove share_object_url. - Remove clipboard npm dependency. - Add toggle for switching between Short and Long URLs. - Add ability to share embedded iframe to saved visualizations, including current global state.
61acdb5 to
a985840
Compare
|
@cjcenizal Can you make sure the docs are updated with new screenshots and such? https://www.elastic.co/guide/en/kibana/current/dashboard.html#sharing-dashboards That doesn't necessarily have to happen in this PR if you're still trying to get this feature in for 5.0, but it should happen in a follow up as soon as possible. |
--------- **Commit 1:** Redesign Share UI to emphasize difference between Saved URLs and Snapshot URLs. - Remove share_object_url. - Remove clipboard npm dependency. - Add toggle for switching between Short and Long URLs. - Add ability to share embedded iframe to saved visualizations, including current global state. * Original sha: a985840 * Authored by CJ Cenizal <[email protected]> on 2016-09-02T20:15:27Z
--------- **Commit 1:** Redesign Share UI to emphasize difference between Saved URLs and Snapshot URLs. - Remove share_object_url. - Remove clipboard npm dependency. - Add toggle for switching between Short and Long URLs. - Add ability to share embedded iframe to saved visualizations, including current global state. * Original sha: a985840 * Authored by CJ Cenizal <[email protected]> on 2016-09-02T20:15:27Z
|
@cjcenizal I created backport PRs for this since we're running out of time to get stuff into 5.0 and I wanted the builds going. |
|
Thanks @epixa |
[backport] PR #8172 to 5.x - Redesign Share UI to emphasize difference between Original URLs and Snapshot URLs.
[backport] PR #8172 to 5.0 - Redesign Share UI to emphasize difference between Original URLs and Snapshot URLs.
--------- **Commit 1:** Redesign Share UI to emphasize difference between Saved URLs and Snapshot URLs. - Remove share_object_url. - Remove clipboard npm dependency. - Add toggle for switching between Short and Long URLs. - Add ability to share embedded iframe to saved visualizations, including current global state. * Original sha: e22c244de52402167bb8909024fd88834a740065 [formerly a985840] * Authored by CJ Cenizal <[email protected]> on 2016-09-02T20:15:27Z Former-commit-id: 2670a0e
[backport] PR elastic#8172 to 5.x - Redesign Share UI to emphasize difference between Original URLs and Snapshot URLs. Former-commit-id: e9dfd52




This supersedes #8157.
Redesign Share UI to emphasize difference between Original URLs and Snapshot URLs.
Discover
Unsaved
Saved
Short URL
Dashboard
Unsaved
Saved
Short URL
Visualization
Unsaved
Saved
Short URL