diff --git a/package.json b/package.json index 425527a058e86..e249546e71581 100644 --- a/package.json +++ b/package.json @@ -454,7 +454,7 @@ "murmurhash3js": "3.0.1", "mutation-observer": "^1.0.3", "nock": "10.0.6", - "node-sass": "^4.9.4", + "node-sass": "^4.13.1", "normalize-path": "^3.0.0", "nyc": "^14.1.1", "pixelmatch": "^5.1.0", diff --git a/packages/kbn-plugin-helpers/package.json b/packages/kbn-plugin-helpers/package.json index 68af0aa791c8e..3b358c03b8053 100644 --- a/packages/kbn-plugin-helpers/package.json +++ b/packages/kbn-plugin-helpers/package.json @@ -24,7 +24,7 @@ "gulp-zip": "5.0.1", "inquirer": "^1.2.2", "minimatch": "^3.0.4", - "node-sass": "^4.9.4", + "node-sass": "^4.13.1", "through2": "^2.0.3", "through2-map": "^3.0.0", "vinyl-fs": "^3.0.3" diff --git a/packages/kbn-ui-framework/package.json b/packages/kbn-ui-framework/package.json index b4d9d3dfee03f..4bb4c660a01ab 100644 --- a/packages/kbn-ui-framework/package.json +++ b/packages/kbn-ui-framework/package.json @@ -53,7 +53,7 @@ "jquery": "^3.4.1", "keymirror": "0.1.1", "moment": "^2.24.0", - "node-sass": "^4.9.4", + "node-sass": "^4.13.1", "postcss": "^7.0.5", "postcss-loader": "^3.0.0", "raw-loader": "^3.1.0", diff --git a/src/legacy/core_plugins/kibana/public/dashboard/legacy_imports.ts b/src/legacy/core_plugins/kibana/public/dashboard/legacy_imports.ts index 97d165b6b5c23..14bdef99ca894 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/legacy_imports.ts +++ b/src/legacy/core_plugins/kibana/public/dashboard/legacy_imports.ts @@ -38,15 +38,8 @@ export { showSaveModal, SaveResult } from 'ui/saved_objects/show_saved_object_sa export { migrateLegacyQuery } from 'ui/utils/migrate_legacy_query'; export { KbnUrl } from 'ui/url/kbn_url'; // @ts-ignore -export { GlobalStateProvider } from 'ui/state_management/global_state'; -// @ts-ignore -export { StateManagementConfigProvider } from 'ui/state_management/config_provider'; -// @ts-ignore export { PrivateProvider } from 'ui/private/private'; // @ts-ignore -export { EventsProvider } from 'ui/events'; -export { PersistedState } from 'ui/persisted_state'; -// @ts-ignore export { createTopNavDirective, createTopNavHelper } from 'ui/kbn_top_nav/kbn_top_nav'; // @ts-ignore export { PromiseServiceCreator } from 'ui/promises/promises'; diff --git a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/application.ts b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/application.ts index 1a0a99311d06b..0d461028d994a 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/application.ts +++ b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/application.ts @@ -33,15 +33,12 @@ import { confirmModalFactory, createTopNavDirective, createTopNavHelper, - EventsProvider, IPrivate, KbnUrlProvider, - PersistedState, PrivateProvider, PromiseServiceCreator, RedirectWhenMissingProvider, SavedObjectLoader, - StateManagementConfigProvider, } from '../legacy_imports'; // @ts-ignore import { initDashboardApp } from './legacy_app'; @@ -112,8 +109,6 @@ function createLocalAngularModule(core: AppMountContext['core'], navigation: Nav createLocalPromiseModule(); createLocalConfigModule(core); createLocalKbnUrlModule(); - createLocalStateModule(); - createLocalPersistedStateModule(); createLocalTopNavModule(navigation); createLocalConfirmModalModule(); createLocalIconModule(); @@ -123,9 +118,9 @@ function createLocalAngularModule(core: AppMountContext['core'], navigation: Nav 'app/dashboard/Config', 'app/dashboard/I18n', 'app/dashboard/Private', - 'app/dashboard/PersistedState', 'app/dashboard/TopNav', - 'app/dashboard/State', + 'app/dashboard/KbnUrl', + 'app/dashboard/Promise', 'app/dashboard/ConfirmModal', 'app/dashboard/icon', ]); @@ -145,29 +140,6 @@ function createLocalConfirmModalModule() { .directive('confirmModal', reactDirective => reactDirective(EuiConfirmModal)); } -function createLocalStateModule() { - angular.module('app/dashboard/State', [ - 'app/dashboard/Private', - 'app/dashboard/Config', - 'app/dashboard/KbnUrl', - 'app/dashboard/Promise', - 'app/dashboard/PersistedState', - ]); -} - -function createLocalPersistedStateModule() { - angular - .module('app/dashboard/PersistedState', ['app/dashboard/Private', 'app/dashboard/Promise']) - .factory('PersistedState', (Private: IPrivate) => { - const Events = Private(EventsProvider); - return class AngularPersistedState extends PersistedState { - constructor(value: any, path: any) { - super(value, path, Events); - } - }; - }); -} - function createLocalKbnUrlModule() { angular .module('app/dashboard/KbnUrl', ['app/dashboard/Private', 'ngRoute']) @@ -176,16 +148,13 @@ function createLocalKbnUrlModule() { } function createLocalConfigModule(core: AppMountContext['core']) { - angular - .module('app/dashboard/Config', ['app/dashboard/Private']) - .provider('stateManagementConfig', StateManagementConfigProvider) - .provider('config', () => { - return { - $get: () => ({ - get: core.uiSettings.get.bind(core.uiSettings), - }), - }; - }); + angular.module('app/dashboard/Config', ['app/dashboard/Private']).provider('config', () => { + return { + $get: () => ({ + get: core.uiSettings.get.bind(core.uiSettings), + }), + }; + }); } function createLocalPromiseModule() { diff --git a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/legacy_app.js b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/legacy_app.js index 2121b51ea78d8..abc0c789326f8 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/legacy_app.js +++ b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/legacy_app.js @@ -59,11 +59,6 @@ export function initDashboardApp(app, deps) { addHelpMenuToAppChrome(deps.chrome, deps.core.docLinks); } - app.config(stateManagementConfigProvider => { - // Dashboard state management is handled by state containers and state_sync utilities - stateManagementConfigProvider.disable(); - }); - app.factory('history', () => createHashHistory()); app.factory('kbnUrlStateStorage', history => createKbnUrlStateStorage({ @@ -141,7 +136,7 @@ export function initDashboardApp(app, deps) { }); }, resolve: { - dash: function($rootScope, $route, redirectWhenMissing, kbnUrl) { + dash: function($rootScope, $route, redirectWhenMissing, kbnUrl, history) { return ensureDefaultIndexPattern(deps.core, deps.npDataStart, $rootScope, kbnUrl).then( () => { const savedObjectsClient = deps.savedObjectsClient; @@ -160,13 +155,13 @@ export function initDashboardApp(app, deps) { dashboard.attributes.title.toLowerCase() === title.toLowerCase() ); if (matchingDashboards.length === 1) { - kbnUrl.redirect(createDashboardEditUrl(matchingDashboards[0].id)); + history.replace(createDashboardEditUrl(matchingDashboards[0].id)); } else { - kbnUrl.redirect( + history.replace( `${DashboardConstants.LANDING_PAGE_PATH}?filter="${title}"` ); + $route.reload(); } - $rootScope.$digest(); return new Promise(() => {}); }); } diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/_index.scss b/x-pack/legacy/plugins/maps/public/layers/styles/_index.scss index 6d332ee878d95..b5d9113619c76 100644 --- a/x-pack/legacy/plugins/maps/public/layers/styles/_index.scss +++ b/x-pack/legacy/plugins/maps/public/layers/styles/_index.scss @@ -1,4 +1,4 @@ @import './components/color_gradient'; -@import './vector/components/static_dynamic_style_row'; +@import './vector/components/style_prop_editor'; @import './vector/components/color/color_stops'; @import './vector/components/symbol/icon_select'; diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/_static_dynamic_style_row.scss b/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/_static_dynamic_style_row.scss deleted file mode 100644 index 8ec006d32a8b9..0000000000000 --- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/_static_dynamic_style_row.scss +++ /dev/null @@ -1,3 +0,0 @@ -.mapStaticDynamicSylingOption__dynamicSizeHack { - width: calc(100% - #{$euiSizeXXL + $euiSizeS}); -} diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/_style_prop_editor.scss b/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/_style_prop_editor.scss new file mode 100644 index 0000000000000..138605b1a7dcc --- /dev/null +++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/_style_prop_editor.scss @@ -0,0 +1,3 @@ +.mapStyleFormDisabledTooltip { + width: 100%; +} diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/get_vector_style_label.js b/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/get_vector_style_label.js index c5fdda70c4eb4..35e6fa60b28e7 100644 --- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/get_vector_style_label.js +++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/get_vector_style_label.js @@ -8,6 +8,13 @@ import { i18n } from '@kbn/i18n'; import { VECTOR_STYLES } from '../vector_style_defaults'; +export function getDisabledByMessage(styleName) { + return i18n.translate('xpack.maps.styles.vector.disabledByMessage', { + defaultMessage: `Set '{styleLabel}' to enable`, + values: { styleLabel: getVectorStyleLabel(styleName) }, + }); +} + export function getVectorStyleLabel(styleName) { switch (styleName) { case VECTOR_STYLES.FILL_COLOR: diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/label/vector_style_label_border_size_editor.js b/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/label/vector_style_label_border_size_editor.js index 7d06e8b530011..04bb800eb1ecf 100644 --- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/label/vector_style_label_border_size_editor.js +++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/label/vector_style_label_border_size_editor.js @@ -6,9 +6,9 @@ import React from 'react'; -import { EuiFormRow, EuiSelect } from '@elastic/eui'; +import { EuiFormRow, EuiSelect, EuiToolTip } from '@elastic/eui'; import { LABEL_BORDER_SIZES, VECTOR_STYLES } from '../../vector_style_defaults'; -import { getVectorStyleLabel } from '../get_vector_style_label'; +import { getVectorStyleLabel, getDisabledByMessage } from '../get_vector_style_label'; import { i18n } from '@kbn/i18n'; const options = [ @@ -38,7 +38,12 @@ const options = [ }, ]; -export function VectorStyleLabelBorderSizeEditor({ handlePropertyChange, styleProperty }) { +export function VectorStyleLabelBorderSizeEditor({ + disabled, + disabledBy, + handlePropertyChange, + styleProperty, +}) { function onChange(e) { const styleDescriptor = { options: { size: e.target.value }, @@ -46,12 +51,13 @@ export function VectorStyleLabelBorderSizeEditor({ handlePropertyChange, stylePr handlePropertyChange(styleProperty.getStyleName(), styleDescriptor); } - return ( + const labelBorderSizeForm = ( ); + + if (!disabled) { + return labelBorderSizeForm; + } + + return ( + + {labelBorderSizeForm} + + ); } diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/style_prop_editor.js b/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/style_prop_editor.js index e8b544d8ede16..f1180a3a56494 100644 --- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/style_prop_editor.js +++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/style_prop_editor.js @@ -5,8 +5,15 @@ */ import React, { Component, Fragment } from 'react'; -import { getVectorStyleLabel } from './get_vector_style_label'; -import { EuiFormRow, EuiSelect } from '@elastic/eui'; +import { getVectorStyleLabel, getDisabledByMessage } from './get_vector_style_label'; +import { + EuiFormRow, + EuiSelect, + EuiFlexGroup, + EuiFlexItem, + EuiFieldText, + EuiToolTip, +} from '@elastic/eui'; import { VectorStyle } from '../vector_style'; import { i18n } from '@kbn/i18n'; @@ -69,7 +76,7 @@ export class StylePropEditor extends Component { : VectorStyle.STYLE_TYPE.STATIC } onChange={this._onTypeToggle} - disabled={this.props.fields.length === 0} + disabled={this.props.disabled || this.props.fields.length === 0} aria-label={i18n.translate('xpack.maps.styles.staticDynamicSelect.ariaLabel', { defaultMessage: 'Select to style by fixed value or by data value', })} @@ -83,17 +90,35 @@ export class StylePropEditor extends Component { this._onFieldMetaOptionsChange ); + const staticDynamicSelect = this.renderStaticDynamicSelect(); + + const stylePropertyForm = this.props.disabled ? ( + + + {staticDynamicSelect} + + + + + + ) : ( + + {React.cloneElement(this.props.children, { + staticDynamicSelect, + })} + {fieldMetaOptionsPopover} + + ); + return ( - - {React.cloneElement(this.props.children, { - staticDynamicSelect: this.renderStaticDynamicSelect(), - })} - {fieldMetaOptionsPopover} - + {stylePropertyForm} ); } diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/symbol/vector_style_symbolize_as_editor.js b/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/symbol/vector_style_symbolize_as_editor.js index 9394e5c068569..219fee311ba1b 100644 --- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/symbol/vector_style_symbolize_as_editor.js +++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/symbol/vector_style_symbolize_as_editor.js @@ -6,11 +6,12 @@ import React from 'react'; -import { EuiFormRow, EuiButtonGroup } from '@elastic/eui'; +import { EuiFormRow, EuiButtonGroup, EuiToolTip } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { SYMBOLIZE_AS_TYPES } from '../../../../../../common/constants'; import { VECTOR_STYLES } from '../../vector_style_defaults'; +import { getDisabledByMessage } from '../get_vector_style_label'; const SYMBOLIZE_AS_OPTIONS = [ { @@ -27,7 +28,12 @@ const SYMBOLIZE_AS_OPTIONS = [ }, ]; -export function VectorStyleSymbolizeAsEditor({ styleProperty, handlePropertyChange }) { +export function VectorStyleSymbolizeAsEditor({ + disabled, + disabledBy, + styleProperty, + handlePropertyChange, +}) { const styleOptions = styleProperty.getOptions(); const selectedOption = SYMBOLIZE_AS_OPTIONS.find(({ id }) => { return id === styleOptions.value; @@ -42,7 +48,7 @@ export function VectorStyleSymbolizeAsEditor({ styleProperty, handlePropertyChan handlePropertyChange(VECTOR_STYLES.SYMBOLIZE_AS, styleDescriptor); }; - return ( + const symbolizeAsForm = ( ); + + if (!disabled) { + return symbolizeAsForm; + } + + return ( + + {symbolizeAsForm} + + ); } diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/vector_style_editor.js b/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/vector_style_editor.js index 9299022b7895b..441ebfb2d53bf 100644 --- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/vector_style_editor.js +++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/vector_style_editor.js @@ -18,6 +18,7 @@ import { OrientationEditor } from './orientation/orientation_editor'; import { getDefaultDynamicProperties, getDefaultStaticProperties, + LABEL_BORDER_SIZES, VECTOR_STYLES, } from '../vector_style_defaults'; import { DEFAULT_FILL_COLORS, DEFAULT_LINE_COLORS } from '../../color_utils'; @@ -145,9 +146,33 @@ export class VectorStyleEditor extends Component { this.props.handlePropertyChange(propertyName, styleDescriptor); }; - _renderFillColor() { + _hasBorder() { + const width = this.props.styleProperties[VECTOR_STYLES.LINE_WIDTH]; + return width.isDynamic() ? width.isComplete() : width.getOptions().size !== 0; + } + + _hasMarkerOrIcon() { + const iconSize = this.props.styleProperties[VECTOR_STYLES.ICON_SIZE]; + return !iconSize.isDynamic() && iconSize.getOptions().size > 0; + } + + _hasLabel() { + const label = this.props.styleProperties[VECTOR_STYLES.LABEL_TEXT]; + return label.isDynamic() + ? label.isComplete() + : label.getOptions().value != null && label.getOptions().value.length; + } + + _hasLabelBorder() { + const labelBorderSize = this.props.styleProperties[VECTOR_STYLES.LABEL_BORDER_SIZE]; + return labelBorderSize.getOptions().size !== LABEL_BORDER_SIZES.NONE; + } + + _renderFillColor(isPointFillColor = false) { return ( - ); - } - _renderLabelProperties() { + const hasLabel = this._hasLabel(); + const hasLabelBorder = this._hasLabelBorder(); return ( @@ -286,12 +309,15 @@ export class VectorStyleEditor extends Component { } _renderPointProperties() { + const hasMarkerOrIcon = this._hasMarkerOrIcon(); let iconOrientationEditor; let iconEditor; if (this.props.styleProperties[VECTOR_STYLES.SYMBOLIZE_AS].isSymbolizedAsIcon()) { iconOrientationEditor = ( @@ -335,18 +365,29 @@ export class VectorStyleEditor extends Component { {iconEditor} - {this._renderFillColor()} + {this._renderFillColor(true)} - {this._renderLineColor()} + {this._renderLineColor(true)} - {this._renderLineWidth()} + {this._renderLineWidth(true)} {iconOrientationEditor} - {this._renderSymbolSize()} + {this._renderLabelProperties()} diff --git a/yarn.lock b/yarn.lock index 3563ee3fc2733..a3acc2ae216c5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19371,7 +19371,7 @@ lodash.clone@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.clone/-/lodash.clone-4.5.0.tgz#195870450f5a13192478df4bc3d23d2dea1907b6" integrity sha1-GVhwRQ9aExkkeN9Lw9I9LeoZB7Y= -lodash.clonedeep@^4.3.2, lodash.clonedeep@^4.5.0: +lodash.clonedeep@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8= @@ -19516,11 +19516,6 @@ lodash.merge@^4.4.0, lodash.merge@^4.6.1: resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== -lodash.mergewith@^4.6.0: - version "4.6.2" - resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz#617121f89ac55f59047c7aec1ccd6654c6590f55" - integrity sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ== - lodash.omit@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.omit/-/lodash.omit-4.5.0.tgz#6eb19ae5a1ee1dd9df0b969e66ce0b7fa30b5e60" @@ -20947,7 +20942,12 @@ mute-stream@0.0.8: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== -nan@^2.10.0, nan@^2.9.2: +nan@^2.13.2: + version "2.14.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" + integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== + +nan@^2.9.2: version "2.10.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.10.0.tgz#96d0cd610ebd58d4b4de9cc0c6828cda99c7548f" integrity sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA== @@ -21350,10 +21350,10 @@ node-releases@^1.1.25: dependencies: semver "^5.3.0" -node-sass@^4.9.4: - version "4.9.4" - resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.9.4.tgz#349bd7f1c89422ffe7e1e4b60f2055a69fbc5512" - integrity sha512-MXyurANsUoE4/6KmfMkwGcBzAnJQ5xJBGW7Ei6ea8KnUKuzHr/SguVBIi3uaUAHtZCPUYkvlJ3Ef5T5VAwVpaA== +node-sass@^4.13.1: + version "4.13.1" + resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.13.1.tgz#9db5689696bb2eec2c32b98bfea4c7a2e992d0a3" + integrity sha512-TTWFx+ZhyDx1Biiez2nB0L3YrCZ/8oHagaDalbuBSlqXgUPsdkUSzJsVxeDO9LtPB49+Fh3WQl3slABo6AotNw== dependencies: async-foreach "^0.1.3" chalk "^1.1.1" @@ -21362,12 +21362,10 @@ node-sass@^4.9.4: get-stdin "^4.0.1" glob "^7.0.3" in-publish "^2.0.0" - lodash.assign "^4.2.0" - lodash.clonedeep "^4.3.2" - lodash.mergewith "^4.6.0" + lodash "^4.17.15" meow "^3.7.0" mkdirp "^0.5.1" - nan "^2.10.0" + nan "^2.13.2" node-gyp "^3.8.0" npmlog "^4.0.0" request "^2.88.0"