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

Settings sections registry #6077

Merged
merged 8 commits into from
Feb 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/plugins/kibana/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ module.exports = function (kibana) {
'visTypes',
'spyModes',
'fieldFormats',
'navbarExtensions'
'navbarExtensions',
'settingsSections'
],

injectVars: function (server, options) {
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/kibana/public/kibana.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// autoloading

// preloading (for faster webpack builds)

import moment from 'moment-timezone';
import chrome from 'ui/chrome';
import routes from 'ui/routes';
Expand All @@ -13,7 +12,6 @@ import 'plugins/kibana/discover/index';
import 'plugins/kibana/visualize/index';
import 'plugins/kibana/dashboard/index';
import 'plugins/kibana/settings/index';
import 'plugins/kibana/settings/sections';
import 'plugins/kibana/doc';
import 'ui/vislib';
import 'ui/agg_response';
Expand Down
13 changes: 9 additions & 4 deletions src/plugins/kibana/public/settings/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import _ from 'lodash';
import sections from 'plugins/kibana/settings/sections/index';
import 'plugins/kibana/settings/sections/indices/index';
import 'plugins/kibana/settings/sections/advanced/index';
import 'plugins/kibana/settings/sections/objects/index';
import 'plugins/kibana/settings/sections/status/index';
import 'plugins/kibana/settings/sections/about/index';
import 'plugins/kibana/settings/styles/main.less';
import 'ui/filters/start_from';
import 'ui/field_editor';
import 'plugins/kibana/settings/sections/indices/_indexed_fields';
import 'plugins/kibana/settings/sections/indices/_scripted_fields';
define(function (require) {

import registry from 'ui/registry/settings_sections';

define(function (require) {
require('ui/routes')
.when('/settings', {
redirectTo: '/settings/indices'
Expand All @@ -21,6 +25,7 @@ define(function (require) {
require('ui/modules')
.get('apps/settings')
.directive('kbnSettingsApp', function (Private, $route, timefilter) {
const sections = Private(registry);
return {
restrict: 'E',
template: require('plugins/kibana/settings/app.html'),
Expand All @@ -30,7 +35,7 @@ define(function (require) {
},
link: function ($scope, $el) {
timefilter.enabled = false;
$scope.sections = sections;
$scope.sections = sections.inOrder;
$scope.section = _.find($scope.sections, { name: $scope.sectionName });

$scope.sections.forEach(function (section) {
Expand Down
9 changes: 5 additions & 4 deletions src/plugins/kibana/public/settings/sections/about/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import _ from 'lodash';
define(function (require) {
import registry from 'ui/registry/settings_sections';

define(function (require) {
require('ui/routes')
.when('/settings/about', {
template: require('plugins/kibana/settings/sections/about/index.html')
Expand All @@ -13,10 +14,10 @@ define(function (require) {
$scope.buildSha = buildSha;
});

return {
order: Infinity,
registry.register(_.constant({
order: 1001,
name: 'about',
display: 'About',
url: '#/settings/about'
};
}));
});
9 changes: 4 additions & 5 deletions src/plugins/kibana/public/settings/sections/advanced/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import _ from 'lodash';
import registry from 'ui/registry/settings_sections';
import toEditableConfig from 'plugins/kibana/settings/sections/advanced/lib/to_editable_config';
import 'plugins/kibana/settings/sections/advanced/advanced_row';
define(function (require) {



define(function (require) {
require('ui/routes')
.when('/settings/advanced', {
template: require('plugins/kibana/settings/sections/advanced/index.html')
Expand Down Expand Up @@ -52,10 +51,10 @@ define(function (require) {
};
});

return {
registry.register(_.constant({
order: 2,
name: 'advanced',
display: 'Advanced',
url: '#/settings/advanced'
};
}));
});
11 changes: 0 additions & 11 deletions src/plugins/kibana/public/settings/sections/index.js

This file was deleted.

11 changes: 6 additions & 5 deletions src/plugins/kibana/public/settings/sections/indices/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import _ from 'lodash';
import registry from 'ui/registry/settings_sections';
import 'plugins/kibana/settings/sections/indices/_create';
import 'plugins/kibana/settings/sections/indices/_edit';
import 'plugins/kibana/settings/sections/indices/_field_editor';
define(function (require) {


define(function (require) {
// add a dependency to all of the subsection routes
require('ui/routes')
.defaults(/settings\/indices/, {
Expand Down Expand Up @@ -43,9 +43,10 @@ define(function (require) {
};
});

return {
registry.register(_.constant({
order: 1,
name: 'indices',
display: 'Indices',
url: '#/settings/indices',
};
url: '#/settings/indices'
}));
});
9 changes: 5 additions & 4 deletions src/plugins/kibana/public/settings/sections/objects/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import _ from 'lodash';
import registry from 'ui/registry/settings_sections';
import 'plugins/kibana/settings/sections/objects/_view';
import 'plugins/kibana/settings/sections/objects/_objects';
import 'ace';
import 'ui/directives/confirm_click';
define(function (require) {


// add the module deps to this module
require('ui/modules').get('apps/settings');

return {
registry.register(_.constant({
order: 3,
name: 'objects',
display: 'Objects',
url: '#/settings/objects'
};
}));
});
9 changes: 5 additions & 4 deletions src/plugins/kibana/public/settings/sections/status/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import _ from 'lodash';
define(function (require) {
import registry from 'ui/registry/settings_sections';

return {
order: 3,
define(function (require) {
registry.register(_.constant({
order: 1000,
name: 'status',
display: 'Status',
url: '/status'
};
}));
});
6 changes: 6 additions & 0 deletions src/ui/public/registry/settings_sections.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
define(function (require) {
return require('ui/registry/_registry')({
name: 'settingsSections',
order: ['order']
});
});
1 change: 1 addition & 0 deletions src/ui/ui_exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class UiExports {
case 'spyModes':
case 'chromeNavControls':
case 'navbarExtensions':
case 'settingsSections':
return (plugin, spec) => {
this.aliases[type] = _.union(this.aliases[type] || [], spec);
};
Expand Down