-
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
Add comments and inline docs for visualization saving and editing process. #8208
Add comments and inline docs for visualization saving and editing process. #8208
Conversation
@cjcenizal What's the status of this? |
@epixa I'll get this merged this week. |
b7285f5
to
fcd9615
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.
Just found one nitpick, but other than that it was a very informative PR.
@@ -2,6 +2,12 @@ import 'elasticsearch-browser'; | |||
import _ from 'lodash'; | |||
import uiModules from 'ui/modules'; | |||
|
|||
/** | |||
* @name es | |||
* @description This is the result of calling esFactory. Where is esFactory |
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.
To keep this PR consistent, can we place a line break between name and description?
fcd9615
to
b94253a
Compare
LGTM |
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.
Some of the descriptions here feel more like observations, and not descriptions of the functionality they label. I'm all for sharing your observations but I would rather only put full-formed descriptions into the code.
requesting.call(vis); | ||
|
||
// The benefit of calling `editableVis.requesting()` isn't clear. |
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.
Is this not explained above?
When a vis is marked as being requested, the bounds of that vis are updated and new data is fetched using the new bounds.
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 made this comment on the original PR: #7968 (comment)
const savedVis = $route.current.locals.savedVis; | ||
|
||
// Instance of vis.js. |
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 that in order for this to be useful the comment should point to the actual file, not just vis.js
@@ -115,6 +127,8 @@ function VisEditor($scope, $route, timefilter, AppState, $location, kbnUrl, $tim | |||
docTitle.change(savedVis.title); | |||
} | |||
|
|||
// Extract visualization state with filtered aggs. | |||
// Consists of: aggs, params, listeners, title, and type. |
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 probably point the reader to where they can find the current state (like the URL) rather than list out it's properties. Otherwise the list will just get out of date and not benefit anyone
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 not sure what you mean re point out where the reader can find current state. Can you give me an example of the comment you have in mind?
/** | ||
* @name _doc_send_to_es | ||
* | ||
* @description Depends upon the es object to make ES requests, and also |
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 don't think this comment is useful
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's not the most insightful comment, but it does give some idea of the relationship with the other actors in our codebase, so I'd like to leave it unless we can come up with a more meaningful description. :)
/** | ||
* @name DocSource | ||
* | ||
* @description This class is tightly coupled with _doc_send_to_es. Its primary |
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.
The relationship between this class and _doc_send_to_es doesn't really describe the class 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.
I think you'll need to illuminate me...
/** | ||
* @name es | ||
* | ||
* @description This is the result of calling esFactory. Where is esFactory |
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.
esFactory is exposed by the elasticsearch.angular.js client
@@ -24,7 +34,6 @@ export default function VisFactory(Notifier, Private) { | |||
|
|||
this.indexPattern = indexPattern; | |||
|
|||
// http://aphyr.com/data/posts/317/state.gif |
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.
party pooper
if (!angular.equals($state.vis, savedVisState)) { | ||
// This is used to generate a 'uiState' PersistedState instance, and | ||
// implictly add 'change' and 'fetch_with_changes' event handlers. | ||
const appState = new AppState(stateDefaults); |
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 don't see how the change
or fetch_with_changes
listeners are of any importance here. All that maters is that the properties of the appState are synced with the url, right? In order to save changes call appState.save()
any changed from the url will be reflected in the properties of the appState
@@ -258,6 +285,9 @@ function VisEditor($scope, $route, timefilter, AppState, $location, kbnUrl, $tim | |||
kbnUrl.change('/visualize', {}); | |||
}; | |||
|
|||
/** | |||
* Called when the user clicks "Save" 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.
This is probably unnecessary
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 would agree if the name of the method was something like onClickSave
to indicate that this is part of the interface exposed to the template. But since the role of this method is a little unclear from the name, I'd like to leave this comment until we refactor and clarify naming.
* | ||
* @extends SavedObject. | ||
* | ||
* @description It's a type of SavedObject, but specific to visualizations. |
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 seeing the value in this description
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 do. :)
f191358
to
bd21af2
Compare
bd21af2
to
00f532e
Compare
jenkins, test this |
…cess. The goal is to clarify where URL state is coming from, when working with visualizations. Some of the classes touched upon are: SavedVis, PersistedState, AppState, and base classes. Explored files: - src/core_plugins/kibana/public/visualize/editor/editor.js - src/core_plugins/kibana/public/visualize/saved_visualizations/_saved_vis.js - src/ui/public/courier/data_source/_doc_send_to_es.js - src/ui/public/courier/data_source/doc_source.js - src/ui/public/courier/saved_object/saved_object.js - src/ui/public/es.js - src/ui/public/events.js - src/ui/public/persisted_state/persisted_state.js - src/ui/public/state_management/app_state.js - src/ui/public/state_management/state.js - src/ui/public/vis/agg_config.js - src/ui/public/vis/agg_configs.js - src/ui/public/vis/vis.js
00f532e
to
34e3f49
Compare
@cjcenizal To help in our ongoing quest to make backports easier, please backport this to 5.x and 5.0 |
--------- **Commit 1:** Add comments and inline docs for visualization saving and editing process. The goal is to clarify where URL state is coming from, when working with visualizations. Some of the classes touched upon are: SavedVis, PersistedState, AppState, and base classes. Explored files: - src/core_plugins/kibana/public/visualize/editor/editor.js - src/core_plugins/kibana/public/visualize/saved_visualizations/_saved_vis.js - src/ui/public/courier/data_source/_doc_send_to_es.js - src/ui/public/courier/data_source/doc_source.js - src/ui/public/courier/saved_object/saved_object.js - src/ui/public/es.js - src/ui/public/events.js - src/ui/public/persisted_state/persisted_state.js - src/ui/public/state_management/app_state.js - src/ui/public/state_management/state.js - src/ui/public/vis/agg_config.js - src/ui/public/vis/agg_configs.js - src/ui/public/vis/vis.js * Original sha: 34e3f49 * Authored by CJ Cenizal <[email protected]> on 2016-08-10T00:10:48Z
--------- **Commit 1:** Add comments and inline docs for visualization saving and editing process. The goal is to clarify where URL state is coming from, when working with visualizations. Some of the classes touched upon are: SavedVis, PersistedState, AppState, and base classes. Explored files: - src/core_plugins/kibana/public/visualize/editor/editor.js - src/core_plugins/kibana/public/visualize/saved_visualizations/_saved_vis.js - src/ui/public/courier/data_source/_doc_send_to_es.js - src/ui/public/courier/data_source/doc_source.js - src/ui/public/courier/saved_object/saved_object.js - src/ui/public/es.js - src/ui/public/events.js - src/ui/public/persisted_state/persisted_state.js - src/ui/public/state_management/app_state.js - src/ui/public/state_management/state.js - src/ui/public/vis/agg_config.js - src/ui/public/vis/agg_configs.js - src/ui/public/vis/vis.js * Original sha: 34e3f49 * Authored by CJ Cenizal <[email protected]> on 2016-08-10T00:10:48Z
[backport] PR #8208 to 5.x - Add comments and inline docs for visualization saving and editing process.
Backported to 5.0 and 5.x. |
--------- **Commit 1:** Add comments and inline docs for visualization saving and editing process. The goal is to clarify where URL state is coming from, when working with visualizations. Some of the classes touched upon are: SavedVis, PersistedState, AppState, and base classes. Explored files: - src/core_plugins/kibana/public/visualize/editor/editor.js - src/core_plugins/kibana/public/visualize/saved_visualizations/_saved_vis.js - src/ui/public/courier/data_source/_doc_send_to_es.js - src/ui/public/courier/data_source/doc_source.js - src/ui/public/courier/saved_object/saved_object.js - src/ui/public/es.js - src/ui/public/events.js - src/ui/public/persisted_state/persisted_state.js - src/ui/public/state_management/app_state.js - src/ui/public/state_management/state.js - src/ui/public/vis/agg_config.js - src/ui/public/vis/agg_configs.js - src/ui/public/vis/vis.js * Original sha: 3cf76b6004f98d694cb0d31831035e806f71357c [formerly 34e3f49] * Authored by CJ Cenizal <[email protected]> on 2016-08-10T00:10:48Z Former-commit-id: 433c265
[backport] PR elastic#8208 to 5.x - Add comments and inline docs for visualization saving and editing process. Former-commit-id: 8752eea
Supersedes #7968
The goal is to clarify where URL state is coming from, when working with visualizations. Some of the classes touched upon are: SavedVis, PersistedState, AppState, and base classes.
Explored files: