From 5859ecf455e17074bdfa566fd9ebbe1d82aa68a0 Mon Sep 17 00:00:00 2001 From: Matthew Bargar Date: Mon, 2 Oct 2017 17:43:52 -0400 Subject: [PATCH 1/3] Deprecate expression based scripted fields --- .../scripted_fields_table.html | 22 ++++++++++++++++++ .../scripted_fields_table.js | 9 ++++++++ src/ui/public/field_editor/field_editor.html | 23 ++++++++++++++++++- src/ui/public/field_editor/field_editor.js | 14 ++++++++--- src/ui/public/scripting_languages/index.js | 6 ++++- 5 files changed, 69 insertions(+), 5 deletions(-) diff --git a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/scripted_fields_table.html b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/scripted_fields_table.html index 46c3eb1ca50a..1ad6dfde19e0 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/scripted_fields_table.html +++ b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/scripted_fields_table.html @@ -6,6 +6,28 @@

These scripted fields are computed on the fly from your data. They can be used in visualizations and displayed in your documents, however they can not be searched. You can manage them here and add new ones as you see fit, but be careful, scripts can be tricky!

+
+
+ + + Deprecation Warning + +
+ +
+
+ We've detected that the following deprecated languages are in use: {{ getDeprecatedLanguagesInUse().join(', ') }}. + Support for these languages will be removed in the next major version of Kibana and Elasticsearch. + We recommend converting your scripted fields to + Painless. +
+
+
+ + diff --git a/src/ui/public/field_editor/field_editor.js b/src/ui/public/field_editor/field_editor.js index 7083719eb5b7..b93da6a5c697 100644 --- a/src/ui/public/field_editor/field_editor.js +++ b/src/ui/public/field_editor/field_editor.js @@ -8,7 +8,11 @@ import { uiModules } from 'ui/modules'; import fieldEditorTemplate from 'ui/field_editor/field_editor.html'; import '../directives/documentation_href'; import './field_editor.less'; -import { GetEnabledScriptingLanguagesProvider, getSupportedScriptingLanguages } from '../scripting_languages'; +import { + GetEnabledScriptingLanguagesProvider, + getSupportedScriptingLanguages, + getDeprecatedScriptingLanguages +} from '../scripting_languages'; import { getKbnTypeNames } from '../../../utils'; uiModules @@ -38,7 +42,7 @@ uiModules const notify = new Notifier({ location: 'Field Editor' }); getScriptingLangs().then((langs) => { - self.scriptingLangs = _.intersection(langs, ['expression', 'painless']); + self.scriptingLangs = langs; if (!_.includes(self.scriptingLangs, self.field.lang)) { self.field.lang = undefined; } @@ -103,6 +107,10 @@ uiModules ); }; + self.isSupportedLang = function (lang) { + return _.contains(getSupportedScriptingLanguages(), lang); + }; + $scope.$watch('editor.selectedFormatId', function (cur, prev) { const format = self.field.format; const changedFormat = cur !== prev; @@ -179,7 +187,7 @@ uiModules function getScriptingLangs() { return getEnabledScriptingLanguages() .then((enabledLanguages) => { - return _.intersection(enabledLanguages, getSupportedScriptingLanguages()); + return _.intersection(enabledLanguages, _.union(getSupportedScriptingLanguages(), getDeprecatedScriptingLanguages())); }); } diff --git a/src/ui/public/scripting_languages/index.js b/src/ui/public/scripting_languages/index.js index 74a38bf0f249..f773baa34488 100644 --- a/src/ui/public/scripting_languages/index.js +++ b/src/ui/public/scripting_languages/index.js @@ -4,7 +4,11 @@ import { Notifier } from 'ui/notify/notifier'; const notify = new Notifier({ location: 'Scripting Language Service' }); export function getSupportedScriptingLanguages() { - return ['expression', 'painless']; + return ['painless']; +} + +export function getDeprecatedScriptingLanguages() { + return ['expression']; } export function GetEnabledScriptingLanguagesProvider($http) { From e7ea4214c6b95008dc6f738c60dd2964332f775b Mon Sep 17 00:00:00 2001 From: Matthew Bargar Date: Wed, 4 Oct 2017 15:29:39 -0400 Subject: [PATCH 2/3] Remove support for expression based scripted fields --- .../scripted_fields_table.html | 20 +++++++++++++++++++ .../scripted_fields_table.js | 15 ++++++++++---- src/ui/public/field_editor/field_editor.html | 2 +- src/ui/public/field_editor/field_editor.js | 4 ++-- src/ui/public/scripting_languages/index.js | 2 +- 5 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/scripted_fields_table.html b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/scripted_fields_table.html index 1ad6dfde19e0..98b5eaa438c2 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/scripted_fields_table.html +++ b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/scripted_fields_table.html @@ -28,6 +28,26 @@

+
+
+ + + Unsupported Languages + +
+ +
+
+ We've detected that the following unsupported languages are in use: {{ getUnsupportedLanguagesInUse().join(', ') }}. + All scripted fields must be converted to Painless. +
+
+
+ -
+
diff --git a/src/ui/public/scripting_languages/index.js b/src/ui/public/scripting_languages/index.js index 2ffdf05e85c2..f773baa34488 100644 --- a/src/ui/public/scripting_languages/index.js +++ b/src/ui/public/scripting_languages/index.js @@ -8,7 +8,7 @@ export function getSupportedScriptingLanguages() { } export function getDeprecatedScriptingLanguages() { - return []; + return ['expression']; } export function GetEnabledScriptingLanguagesProvider($http) {