-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Introduce Clone feature in view mode #10925
Introduce Clone feature in view mode #10925
Conversation
6f9a604
to
b2b47b0
Compare
b2b47b0
to
af95ec3
Compare
@cjcenizal Removing you from review, but feel free to comment on functionality if you prefer. @archanid I heard you'd like to review more stuff, so tagging you, hope you don't mind! 🥇 @alexfrancoeur Likewise, feel free to check out the functionality and comment if you like. You seemed partial to the previous clone functionality that got taken away. :) |
@stacey-gammon you are correct, I love the clone concept :-) Functionally it works perfectly ++ My initial reaction was that I'd like to rename it immediately. What are your thoughts around providing similar functionality that |
Yea, good point @alexfrancoeur - renaming is a natural step immediately before or after a clone command. But we want the save panel to eventually go away and be a "one click save", so I don't know if adding another similar panel will be good in the long run. We just really need an easier way to rename the dashboard without having to save it. :( |
I agree and am certainly all for one click saving and inline dashboard naming. While we don't have those features, should we keep the "saving" of a dashboard consistent? |
@snide @cjcenizal Any perspective from the design team here? One click clone vs the same experience for |
@stacey-gammon from a technical perspective, this LGTM. Though, I'm holding off on approving it until we get some design input. |
Chatted with the design team and we decided to go with a pop up modal that provides an input field where the name can be changed, along with Given that, I expect this will get pushed to 5.5. cc @cjcenizal @snide |
Sounds good @stacey-gammon. No need to rush, users still can save as new under edit mode. This functionality will be much more important when we begin to introduce more granular access control in the future. @cjcenizal @snide I don't want to increase the scope of this PR by any means but I have a question about the proposed approach. If we introduce modals here for saving confirmation, do we need to keep that consistent across the board? Saving a visualization, saving a dashboard, etc. Or is cloning unique in this situation? |
@alexfrancoeur I don't think the answer is as clearcut as "All 'saving' actions require modals" or "Only cloning needs a modal." I think surfacing a modal for cloning is a strong UX, and is an improvement worth introducing even as a standalone change. As for the rest of the header, we know it needs an overall redesign, and on a more granular level we know we want to improve the saving UX. I'd say we can move forward with the cloning modal now, and figure out the other saving UX improvements later (which may or may not involve modals). |
@cjcenizal I agree that the the modal is a better UX than what we have now. However, I also know how important consistency is for UX. My concern is that introducing different ways to save items is confusing to a user. This was part of the reason why we had to revert back to the original saving approach for edit mode. It was too different from visualize, saved searches, etc. If design does not believe this will be a poor user experience, I'm all for introducing the modal. Otherwise, I don't see why wouldn't just keep them the same. |
@snide What are your thoughts on @alexfrancoeur's points about preserving UX consistency, above? |
super(props); | ||
|
||
this.state = { | ||
newDashboardName: props.title |
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.
Do you want the default value to cause a name collision with the existing dashboard title? Maybe Clone
should be appended to the title or something like that, or maybe the default value is blank?
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.
Yea, I originally had it with 'Copy' appended, wasn't sure which version I liked better. I can bring that back.
const kbnUrl = $injector.get('kbnUrl'); | ||
const confirmModal = $injector.get('confirmModal'); | ||
const Private = $injector.get('Private'); | ||
|
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.
Why the switch to $injector.get()?
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.
@spalger's preference for injector over multiline argument lists. :)
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.
className="kuiTextInput kuiTextInput--large" | ||
value={ this.state.newDashboardName } | ||
onChange={ this.onInputChange } /> | ||
</KuiModalBodyText> |
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.
Should the model also let the user update the dashboard description for the clone? I could see a user cloning a dashboard and wanting to describe what the clone is going to be used for. Might be nice to complete this action in a single screen.
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.
Yea, I could see that being helpful. Mind if I make that a separate enhancement/PR though so it doesn't hold this PR up?
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.
not at all
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.
Filed: #11817
eb015c5
to
2337cd0
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.
Nice job, really excited to see us using React for this!!
Just a few minor comments, nothing mission/critical or worth blocking this PR.
type="primary" | ||
data-test-subj="cloneConfirmButton" | ||
onClick={ this.cloneDashboard } | ||
ref={ (button) => { this.confirmButton = button; } } |
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.
It looks like you can use the autoFocus
attribute to do the same without having to use the ref
.
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.
Also, do we want the confirm button to be focused when the modal pops up? It seems like we'd want the textbox with the name to be focused, and make the enter key for that textbox trigger the Save.
}; | ||
|
||
onKeyDown = (event) => { | ||
if (event.keyCode === 27) { |
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.
Can we add a comment to denote what keyCode
27 is? I had to look it up to figure out what this was intended to do.
I really like this behavior, and wonder whether we should see if the design-team would like to introduce it for all modals.
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.
We have it for all the confirm modals currently. Or at least, it should be working for our confirm modals.... if it's not it's a bug.
]); | ||
|
||
app.directive('dashboardCloneModal', function (reactDirective) { |
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.
We should be able to remove this as the showCloneModal
is using the React component directly as opposed to via ng-react.
} | ||
|
||
componentDidMount() { | ||
this.confirmButton.focus(); |
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 haven't used it myself yet, but it looks like there is an autoFocus
attribute that we can add to the button itself to make this work.
Tangentially, what made you choose to have the confirm button focused by default. From my naive perspective, we'd want the user to change the name of the Dashboard so there isn't a naming collision, so defaulting the focus to the textbox for them to make the changes would make more sense. This point might no longer be valid now that we're appending "Copy" to the name of the title with the most recent changes.
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 didn't use autoFocus because it's not supported by all browsers here: http://caniuse.com/#feat=autofocus
Though honestly, I thought it wasn't supported on Safari, but a closer look reveals it's "IOS" safari, so the phone browser, and Opera Mini. So maybe it's okay? Since they are touch screen devices, you wouldn't be pressing enter anyway, but touching one of the buttons.
@epixa, do we have a set of browsers we have to support?
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.
We officially support these browsers: https://www.elastic.co/support/matrix#show_browsers
No need to optimize for mobile browsers, though Kibana should really still function in those browsers, ideally.
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.
In that case, I'll switch over to using autoFocus, it's a lot simpler of an implementation and Kibana will still function in those mobile browsers.
98a4061
to
f85070f
Compare
Unfortunately can’t run jest tests outside of the ui_framework at this time.
It’ll cause failures for the normal unit test runs
f85070f
to
694c5bf
Compare
* Introduce Clone feature in view mode * Use a new react modal for cloning dashboards * Fix focus issues and tests Unfortunately can’t run jest tests outside of the ui_framework at this time. * Add tests for dashboard clone modal * move the jest tests out of the __tests__ directory It’ll cause failures for the normal unit test runs * use react instead of angular for overlay and loading of dom element * Append 'Copy' to the title in the clone dialog so by default it doesn't clash * address code comments
* Introduce Clone feature in view mode * Use a new react modal for cloning dashboards * Fix focus issues and tests Unfortunately can’t run jest tests outside of the ui_framework at this time. * Add tests for dashboard clone modal * move the jest tests out of the __tests__ directory It’ll cause failures for the normal unit test runs * use react instead of angular for overlay and loading of dom element * Append 'Copy' to the title in the clone dialog so by default it doesn't clash * address code comments
* Introduce Clone feature in view mode * Use a new react modal for cloning dashboards * Fix focus issues and tests Unfortunately can’t run jest tests outside of the ui_framework at this time. * Add tests for dashboard clone modal * move the jest tests out of the __tests__ directory It’ll cause failures for the normal unit test runs * use react instead of angular for overlay and loading of dom element * Append 'Copy' to the title in the clone dialog so by default it doesn't clash * address code comments
Summary: Introducing the ability to easily clone dashboards in view mode. Just click the new button in the top navigation, and enter in a new dashboard name.
Fixes #10621
cc @alexfrancoeur