-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Refactor Visualize wizard. #8325
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
Closed
cjcenizal
wants to merge
1
commit into
elastic:master
from
cjcenizal:experiment/refactor-visualize-wizard
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,61 @@ | ||
| import 'plugins/kibana/visualize/styles/main.less'; | ||
| import 'plugins/kibana/visualize/editor/editor'; | ||
| import 'plugins/kibana/visualize/wizard/wizard'; | ||
| import 'plugins/kibana/visualize/editor/add_bucket_agg'; | ||
| import 'plugins/kibana/visualize/editor/agg'; | ||
| import 'plugins/kibana/visualize/editor/agg_add'; | ||
| import 'plugins/kibana/visualize/editor/agg_filter'; | ||
| import 'plugins/kibana/visualize/editor/agg_group'; | ||
| import 'plugins/kibana/visualize/editor/agg_param'; | ||
| import 'plugins/kibana/visualize/editor/agg_params'; | ||
| import 'plugins/kibana/visualize/editor/nesting_indicator'; | ||
| import 'plugins/kibana/visualize/editor/sidebar'; | ||
| import 'plugins/kibana/visualize/editor/vis_options'; | ||
| import 'plugins/kibana/visualize/editor/draggable_container'; | ||
| import 'plugins/kibana/visualize/editor/draggable_item'; | ||
| import 'plugins/kibana/visualize/editor/draggable_handle'; | ||
| import 'plugins/kibana/visualize/saved_visualizations/_saved_vis'; | ||
| import 'plugins/kibana/visualize/saved_visualizations/saved_visualizations'; | ||
| import uiRoutes from 'ui/routes'; | ||
| import './styles/main.less'; | ||
| import './editor/editor'; | ||
| import './editor/add_bucket_agg'; | ||
| import './editor/agg'; | ||
| import './editor/agg_add'; | ||
| import './editor/agg_filter'; | ||
| import './editor/agg_group'; | ||
| import './editor/agg_param'; | ||
| import './editor/agg_params'; | ||
| import './editor/nesting_indicator'; | ||
| import './editor/sidebar'; | ||
| import './editor/vis_options'; | ||
| import './editor/draggable_container'; | ||
| import './editor/draggable_item'; | ||
| import './editor/draggable_handle'; | ||
| import './saved_visualizations/_saved_vis'; | ||
| import './saved_visualizations/saved_visualizations'; | ||
| import '../discover/saved_searches/saved_searches'; | ||
| import '../../../../ui/public/directives/saved_object_finder'; | ||
| import '../../../../ui/public/directives/paginated_selectable_list'; | ||
|
|
||
| import routes from '../../../../ui/public/routes'; | ||
| import modules from '../../../../ui/public/modules'; | ||
| import RegistryVisTypesProvider from '../../../../ui/public/registry/vis_types'; | ||
|
|
||
| uiRoutes | ||
| .defaults(/visualize/, { | ||
| requireDefaultIndex: true | ||
| }) | ||
| .when('/visualize', { | ||
| redirectTo: '/visualize/step/1' | ||
| }); | ||
| const module = modules.get('app/visualize', ['kibana/courier']); | ||
|
|
||
| import step1Template from './wizard/step_1.html'; | ||
| import step1Controller from './wizard/step_1_controller'; | ||
| step1Controller(module, RegistryVisTypesProvider); | ||
|
|
||
| import step2Template from './wizard/step_2.html'; | ||
| import step2Controller from './wizard/step_2_controller'; | ||
| step2Controller(module); | ||
|
|
||
| routes | ||
| .defaults(/visualize/, { | ||
| requireDefaultIndex: true | ||
| }) | ||
| .when('/visualize', { | ||
| redirectTo: '/visualize/step/1' | ||
| }) | ||
| .when('/visualize/step/1', { | ||
| template: step1Template, | ||
| controller: 'VisualizeWizardStep1', | ||
| }) | ||
| .when('/visualize/step/2', { | ||
| template: step2Template, | ||
| controller: 'VisualizeWizardStep2', | ||
| resolve: { | ||
| indexPatternIds: function (courier) { | ||
| return courier.indexPatterns.getIds(); | ||
| } | ||
| }, | ||
| }); | ||
|
|
||
| // preloading | ||
|
|
||
| require('ui/saved_objects/saved_object_registry') | ||
| .register(require('plugins/kibana/visualize/saved_visualizations/saved_visualization_register')); | ||
| import savedObjectRegistry from '../../../../ui/public/saved_objects/saved_object_registry'; | ||
| import savedVisualizationRegister from './saved_visualizations/saved_visualization_register'; | ||
| savedObjectRegistry.register(savedVisualizationRegister); |
58 changes: 30 additions & 28 deletions
58
src/core_plugins/kibana/public/visualize/wizard/step_1.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,33 @@ | ||
| <bread-crumbs></bread-crumbs> | ||
| <div class="wizard"> | ||
| <div class="wizard-column"> | ||
| <h3 class="wizard-sub-title">Create New Visualization</h3> | ||
| <div class="wizard-row"> | ||
| <a | ||
| class="wizard-type" | ||
| ng-repeat="type in visTypes.inTitleOrder" | ||
| ng-href="{{ visTypeUrl(type) }}" | ||
| > | ||
| <div class="wizard-type-heading"> | ||
| <i | ||
| aria-hidden="true" | ||
| class="wizard-type-heading-icon fa fa-fw" | ||
| ng-class="type.icon" | ||
| ></i> | ||
| <h4 class="wizard-type-heading-text">{{type.title}}</h4> | ||
| </div> | ||
| <p class="wizard-type-description">{{type.description}}</p> | ||
| </a> | ||
| <div class="container-fluid vis-wizard"> | ||
| <bread-crumbs></bread-crumbs> | ||
| <div class="wizard"> | ||
| <div class="wizard-column"> | ||
| <h3 class="wizard-sub-title">Create New Visualization</h3> | ||
| <div class="wizard-row"> | ||
| <a | ||
| class="wizard-type" | ||
| ng-repeat="type in visTypes.inTitleOrder" | ||
| ng-href="{{ visTypeUrl(type) }}" | ||
| > | ||
| <div class="wizard-type-heading"> | ||
| <i | ||
| aria-hidden="true" | ||
| class="wizard-type-heading-icon fa fa-fw" | ||
| ng-class="type.icon" | ||
| ></i> | ||
| <h4 class="wizard-type-heading-text">{{type.title}}</h4> | ||
| </div> | ||
| <p class="wizard-type-description">{{type.description}}</p> | ||
| </a> | ||
| </div> | ||
| </div> | ||
| <div class="wizard-column"> | ||
| <h3 class="wizard-sub-title">Or, Open a Saved Visualization</h3> | ||
| <saved-object-finder | ||
| title="Saved Visualizations" | ||
| type="visualizations" | ||
| class="wizard-row" | ||
| ></saved-object-finder> | ||
| </div> | ||
| </div> | ||
| <div class="wizard-column"> | ||
| <h3 class="wizard-sub-title">Or, Open a Saved Visualization</h3> | ||
| <saved-object-finder | ||
| title="Saved Visualizations" | ||
| type="visualizations" | ||
| class="wizard-row" | ||
| ></saved-object-finder> | ||
| </div> | ||
| </div> | ||
11 changes: 11 additions & 0 deletions
11
src/core_plugins/kibana/public/visualize/wizard/step_1_controller.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| export default (module, RegistryVisTypesProvider) => { | ||
| module.controller('VisualizeWizardStep1', function ($scope, timefilter, Private) { | ||
| timefilter.enabled = false; | ||
|
|
||
| $scope.visTypes = Private(RegistryVisTypesProvider); | ||
| $scope.visTypeUrl = function (visType) { | ||
| if (!visType.requiresSearch) return '#/visualize/create?type=' + encodeURIComponent(visType.name); | ||
| else return '#/visualize/step/2?type=' + encodeURIComponent(visType.name); | ||
| }; | ||
| }); | ||
| }; |
40 changes: 21 additions & 19 deletions
40
src/core_plugins/kibana/public/visualize/wizard/step_2.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,24 @@ | ||
| <bread-crumbs></bread-crumbs> | ||
| <div class="wizard"> | ||
| <div class="wizard-column wizard-column--small"> | ||
| <h3 class="wizard-sub-title">From a New Search, Select Index</h3> | ||
| <paginated-selectable-list | ||
| per-page="20" | ||
| list="indexPattern.list" | ||
| user-make-url="makeUrl" | ||
| class="wizard-row" | ||
| ></paginated-selectable-list> | ||
| </div> | ||
| <div class="wizard-column wizard-column--large"> | ||
| <h3 class="wizard-sub-title">Or, From a Saved Search</h3> | ||
| <!-- Saved searches --> | ||
| <saved-object-finder | ||
| title="Saved Searches" | ||
| type="searches" | ||
| <div class="container-fluid vis-wizard"> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file remains unchanged, except for the addition of a new root element. |
||
| <bread-crumbs></bread-crumbs> | ||
| <div class="wizard"> | ||
| <div class="wizard-column wizard-column--small"> | ||
| <h3 class="wizard-sub-title">From a New Search, Select Index</h3> | ||
| <paginated-selectable-list | ||
| per-page="20" | ||
| list="indexPattern.list" | ||
| user-make-url="makeUrl" | ||
| class="wizard-row" | ||
| make-url="step2WithSearchUrl" | ||
| ></saved-object-finder> | ||
| ></paginated-selectable-list> | ||
| </div> | ||
| <div class="wizard-column wizard-column--large"> | ||
| <h3 class="wizard-sub-title">Or, From a Saved Search</h3> | ||
| <!-- Saved searches --> | ||
| <saved-object-finder | ||
| title="Saved Searches" | ||
| type="searches" | ||
| class="wizard-row" | ||
| make-url="step2WithSearchUrl" | ||
| ></saved-object-finder> | ||
| </div> | ||
| </div> | ||
| </div> | ||
21 changes: 21 additions & 0 deletions
21
src/core_plugins/kibana/public/visualize/wizard/step_2_controller.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| export default module => { | ||
| module.controller('VisualizeWizardStep2', function ($route, $scope, timefilter, kbnUrl) { | ||
| const type = $route.current.params.type; | ||
|
|
||
| $scope.step2WithSearchUrl = function (hit) { | ||
| return kbnUrl.eval('#/visualize/create?&type={{type}}&savedSearchId={{id}}', {type: type, id: hit.id}); | ||
| }; | ||
|
|
||
| timefilter.enabled = false; | ||
|
|
||
| $scope.indexPattern = { | ||
| selection: null, | ||
| list: $route.current.locals.indexPatternIds | ||
| }; | ||
|
|
||
| $scope.makeUrl = function (pattern) { | ||
| if (!pattern) return; | ||
| return `#/visualize/create?type=${type}&indexPattern=${pattern}`; | ||
| }; | ||
| }); | ||
| }; |
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 file remains unchanged, except for the addition of a new root element.