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

Changes settings to management #7284

Merged
merged 17 commits into from
Jun 15, 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
8 changes: 4 additions & 4 deletions src/plugins/kibana/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@ module.exports = function (kibana) {
title: 'Kibana',
listed: false,
description: 'the kibana you know and love',
//icon: 'plugins/kibana/settings/sections/about/barcode.svg',
main: 'plugins/kibana/kibana',
uses: [
'visTypes',
'spyModes',
'fieldFormats',
'navbarExtensions',
'settingsSections',
'managementSections',
'docViews'
],

Expand Down Expand Up @@ -62,11 +61,12 @@ module.exports = function (kibana) {
icon: 'plugins/kibana/assets/dashboard.svg',
},
{
title: 'Settings',
title: 'Management',
order: 1000,
url: '/app/kibana#/settings',
url: '/app/kibana#/management',
description: 'define index patterns, change config, and more',
icon: 'plugins/kibana/assets/settings.svg',
linkToLastSubUrl: false
}
],
injectDefaultVars(server, options) {
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/kibana/public/dashboard/components/panel/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ uiModules
const filterManager = Private(FilterManagerProvider);
const notify = new Notifier();

const services = require('plugins/kibana/settings/saved_object_registry').all().map(function (serviceObj) {
const services = require('plugins/kibana/management/saved_object_registry').all().map(function (serviceObj) {
const service = $injector.get(serviceObj.service);
return {
type: service.type,
Expand Down Expand Up @@ -79,7 +79,7 @@ uiModules
const service = _.find(services, { type: type });
if (!service) return;

$scope.editUrl = '#settings/objects/' + service.name + '/' + id + '?notFound=' + e.savedObjectType;
$scope.editUrl = '#management/kibana/objects/' + service.name + '/' + id + '?notFound=' + e.savedObjectType;
});

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const module = uiModules.get('app/dashboard');

// Register this service with the saved object registry so it can be
// edited by the object editor.
require('plugins/kibana/settings/saved_object_registry').register({
require('plugins/kibana/management/saved_object_registry').register({
service: 'savedDashboards',
title: 'dashboards'
});
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/kibana/public/discover/controllers/discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ uiRoutes
return savedSearches.get($route.current.params.id)
.catch(courier.redirectWhenMissing({
'search': '/discover',
'index-pattern': '/settings/objects/savedSearches/' + $route.current.params.id
'index-pattern': '/management/kibana/objects/savedSearches/' + $route.current.params.id
}));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const module = uiModules.get('discover/saved_searches', [

// Register this service with the saved object registry so it can be
// edited by the object editor.
require('plugins/kibana/settings/saved_object_registry').register({
require('plugins/kibana/management/saved_object_registry').register({
service: 'savedSearches',
title: 'searches'
});
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/kibana/public/kibana.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'ui/autoload/all';
import 'plugins/kibana/discover/index';
import 'plugins/kibana/visualize/index';
import 'plugins/kibana/dashboard/index';
import 'plugins/kibana/settings/index';
import 'plugins/kibana/management/index';
import 'plugins/kibana/doc';
import 'ui/vislib';
import 'ui/agg_response';
Expand Down
23 changes: 23 additions & 0 deletions src/plugins/kibana/public/management/app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<div class="app-container">
<nav class="navbar navbar-default navbar-static-top subnav" data-test-subj="managementNav">
<bread-crumbs omit-current-page="true"></bread-crumbs>

<ul class="nav navbar-nav">
<li class="current-page" ng-hide="sectionName">
{{::section.display}}
</li>

<li
ng-if="sectionName"
ng-repeat="item in section.items.inOrder"
ng-class="item.class">

<a class="navbar-link" kbn-href="{{::item.url}}" data-test-subj="{{::item.name}}">
{{::item.display}}
</a>
</li>
</ul>
</nav>

<div role="main" class="management-container" ng-transclude></div>
</div>
64 changes: 64 additions & 0 deletions src/plugins/kibana/public/management/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import _ from 'lodash';

import 'plugins/kibana/management/sections';
import 'plugins/kibana/management/styles/main.less';
import 'ui/filters/start_from';
import 'ui/field_editor';
import 'plugins/kibana/management/sections/indices/_indexed_fields';
import 'plugins/kibana/management/sections/indices/_scripted_fields';
import 'ui/directives/bread_crumbs';
import uiRoutes from 'ui/routes';
import uiModules from 'ui/modules';
import appTemplate from 'plugins/kibana/management/app.html';
import landingTemplate from 'plugins/kibana/management/landing.html';
import chrome from 'ui/chrome/chrome';
import management from 'ui/management';

uiRoutes
.when('/management', {
template: landingTemplate
});

require('ui/index_patterns/route_setup/load_default')({
notRequiredRe: /^\/management\/data\//,
whenMissingRedirectTo: '/management/data/index'
});

uiModules
.get('apps/management')
.directive('kbnManagementApp', function (Private, $route, $location, timefilter, buildNum, buildSha) {
return {
restrict: 'E',
template: appTemplate,
transclude: true,
scope: {
sectionName: '@section'
},

link: function ($scope) {
timefilter.enabled = false;
$scope.sections = management.items.inOrder;
$scope.section = management.getSection($scope.sectionName) || management;

if ($scope.section) {
$scope.section.items.forEach(item => {
item.class = `#${$location.path()}`.indexOf(item.url) > -1 ? 'active' : undefined;
});
}

management.getSection('kibana').info = `Build ${buildNum}, Commit SHA ${buildSha.substr(0, 8)}`;
}
};
});

uiModules
.get('apps/management')
.directive('kbnManagementLanding', function (kbnVersion) {
return {
restrict: 'E',
link: function ($scope) {
$scope.sections = management.items.inOrder;
$scope.kbnVersion = kbnVersion;
}
};
});
45 changes: 45 additions & 0 deletions src/plugins/kibana/public/management/landing.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<kbn-management-app>
<kbn-management-landing>
<div class="product-overview">
<span class="kibana-version">Version: {{::kbnVersion}}</span>
</div>
<div class="management-sections">
<div
ng-if="section.items.length > 0"
ng-repeat="section in sections"
ng-class="{ 'management-section-info-expanded': section.showInfo }"
class="col-xs-12 management-section management-section-{{::section.id}}">

<div class="panel panel-product management-panel-product">
<div class="panel-heading panel-heading-{{::section.id}}">
{{::section.display}}

<i
class="fa fa-info-circle pull-right panel-heading-icon"
ng-click="section.showInfo = !!!section.showInfo"
ng-if="section.info">
</i>
</div>

<div class="panel-body">
<div class="row">
<ul class="management-section-items list-unstyled">
<li
class="col-xs-4 col-md-3"
ng-repeat="item in section.items.inOrder">

<a class="management-link" kbn-href="{{::item.url}}">
{{::item.display}}
</a>
</li>
</ul>
</div>
<div class="management-section-info">
{{::section.info}}
</div>
</div>
</div>
</div>
</div>
</kbn-management-landing>
</kbn-management-app>
3 changes: 3 additions & 0 deletions src/plugins/kibana/public/management/sections/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import 'plugins/kibana/management/sections/settings';
import 'plugins/kibana/management/sections/objects';
import 'plugins/kibana/management/sections/indices';
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<kbn-settings-app section="indices">
<kbn-settings-indices>
<div ng-controller="settingsIndicesCreate" class="kbn-settings-indices-create">
<kbn-management-app section="data">
<kbn-management-indices>
<div ng-controller="managementIndicesCreate" class="kbn-management-indices-create">
<div class="page-header">
<h1>Configure an index pattern</h1>
In order to use Kibana you must configure at least one index pattern. Index patterns are
Expand Down Expand Up @@ -177,5 +177,5 @@ <h4>Time-interval based index patterns are deprecated!</h4>
</form>
</div>
</div>
</kbn-settings-indices>
</kbn-settings-app>
</kbn-management-indices>
</kbn-management-app>
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@ import moment from 'moment';
import { IndexPatternMissingIndices } from 'ui/errors';
import 'ui/directives/validate_index_name';
import 'ui/directives/auto_select_if_only_one';
import PluginsKibanaSettingsSectionsIndicesRefreshKibanaIndexProvider from 'plugins/kibana/settings/sections/indices/_refresh_kibana_index';
import RefreshKibanaIndex from 'plugins/kibana/management/sections/indices/_refresh_kibana_index';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

God, thank you for this. Haha

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LukasYouAreVeryWelcomeForThisLittleGemOfAVariableName

import uiRoutes from 'ui/routes';
import uiModules from 'ui/modules';
import createTemplate from 'plugins/kibana/settings/sections/indices/_create.html';

import createTemplate from 'plugins/kibana/management/sections/indices/_create.html';

uiRoutes
.when('/settings/indices/', {
.when('/management/data/index/', {
template: createTemplate
});

uiModules.get('apps/settings')
.controller('settingsIndicesCreate', function ($scope, kbnUrl, Private, Notifier, indexPatterns, es, config, Promise) {
uiModules.get('apps/management')
.controller('managementIndicesCreate', function ($scope, kbnUrl, Private, Notifier, indexPatterns, es, config, Promise) {
const notify = new Notifier();
const refreshKibanaIndex = Private(PluginsKibanaSettingsSectionsIndicesRefreshKibanaIndexProvider);
const refreshKibanaIndex = Private(RefreshKibanaIndex);
const intervals = indexPatterns.intervals;
let samplePromise;

Expand Down Expand Up @@ -73,7 +72,7 @@ uiModules.get('apps/settings')
config.set('defaultIndex', indexPattern.id);
}
indexPatterns.cache.clear(indexPattern.id);
kbnUrl.change('/settings/indices/' + indexPattern.id);
kbnUrl.change('/management/kibana/indices/' + indexPattern.id);
});
}
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<kbn-settings-app section="indices">
<kbn-settings-indices>
<div ng-controller="settingsIndicesEdit">
<kbn-management-app section="kibana">
<kbn-management-indices>
<div ng-controller="managementIndicesEdit">
<div class="page-header">
<kbn-settings-index-header
<kbn-management-index-header
index-pattern="indexPattern"
set-default="setDefaultPattern()"
refresh-fields="indexPattern.refreshFields()"
delete="removePattern()">
</kbn-settings-index-header>
</kbn-management-index-header>

<p>
This page lists every field in the <strong>{{::indexPattern.id}}</strong>
Expand Down Expand Up @@ -38,7 +38,7 @@
<br />

<ul class="nav nav-tabs">
<li class="kbn-settings-tab" ng-class="{ active: state.tab === fieldType.index }" ng-repeat="fieldType in fieldTypes">
<li class="kbn-management-tab" ng-class="{ active: state.tab === fieldType.index }" ng-repeat="fieldType in fieldTypes">
<a ng-click="changeTab(fieldType)">
{{ fieldType.title }}
<small>({{ fieldType.count }})</small>
Expand All @@ -50,5 +50,5 @@
<scripted-fields ng-show="state.tab == 'scriptedFields'" class="fields scripted-fields"></scripted-fields>

</div>
</kbn-settings-indices>
</kbn-settings-app>
</kbn-management-indices>
</kbn-management-app>
Original file line number Diff line number Diff line change
@@ -1,38 +1,44 @@
import _ from 'lodash';
import 'plugins/kibana/settings/sections/indices/_indexed_fields';
import 'plugins/kibana/settings/sections/indices/_scripted_fields';
import 'plugins/kibana/settings/sections/indices/_index_header';
import PluginsKibanaSettingsSectionsIndicesRefreshKibanaIndexProvider from 'plugins/kibana/settings/sections/indices/_refresh_kibana_index';
import 'plugins/kibana/management/sections/indices/_indexed_fields';
import 'plugins/kibana/management/sections/indices/_scripted_fields';
import 'plugins/kibana/management/sections/indices/_index_header';
import RefreshKibanaIndex from 'plugins/kibana/management/sections/indices/_refresh_kibana_index';
import UrlProvider from 'ui/url';
import PluginsKibanaSettingsSectionsIndicesFieldTypesProvider from 'plugins/kibana/settings/sections/indices/_field_types';
import IndicesFieldTypesProvider from 'plugins/kibana/management/sections/indices/_field_types';
import uiRoutes from 'ui/routes';
import uiModules from 'ui/modules';
import editTemplate from 'plugins/kibana/settings/sections/indices/_edit.html';
import editTemplate from 'plugins/kibana/management/sections/indices/_edit.html';

uiRoutes
.when('/settings/indices/:indexPatternId', {
.when('/management/kibana/indices/:indexPatternId?', {
template: editTemplate,
resolve: {
indexPattern: function ($route, courier) {
return courier.indexPatterns.get($route.current.params.indexPatternId)
.catch(courier.redirectWhenMissing('/settings/indices'));
indexPattern: function ($route, config, courier) {
const params = $route.current.params;

if (typeof params.indexPatternId === 'undefined') {
params.indexPatternId = config.get('defaultIndex');
}

return courier.indexPatterns.get(params.indexPatternId)
.catch(courier.redirectWhenMissing('/management/data/index'));
}
}
});

uiModules.get('apps/settings')
.controller('settingsIndicesEdit', function ($scope, $location, $route, config, courier, Notifier, Private, AppState, docTitle) {
uiModules.get('apps/management')
.controller('managementIndicesEdit', function ($scope, $location, $route, config, courier, Notifier, Private, AppState, docTitle) {

const notify = new Notifier();
const $state = $scope.state = new AppState();
const refreshKibanaIndex = Private(PluginsKibanaSettingsSectionsIndicesRefreshKibanaIndexProvider);
const refreshKibanaIndex = Private(RefreshKibanaIndex);

$scope.kbnUrl = Private(UrlProvider);
$scope.indexPattern = $route.current.locals.indexPattern;
docTitle.change($scope.indexPattern.id);
const otherIds = _.without($route.current.locals.indexPatternIds, $scope.indexPattern.id);

const fieldTypes = Private(PluginsKibanaSettingsSectionsIndicesFieldTypesProvider);
const fieldTypes = Private(IndicesFieldTypesProvider);
$scope.$watch('indexPattern.fields', function () {
$scope.fieldTypes = fieldTypes($scope.indexPattern);
});
Expand Down Expand Up @@ -65,7 +71,7 @@ uiModules.get('apps/settings')
courier.indexPatterns.delete($scope.indexPattern)
.then(refreshKibanaIndex)
.then(function () {
$location.url('/settings/indices');
$location.url('/management/data/index');
})
.catch(notify.fatal);
};
Expand Down
Loading