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

ui/management -> new platform #45747

Merged
merged 53 commits into from
Dec 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
21bf0ac
Management plugin initial update
sainthkh Sep 13, 2019
a3e8776
Removed IndexPatternListRegistry and TypeScriptified index_pattern_li…
sainthkh Sep 14, 2019
a2bd976
Prettierize files.
sainthkh Sep 15, 2019
f6e7ef7
TypeScriptify index_pattern_creation.
sainthkh Sep 15, 2019
e989b1c
Prettierize section files.
sainthkh Sep 15, 2019
2bad2cb
Added IndexPatternManagementService.
sainthkh Sep 16, 2019
c5bed68
Added SavedObjectsManagementService.
sainthkh Sep 16, 2019
20036cd
Reverted the name to getType()
sainthkh Sep 16, 2019
09c2483
Prettierize files.
sainthkh Sep 16, 2019
f2188f1
Exported types.
sainthkh Sep 16, 2019
6c47d86
Removed ui/management/index_pattern_creation.
sainthkh Sep 16, 2019
77f77f0
Prettierize files.
sainthkh Sep 16, 2019
d9671dd
Changed arrow functions to normal ones.
sainthkh Sep 16, 2019
503362e
Removed ui/management/index_pattern_list.
sainthkh Sep 16, 2019
5e03940
Exported types.
sainthkh Sep 16, 2019
15bd13c
Prettierize files.
sainthkh Sep 16, 2019
2305c04
Removed ui/management/saved_objects_management.
sainthkh Sep 16, 2019
2815f41
Fixed injector error.
sainthkh Sep 16, 2019
571e470
Fixed CreateIndexPatternWizard error.
sainthkh Sep 16, 2019
aba8b25
Prettierize
sainthkh Sep 16, 2019
738cd1a
Removed destructuring to fix CreateIndexPatternWizard step 2.
sainthkh Sep 16, 2019
58091b3
Changed key variable from static to public readonly.
sainthkh Sep 17, 2019
fb7762b
Prettierize api.js.
sainthkh Sep 17, 2019
409ce68
Changed the IndexPatternCreationConfig to use core.http.
sainthkh Sep 17, 2019
10ee194
Fixed i18n errors.
sainthkh Sep 17, 2019
d456a06
Fixed error caused by arrow function.
sainthkh Sep 18, 2019
a451566
Fixed type error.
sainthkh Sep 18, 2019
9a50fc3
Merge branch 'master' into management-plugin
elasticmachine Oct 3, 2019
d33df5d
Merge remote-tracking branch 'upstream/master' into management-plugin
sainthkh Oct 4, 2019
c57b0bb
Fixed jest tests.
sainthkh Oct 4, 2019
0ae9fe6
Fixed x-pack test failure.
sainthkh Oct 4, 2019
772a71f
Merge branch 'master' into management-plugin
sainthkh Oct 14, 2019
eb8e19d
Merge branch 'master' into management-plugin
sainthkh Oct 22, 2019
c26977c
Merge branch 'master' into management-plugin
mattkime Nov 13, 2019
a3a84e4
Merge branch 'master' into management-plugin
elasticmachine Nov 13, 2019
599f4bc
Merge branch 'master' into management-plugin
elasticmachine Nov 14, 2019
7da34a4
Fixed eslint error.
sainthkh Nov 14, 2019
8e07187
Merge remote-tracking branch 'upstream/master' into management-plugin
sainthkh Nov 15, 2019
147924f
Fixed hybrid index pattern test failure.
sainthkh Nov 15, 2019
1f66381
Exported specific names.
sainthkh Nov 15, 2019
326512b
Merge branch 'master' into management-plugin
elasticmachine Nov 15, 2019
f263c96
Merge branch 'master' into management-plugin
elasticmachine Nov 15, 2019
706a531
typescript fix
mattkime Nov 15, 2019
99429c2
try simpler url for /api/rollup/indices
mattkime Nov 15, 2019
226acda
Merge branch 'master' into management-plugin
elasticmachine Nov 18, 2019
7187dcf
Merge branch 'master' into management-plugin
elasticmachine Nov 19, 2019
1caebf9
Merge branch 'master' into management-plugin
sainthkh Nov 20, 2019
0301e7c
Removed anys.
sainthkh Nov 20, 2019
4cb7f4b
Merge branch 'master' into management-plugin
elasticmachine Nov 21, 2019
ad6500d
Used new data types.
sainthkh Nov 22, 2019
49752d3
Merge remote-tracking branch 'upstream/master' into management-plugin
sainthkh Nov 22, 2019
265677c
Merge remote-tracking branch 'origin/management-plugin' into manageme…
sainthkh Nov 22, 2019
ab9a2dc
Merge branch 'master' into management-plugin
elasticmachine Dec 9, 2019
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
1 change: 1 addition & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"kbn": "src/legacy/core_plugins/kibana",
"kbnDocViews": "src/legacy/core_plugins/kbn_doc_views",
"kbnVislibVisTypes": "src/legacy/core_plugins/kbn_vislib_vis_types",
"management": "src/legacy/core_plugins/management",
lukeelmers marked this conversation as resolved.
Show resolved Hide resolved
"kibana_react": "src/legacy/core_plugins/kibana_react",
"kibana-react": "src/plugins/kibana_react",
"kibana_utils": "src/plugins/kibana_utils",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ export class StepTimeField extends Component {
constructor(props) {
super(props);

const { getIndexPatternType, getIndexPatternName } = props.indexPatternCreationType;
lukeelmers marked this conversation as resolved.
Show resolved Hide resolved

this.state = {
error: '',
timeFields: [],
Expand All @@ -61,8 +59,8 @@ export class StepTimeField extends Component {
isFetchingTimeFields: false,
isCreating: false,
indexPatternId: '',
indexPatternType: getIndexPatternType(),
indexPatternName: getIndexPatternName(),
indexPatternType: props.indexPatternCreationType.getIndexPatternType(),
indexPatternName: props.indexPatternCreationType.getIndexPatternName(),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { SavedObjectsClientProvider } from 'ui/saved_objects';
import uiRoutes from 'ui/routes';
import angularTemplate from './angular_template.html';
import 'ui/index_patterns';
import { IndexPatternCreationFactory } from 'ui/management/index_pattern_creation';
import { setup as managementSetup } from '../../../../../../management/public/legacy';
import { getCreateBreadcrumbs } from '../breadcrumbs';

import { renderCreateIndexPatternWizard, destroyCreateIndexPatternWizard } from './render';
Expand All @@ -35,8 +35,9 @@ uiRoutes.when('/management/kibana/index_pattern', {
const Private = $injector.get('Private');
$scope.$$postDigest(() => {
const $routeParams = $injector.get('$routeParams');
const indexPatternCreationProvider = Private(IndexPatternCreationFactory)($routeParams.type);
const indexPatternCreationType = indexPatternCreationProvider.getType();
const indexPatternCreationType = managementSetup.indexPattern.creation.getType(
$routeParams.type
);
const services = {
config: $injector.get('config'),
es: $injector.get('es'),
Expand All @@ -52,12 +53,9 @@ uiRoutes.when('/management/kibana/index_pattern', {

const initialQuery = $routeParams.id ? decodeURIComponent($routeParams.id) : undefined;

renderCreateIndexPatternWizard(
initialQuery,
services
);
renderCreateIndexPatternWizard(initialQuery, services);
});

$scope.$on('$destroy', destroyCreateIndexPatternWizard);
}
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import uiRoutes from 'ui/routes';
import { uiModules } from 'ui/modules';
import template from './edit_index_pattern.html';
import { fieldWildcardMatcher } from 'ui/field_wildcard';
import { IndexPatternListFactory } from 'ui/management/index_pattern_list';
import { setup as managementSetup } from '../../../../../../management/public/legacy';
import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { SourceFiltersTable } from './source_filters_table';
Expand Down Expand Up @@ -58,13 +58,17 @@ function updateSourceFiltersTable($scope, $state) {
filterFilter={$scope.fieldFilter}
fieldWildcardMatcher={$scope.fieldWildcardMatcher}
onAddOrRemoveFilter={() => {
$scope.editSections = $scope.editSectionsProvider($scope.indexPattern, $scope.fieldFilter, $scope.indexPatternListProvider);
$scope.editSections = $scope.editSectionsProvider(
$scope.indexPattern,
$scope.fieldFilter,
$scope.indexPatternListProvider
);
$scope.refreshFilters();
$scope.$apply();
}}
/>
</I18nContext>,
node,
node
);
});
} else {
Expand All @@ -77,7 +81,6 @@ function destroySourceFiltersTable() {
node && unmountComponentAtNode(node);
}


function updateScriptedFieldsTable($scope, $state) {
if ($state.tab === 'scriptedFields') {
$scope.$$postDigest(() => {
Expand All @@ -100,13 +103,17 @@ function updateScriptedFieldsTable($scope, $state) {
getRouteHref: (obj, route) => $scope.kbnUrl.getRouteHref(obj, route),
}}
onRemoveField={() => {
$scope.editSections = $scope.editSectionsProvider($scope.indexPattern, $scope.fieldFilter, $scope.indexPatternListProvider);
$scope.editSections = $scope.editSectionsProvider(
$scope.indexPattern,
$scope.fieldFilter,
$scope.indexPatternListProvider
);
$scope.refreshFilters();
$scope.$apply();
}}
/>
</I18nContext>,
node,
node
);
});
} else {
Expand Down Expand Up @@ -144,7 +151,7 @@ function updateIndexedFieldsTable($scope, $state) {
}}
/>
</I18nContext>,
node,
node
);
});
} else {
Expand All @@ -157,42 +164,48 @@ function destroyIndexedFieldsTable() {
node && unmountComponentAtNode(node);
}

uiRoutes
.when('/management/kibana/index_patterns/:indexPatternId', {
template,
k7Breadcrumbs: getEditBreadcrumbs,
resolve: {
indexPattern: function ($route, Promise, redirectWhenMissing, indexPatterns) {
return Promise.resolve(indexPatterns.get($route.current.params.indexPatternId))
.catch(redirectWhenMissing('/management/kibana/index_patterns'));
}
uiRoutes.when('/management/kibana/index_patterns/:indexPatternId', {
template,
k7Breadcrumbs: getEditBreadcrumbs,
resolve: {
indexPattern: function ($route, Promise, redirectWhenMissing, indexPatterns) {
return Promise.resolve(indexPatterns.get($route.current.params.indexPatternId)).catch(
redirectWhenMissing('/management/kibana/index_patterns')
);
},
});
},
});

uiModules.get('apps/management')
uiModules
.get('apps/management')
.controller('managementIndexPatternsEdit', function (
$scope, $location, $route, Promise, config, indexPatterns, Private, AppState, confirmModal) {
const $state = $scope.state = new AppState();
const indexPatternListProvider = Private(IndexPatternListFactory)();

$scope.fieldWildcardMatcher = (...args) => fieldWildcardMatcher(...args, config.get('metaFields'));
$scope.editSectionsProvider = Private(IndicesEditSectionsProvider);
$scope.kbnUrl = Private(KbnUrlProvider);
$scope.indexPattern = $route.current.locals.indexPattern;
$scope.indexPatternListProvider = indexPatternListProvider;
$scope.indexPattern.tags = indexPatternListProvider.getIndexPatternTags(
$scope.indexPatternListProvider = managementSetup.indexPattern.list;
$scope.indexPattern.tags = managementSetup.indexPattern.list.getIndexPatternTags(
$scope.indexPattern,
$scope.indexPattern.id === config.get('defaultIndex')
);
$scope.getFieldInfo = indexPatternListProvider.getFieldInfo;
$scope.getFieldInfo = managementSetup.indexPattern.list.getFieldInfo.bind(
managementSetup.indexPattern.list
);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this became undefined by this line. So, I added bind here.

docTitle.change($scope.indexPattern.title);

const otherPatterns = _.filter($route.current.locals.indexPatterns, pattern => {
return pattern.id !== $scope.indexPattern.id;
});

$scope.$watch('indexPattern.fields', function () {
$scope.editSections = $scope.editSectionsProvider($scope.indexPattern, $scope.fieldFilter, indexPatternListProvider);
$scope.editSections = $scope.editSectionsProvider(
$scope.indexPattern,
$scope.fieldFilter,
managementSetup.indexPattern.list
);
$scope.refreshFilters();
$scope.fields = $scope.indexPattern.getNonScriptedFields();
updateIndexedFieldsTable($scope, $state);
Expand Down Expand Up @@ -231,26 +244,26 @@ uiModules.get('apps/management')
});

$scope.$watchCollection('indexPattern.fields', function () {
$scope.conflictFields = $scope.indexPattern.fields
.filter(field => field.type === 'conflict');
$scope.conflictFields = $scope.indexPattern.fields.filter(field => field.type === 'conflict');
});

$scope.refreshFields = function () {
const confirmMessage = i18n.translate('kbn.management.editIndexPattern.refreshLabel', {
defaultMessage: 'This action resets the popularity counter of each field.'
defaultMessage: 'This action resets the popularity counter of each field.',
});
const confirmModalOptions = {
confirmButtonText: i18n.translate('kbn.management.editIndexPattern.refreshButton', { defaultMessage: 'Refresh' }),
confirmButtonText: i18n.translate('kbn.management.editIndexPattern.refreshButton', {
defaultMessage: 'Refresh',
}),
onConfirm: async () => {
await $scope.indexPattern.init(true);
$scope.fields = $scope.indexPattern.getNonScriptedFields();
},
title: i18n.translate('kbn.management.editIndexPattern.refreshHeader', { defaultMessage: 'Refresh field list?' })
title: i18n.translate('kbn.management.editIndexPattern.refreshHeader', {
defaultMessage: 'Refresh field list?',
}),
};
confirmModal(
confirmMessage,
confirmModalOptions
);
confirmModal(confirmMessage, confirmModalOptions);
};

$scope.removePattern = function () {
Expand All @@ -271,9 +284,13 @@ uiModules.get('apps/management')
}

const confirmModalOptions = {
confirmButtonText: i18n.translate('kbn.management.editIndexPattern.deleteButton', { defaultMessage: 'Delete' }),
confirmButtonText: i18n.translate('kbn.management.editIndexPattern.deleteButton', {
defaultMessage: 'Delete',
}),
onConfirm: doRemove,
title: i18n.translate('kbn.management.editIndexPattern.deleteHeader', { defaultMessage: 'Delete index pattern?' })
title: i18n.translate('kbn.management.editIndexPattern.deleteHeader', {
defaultMessage: 'Delete index pattern?',
}),
};
confirmModal('', confirmModalOptions);
};
Expand All @@ -285,7 +302,8 @@ uiModules.get('apps/management')
$scope.setIndexPatternsTimeField = function (field) {
if (field.type !== 'date') {
const errorMessage = i18n.translate('kbn.management.editIndexPattern.notDateErrorMessage', {
defaultMessage: 'That field is a {fieldType} not a date.', values: { fieldType: field.type }
defaultMessage: 'That field is a {fieldType} not a date.',
values: { fieldType: field.type },
});
toastNotifications.addDanger(errorMessage);
return;
Expand All @@ -295,12 +313,16 @@ uiModules.get('apps/management')
};

$scope.$watch('fieldFilter', () => {
$scope.editSections = $scope.editSectionsProvider($scope.indexPattern, $scope.fieldFilter, indexPatternListProvider);
$scope.editSections = $scope.editSectionsProvider(
$scope.indexPattern,
$scope.fieldFilter,
managementSetup.indexPattern.list
);
if ($scope.fieldFilter === undefined) {
return;
}

switch($state.tab) {
switch ($state.tab) {
case 'indexedFields':
updateIndexedFieldsTable($scope, $state);
case 'scriptedFields':
Expand Down
Loading