diff --git a/.eslintignore b/.eslintignore index d22b6a70bc..fe00b4d91d 100644 --- a/.eslintignore +++ b/.eslintignore @@ -5,6 +5,7 @@ src/** resources/** packages/** node_modules/** +node_modules.bak/** locale/** libraries/** dist/** diff --git a/.eslintrc.js b/.eslintrc.js index 71475c6b3e..789074e867 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -30,7 +30,7 @@ module.exports = { "__webpack_public_path__": false }, "parserOptions": { - "ecmaVersion": 6, + "ecmaVersion": 9, "sourceType": "module" }, // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style diff --git a/bundles/admin/admin-hierarchical-layerlist/collections/userRoleCollection.js b/bundles/admin/admin-hierarchical-layerlist/collections/userRoleCollection.js index 13967f6836..26291dac0b 100644 --- a/bundles/admin/admin-hierarchical-layerlist/collections/userRoleCollection.js +++ b/bundles/admin/admin-hierarchical-layerlist/collections/userRoleCollection.js @@ -4,7 +4,7 @@ function (roleModel) { return Backbone.Collection.extend({ - // Reference to this collection's model. + // Reference to this collection's model. model: roleModel, getRoles: function () { diff --git a/bundles/admin/admin-hierarchical-layerlist/instance.js b/bundles/admin/admin-hierarchical-layerlist/instance.js index 394dc70224..4f75e6b612 100644 --- a/bundles/admin/admin-hierarchical-layerlist/instance.js +++ b/bundles/admin/admin-hierarchical-layerlist/instance.js @@ -347,7 +347,7 @@ Oskari.clazz.define('Oskari.admin.bundle.admin.HierarchicalLayerListBundleInstan xhr = null; var successCount = resp.success.length; var failCount = Object.keys(resp.error).length; - content.append('

' + loc('recheckAllSucceeded', {success: successCount, fail: failCount}) + ''); + content.append('

' + loc('recheckAllSucceeded', { success: successCount, fail: failCount }) + ''); tool.removeClass('active'); }, error: function (xhr, status, error) { diff --git a/bundles/admin/admin-layereditor/components/Button.stories.js b/bundles/admin/admin-layereditor/components/Button.stories.js index 983adc85ed..1b7a1559bf 100644 --- a/bundles/admin/admin-layereditor/components/Button.stories.js +++ b/bundles/admin/admin-layereditor/components/Button.stories.js @@ -1,7 +1,7 @@ import React from 'react'; import { storiesOf } from '@storybook/react'; import { Button } from './Button'; -import {StyledButton} from './StyledButton'; +import { StyledButton } from './StyledButton'; const defaultText = 'My text'; const defaultProps = {}; diff --git a/bundles/admin/admin-layereditor/instance.js b/bundles/admin/admin-layereditor/instance.js index 1fe6c2c9f7..15e29caa9e 100644 --- a/bundles/admin/admin-layereditor/instance.js +++ b/bundles/admin/admin-layereditor/instance.js @@ -1,4 +1,4 @@ -import {LayerEditorFlyout} from './view/Flyout'; +import { LayerEditorFlyout } from './view/Flyout'; const BasicBundle = Oskari.clazz.get('Oskari.BasicBundle'); Oskari.clazz.defineES('Oskari.admin.admin-layereditor.instance', diff --git a/bundles/admin/admin-layereditor/view/LayerWizard/LayerCapabilitiesListing.jsx b/bundles/admin/admin-layereditor/view/LayerWizard/LayerCapabilitiesListing.jsx index 63fb167f05..8597c30541 100644 --- a/bundles/admin/admin-layereditor/view/LayerWizard/LayerCapabilitiesListing.jsx +++ b/bundles/admin/admin-layereditor/view/LayerWizard/LayerCapabilitiesListing.jsx @@ -1,17 +1,19 @@ import React from 'react'; import PropTypes from 'prop-types'; -import {List} from '../../components/List'; +import {List, ListItem} from '../../components/List'; export class LayerCapabilitiesListing extends React.Component { getItem (item) { return ( - this.props.onSelect(item)}>{item.name} + this.props.onSelect(item)}> + {item.name} + ); } render () { return (
- this.getItem(item))}> + this.getItem(item)}>
); } diff --git a/bundles/admin/admin-layereditor/view/LayerWizard/StateHandler.js b/bundles/admin/admin-layereditor/view/LayerWizard/StateHandler.js index 026d227f6c..cbfaf7ce5f 100644 --- a/bundles/admin/admin-layereditor/view/LayerWizard/StateHandler.js +++ b/bundles/admin/admin-layereditor/view/LayerWizard/StateHandler.js @@ -19,7 +19,7 @@ export class StateHandler { return this.loading; } getLayer () { - return {...this.layer}; + return { ...this.layer }; } getCapabilities () { return this.capabilities || []; diff --git a/bundles/admin/admin/DefaultViews.js b/bundles/admin/admin/DefaultViews.js index 4b8a27b6f2..888dfb0c6a 100755 --- a/bundles/admin/admin/DefaultViews.js +++ b/bundles/admin/admin/DefaultViews.js @@ -174,13 +174,13 @@ Oskari.clazz.define('Oskari.admin.bundle.admin.DefaultViews', function (locale, __showGenericErrorSave: function (id) { this.instance.showMessage( this.locale.notifications.errorTitle, - _.template(this.locale.notifications.errorUpdating)({id: id})); + _.template(this.locale.notifications.errorUpdating)({ id: id })); }, __viewSaved: function (id, data) { this.instance.showMessage( this.locale.notifications.successTitle, - _.template(this.locale.notifications.viewUpdated)({id: id})); + _.template(this.locale.notifications.viewUpdated)({ id: id })); }, /** diff --git a/bundles/admin/admin/Flyout.js b/bundles/admin/admin/Flyout.js index 5a29f8b207..27a220a81a 100755 --- a/bundles/admin/admin/Flyout.js +++ b/bundles/admin/admin/Flyout.js @@ -61,7 +61,7 @@ Oskari.clazz.define('Oskari.admin.bundle.admin.GenericAdminFlyout', * request to handle */ handleRequest: function (core, request) { - this.addTab({'title': request.getTitle(), 'content': request.getContent(), 'priority': request.getPriority(), 'id': request.getId()}); + this.addTab({ 'title': request.getTitle(), 'content': request.getContent(), 'priority': request.getPriority(), 'id': request.getId() }); } }, { 'extend': ['Oskari.userinterface.extension.DefaultFlyout'] diff --git a/bundles/admin/admin/request/AddTabRequestHandler.js b/bundles/admin/admin/request/AddTabRequestHandler.js index 2b909b3b66..040a5dce11 100755 --- a/bundles/admin/admin/request/AddTabRequestHandler.js +++ b/bundles/admin/admin/request/AddTabRequestHandler.js @@ -22,7 +22,7 @@ Oskari.clazz.define('Oskari.mapframework.bundle.admin.request.AddTabRequestHandl * request to handle */ handleRequest: function (core, request) { - this.flyout.addTab({'title': request.getTitle(), 'content': request.getContent(), 'priority': request.getPriority(), 'id': request.getId()}); + this.flyout.addTab({ 'title': request.getTitle(), 'content': request.getContent(), 'priority': request.getPriority(), 'id': request.getId() }); } }, { /** diff --git a/bundles/admin/metrics/instance.js b/bundles/admin/metrics/instance.js index 0dfe62153e..161f7588d2 100755 --- a/bundles/admin/metrics/instance.js +++ b/bundles/admin/metrics/instance.js @@ -29,7 +29,7 @@ Oskari.clazz.define('Oskari.admin.bundle.metrics.MetricsAdminBundleInstance', content.append('Error loading metrics'); }, success: function (response) { - content.tree({'data': me.formatData(response)}); + content.tree({ 'data': me.formatData(response) }); } }); if (sandbox.hasHandler('Admin.AddTabRequest')) { diff --git a/bundles/catalogue/metadatacatalogue/instance.js b/bundles/catalogue/metadatacatalogue/instance.js index adec6830db..7f7aa50966 100755 --- a/bundles/catalogue/metadatacatalogue/instance.js +++ b/bundles/catalogue/metadatacatalogue/instance.js @@ -625,7 +625,7 @@ Oskari.clazz.define( dropdownDef, emptyOption, newOption, - renderCoverageButton = (_.filter(dataFields, {'field': 'coverage'}).length > 0), + renderCoverageButton = (_.filter(dataFields, { 'field': 'coverage' }).length > 0), checkboxChange = function () { me._updateOptions(advancedContainer); }; @@ -1079,7 +1079,7 @@ Oskari.clazz.define( if (action.callback && typeof action.callback === 'function') { // Bind action click to bindCallbackTo if bindCallbackTo param exist callbackElement = actionElement.first(); - callbackElement.css({'cursor': 'pointer'}).on('click', {metadata: row}, function (event) { + callbackElement.css({ 'cursor': 'pointer' }).on('click', { metadata: row }, function (event) { action.callback(event.data.metadata); }); } diff --git a/bundles/catalogue/metadatacatalogue/instance.ol2.js b/bundles/catalogue/metadatacatalogue/instance.ol2.js index 15bf80fc22..bd0d86aece 100644 --- a/bundles/catalogue/metadatacatalogue/instance.ol2.js +++ b/bundles/catalogue/metadatacatalogue/instance.ol2.js @@ -582,7 +582,7 @@ Oskari.clazz.define( dropdownDef, emptyOption, newOption, - renderCoverageButton = (_.filter(dataFields, {'field': 'coverage'}).length > 0), + renderCoverageButton = (_.filter(dataFields, { 'field': 'coverage' }).length > 0), checkboxChange = function () { me._updateOptions(advancedContainer); }; @@ -718,7 +718,7 @@ Oskari.clazz.define( this.selectionPlugin = Oskari.clazz.create('Oskari.mapframework.bundle.featuredata2.plugin.MapSelectionPlugin', config, me.sandbox); mapModule.registerPlugin(this.selectionPlugin); mapModule.startPlugin(this.selectionPlugin); - this.selectionPlugin.startDrawing({drawMode: 'square'}); + this.selectionPlugin.startDrawing({ drawMode: 'square' }); }, /** @@ -1037,7 +1037,7 @@ Oskari.clazz.define( // Set action callback if (action.callback && typeof action.callback === 'function') { callbackElement = actionElement.first(); - callbackElement.css({'cursor': 'pointer'}).on('click', {metadata: row}, function (event) { + callbackElement.css({ 'cursor': 'pointer' }).on('click', { metadata: row }, function (event) { action.callback(event.data.metadata); }); } diff --git a/bundles/catalogue/metadatacatalogue/request/AddSearchResultActionRequest.js b/bundles/catalogue/metadatacatalogue/request/AddSearchResultActionRequest.js index 48ffc12c48..3d30ff2259 100755 --- a/bundles/catalogue/metadatacatalogue/request/AddSearchResultActionRequest.js +++ b/bundles/catalogue/metadatacatalogue/request/AddSearchResultActionRequest.js @@ -7,7 +7,7 @@ */ Oskari.clazz.define('Oskari.catalogue.bundle.metadatacatalogue.request.AddSearchResultActionRequest', -/** + /** * @method create called automatically on construction * @static * diff --git a/bundles/catalogue/metadatacatalogue/service/MetadataOptionService.js b/bundles/catalogue/metadatacatalogue/service/MetadataOptionService.js index ea22ce2bf6..3713651ea2 100755 --- a/bundles/catalogue/metadatacatalogue/service/MetadataOptionService.js +++ b/bundles/catalogue/metadatacatalogue/service/MetadataOptionService.js @@ -6,7 +6,7 @@ */ Oskari.clazz.define('Oskari.catalogue.bundle.metadatacatalogue.service.MetadataOptionService', -/** + /** * @method create called automatically on construction * @static * diff --git a/bundles/catalogue/metadatacatalogue/service/MetadataSearchService.js b/bundles/catalogue/metadatacatalogue/service/MetadataSearchService.js index 80348639d5..e958189f9e 100755 --- a/bundles/catalogue/metadatacatalogue/service/MetadataSearchService.js +++ b/bundles/catalogue/metadatacatalogue/service/MetadataSearchService.js @@ -6,7 +6,7 @@ */ Oskari.clazz.define('Oskari.catalogue.bundle.metadatacatalogue.service.MetadataSearchService', -/** + /** * @method create called automatically on construction * @static * diff --git a/bundles/catalogue/metadataflyout/Flyout.js b/bundles/catalogue/metadataflyout/Flyout.js index 99d8326c98..3752ca6631 100644 --- a/bundles/catalogue/metadataflyout/Flyout.js +++ b/bundles/catalogue/metadataflyout/Flyout.js @@ -122,7 +122,7 @@ Oskari.clazz.define('Oskari.catalogue.bundle.metadataflyout.Flyout', } } } - me.instance.state = {current: allMetadata}; + me.instance.state = { current: allMetadata }; }, /** diff --git a/bundles/framework/coordinatetool/plugin/CoordinateToolPlugin.js b/bundles/framework/coordinatetool/plugin/CoordinateToolPlugin.js index cfc8dd7b5e..fee0c78d18 100755 --- a/bundles/framework/coordinatetool/plugin/CoordinateToolPlugin.js +++ b/bundles/framework/coordinatetool/plugin/CoordinateToolPlugin.js @@ -185,7 +185,7 @@ Oskari.clazz.define('Oskari.mapframework.bundle.coordinatetool.plugin.Coordinate popupTitle = loc('display.popup.title'), popupContent = me._templates.popupContent.clone(), crs = me.getMapModule().getProjection(), - crsDefaultText = loc('display.crs.default', {crs: crs}), + crsDefaultText = loc('display.crs.default', { crs: crs }), popupName = 'xytoolpopup', popupLocation, isMobile = Oskari.util.isMobile(), @@ -315,7 +315,7 @@ Oskari.clazz.define('Oskari.mapframework.bundle.coordinatetool.plugin.Coordinate var topOffsetElement = jQuery('div.mobileToolbarDiv'); me._popup.addClass('coordinatetool__popup'); me._popup.addClass('mobile-popup'); - me._popup.setColourScheme({'bgColour': '#e6e6e6'}); + me._popup.setColourScheme({ 'bgColour': '#e6e6e6' }); // hide mouse coordinates popupContent.find('.mousecoordinates-div').hide(); diff --git a/bundles/framework/divmanazer/component/Chart.js b/bundles/framework/divmanazer/component/Chart.js index 39d2968934..a3a7c5e445 100755 --- a/bundles/framework/divmanazer/component/Chart.js +++ b/bundles/framework/divmanazer/component/Chart.js @@ -24,8 +24,6 @@ Oskari.clazz.define('Oskari.userinterface.component.Chart', function () { options.colors = options.colors || this._options.colors; if (typeof options.colors === 'string') { options.colors = [options.colors]; - } else if (options.colors) { - options.colors = options.colors; } }, chartIsInitialized: function () { @@ -184,7 +182,7 @@ Oskari.clazz.define('Oskari.userinterface.component.Chart', function () { .ticks(Math.min(10, tickTarget)) .tickSizeInner(-this.dimensions.height() + this.dimensions.xAxisOffset) .tickSizeOuter(0) - .tickFormat(function (d) { return me.loc('graph.tick', {value: d}); }); + .tickFormat(function (d) { return me.loc('graph.tick', { value: d }); }); }, /** * initializes the chart skeleton without any specific line or bar options diff --git a/bundles/framework/divmanazer/component/FileInput.js b/bundles/framework/divmanazer/component/FileInput.js index 5f1d3b0c70..2a9b063fd4 100755 --- a/bundles/framework/divmanazer/component/FileInput.js +++ b/bundles/framework/divmanazer/component/FileInput.js @@ -173,14 +173,14 @@ Oskari.clazz.define('Oskari.userinterface.component.FileInput', function (option message = this.loc('fileInput.invalidType'); if (Array.isArray(allowedExtensions) && allowedExtensions.length > 0) { allowedExtensions = '.' + allowedExtensions.join(', .'); - message += '
' + this.loc('fileInput.allowedExtensions', {allowedExtensions: allowedExtensions}); + message += '
' + this.loc('fileInput.allowedExtensions', { allowedExtensions: allowedExtensions }); } this._showPopup(this.loc('fileInput.error'), message); } // if max file size is defined check that file isn't too large if (opts.maxFileSize && file.size > opts.maxFileSize * 1048576) { valid = false; - this._showPopup(this.loc('fileInput.error'), this.loc('fileInput.fileSize', {size: opts.maxFileSize})); + this._showPopup(this.loc('fileInput.error'), this.loc('fileInput.fileSize', { size: opts.maxFileSize })); } return valid; }, @@ -238,10 +238,10 @@ Oskari.clazz.define('Oskari.userinterface.component.FileInput', function (option if (opts.allowMultipleFiles === true) { allowMultiple = 'multiple'; - fileUpload = this.loc('fileInput.fileUpload', {files: 2}); + fileUpload = this.loc('fileInput.fileUpload', { files: 2 }); } else { allowMultiple = ''; - fileUpload = this.loc('fileInput.fileUpload', {files: 1}); + fileUpload = this.loc('fileInput.fileUpload', { files: 1 }); } if (this.isAdvancedUpload) { @@ -319,7 +319,7 @@ Oskari.clazz.define('Oskari.userinterface.component.FileInput', function (option var tooltip; if (Array.isArray(allowedExtensions) && allowedExtensions.length !== 0) { allowedExtensions = '.' + allowedExtensions.join(', .'); - tooltip = this.loc('fileInput.allowedExtensions', {allowedExtensions: allowedExtensions}); + tooltip = this.loc('fileInput.allowedExtensions', { allowedExtensions: allowedExtensions }); elem.prop('title', tooltip); } }, @@ -333,7 +333,7 @@ Oskari.clazz.define('Oskari.userinterface.component.FileInput', function (option }, // TODO should these be in different place exportToFile: function (data, filename, type) { - var blob = new Blob([data], {type: type}); + var blob = new Blob([data], { type: type }); if (window.navigator.msSaveOrOpenBlob) { window.navigator.msSaveBlob(blob, filename); } else { diff --git a/bundles/framework/divmanazer/component/FilterDialog.js b/bundles/framework/divmanazer/component/FilterDialog.js index 5837c9d046..5fea0fbd8e 100755 --- a/bundles/framework/divmanazer/component/FilterDialog.js +++ b/bundles/framework/divmanazer/component/FilterDialog.js @@ -283,7 +283,7 @@ Oskari.clazz.define('Oskari.userinterface.component.FilterDialog', * @param {boolean} activate */ _toggleClickedFeaturesSelection: function (container, enable, check) { - container.find('#analyse-clicked-features').prop({'checked': check, 'disabled': !enable}); + container.find('#analyse-clicked-features').prop({ 'checked': check, 'disabled': !enable }); }, /** * Toggles the filter by geometry radios of the filter dialog popup. @@ -297,13 +297,13 @@ Oskari.clazz.define('Oskari.userinterface.component.FilterDialog', if (!enable) { check = false; } - container.find('#analyse-filter-by-geometry').prop({'checked': check, 'disabled': !enable}); + container.find('#analyse-filter-by-geometry').prop({ 'checked': check, 'disabled': !enable }); if (check) { - container.find('input[name="filter-by-geometry"]').prop({'disabled': !enable}); + container.find('input[name="filter-by-geometry"]').prop({ 'disabled': !enable }); // check the first option. - container.find('#analyse-filter-by-geometry-intersect').prop({'checked': check, 'disabled': !enable}); + container.find('#analyse-filter-by-geometry-intersect').prop({ 'checked': check, 'disabled': !enable }); } else { - container.find('input[name="filter-by-geometry"]').prop({'checked': check, 'disabled': true}); + container.find('input[name="filter-by-geometry"]').prop({ 'checked': check, 'disabled': true }); } }, /** @@ -315,8 +315,8 @@ Oskari.clazz.define('Oskari.userinterface.component.FilterDialog', * @param {boolean} activate */ _toggleBBOXSelection: function (container, check) { - container.find('div.bbox-on').find('input[name=analysis-filter-radio]').prop({'checked': check}); - container.find('div.bbox-off').find('input[name=analysis-filter-radio]').prop({'checked': false}); + container.find('div.bbox-on').find('input[name=analysis-filter-radio]').prop({ 'checked': check }); + container.find('div.bbox-off').find('input[name=analysis-filter-radio]').prop({ 'checked': false }); }, /** * Toggles the property selections of the filter dialog popup. @@ -329,13 +329,13 @@ Oskari.clazz.define('Oskari.userinterface.component.FilterDialog', bboxOFF = filterContentBBOX.find('div.bbox-off').find('input[name=analysis-filter-radio]').is(':checked'); if (bboxOFF) { valuesSelection.find('div.values-additional-info').html(this.loc.values.info.bboxOff); - valuesSelection.find('div.filter-by-values-container').css({'display': 'block'}); + valuesSelection.find('div.filter-by-values-container').css({ 'display': 'block' }); } else if (filterByGeometryChecked) { valuesSelection.find('div.values-additional-info').html(this.loc.values.info.filterByGeometrySelected); - valuesSelection.find('div.filter-by-values-container').css({'display': 'none'}); + valuesSelection.find('div.filter-by-values-container').css({ 'display': 'none' }); } else { valuesSelection.find('div.values-additional-info').html(''); - valuesSelection.find('div.filter-by-values-container').css({'display': 'block'}); + valuesSelection.find('div.filter-by-values-container').css({ 'display': 'block' }); } }, /** @@ -362,7 +362,7 @@ Oskari.clazz.define('Oskari.userinterface.component.FilterDialog', this._toggleFilterByGeometrySelection(filterByGeometryDiv, selectedTemporaryFeatures, false); } else if (values.noBBOX) { this._toggleBBOXSelection(bboxDiv, false); - bboxDiv.find('div.bbox-off').find('input[name=analysis-filter-radio]').prop({'checked': true}); + bboxDiv.find('div.bbox-off').find('input[name=analysis-filter-radio]').prop({ 'checked': true }); this._toggleClickedFeaturesSelection(clickedFeaturesDiv, clickedFeatures, false); this._toggleFilterByGeometrySelection(filterByGeometryDiv, selectedTemporaryFeatures, false); // no previous selections (bbox or no bbox, ) and no selected features -> select bbox by default. diff --git a/bundles/framework/divmanazer/component/Grid.js b/bundles/framework/divmanazer/component/Grid.js index ab94a45158..c0ab7d657a 100755 --- a/bundles/framework/divmanazer/component/Grid.js +++ b/bundles/framework/divmanazer/component/Grid.js @@ -712,7 +712,7 @@ Oskari.clazz.define('Oskari.userinterface.component.Grid', if (renderer) { value = renderer(value, data); } else if (typeof value === 'number') { - value = me._loc('Grid.cellValue', {value: value}); + value = me._loc('Grid.cellValue', { value: value }); } cell.append(value); row.append(cell); diff --git a/bundles/framework/divmanazer/component/GridPaging.js b/bundles/framework/divmanazer/component/GridPaging.js index bdb9206938..089cfd008a 100755 --- a/bundles/framework/divmanazer/component/GridPaging.js +++ b/bundles/framework/divmanazer/component/GridPaging.js @@ -59,7 +59,7 @@ Oskari.clazz.category( } }; - var visibleCols = Array.apply(null, {length: groupCols}).map(Number.call, Number); + var visibleCols = Array.apply(null, { length: groupCols }).map(Number.call, Number); // Get visible cols and shows them // If page is first then show only first cols diff --git a/bundles/framework/divmanazer/component/Popup.js b/bundles/framework/divmanazer/component/Popup.js index 63105f75ab..6315d7e47c 100755 --- a/bundles/framework/divmanazer/component/Popup.js +++ b/bundles/framework/divmanazer/component/Popup.js @@ -178,11 +178,11 @@ Oskari.clazz.define('Oskari.userinterface.component.Popup', setColourScheme: function (colourScheme) { if (colourScheme.bgColour) { - this.dialog.find('h3.popupHeader').css({'background-color': colourScheme.bgColour}); + this.dialog.find('h3.popupHeader').css({ 'background-color': colourScheme.bgColour }); } if (colourScheme.titleColour) { - this.dialog.find('h3.popupHeader').css({'color': colourScheme.titleColour}); + this.dialog.find('h3.popupHeader').css({ 'color': colourScheme.titleColour }); } if (colourScheme.iconCls) { @@ -192,7 +192,7 @@ Oskari.clazz.define('Oskari.userinterface.component.Popup', } if (colourScheme.bodyBgColour) { - this.dialog.find('.popup-body').css({'background-color': colourScheme.bodyBgColour}); + this.dialog.find('.popup-body').css({ 'background-color': colourScheme.bodyBgColour }); } /* buttons and actionlinks */ @@ -211,7 +211,7 @@ Oskari.clazz.define('Oskari.userinterface.component.Popup', }, setFont: function (font) { - this.dialog.find('h3.popupHeader').css({'font-family': font}); + this.dialog.find('h3.popupHeader').css({ 'font-family': font }); }, /** @@ -560,7 +560,7 @@ Oskari.clazz.define('Oskari.userinterface.component.Popup', this.eventHandlers = { MapSizeChangedEvent: function (evt) { - this._handleMapSizeChanges({width: evt.getWidth(), height: evt.getHeight()}); + this._handleMapSizeChanges({ width: evt.getWidth(), height: evt.getHeight() }); } }; diff --git a/bundles/framework/divmanazer/component/visualization-form/AreaForm.js b/bundles/framework/divmanazer/component/visualization-form/AreaForm.js index a7f51c2ee5..a70cc9c068 100755 --- a/bundles/framework/divmanazer/component/visualization-form/AreaForm.js +++ b/bundles/framework/divmanazer/component/visualization-form/AreaForm.js @@ -548,7 +548,7 @@ Oskari.clazz.define( * @private */ _createColorPickers: function () { - var options = {allowEmpty: true, cancelText: this.loc.buttons.cancel}; + var options = { allowEmpty: true, cancelText: this.loc.buttons.cancel }; this._colorPickers = [ Oskari.clazz.create('Oskari.userinterface.component.ColorPickerInput', options), Oskari.clazz.create('Oskari.userinterface.component.ColorPickerInput', options) diff --git a/bundles/framework/divmanazer/component/visualization-form/DotForm.js b/bundles/framework/divmanazer/component/visualization-form/DotForm.js index 0fd845a24c..bc50fb9da0 100755 --- a/bundles/framework/divmanazer/component/visualization-form/DotForm.js +++ b/bundles/framework/divmanazer/component/visualization-form/DotForm.js @@ -325,7 +325,7 @@ Oskari.clazz.define( * Creates a color picker component */ _createColorPicker: function () { - var options = {flat: true}; + var options = { flat: true }; this._colorPicker = Oskari.clazz.create('Oskari.userinterface.component.ColorPickerInput', options); }, diff --git a/bundles/framework/divmanazer/component/visualization-form/LineForm.js b/bundles/framework/divmanazer/component/visualization-form/LineForm.js index 88802b1d39..7138982e6b 100755 --- a/bundles/framework/divmanazer/component/visualization-form/LineForm.js +++ b/bundles/framework/divmanazer/component/visualization-form/LineForm.js @@ -308,7 +308,7 @@ Oskari.clazz.define( * Creates a color picker component */ _createColorPicker: function () { - var options = {flat: true}; + var options = { flat: true }; this._colorPicker = Oskari.clazz.create('Oskari.userinterface.component.ColorPickerInput', options); }, diff --git a/bundles/framework/divmanazer/extension/DefaultFlyout.js b/bundles/framework/divmanazer/extension/DefaultFlyout.js index 4cd7595359..d58d62324f 100755 --- a/bundles/framework/divmanazer/extension/DefaultFlyout.js +++ b/bundles/framework/divmanazer/extension/DefaultFlyout.js @@ -65,7 +65,7 @@ Oskari.clazz.define('Oskari.userinterface.extension.DefaultFlyout', var textWidth = function (el) { // Only create the dummy element once - var calc = jQuery('').css('font', el.css('font')).css({'font-size': el.css('font-size'), display: 'none', 'white-space': 'nowrap'}).appendTo('body'); + var calc = jQuery('').css('font', el.css('font')).css({ 'font-size': el.css('font-size'), display: 'none', 'white-space': 'nowrap' }).appendTo('body'); var width = calc.html(el.html()).width(); // Empty out the content until next time - not needed, but cleaner calc.remove(); diff --git a/bundles/framework/divmanazer/extension/ExtraFlyout.js b/bundles/framework/divmanazer/extension/ExtraFlyout.js index 3bdae2c137..b700e42972 100755 --- a/bundles/framework/divmanazer/extension/ExtraFlyout.js +++ b/bundles/framework/divmanazer/extension/ExtraFlyout.js @@ -264,11 +264,11 @@ Oskari.clazz.define('Oskari.userinterface.extension.ExtraFlyout', */ addSideTool: function (label, callback) { var me = this; - var sidelabel = jQuery(this.__templates.sideTool({label: label})); + var sidelabel = jQuery(this.__templates.sideTool({ label: label })); var textWidth = function (el) { // Only create the dummy element once - var calc = jQuery('').css('font', el.css('font')).css({'font-size': el.css('font-size'), display: 'none', 'white-space': 'nowrap'}).appendTo('body'); + var calc = jQuery('').css('font', el.css('font')).css({ 'font-size': el.css('font-size'), display: 'none', 'white-space': 'nowrap' }).appendTo('body'); var width = calc.html(el.html()).width(); // Empty out the content until next time - not needed, but cleaner calc.remove(); diff --git a/bundles/framework/featuredata2/Flyout.js b/bundles/framework/featuredata2/Flyout.js index ce91116f48..d5fbab5165 100755 --- a/bundles/framework/featuredata2/Flyout.js +++ b/bundles/framework/featuredata2/Flyout.js @@ -224,8 +224,8 @@ Oskari.clazz.define( var me = this, prevJson; - // this is needed to add the functionality to filter with aggregate analyse values - // if value is true, the link to filter with aggregate analyse values is added to dialog + // this is needed to add the functionality to filter with aggregate analyse values + // if value is true, the link to filter with aggregate analyse values is added to dialog var isAggregateValueAvailable = me.checkIfAggregateValuesAreAvailable(); var fixedOptions = { diff --git a/bundles/framework/hierarchical-layerlist/Flyout.js b/bundles/framework/hierarchical-layerlist/Flyout.js index 322ff20c0f..76872e3068 100644 --- a/bundles/framework/hierarchical-layerlist/Flyout.js +++ b/bundles/framework/hierarchical-layerlist/Flyout.js @@ -186,7 +186,7 @@ Oskari.clazz.define('Oskari.framework.bundle.hierarchical-layerlist.Flyout', }); notLoadedBackend[group.name].getName()[Oskari.getLang()] = group.name; } - notLoadedBackend[group.name].getChildren().push({id: layer.getId(), type: 'layer'}); + notLoadedBackend[group.name].getChildren().push({ id: layer.getId(), type: 'layer' }); notLoadedBackend[group.name].layersModels.push(layer); } }); diff --git a/bundles/framework/language-selector/instance.js b/bundles/framework/language-selector/instance.js index 2220f37cd3..b6918dc830 100755 --- a/bundles/framework/language-selector/instance.js +++ b/bundles/framework/language-selector/instance.js @@ -1,6 +1,6 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import {LanguageChanger} from './components/LanguageChanger'; +import { LanguageChanger } from './components/LanguageChanger'; const BasicBundle = Oskari.clazz.get('Oskari.BasicBundle'); diff --git a/bundles/framework/layerlist/view/LayerCollapse.jsx b/bundles/framework/layerlist/view/LayerCollapse.jsx index 74897f8d8c..95b8029691 100644 --- a/bundles/framework/layerlist/view/LayerCollapse.jsx +++ b/bundles/framework/layerlist/view/LayerCollapse.jsx @@ -27,7 +27,7 @@ const getNoResultsProps = locale => { return alertProps; }; -export const LayerCollapse = ({ locale, groups, openGroupTitles, filtered, mutator, selectedLayerIds }) => { +export const LayerCollapse = ({ groups, openGroupTitles, filtered, selectedLayerIds, mapSrs, mutator, locale }) => { if (!Array.isArray(groups) || groups.length === 0 || (filtered && filtered.length === 0)) { return ; } @@ -39,13 +39,9 @@ export const LayerCollapse = ({ locale, groups, openGroupTitles, filtered, mutat mutator.updateOpenGroupTitles(keys)}> { panels.map(({group, showLayers}) => { + const panelProps = {group, showLayers, selectedLayerIds, mapSrs, mutator, locale}; return ( - + ); }) } @@ -54,10 +50,11 @@ export const LayerCollapse = ({ locale, groups, openGroupTitles, filtered, mutat }; LayerCollapse.propTypes = { - groups: PropTypes.array, - openGroupTitles: PropTypes.array, + groups: PropTypes.array.isRequired, + openGroupTitles: PropTypes.array.isRequired, filtered: PropTypes.array, - selectedLayerIds: PropTypes.array, + selectedLayerIds: PropTypes.array.isRequired, + mapSrs: PropTypes.string.isRequired, mutator: PropTypes.any.isRequired, locale: PropTypes.any.isRequired }; diff --git a/bundles/framework/layerlist/view/LayerCollapse/Layer.jsx b/bundles/framework/layerlist/view/LayerCollapse/Layer.jsx index 4c6b14678d..c1b8878669 100644 --- a/bundles/framework/layerlist/view/LayerCollapse/Layer.jsx +++ b/bundles/framework/layerlist/view/LayerCollapse/Layer.jsx @@ -50,9 +50,9 @@ export const Layer = ({model, even, selected, mapSrs, mutator, locale}) => { Layer.propTypes = { model: PropTypes.any.isRequired, - even: PropTypes.bool, - selected: PropTypes.bool, - mapSrs: PropTypes.string, + even: PropTypes.bool.isRequired, + selected: PropTypes.bool.isRequired, + mapSrs: PropTypes.string.isRequired, mutator: PropTypes.any.isRequired, locale: PropTypes.any.isRequired }; diff --git a/bundles/framework/layerlist/view/LayerCollapse/Layer/LayerTools.jsx b/bundles/framework/layerlist/view/LayerCollapse/Layer/LayerTools.jsx index 3c7d5490f4..570bdc3171 100644 --- a/bundles/framework/layerlist/view/LayerCollapse/Layer/LayerTools.jsx +++ b/bundles/framework/layerlist/view/LayerCollapse/Layer/LayerTools.jsx @@ -137,7 +137,7 @@ export const LayerTools = ({model, mapSrs, mutator, locale}) => { LayerTools.propTypes = { model: PropTypes.any.isRequired, - mapSrs: PropTypes.string, + mapSrs: PropTypes.string.isRequired, mutator: PropTypes.any.isRequired, locale: PropTypes.any.isRequired }; diff --git a/bundles/framework/layerlist/view/LayerCollapse/LayerCollapsePanel.jsx b/bundles/framework/layerlist/view/LayerCollapse/LayerCollapsePanel.jsx index e719781edd..19d968552e 100644 --- a/bundles/framework/layerlist/view/LayerCollapse/LayerCollapsePanel.jsx +++ b/bundles/framework/layerlist/view/LayerCollapse/LayerCollapsePanel.jsx @@ -19,28 +19,34 @@ const getBadgeText = (group, visibleLayerCount) => { return badgeText; }; -const renderItem = ({layer, ...rest}) => { +const renderLayer = ({model, even, selected, mapSrs, mutator, locale}) => { + const itemProps = {model, even, selected, mapSrs, mutator, locale}; return ( - + ); }; -renderItem.propTypes = { - layer: PropTypes.any.isRequired +renderLayer.propTypes = { + model: PropTypes.any, + even: PropTypes.any, + selected: PropTypes.any, + mapSrs: PropTypes.any, + mutator: PropTypes.any, + locale: PropTypes.any }; export const LayerCollapsePanel = ({group, showLayers, selectedLayerIds, mapSrs, mutator, locale, ...propsNeededForPanel}) => { - const items = showLayers.map((layer, index) => { - const itemProps = { - layer, + const layerRows = showLayers.map((layer, index) => { + const layerProps = { + model: layer, even: index % 2 === 0, selected: Array.isArray(selectedLayerIds) && selectedLayerIds.includes(layer.getId()), mapSrs, mutator, locale }; - return itemProps; + return layerProps; }); const visibleLayerCount = showLayers ? showLayers.length : 0; return ( @@ -49,7 +55,7 @@ export const LayerCollapsePanel = ({group, showLayers, selectedLayerIds, mapSrs, extra={ }> - + ); }; @@ -57,8 +63,8 @@ export const LayerCollapsePanel = ({group, showLayers, selectedLayerIds, mapSrs, LayerCollapsePanel.propTypes = { group: PropTypes.any.isRequired, showLayers: PropTypes.array.isRequired, - selectedLayerIds: PropTypes.array, - mapSrs: PropTypes.string, + selectedLayerIds: PropTypes.array.isRequired, + mapSrs: PropTypes.string.isRequired, mutator: PropTypes.any.isRequired, locale: PropTypes.any.isRequired }; diff --git a/bundles/framework/layerlist/view/LayerCollapse/StateHandler.js b/bundles/framework/layerlist/view/LayerCollapse/StateHandler.js index 1aa4d654fb..6bd73a1c41 100644 --- a/bundles/framework/layerlist/view/LayerCollapse/StateHandler.js +++ b/bundles/framework/layerlist/view/LayerCollapse/StateHandler.js @@ -1,4 +1,4 @@ -const LAYER_TIMEOUT_MS = 300; +const LAYER_TIMEOUT_MS = 400; export class StateHandler { constructor () { @@ -10,7 +10,7 @@ export class StateHandler { this.filtered = null; this.map = Oskari.getSandbox().getMap(); } - updateStateWithProps ({groups, selectedLayerIds, filterKeyword}) { + updateStateWithProps ({ groups, selectedLayerIds, filterKeyword }) { this.groups = groups || this.groups; this.selectedLayerIds = selectedLayerIds || this.selectedLayerIds; if (!this._filterStateChanged(filterKeyword)) { @@ -38,7 +38,7 @@ export class StateHandler { const layers = group.getLayers() .filter(lyr => group.matchesKeyword(lyr.getId(), this.filterKeyword)); // and some other rule? - return {group, layers}; + return { group, layers }; }).filter(result => result.layers.length !== 0); return results; } @@ -52,7 +52,7 @@ export class StateHandler { groups: this.groups, filtered: this.filtered, openGroupTitles: this.openGroupTitles, - mapSrsName: this.map.getSrsName() + mapSrs: this.map.getSrsName() }; } notify () { @@ -96,8 +96,8 @@ export class StateHandler { }); } sandbox.postRequestByName('catalogue.ShowMetadataRequest', [ - {uuid}, - subUuids.map(sub => ({uuid: sub})) + { uuid }, + subUuids.map(sub => ({ uuid: sub })) ]); }, showLayerBackendStatus (layerId) { diff --git a/bundles/framework/layerlist/view/LayerCollapse/stories/mock.js b/bundles/framework/layerlist/view/LayerCollapse/stories/mock.js index 19cc8b7eb9..59148ac7d5 100644 --- a/bundles/framework/layerlist/view/LayerCollapse/stories/mock.js +++ b/bundles/framework/layerlist/view/LayerCollapse/stories/mock.js @@ -1,5 +1,5 @@ -export {AbstractLayer} from './mock/AbstractLayer.class'; -export {locale} from './mock/locale'; +export { AbstractLayer } from './mock/AbstractLayer.class'; +export { locale } from './mock/locale'; class MockMap { constructor () { diff --git a/bundles/framework/layerselection2/Tile.js b/bundles/framework/layerselection2/Tile.js index 1685314708..42925c9f00 100644 --- a/bundles/framework/layerselection2/Tile.js +++ b/bundles/framework/layerselection2/Tile.js @@ -5,7 +5,7 @@ */ Oskari.clazz.define('Oskari.mapframework.bundle.layerselection2.Tile', -/** + /** * @method create called automatically on construction * @static * @param diff --git a/bundles/framework/layerselector2/instance.js b/bundles/framework/layerselector2/instance.js index bb7042b04f..4cf8dd9ba7 100644 --- a/bundles/framework/layerselector2/instance.js +++ b/bundles/framework/layerselector2/instance.js @@ -23,7 +23,7 @@ Oskari.clazz.define( this.filteredLayerListOpenedByRequest = false; this.throttledRedraw = Oskari.util.throttle(() => { this.plugins['Oskari.userinterface.Flyout'].populateLayers(); - }, 2000, {leading: false}); + }, 2000, { leading: false }); }, { /** * @static diff --git a/bundles/framework/mapfull/instance.js b/bundles/framework/mapfull/instance.js index 31597f826e..6ef0ea2a04 100755 --- a/bundles/framework/mapfull/instance.js +++ b/bundles/framework/mapfull/instance.js @@ -1,4 +1,4 @@ -import {automagicPlugins} from './automagicPlugins'; +import { automagicPlugins } from './automagicPlugins'; /** * @class Oskari.mapframework.bundle.mapfull.MapFullBundleInstance diff --git a/bundles/framework/myplaces3/MyPlacesTab.js b/bundles/framework/myplaces3/MyPlacesTab.js index af03ecd5ae..da25df5456 100644 --- a/bundles/framework/myplaces3/MyPlacesTab.js +++ b/bundles/framework/myplaces3/MyPlacesTab.js @@ -199,7 +199,7 @@ Oskari.clazz.define('Oskari.mapframework.bundle.myplaces3.MyPlacesTab', service.deleteMyPlace(data.id, callback); }); var cancelBtn = dialog.createCloseButton(me.loc('tab.notification.delete.btnCancel')); - var confirmMsg = me.loc('tab.notification.delete.confirm', {name: data.name}); + var confirmMsg = me.loc('tab.notification.delete.confirm', { name: data.name }); dialog.show(me.loc('tab.notification.delete.title'), confirmMsg, [cancelBtn, okBtn]); dialog.makeModal(); }, diff --git a/bundles/framework/myplaces3/event/MyPlacesChangedEvent.js b/bundles/framework/myplaces3/event/MyPlacesChangedEvent.js index 2a287d4a08..d0bad322ec 100644 --- a/bundles/framework/myplaces3/event/MyPlacesChangedEvent.js +++ b/bundles/framework/myplaces3/event/MyPlacesChangedEvent.js @@ -4,7 +4,7 @@ */ Oskari.clazz.define('Oskari.mapframework.myplaces.event.MyPlacesChangedEvent', -/** + /** * @method create called automatically on construction * @static */ diff --git a/bundles/framework/myplaces3/model/MyPlacesCategory.js b/bundles/framework/myplaces3/model/MyPlacesCategory.js index 3377eeb9e5..28f2c13307 100644 --- a/bundles/framework/myplaces3/model/MyPlacesCategory.js +++ b/bundles/framework/myplaces3/model/MyPlacesCategory.js @@ -3,7 +3,7 @@ */ Oskari.clazz.define('Oskari.mapframework.bundle.myplaces3.model.MyPlacesCategory', -/** + /** * @method create called automatically on construction * @static */ diff --git a/bundles/framework/myplaces3/request/DeleteCategoryRequest.js b/bundles/framework/myplaces3/request/DeleteCategoryRequest.js index a7294f6f70..3f85faca3b 100644 --- a/bundles/framework/myplaces3/request/DeleteCategoryRequest.js +++ b/bundles/framework/myplaces3/request/DeleteCategoryRequest.js @@ -7,7 +7,7 @@ */ Oskari.clazz.define('Oskari.mapframework.bundle.myplaces3.request.DeleteCategoryRequest', -/** + /** * @method create called automatically on construction * @static * diff --git a/bundles/framework/myplaces3/request/DeletePlaceRequest.js b/bundles/framework/myplaces3/request/DeletePlaceRequest.js index eb076cb0ba..0985154e96 100644 --- a/bundles/framework/myplaces3/request/DeletePlaceRequest.js +++ b/bundles/framework/myplaces3/request/DeletePlaceRequest.js @@ -8,7 +8,7 @@ */ Oskari.clazz.define('Oskari.mapframework.bundle.myplaces3.request.DeletePlaceRequest', -/** + /** * @method create called automatically on construction * @static * diff --git a/bundles/framework/myplaces3/request/EditCategoryRequest.js b/bundles/framework/myplaces3/request/EditCategoryRequest.js index 4309cf2899..94801d94bc 100644 --- a/bundles/framework/myplaces3/request/EditCategoryRequest.js +++ b/bundles/framework/myplaces3/request/EditCategoryRequest.js @@ -7,7 +7,7 @@ */ Oskari.clazz.define('Oskari.mapframework.bundle.myplaces3.request.EditCategoryRequest', -/** + /** * @method create called automatically on construction * @static * diff --git a/bundles/framework/myplaces3/request/EditRequestHandler.js b/bundles/framework/myplaces3/request/EditRequestHandler.js index 4aa43301a0..e437d98a44 100644 --- a/bundles/framework/myplaces3/request/EditRequestHandler.js +++ b/bundles/framework/myplaces3/request/EditRequestHandler.js @@ -51,7 +51,7 @@ Oskari.clazz.define('Oskari.mapframework.bundle.myplaces3.request.EditRequestHan shape = geometry.type.replace('Multi', ''); this.instance.myPlaceSelected(); this.instance.setIsEditPlace(true); - this.sandbox.postRequestByName('DrawTools.StartDrawingRequest', [this.instance.getName(), shape, {allowMultipleDrawing: 'multiGeom', geojson: JSON.stringify(geometry), drawControl: false, showMeasureOnMap: true, style: this.instance.getDrawStyle()}]); + this.sandbox.postRequestByName('DrawTools.StartDrawingRequest', [this.instance.getName(), shape, { allowMultipleDrawing: 'multiGeom', geojson: JSON.stringify(geometry), drawControl: false, showMeasureOnMap: true, style: this.instance.getDrawStyle() }]); this.instance.getMainView().showPlaceForm(center, place); } else { // should not happen diff --git a/bundles/framework/myplaces3/request/OpenAddLayerDialogHandler.js b/bundles/framework/myplaces3/request/OpenAddLayerDialogHandler.js index 28c665c062..10eef3169a 100644 --- a/bundles/framework/myplaces3/request/OpenAddLayerDialogHandler.js +++ b/bundles/framework/myplaces3/request/OpenAddLayerDialogHandler.js @@ -4,7 +4,7 @@ */ Oskari.clazz.define('Oskari.mapframework.bundle.myplaces3.request.OpenAddLayerDialogHandler', -/** + /** * @method create called automatically on construction * @static * @param {Oskari.Sandbox} sandbox diff --git a/bundles/framework/myplaces3/request/OpenAddLayerDialogRequest.js b/bundles/framework/myplaces3/request/OpenAddLayerDialogRequest.js index 039e4e1d7e..cfa78a6f71 100644 --- a/bundles/framework/myplaces3/request/OpenAddLayerDialogRequest.js +++ b/bundles/framework/myplaces3/request/OpenAddLayerDialogRequest.js @@ -7,7 +7,7 @@ */ Oskari.clazz.define('Oskari.mapframework.bundle.myplaces3.request.OpenAddLayerDialogRequest', -/** + /** * @method create called automatically on construction * @static * diff --git a/bundles/framework/myplaces3/request/PublishCategoryRequest.js b/bundles/framework/myplaces3/request/PublishCategoryRequest.js index 876fa28236..d15c01d70c 100644 --- a/bundles/framework/myplaces3/request/PublishCategoryRequest.js +++ b/bundles/framework/myplaces3/request/PublishCategoryRequest.js @@ -7,7 +7,7 @@ */ Oskari.clazz.define('Oskari.mapframework.bundle.myplaces3.request.PublishCategoryRequest', -/** + /** * @method create called automatically on construction * @static * diff --git a/bundles/framework/myplaces3/service/MyPlacesService.js b/bundles/framework/myplaces3/service/MyPlacesService.js index 0791b0adb9..8bb07cc35b 100644 --- a/bundles/framework/myplaces3/service/MyPlacesService.js +++ b/bundles/framework/myplaces3/service/MyPlacesService.js @@ -603,7 +603,7 @@ Oskari.clazz.define('Oskari.mapframework.bundle.myplaces3.service.MyPlacesServic type: isNew ? 'POST' : 'PUT', dataType: 'json', contentType: 'application/json', - data: JSON.stringify({'features': categories}), + data: JSON.stringify({ 'features': categories }), url: Oskari.urls.getRoute('MyPlacesLayers'), success: function (response) { if (response) { diff --git a/bundles/framework/myplacesimport/Flyout.js b/bundles/framework/myplacesimport/Flyout.js index b074f662c4..f3c33557fe 100755 --- a/bundles/framework/myplacesimport/Flyout.js +++ b/bundles/framework/myplacesimport/Flyout.js @@ -124,7 +124,7 @@ Oskari.clazz.define('Oskari.mapframework.bundle.myplacesimport.Flyout', createUi: function () { var template = jQuery(this.__templates.base).clone(); template.find('div.info') - .html(this.loc('flyout.description', {maxSize: this.maxFileSize})); + .html(this.loc('flyout.description', { maxSize: this.maxFileSize })); template.find('div.state') .html(this.__createFileImportTemplate()); return template; @@ -302,11 +302,11 @@ Oskari.clazz.define('Oskari.mapframework.bundle.myplacesimport.Flyout', __finish: function (json) { this.progressSpinner.stop(); var title = this.loc('flyout.finish.success.title'); - var msg = this.loc('flyout.finish.success.message', {count: json.featuresCount}); + var msg = this.loc('flyout.finish.success.message', { count: json.featuresCount }); var fadeout = true; if (json.warning !== undefined && json.warning.featuresSkipped) { - msg = msg + ' ' + this.loc('flyout.warning.features_skipped', {count: json.warning.featuresSkipped}); + msg = msg + ' ' + this.loc('flyout.warning.features_skipped', { count: json.warning.featuresSkipped }); fadeout = false; } this.instance.addUserLayer(json); @@ -326,13 +326,13 @@ Oskari.clazz.define('Oskari.mapframework.bundle.myplacesimport.Flyout', const key = errorInfo.error; switch (key) { case 'multiple_extensions': - msg = this.loc('flyout.error.multiple_extensions', {extension: errorInfo.extensions}); + msg = this.loc('flyout.error.multiple_extensions', { extension: errorInfo.extensions }); break; case 'multiple_main_file': - msg = this.loc('flyout.error.multiple_main_file', {extensions: errorInfo.extensions}); + msg = this.loc('flyout.error.multiple_main_file', { extensions: errorInfo.extensions }); break; case 'file_over_size': - msg = this.loc('flyout.error.file_over_size', {maxSize: this.maxFileSize}); + msg = this.loc('flyout.error.file_over_size', { maxSize: this.maxFileSize }); break; case 'no_main_file': list.push(errors.no_main_file); diff --git a/bundles/framework/myplacesimport/UserLayersTab.js b/bundles/framework/myplacesimport/UserLayersTab.js index 183c3744d4..1074634cba 100755 --- a/bundles/framework/myplacesimport/UserLayersTab.js +++ b/bundles/framework/myplacesimport/UserLayersTab.js @@ -117,7 +117,7 @@ Oskari.clazz.define('Oskari.mapframework.bundle.myplacesimport.UserLayersTab', dialog.close(); }); var cancelBtn = dialog.createCloseButton(me.loc('tab.buttons.cancel')); - var confirmMsg = me.loc('tab.confirmDeleteMsg', {name: data.name}); + var confirmMsg = me.loc('tab.confirmDeleteMsg', { name: data.name }); dialog.show(me.loc('tab.deleteLayer'), confirmMsg, [cancelBtn, okBtn]); dialog.makeModal(); }, diff --git a/bundles/framework/personaldata/MyViewsTab.js b/bundles/framework/personaldata/MyViewsTab.js index 5079ef76e5..806399ad23 100644 --- a/bundles/framework/personaldata/MyViewsTab.js +++ b/bundles/framework/personaldata/MyViewsTab.js @@ -449,7 +449,7 @@ Oskari.clazz.define('Oskari.mapframework.bundle.personaldata.MyViewsTab', me.popupOpen = false; }); var cancelBtn = dialog.createCloseButton(this.loc('tabs.myviews.button.cancel')); - dialog.show(me.loc('tabs.myviews.popup.deletetitle'), me.loc('tabs.myviews.popup.deletemsg', {name: view.name}), [cancelBtn, okBtn]); + dialog.show(me.loc('tabs.myviews.popup.deletetitle'), me.loc('tabs.myviews.popup.deletemsg', { name: view.name }), [cancelBtn, okBtn]); me.popupOpen = true; dialog.makeModal(); }, diff --git a/bundles/framework/personaldata/PublishedMapsTab.js b/bundles/framework/personaldata/PublishedMapsTab.js index 22ba59413b..0db51fe175 100755 --- a/bundles/framework/personaldata/PublishedMapsTab.js +++ b/bundles/framework/personaldata/PublishedMapsTab.js @@ -189,7 +189,7 @@ Oskari.clazz.define('Oskari.mapframework.bundle.personaldata.PublishedMapsTab', }); dialog.show( me.loc('tabs.publishedmaps.popup.deletetitle'), - me.loc('tabs.publishedmaps.popup.deletemsg', {name: view.name}), + me.loc('tabs.publishedmaps.popup.deletemsg', { name: view.name }), [cancelBtn, okBtn] ); me.popupOpen = true; diff --git a/bundles/framework/personaldata/request/AddTabRequestHandler.js b/bundles/framework/personaldata/request/AddTabRequestHandler.js index 8b50efa184..7b63af678a 100755 --- a/bundles/framework/personaldata/request/AddTabRequestHandler.js +++ b/bundles/framework/personaldata/request/AddTabRequestHandler.js @@ -22,7 +22,7 @@ Oskari.clazz.define('Oskari.mapframework.bundle.personaldata.request.AddTabReque * request to handle */ handleRequest: function (core, request) { - this.personaldata.addTab({'title': request.getTitle(), 'content': request.getContent(), 'first': request.isFirst(), 'id': request.getId()}); + this.personaldata.addTab({ 'title': request.getTitle(), 'content': request.getContent(), 'first': request.isFirst(), 'id': request.getId() }); } }, { /** diff --git a/bundles/framework/postprocessor/instance.js b/bundles/framework/postprocessor/instance.js index a15599885d..69c60a4294 100755 --- a/bundles/framework/postprocessor/instance.js +++ b/bundles/framework/postprocessor/instance.js @@ -105,7 +105,7 @@ Oskari.clazz.define('Oskari.mapframework.bundle.postprocessor.PostProcessorBundl var olPoints = { _points: [], addPoint: function (lon, lat) { - this._points.push({lon: parseFloat(lon), lat: parseFloat(lat)}); + this._points.push({ lon: parseFloat(lon), lat: parseFloat(lat) }); }, getBounds: function () { var top = 0, diff --git a/bundles/framework/promote/Flyout.js b/bundles/framework/promote/Flyout.js index a495a26590..887cdd0f30 100644 --- a/bundles/framework/promote/Flyout.js +++ b/bundles/framework/promote/Flyout.js @@ -5,7 +5,7 @@ */ Oskari.clazz.define('Oskari.mapframework.bundle.promote.Flyout', -/** + /** * @method create called automatically on construction * @static * @param {Oskari.mapframework.bundle.promote.PromoteBundleInstance} diff --git a/bundles/framework/promote/instance.js b/bundles/framework/promote/instance.js index 20af68b5a3..13d96139ad 100644 --- a/bundles/framework/promote/instance.js +++ b/bundles/framework/promote/instance.js @@ -9,7 +9,7 @@ */ Oskari.clazz.define('Oskari.mapframework.bundle.promote.PromoteBundleInstance', -/** + /** * @method create called automatically on construction * @static */ diff --git a/bundles/framework/publisher2/instance.js b/bundles/framework/publisher2/instance.js index e9ec02a5e2..059273b570 100755 --- a/bundles/framework/publisher2/instance.js +++ b/bundles/framework/publisher2/instance.js @@ -330,9 +330,9 @@ Oskari.clazz.define('Oskari.mapframework.bundle.publisher2.PublisherBundleInstan mapfull: { conf: { plugins: [ - {id: 'Oskari.mapframework.bundle.mapmodule.plugin.ScaleBarPlugin'}, - {id: 'Oskari.mapframework.mapmodule.ControlsPlugin'}, - {id: 'Oskari.mapframework.mapmodule.GetInfoPlugin'} + { id: 'Oskari.mapframework.bundle.mapmodule.plugin.ScaleBarPlugin' }, + { id: 'Oskari.mapframework.mapmodule.ControlsPlugin' }, + { id: 'Oskari.mapframework.mapmodule.GetInfoPlugin' } ] } }, diff --git a/bundles/framework/publisher2/tools/GetInfoTool.js b/bundles/framework/publisher2/tools/GetInfoTool.js index 547287222a..14e93d89e2 100755 --- a/bundles/framework/publisher2/tools/GetInfoTool.js +++ b/bundles/framework/publisher2/tools/GetInfoTool.js @@ -629,7 +629,7 @@ Oskari.clazz.define('Oskari.mapframework.publisher.tool.GetInfoTool', * @private */ _createColorPickers: function () { - var options = {className: 'oskari-colorpickerinput', cancelText: this.__instance._localization.BasicView.buttons.cancel}; + var options = { className: 'oskari-colorpickerinput', cancelText: this.__instance._localization.BasicView.buttons.cancel }; this._colorPickers = [ Oskari.clazz.create('Oskari.userinterface.component.ColorPickerInput', options), Oskari.clazz.create('Oskari.userinterface.component.ColorPickerInput', options), diff --git a/bundles/framework/publisher2/tools/LayerSelectionTool.js b/bundles/framework/publisher2/tools/LayerSelectionTool.js index a227bd1b14..077150600b 100755 --- a/bundles/framework/publisher2/tools/LayerSelectionTool.js +++ b/bundles/framework/publisher2/tools/LayerSelectionTool.js @@ -51,7 +51,7 @@ Oskari.clazz.define('Oskari.mapframework.publisher.tool.LayerSelectionTool', var me = this; if (me.state.enabled) { - var pluginConfig = {id: this.getTool().id, config: this.getPlugin().getConfig()}; + var pluginConfig = { id: this.getTool().id, config: this.getPlugin().getConfig() }; var layerSelection = me._getLayerSelection(); if (layerSelection && !jQuery.isEmptyObject(layerSelection)) { diff --git a/bundles/framework/publisher2/tools/ToolbarTool.js b/bundles/framework/publisher2/tools/ToolbarTool.js index ec4bdace2d..671843850c 100755 --- a/bundles/framework/publisher2/tools/ToolbarTool.js +++ b/bundles/framework/publisher2/tools/ToolbarTool.js @@ -161,7 +161,7 @@ Oskari.clazz.define('Oskari.mapframework.publisher.tool.ToolbarTool', return { id: 'Oskari.mapframework.bundle.mapmodule.plugin.PublisherToolbarPlugin', title: 'PublisherToolbarPlugin', - config: {'toolbarId': 'PublisherToolbar', buttons: []} + config: { 'toolbarId': 'PublisherToolbar', buttons: [] } }; }, /** @@ -198,7 +198,7 @@ Oskari.clazz.define('Oskari.mapframework.publisher.tool.ToolbarTool', }; // we want toolbar always with no default tools - retValue.configuration.toolbar = { conf: {'history': false, 'basictools': false, 'viewtools': false} }; + retValue.configuration.toolbar = { conf: { 'history': false, 'basictools': false, 'viewtools': false } }; // PublishedMyPlaces is not supported with ol3 diff --git a/bundles/framework/publisher2/view/PanelMapTools.js b/bundles/framework/publisher2/view/PanelMapTools.js index f090437485..6c2b917dba 100755 --- a/bundles/framework/publisher2/view/PanelMapTools.js +++ b/bundles/framework/publisher2/view/PanelMapTools.js @@ -126,7 +126,7 @@ Oskari.clazz.define('Oskari.mapframework.bundle.publisher2.view.PanelMapTools', me._sortTools(); // Add tools to panel _.each(tools, function (tool) { - var ui = jQuery(me.templates.tool({title: tool.getTitle()})); + var ui = jQuery(me.templates.tool({ title: tool.getTitle() })); // setup values when editing an existing map ui.find('input').prop('checked', !!tool.isEnabled()); ui.find('input').prop('disabled', !!tool.isDisabled()); diff --git a/bundles/framework/search/request/AddTabRequestHandler.js b/bundles/framework/search/request/AddTabRequestHandler.js index ccba90eedc..bbd4942c0e 100755 --- a/bundles/framework/search/request/AddTabRequestHandler.js +++ b/bundles/framework/search/request/AddTabRequestHandler.js @@ -22,7 +22,7 @@ Oskari.clazz.define('Oskari.mapframework.bundle.search.request.AddTabRequestHand * request to handle */ handleRequest: function (core, request) { - this.search.addTab({'title': request.getTitle(), 'content': request.getContent(), 'priority': request.getPriority(), 'id': request.getId()}); + this.search.addTab({ 'title': request.getTitle(), 'content': request.getContent(), 'priority': request.getPriority(), 'id': request.getId() }); } }, { /** diff --git a/bundles/framework/search/view/DefaultSearchView.js b/bundles/framework/search/view/DefaultSearchView.js index 50d02fad5d..f4a444eee6 100755 --- a/bundles/framework/search/view/DefaultSearchView.js +++ b/bundles/framework/search/view/DefaultSearchView.js @@ -286,7 +286,7 @@ Oskari.clazz.define( }, __getSearchResultHeader: function (count, hasMore) { var intro = _.template(this.instance.getLocalization('searchResultCount') + ' ${count} ' + this.instance.getLocalization('searchResultCount2')); - var msg = intro({count: count}); + var msg = intro({ count: count }); msg = msg + '
'; if (hasMore) { @@ -400,7 +400,7 @@ Oskari.clazz.define( var moveReqBuilder = Oskari.requestBuilder('MapMoveRequest'), zoom = result.zoomLevel; if (result.zoomScale) { - zoom = {scale: result.zoomScale}; + zoom = { scale: result.zoomScale }; } sandbox.request( me.instance.getName(), diff --git a/bundles/framework/statehandler/session-methods.js b/bundles/framework/statehandler/session-methods.js index 8dd8bee056..355f74cee4 100755 --- a/bundles/framework/statehandler/session-methods.js +++ b/bundles/framework/statehandler/session-methods.js @@ -31,7 +31,7 @@ Oskari.clazz.category( var extendButtonTitle = locale('session.expiring.extend'); var logoutButtonMessage = locale('session.expiring.logout'); var notifyTitle = locale('session.expiring.title'); - var notifyMessage = locale('session.expiring.message', {extend: '"' + extendButtonTitle + '"'}); + var notifyMessage = locale('session.expiring.message', { extend: '"' + extendButtonTitle + '"' }); var expiredTitle = locale('session.expired.title'); var expiredMessage = locale('session.expired.message'); var expireTimeout; @@ -43,7 +43,7 @@ Oskari.clazz.category( popup.show(expiredTitle, expiredMessage); popup.makeModal(); }); - clearTimeout(expireTimeout); + clearInterval(expireTimeout); me.setSessionExpiring(minutes); popup.close(true); }); @@ -55,18 +55,18 @@ Oskari.clazz.category( return { show: function () { const expireIn = 60; // Expire time in seconds - popup.show(notifyTitle, notifyMessage + '
' + locale('session.expiring.expires', {expires: expireIn}), [logoutButton, extendButton]); + popup.show(notifyTitle, notifyMessage + '
' + locale('session.expiring.expires', { expires: expireIn }), [logoutButton, extendButton]); // Using Date for more accurate countdown (instead of just using setTimeout or setInterval) const start = Date.now(); let diff; let seconds; - const interval = setInterval(timer, 1000); + expireTimeout = setInterval(timer, 1000); function timer () { diff = expireIn - (((Date.now() - start) / 1000) | 0); seconds = (diff % 60) | 0; seconds = seconds < 10 ? 0 + seconds : seconds; - if (seconds === 0) { - clearInterval(interval); + if (seconds < 1) { + clearInterval(expireTimeout); popup.show(expiredTitle, expiredMessage); popup.makeModal(); if (Oskari.user().isLoggedIn()) { @@ -75,7 +75,7 @@ Oskari.clazz.category( location.reload(); } } else { - popup.setContent(notifyMessage + '
' + locale('session.expiring.expires', {expires: seconds})); + popup.setContent(notifyMessage + '
' + locale('session.expiring.expires', { expires: seconds })); } } } diff --git a/bundles/framework/userguide/Flyout.js b/bundles/framework/userguide/Flyout.js index 812a4c57c6..e383419168 100755 --- a/bundles/framework/userguide/Flyout.js +++ b/bundles/framework/userguide/Flyout.js @@ -28,6 +28,8 @@ Oskari.clazz.define('Oskari.mapframework.bundle.userguide.Flyout', */ setEl: function (el, width, height) { this.container = el[0]; + const flyout = jQuery(el[0].parentElement.parentElement); + flyout.addClass('userguide'); if (!jQuery(this.container).hasClass('userguide')) { jQuery(this.container).addClass('userguide'); } diff --git a/bundles/framework/userguide/resources/scss/style.scss b/bundles/framework/userguide/resources/scss/style.scss index 179772061f..3ca6a1d650 100755 --- a/bundles/framework/userguide/resources/scss/style.scss +++ b/bundles/framework/userguide/resources/scss/style.scss @@ -21,3 +21,7 @@ } } } +/* override flyout's default max-width */ +.oskari-flyout.userguide { + max-width: 1000px; +} diff --git a/bundles/integration/admin-layerselector/collections/userRoleCollection.js b/bundles/integration/admin-layerselector/collections/userRoleCollection.js index 13967f6836..26291dac0b 100755 --- a/bundles/integration/admin-layerselector/collections/userRoleCollection.js +++ b/bundles/integration/admin-layerselector/collections/userRoleCollection.js @@ -4,7 +4,7 @@ function (roleModel) { return Backbone.Collection.extend({ - // Reference to this collection's model. + // Reference to this collection's model. model: roleModel, getRoles: function () { diff --git a/bundles/integration/admin-layerselector/views/adminLayerSettingsView.js b/bundles/integration/admin-layerselector/views/adminLayerSettingsView.js index 874479b7c3..a006b4b0bd 100755 --- a/bundles/integration/admin-layerselector/views/adminLayerSettingsView.js +++ b/bundles/integration/admin-layerselector/views/adminLayerSettingsView.js @@ -279,7 +279,7 @@ function ( } else { var reasonKey = Object.keys(resp.error)[0]; var reason = resp.error[reasonKey]; - content = jQuery('' + loc('recheckFailReason', {reason: reason}) + ''); + content = jQuery('' + loc('recheckFailReason', { reason: reason }) + ''); } popup.show(loc('recheckTitle'), content, [closeButton]); }, @@ -655,7 +655,7 @@ function ( form = element.parents('.add-style-send'), sldImport = form.find('.add-layer-style-import-block'); - // set this element invisible + // set this element invisible element.hide(); // Show new sld input block @@ -673,7 +673,7 @@ function ( sldImport = form.find('.add-layer-style-import-block'), sldImportBtn = form.find('.import-wfs-style-button'); - // set this element invisible + // set this element invisible sldImportBtn.show(); // Show new sld input block @@ -693,7 +693,7 @@ function ( sldName = form.find('.add-layer-sld-style-sldname').val(), sldXml = form.find('.add-sld-file').val(); - // Check if sld is valid + // Check if sld is valid if (me._checkXml(sldXml)) { // Save new style me._saveSldStyle(sldName, sldXml); @@ -1009,13 +1009,13 @@ function ( try { return JSON.parse(content); } catch (e) { - parseErrors.push({element: element}); + parseErrors.push({ element: element }); } } }; options = parseOptionQuietly('.add-layer-input.layer-options'); if (parseErrors.length > 0) { - return {errors: parseErrors}; + return { errors: parseErrors }; } if (options) { return options; @@ -1060,7 +1060,7 @@ function ( sandbox = Oskari.getSandbox(), admin; - // If this is a sublayer -> setup parent layers id + // If this is a sublayer -> setup parent layers id if (me.options.baseLayerId) { data.parentId = me.options.baseLayerId; } diff --git a/bundles/integration/admin-layerselector/views/layerSelectorView.js b/bundles/integration/admin-layerselector/views/layerSelectorView.js index 5385e8eae4..9700c69780 100755 --- a/bundles/integration/admin-layerselector/views/layerSelectorView.js +++ b/bundles/integration/admin-layerselector/views/layerSelectorView.js @@ -179,7 +179,7 @@ function (ViewTemplate, TabTitleTemplate, LayerCollection, LayersTabModel, TabPa var target = jQuery(e.currentTarget), type = target.attr('data-tab'); - // change class 'active' to correct tab + // change class 'active' to correct tab jQuery('.tabsHeader').find('.active').removeClass('active'); target.parent().addClass('active'); @@ -238,7 +238,7 @@ function (ViewTemplate, TabTitleTemplate, LayerCollection, LayersTabModel, TabPa xhr = null; var successCount = resp.success.length; var failCount = Object.keys(resp.error).length; - content.append('

' + loc('recheckAllSucceeded', {success: successCount, fail: failCount}) + ''); + content.append('

' + loc('recheckAllSucceeded', { success: successCount, fail: failCount }) + ''); }, error: function (xhr, status, error) { xhr = null; diff --git a/bundles/integration/admin-layerselector/views/tabPanelView.js b/bundles/integration/admin-layerselector/views/tabPanelView.js index e5b53ddd4d..5222aa25d0 100755 --- a/bundles/integration/admin-layerselector/views/tabPanelView.js +++ b/bundles/integration/admin-layerselector/views/tabPanelView.js @@ -200,7 +200,7 @@ function (FilterLayersTemplate, 'lcId': group.id }); - // grouping edit panels + // grouping edit panels groupPanel.find('.accordion-header') .append(this.__createGroupingPanel(this.options.tabId, group)); // add group panel to this tab @@ -264,7 +264,7 @@ function (FilterLayersTemplate, } }; - // override some UI texts for inspire theme form + // override some UI texts for inspire theme form if (tabId === 'inspire') { groupingConfig.title = adminLoc.addInspireName; groupingConfig.desc = adminLoc.addInspireNameTitle; diff --git a/bundles/integration/bb/Adapter.js b/bundles/integration/bb/Adapter.js index f1c1264286..963c65b81c 100755 --- a/bundles/integration/bb/Adapter.js +++ b/bundles/integration/bb/Adapter.js @@ -15,7 +15,7 @@ */ Oskari.clazz.define('Oskari.integration.bundle.bb.AdapterBundleInstance', -/** + /** * @method create called automatically on construction * @static */ @@ -28,7 +28,7 @@ Oskari.clazz.define('Oskari.integration.bundle.bb.AdapterBundleInstance', this._view = null; }, { - /** + /** * @method getTitle * Extension protocol method * @return {String} localized text for the title of the component diff --git a/bundles/integration/bb/Flyout.js b/bundles/integration/bb/Flyout.js index ac38ec7f0a..50500d31a2 100755 --- a/bundles/integration/bb/Flyout.js +++ b/bundles/integration/bb/Flyout.js @@ -8,7 +8,7 @@ */ Oskari.clazz.define('Oskari.integration.bundle.bb.Flyout', -/** + /** * @method create called automatically on construction * @static * diff --git a/bundles/mapping/drawtools/instance.js b/bundles/mapping/drawtools/instance.js index 5335f576bc..d767fc2af8 100755 --- a/bundles/mapping/drawtools/instance.js +++ b/bundles/mapping/drawtools/instance.js @@ -24,7 +24,7 @@ */ Oskari.clazz.define('Oskari.mapping.drawtools.DrawToolsBundleInstance', -/** + /** * @method create called automatically on construction * @static */ diff --git a/bundles/mapping/drawtools/plugin/DrawPlugin.ol.js b/bundles/mapping/drawtools/plugin/DrawPlugin.ol.js index 1da094cb2b..d8c85a3d9e 100644 --- a/bundles/mapping/drawtools/plugin/DrawPlugin.ol.js +++ b/bundles/mapping/drawtools/plugin/DrawPlugin.ol.js @@ -1,7 +1,7 @@ import olSourceVector from 'ol/source/Vector'; import olLayerVector from 'ol/layer/Vector'; import * as olExtent from 'ol/extent'; -import olInteractionDraw, {createRegularPolygon} from 'ol/interaction/Draw'; +import olInteractionDraw, { createRegularPolygon } from 'ol/interaction/Draw'; import olInteractionModify from 'ol/interaction/Modify'; import * as olEventsCondition from 'ol/events/condition'; import olOverlay from 'ol/Overlay'; @@ -12,7 +12,7 @@ import GeometryCollection from 'ol/geom/GeometryCollection'; import olFormatGeoJSON from 'ol/format/GeoJSON'; import olCollection from 'ol/Collection'; import jstsOL3Parser from 'jsts/org/locationtech/jts/io/OL3Parser'; -import {BufferOp, BufferParameters} from 'jsts/org/locationtech/jts/operation/buffer'; +import { BufferOp, BufferParameters } from 'jsts/org/locationtech/jts/operation/buffer'; import isValidOp from 'jsts/org/locationtech/jts/operation/valid/IsValidOp'; const olParser = new jstsOL3Parser(); @@ -247,7 +247,7 @@ Oskari.clazz.define( feat, feats = []; geometries.forEach(function (geom) { - feat = new olFeature({geometry: geom}); + feat = new olFeature({ geometry: geom }); feat.setId(me.generateNewFeatureId()); feats.push(feat); if (checkIntersection) { @@ -638,7 +638,7 @@ Oskari.clazz.define( var multiGeometry = me.createMultiGeometry(geometries); - feature = new olFeature({geometry: multiGeometry}); + feature = new olFeature({ geometry: multiGeometry }); feature.setId(me.generateNewFeatureId()); jsonObject = me.formJsonObject(feature, measures, buffer); @@ -735,7 +735,7 @@ Oskari.clazz.define( var me = this; var vector = new olLayerVector({ id: layerId, - source: new olSourceVector({features: new olCollection()}), + source: new olSourceVector({ features: new olCollection() }), style: me._styles.draw }); me.getMap().addLayer(vector); diff --git a/bundles/mapping/infobox/instance.js b/bundles/mapping/infobox/instance.js index c1e1074540..151dd80d72 100755 --- a/bundles/mapping/infobox/instance.js +++ b/bundles/mapping/infobox/instance.js @@ -9,7 +9,7 @@ */ Oskari.clazz.define('Oskari.mapframework.bundle.infobox.InfoBoxBundleInstance', -/** + /** * @method create called automatically on construction * @static */ diff --git a/bundles/mapping/infobox/plugin/openlayerspopup/OpenlayersPopupPlugin.ol.js b/bundles/mapping/infobox/plugin/openlayerspopup/OpenlayersPopupPlugin.ol.js index d4ba5854df..fea4c6290f 100644 --- a/bundles/mapping/infobox/plugin/openlayerspopup/OpenlayersPopupPlugin.ol.js +++ b/bundles/mapping/infobox/plugin/openlayerspopup/OpenlayersPopupPlugin.ol.js @@ -154,7 +154,7 @@ Oskari.clazz.define( currPopup.contentData = contentData; } - me._renderPopup(id, contentData, title, {lon: lon, lat: lat}, options, refresh, additionalTools, marker); + me._renderPopup(id, contentData, title, { lon: lon, lat: lat }, options, refresh, additionalTools, marker); }, /** @@ -492,7 +492,7 @@ Oskari.clazz.define( text = link.html(); } if (contentData[i] && contentData[i].actions) { - var actionObject = _.find(contentData[i].actions, {'name': text}); + var actionObject = _.find(contentData[i].actions, { 'name': text }); if (typeof actionObject.action === 'function') { actionObject.action(); } else { diff --git a/bundles/mapping/mapmodule/AbstractMapModule.js b/bundles/mapping/mapmodule/AbstractMapModule.js index 37e5e5239b..64220652bd 100755 --- a/bundles/mapping/mapmodule/AbstractMapModule.js +++ b/bundles/mapping/mapmodule/AbstractMapModule.js @@ -301,7 +301,7 @@ Oskari.clazz.define( this.afterRearrangeSelectedMapLayerEvent(event); }, MapSizeChangedEvent: function (evt) { - this._handleMapSizeChanges({width: evt.getWidth(), height: evt.getHeight()}); + this._handleMapSizeChanges({ width: evt.getWidth(), height: evt.getHeight() }); }, 'Toolbar.ToolbarLoadedEvent': function () { this.startLazyPlugins(); diff --git a/bundles/mapping/mapmodule/LocationModule.js b/bundles/mapping/mapmodule/LocationModule.js index 09966df76c..e562c8ab7e 100644 --- a/bundles/mapping/mapmodule/LocationModule.js +++ b/bundles/mapping/mapmodule/LocationModule.js @@ -1,5 +1,5 @@ -const errorCodes = {1: 'denied', 2: 'unavailable', 3: 'timeout'}; +const errorCodes = { 1: 'denied', 2: 'unavailable', 3: 'timeout' }; const sandbox = Oskari.getSandbox(); const log = Oskari.log('Oskari.mapframework.module.LocationModule'); // let _pathJson = null; diff --git a/bundles/mapping/mapmodule/MapModuleClass.ol.js b/bundles/mapping/mapmodule/MapModuleClass.ol.js index 87acd51e53..9a969fdcae 100644 --- a/bundles/mapping/mapmodule/MapModuleClass.ol.js +++ b/bundles/mapping/mapmodule/MapModuleClass.ol.js @@ -5,21 +5,21 @@ import olStyleCircle from 'ol/style/Circle'; import olStyleIcon from 'ol/style/Icon'; import olStyleText from 'ol/style/Text'; import * as olExtent from 'ol/extent'; -import {defaults as olInteractionDefaults} from 'ol/interaction'; +import { defaults as olInteractionDefaults } from 'ol/interaction'; import olFormatWKT from 'ol/format/WKT'; import olFormatGeoJSON from 'ol/format/GeoJSON'; import olView from 'ol/View'; -import {METERS_PER_UNIT as olProjUnitsMETERS_PER_UNIT} from 'ol/proj/Units'; +import { METERS_PER_UNIT as olProjUnitsMETERS_PER_UNIT } from 'ol/proj/Units'; import * as olProjProj4 from 'ol/proj/proj4'; import * as olProj from 'ol/proj'; import olMap from 'ol/Map'; -import {defaults as olControlDefaults} from 'ol/control'; +import { defaults as olControlDefaults } from 'ol/control'; import * as olSphere from 'ol/sphere'; import * as olGeom from 'ol/geom'; -import {fromCircle} from 'ol/geom/Polygon'; +import { fromCircle } from 'ol/geom/Polygon'; import olFeature from 'ol/Feature'; -import {OskariImageWMS} from './plugin/wmslayer/OskariImageWMS'; +import { OskariImageWMS } from './plugin/wmslayer/OskariImageWMS'; const AbstractMapModule = Oskari.clazz.get('Oskari.mapping.mapmodule.AbstractMapModule'); @@ -272,7 +272,7 @@ export class MapModule extends AbstractMapModule { return geometry.getArea(); } var geom = geometry.clone().transform(sourceProj, 'EPSG:4326'); - return Math.abs(olSphere.getArea(geom, {projection: 'EPSG:4326', radius: 6378137})); + return Math.abs(olSphere.getArea(geom, { projection: 'EPSG:4326', radius: 6378137 })); } /** @@ -698,7 +698,7 @@ export class MapModule extends AbstractMapModule { var olBounds = olGeometry.getExtent(); var x = olBounds[0] + (olBounds[2] - olBounds[0]) / 2; var y = olBounds[1] + (olBounds[3] - olBounds[1]) / 2; - return {lon: x, lat: y}; + return { lon: x, lat: y }; } getClosestPointFromGeoJSON (geojson) { @@ -708,14 +708,14 @@ export class MapModule extends AbstractMapModule { var x = olBounds[0] + (olBounds[2] - olBounds[0]) / 2; var y = olBounds[1] + (olBounds[3] - olBounds[1]) / 2; var coord = olGeometry.getClosestPoint([x, y]); - return {lon: coord[0], lat: coord[1]}; + return { lon: coord[0], lat: coord[1] }; } // TODO: check LayersPlugin.ol3 getGeometryBounds getBoundsFromGeoJSON (geojson) { var olGeometry = this.getOLGeometryFromGeoJSON(geojson); var extent = olGeometry.getExtent(); - return {left: extent[0], bottom: extent[1], right: extent[2], top: extent[3]}; + return { left: extent[0], bottom: extent[1], right: extent[2], top: extent[3] }; } isPointInExtent (extent, x, y) { diff --git a/bundles/mapping/mapmodule/domain/AbstractLayer.js b/bundles/mapping/mapmodule/domain/AbstractLayer.js index bde88934e3..dbb9ad1426 100755 --- a/bundles/mapping/mapmodule/domain/AbstractLayer.js +++ b/bundles/mapping/mapmodule/domain/AbstractLayer.js @@ -1287,7 +1287,7 @@ Oskari.clazz.define( * @param {Array} groups groups array [{id:1,name:name"}] */ setGroups: function (groups) { - this._groups = groups || [{id: -1, name: ''}]; + this._groups = groups || [{ id: -1, name: '' }]; }, /** * @method @public getGroups get groups diff --git a/bundles/mapping/mapmodule/mapmodule.ol.js b/bundles/mapping/mapmodule/mapmodule.ol.js index 7adba78a24..a796a51a2a 100644 --- a/bundles/mapping/mapmodule/mapmodule.ol.js +++ b/bundles/mapping/mapmodule/mapmodule.ol.js @@ -1,4 +1,4 @@ -import {MapModule as MapModuleOl} from './MapModuleClass.ol'; +import { MapModule as MapModuleOl } from './MapModuleClass.ol'; /** * @class Oskari.mapframework.ui.module.common.MapModule diff --git a/bundles/mapping/mapmodule/plugin/bingmapslayer/BingMapsLayerPlugin.js b/bundles/mapping/mapmodule/plugin/bingmapslayer/BingMapsLayerPlugin.js index 3dc3d7a002..633deb57b5 100644 --- a/bundles/mapping/mapmodule/plugin/bingmapslayer/BingMapsLayerPlugin.js +++ b/bundles/mapping/mapmodule/plugin/bingmapslayer/BingMapsLayerPlugin.js @@ -1,6 +1,6 @@ import olSourceBingMaps from 'ol/source/BingMaps'; import olLayerTile from 'ol/layer/Tile'; -import {BingMapsLayerModelBuilder} from './BingMapsLayerModelBuilder'; +import { BingMapsLayerModelBuilder } from './BingMapsLayerModelBuilder'; const AbstractMapLayerPlugin = Oskari.clazz.get('Oskari.mapping.mapmodule.AbstractMapLayerPlugin'); @@ -127,4 +127,4 @@ Oskari.clazz.defineES('Oskari.mapframework.mapmodule.BingMapsLayerPlugin', BingM } ); -export {BingMapsLayerPlugin}; +export { BingMapsLayerPlugin }; diff --git a/bundles/mapping/mapmodule/plugin/layers/LayerSelectionPlugin.js b/bundles/mapping/mapmodule/plugin/layers/LayerSelectionPlugin.js index f6a0a47f1b..5ac07649a7 100755 --- a/bundles/mapping/mapmodule/plugin/layers/LayerSelectionPlugin.js +++ b/bundles/mapping/mapmodule/plugin/layers/LayerSelectionPlugin.js @@ -166,7 +166,7 @@ Oskari.clazz.define('Oskari.mapframework.bundle.mapmodule.plugin.LayerSelectionP } }, MapSizeChangedEvent: function (evt) { - this._handleMapSizeChanged({width: evt.getWidth(), height: evt.getHeight()}); + this._handleMapSizeChanged({ width: evt.getWidth(), height: evt.getHeight() }); } }; }, diff --git a/bundles/mapping/mapmodule/plugin/layers/LayersPlugin.ol.js b/bundles/mapping/mapmodule/plugin/layers/LayersPlugin.ol.js index b237c88f3a..38df8aaad4 100644 --- a/bundles/mapping/mapmodule/plugin/layers/LayersPlugin.ol.js +++ b/bundles/mapping/mapmodule/plugin/layers/LayersPlugin.ol.js @@ -1,4 +1,4 @@ -import {LayersPlugin} from './LayersPluginClass.ol'; +import { LayersPlugin } from './LayersPluginClass.ol'; Oskari.clazz.defineES('Oskari.mapframework.bundle.mapmodule.plugin.LayersPlugin', LayersPlugin, diff --git a/bundles/mapping/mapmodule/plugin/layers/LayersPluginClass.ol.js b/bundles/mapping/mapmodule/plugin/layers/LayersPluginClass.ol.js index 58cb23cce8..08f6aef3ca 100644 --- a/bundles/mapping/mapmodule/plugin/layers/LayersPluginClass.ol.js +++ b/bundles/mapping/mapmodule/plugin/layers/LayersPluginClass.ol.js @@ -137,7 +137,7 @@ export class LayersPlugin extends AbstractMapModulePlugin { getGeometryCenter (geometry) { if (geometry.getType() === 'Point') { var point = geometry.getCoordinates(); - return {lon: point[0], lat: point[1]}; + return { lon: point[0], lat: point[1] }; } else if (geometry.getType() === 'Polygon') { var extent = geometry.getExtent(); return { diff --git a/bundles/mapping/mapmodule/plugin/location/GeoLocationPlugin.js b/bundles/mapping/mapmodule/plugin/location/GeoLocationPlugin.js index 4d5ab09799..1986762fbc 100755 --- a/bundles/mapping/mapmodule/plugin/location/GeoLocationPlugin.js +++ b/bundles/mapping/mapmodule/plugin/location/GeoLocationPlugin.js @@ -1,4 +1,4 @@ -import {getUserLocation} from '../../LocationModule'; +import { getUserLocation } from '../../LocationModule'; /** * @class Oskari.mapframework.bundle.mappublished.GeoLocationPlugin * @@ -58,7 +58,7 @@ Oskari.clazz.define( } mapmodule.centerMap({ lon: lon, lat: lat }, 6); me._locationIsSet = true; - }, null, {timeout: 30000}); + }, null, { timeout: 30000 }); } }, { 'extend': ['Oskari.mapping.mapmodule.plugin.AbstractMapModulePlugin'], diff --git a/bundles/mapping/mapmodule/plugin/logo/DataProviderInfoService.js b/bundles/mapping/mapmodule/plugin/logo/DataProviderInfoService.js index 51dd0b4cf2..f7d037810c 100755 --- a/bundles/mapping/mapmodule/plugin/logo/DataProviderInfoService.js +++ b/bundles/mapping/mapmodule/plugin/logo/DataProviderInfoService.js @@ -16,7 +16,7 @@ service.addItemToGroup('map.layers', { 'id' : 'dummy id the second', 'name' : 'i Oskari.clazz.define('Oskari.map.DataProviderInfoService', - /** + /** * @method create called automatically on construction * @static */ diff --git a/bundles/mapping/mapmodule/plugin/markers/MarkersPlugin.ol.js b/bundles/mapping/mapmodule/plugin/markers/MarkersPlugin.ol.js index cba52fb83d..8d686ca0d2 100644 --- a/bundles/mapping/mapmodule/plugin/markers/MarkersPlugin.ol.js +++ b/bundles/mapping/mapmodule/plugin/markers/MarkersPlugin.ol.js @@ -221,7 +221,7 @@ Oskari.clazz.define('Oskari.mapframework.mapmodule.MarkersPlugin', */ _createMapMarkerLayer: function () { var me = this; - var markerLayer = new olLayerVector({title: 'Markers', source: new olSourceVector()}); + var markerLayer = new olLayerVector({ title: 'Markers', source: new olSourceVector() }); me.getMap().addLayer(markerLayer); me.raiseMarkerLayer(markerLayer); @@ -535,7 +535,7 @@ Oskari.clazz.define('Oskari.mapframework.mapmodule.MarkersPlugin', } var markerLayer = this.getMarkersLayer(); var markerStyle = this.getMapModule().getStyle(style); - var newMarker = new olFeature({id: data.id, geometry: new olGeom.Point([data.x, data.y])}); + var newMarker = new olFeature({ id: data.id, geometry: new olGeom.Point([data.x, data.y]) }); this._markerFeatures[data.id] = newMarker; this._markers[data.id] = data; diff --git a/bundles/mapping/mapmodule/plugin/publishertoolbar/PublisherToolbarPlugin.js b/bundles/mapping/mapmodule/plugin/publishertoolbar/PublisherToolbarPlugin.js index 038b6713ef..20fcbf9be1 100755 --- a/bundles/mapping/mapmodule/plugin/publishertoolbar/PublisherToolbarPlugin.js +++ b/bundles/mapping/mapmodule/plugin/publishertoolbar/PublisherToolbarPlugin.js @@ -480,7 +480,7 @@ Oskari.clazz.define('Oskari.mapframework.bundle.mapmodule.plugin.PublisherToolba me.popup = popupService.createPopup(); me.popup.addClass('toolbar-popup'); - me.popup.setColourScheme({'bgColour': '#e6e6e6'}); + me.popup.setColourScheme({ 'bgColour': '#e6e6e6' }); if (isMobile) { popupService.closeAllPopups(true); } diff --git a/bundles/mapping/mapmodule/plugin/publishertoolbar/request/ToolContainerRequestHandler.js b/bundles/mapping/mapmodule/plugin/publishertoolbar/request/ToolContainerRequestHandler.js index ff9d23c419..e709a82fd9 100755 --- a/bundles/mapping/mapmodule/plugin/publishertoolbar/request/ToolContainerRequestHandler.js +++ b/bundles/mapping/mapmodule/plugin/publishertoolbar/request/ToolContainerRequestHandler.js @@ -5,7 +5,7 @@ */ Oskari.clazz.define('Oskari.mapframework.bundle.toolbar.request.ToolContainerRequestHandler', -/** + /** * @method create called automatically on construction * @static * @param {Oskari.mapframework.bundle.toolbar.ToolbarBundleInstance} toolbar diff --git a/bundles/mapping/mapmodule/plugin/search/SearchPlugin.js b/bundles/mapping/mapmodule/plugin/search/SearchPlugin.js index a85c9cb192..1f2c203581 100755 --- a/bundles/mapping/mapmodule/plugin/search/SearchPlugin.js +++ b/bundles/mapping/mapmodule/plugin/search/SearchPlugin.js @@ -390,7 +390,7 @@ Oskari.clazz.define( lat = msg.locations[0].lat; zoom = msg.locations[0].zoomLevel; if (msg.locations[0].zoomScale) { - zoom = {scale: msg.locations[0].zoomScale}; + zoom = { scale: msg.locations[0].zoomScale }; } me.getSandbox().request( @@ -428,7 +428,7 @@ Oskari.clazz.define( zoom = resultItem.zoomLevel; if (resultItem.zoomScale) { - zoom = {scale: resultItem.zoomScale}; + zoom = { scale: resultItem.zoomScale }; } var row = me.templateResultsRow.clone(), @@ -508,7 +508,7 @@ Oskari.clazz.define( _resultClicked: function (result) { var zoom = result.zoomLevel; if (result.zoomScale) { - zoom = {scale: result.zoomScale}; + zoom = { scale: result.zoomScale }; } this.getSandbox().request( this.getName(), diff --git a/bundles/mapping/mapmodule/plugin/vectorlayer/VectorLayerPlugin.ol.js b/bundles/mapping/mapmodule/plugin/vectorlayer/VectorLayerPlugin.ol.js index 5c0bb4d356..958c71d8db 100644 --- a/bundles/mapping/mapmodule/plugin/vectorlayer/VectorLayerPlugin.ol.js +++ b/bundles/mapping/mapmodule/plugin/vectorlayer/VectorLayerPlugin.ol.js @@ -1,12 +1,12 @@ import olSourceVector from 'ol/source/Vector'; import olLayerVector from 'ol/layer/Vector'; -import {unByKey} from 'ol/Observable.js'; +import { unByKey } from 'ol/Observable.js'; import olOverlay from 'ol/Overlay'; -import {fromExtent} from 'ol/geom/Polygon'; +import { fromExtent } from 'ol/geom/Polygon'; import olFormatWKT from 'ol/format/WKT'; import olFormatGeoJSON from 'ol/format/GeoJSON'; import jstsOL3Parser from 'jsts/org/locationtech/jts/io/OL3Parser'; -import {BufferOp} from 'jsts/org/locationtech/jts/operation/buffer'; +import { BufferOp } from 'jsts/org/locationtech/jts/operation/buffer'; import * as olGeom from 'ol/geom'; import LinearRing from 'ol/geom/LinearRing'; import GeometryCollection from 'ol/geom/GeometryCollection'; @@ -730,7 +730,7 @@ Oskari.clazz.define( */ _updateFeature: function (options, propertyName, value) { const { prio, layerId, featureStyle } = options; - var layers = {layer: layerId}; + var layers = { layer: layerId }; var values = Array.isArray(value) ? value : [value]; var searchValues = values.map(cur => typeof cur === 'object' ? cur.value : cur); var searchOptions = { diff --git a/bundles/mapping/mapmodule/plugin/vectortilelayer/VectorTileLayerPlugin.js b/bundles/mapping/mapmodule/plugin/vectortilelayer/VectorTileLayerPlugin.js index 905f32782b..32a29be2b5 100644 --- a/bundles/mapping/mapmodule/plugin/vectortilelayer/VectorTileLayerPlugin.js +++ b/bundles/mapping/mapmodule/plugin/vectortilelayer/VectorTileLayerPlugin.js @@ -4,8 +4,8 @@ import olFormatMVT from 'ol/format/MVT'; import TileGrid from 'ol/tilegrid/TileGrid'; import { createDefaultStyle } from 'ol/style/Style'; -import {VectorTileModelBuilder} from './VectorTileModelBuilder'; -import {styleGenerator} from './styleGenerator'; +import { VectorTileModelBuilder } from './VectorTileModelBuilder'; +import { styleGenerator } from './styleGenerator'; import mapboxStyleFunction from 'ol-mapbox-style/stylefunction'; import { LAYER_ID, LAYER_HOVER, LAYER_TYPE, FTR_PROPERTY_ID } from '../../domain/constants'; @@ -186,7 +186,7 @@ class VectorTileLayerPlugin extends AbstractMapLayerPlugin { * @param { olVectorTileLayer } layer */ onMapHover (event, feature, layer) { - const {feature: hoverFeature, layer: hoverLayer, property} = this.hoverState; + const { feature: hoverFeature, layer: hoverLayer, property } = this.hoverState; if (feature === hoverFeature) { return; } @@ -243,4 +243,4 @@ Oskari.clazz.defineES('Oskari.mapframework.mapmodule.VectorTileLayerPlugin', } ); -export {VectorTileLayerPlugin}; +export { VectorTileLayerPlugin }; diff --git a/bundles/mapping/mapmodule/plugin/vectortilelayer/styleGenerator.js b/bundles/mapping/mapmodule/plugin/vectortilelayer/styleGenerator.js index 9cdaa1d900..a486106dbd 100644 --- a/bundles/mapping/mapmodule/plugin/vectortilelayer/styleGenerator.js +++ b/bundles/mapping/mapmodule/plugin/vectortilelayer/styleGenerator.js @@ -6,7 +6,7 @@ const isHovered = (feature, hoverState) => { if (!hoverState) { return false; } - const {feature: hoverFeature, property} = hoverState; + const { feature: hoverFeature, property } = hoverState; if (!hoverFeature || !property) { return false; } diff --git a/bundles/mapping/mapmodule/plugin/wmslayer/WmsLayerPlugin.ol.js b/bundles/mapping/mapmodule/plugin/wmslayer/WmsLayerPlugin.ol.js index d9b453f967..89583e6e08 100644 --- a/bundles/mapping/mapmodule/plugin/wmslayer/WmsLayerPlugin.ol.js +++ b/bundles/mapping/mapmodule/plugin/wmslayer/WmsLayerPlugin.ol.js @@ -3,8 +3,8 @@ import olLayerImage from 'ol/layer/Image'; import olProjProjection from 'ol/proj/Projection'; import * as olProj from 'ol/proj'; -import {OskariImageWMS} from './OskariImageWMS'; -import {OskariTileWMS} from './OskariTileWMS'; +import { OskariImageWMS } from './OskariImageWMS'; +import { OskariTileWMS } from './OskariTileWMS'; /** * @class Oskari.mapframework.mapmodule.WmsLayerPlugin diff --git a/bundles/mapping/mapmodule/request/DisableMapKeyboardMovementRequest.js b/bundles/mapping/mapmodule/request/DisableMapKeyboardMovementRequest.js index a322695892..5c33f10e42 100755 --- a/bundles/mapping/mapmodule/request/DisableMapKeyboardMovementRequest.js +++ b/bundles/mapping/mapmodule/request/DisableMapKeyboardMovementRequest.js @@ -11,7 +11,7 @@ */ Oskari.clazz.define('Oskari.mapframework.bundle.mapmodule.request.DisableMapKeyboardMovementRequest', -/** + /** * @method create called automatically on construction * @static */ diff --git a/bundles/mapping/mapmodule/request/DisableMapMouseMovementRequest.js b/bundles/mapping/mapmodule/request/DisableMapMouseMovementRequest.js index 18fb31a121..3bf2e565cf 100755 --- a/bundles/mapping/mapmodule/request/DisableMapMouseMovementRequest.js +++ b/bundles/mapping/mapmodule/request/DisableMapMouseMovementRequest.js @@ -10,7 +10,7 @@ */ Oskari.clazz.define('Oskari.mapframework.bundle.mapmodule.request.DisableMapMouseMovementRequest', -/** + /** * @method create called automatically on construction * @static */ diff --git a/bundles/mapping/mapmodule/request/EnableMapKeyboardMovementRequest.js b/bundles/mapping/mapmodule/request/EnableMapKeyboardMovementRequest.js index eef089260d..2bb3a8f26e 100755 --- a/bundles/mapping/mapmodule/request/EnableMapKeyboardMovementRequest.js +++ b/bundles/mapping/mapmodule/request/EnableMapKeyboardMovementRequest.js @@ -12,7 +12,7 @@ */ Oskari.clazz.define('Oskari.mapframework.bundle.mapmodule.request.EnableMapKeyboardMovementRequest', -/** + /** * @method create called automatically on construction * @static */ diff --git a/bundles/mapping/mapmodule/request/EnableMapMouseMovementRequest.js b/bundles/mapping/mapmodule/request/EnableMapMouseMovementRequest.js index e948e8a6fb..e0c992f994 100755 --- a/bundles/mapping/mapmodule/request/EnableMapMouseMovementRequest.js +++ b/bundles/mapping/mapmodule/request/EnableMapMouseMovementRequest.js @@ -10,7 +10,7 @@ */ Oskari.clazz.define('Oskari.mapframework.bundle.mapmodule.request.EnableMapMouseMovementRequest', -/** + /** * @method create called automatically on construction * @static */ diff --git a/bundles/mapping/mapmodule/request/GetUserLocationRequestHandler.js b/bundles/mapping/mapmodule/request/GetUserLocationRequestHandler.js index afedd28be3..453da57afe 100755 --- a/bundles/mapping/mapmodule/request/GetUserLocationRequestHandler.js +++ b/bundles/mapping/mapmodule/request/GetUserLocationRequestHandler.js @@ -1,4 +1,4 @@ -import {getUserLocation} from '../LocationModule'; +import { getUserLocation } from '../LocationModule'; /** * @classOskari.mapframework.bundle.mapmodule.request.GetUserLocationRequestHandler diff --git a/bundles/mapping/mapmodule/request/StartUserLocationTrackingRequestHandler.js b/bundles/mapping/mapmodule/request/StartUserLocationTrackingRequestHandler.js index 7eece760bd..5de7c01927 100644 --- a/bundles/mapping/mapmodule/request/StartUserLocationTrackingRequestHandler.js +++ b/bundles/mapping/mapmodule/request/StartUserLocationTrackingRequestHandler.js @@ -1,5 +1,5 @@ -import {watchUserLocation, stopUserLocationWatch, - clearLocationCoords, getLocationCoords} from '../LocationModule'; +import { watchUserLocation, stopUserLocationWatch, + clearLocationCoords, getLocationCoords } from '../LocationModule'; /** * @class Oskari.mapframework.bundle.mapmodule.request.StartUserLocationTrackingRequestHandler * Handles StartUserLocationTrackingRequest requests diff --git a/bundles/mapping/mapmodule/request/StopUserLocationTrackingRequestHandler.js b/bundles/mapping/mapmodule/request/StopUserLocationTrackingRequestHandler.js index 40a5bb44aa..986cc972b9 100644 --- a/bundles/mapping/mapmodule/request/StopUserLocationTrackingRequestHandler.js +++ b/bundles/mapping/mapmodule/request/StopUserLocationTrackingRequestHandler.js @@ -1,4 +1,4 @@ -import {stopUserLocationWatch, clearLocationCoords} from '../LocationModule'; +import { stopUserLocationWatch, clearLocationCoords } from '../LocationModule'; /** * @class Oskari.mapframework.bundle.mapmodule.request.StopUserLocationTrackingRequestHandler * Handles StopUserLocationTrackingRequest requests diff --git a/bundles/mapping/mapmodule/resources/scss/mapmodule.ol.scss b/bundles/mapping/mapmodule/resources/scss/mapmodule.ol.scss index e2c59fa039..a3ac178652 100644 --- a/bundles/mapping/mapmodule/resources/scss/mapmodule.ol.scss +++ b/bundles/mapping/mapmodule/resources/scss/mapmodule.ol.scss @@ -179,8 +179,8 @@ div.mapplugins { float: right; margin: 0 0 0 $pluginMargin; } - &.statsgrid-legend-plugin, - &.statsgrid-legend-plugin-transparent { + &.statsgrid-classification-plugin, + &.statsgrid-classification-plugin-transparent { position: absolute; left: -305px; } @@ -262,8 +262,8 @@ div.mapplugins { &.scalebar { float: right; } - &.statsgrid-legend-plugin, - &.statsgrid-legend-plugin-transparent { + &.statsgrid-classification-plugin, + &.statsgrid-classification-plugin-transparent { position: absolute; left: calc(-310px + 100%); top: -75px; diff --git a/bundles/mapping/mapmodule_ol3/plugin/controls/ToolSelectionHandler.js b/bundles/mapping/mapmodule_ol3/plugin/controls/ToolSelectionHandler.js index e6d68149f6..e99b2045fd 100755 --- a/bundles/mapping/mapmodule_ol3/plugin/controls/ToolSelectionHandler.js +++ b/bundles/mapping/mapmodule_ol3/plugin/controls/ToolSelectionHandler.js @@ -66,14 +66,14 @@ Oskari.clazz.define('Oskari.mapframework.mapmodule.ToolSelectionHandler', id = 'measureline'; me.sandbox.postRequestByName('DrawTools.StartDrawingRequest', [id, type, { allowMultipleDrawing: 'single', - showMeasureOnMap: true}]); + showMeasureOnMap: true }]); break; case 'map_control_measure_area_tool': type = 'Polygon'; id = 'measurearea'; me.sandbox.postRequestByName('DrawTools.StartDrawingRequest', [id, type, { allowMultipleDrawing: 'single', - showMeasureOnMap: true}]); + showMeasureOnMap: true }]); break; default: break; diff --git a/bundles/mapping/mapmyplaces/domain/MyPlacesLayer.js b/bundles/mapping/mapmyplaces/domain/MyPlacesLayer.js index 7342b5fbec..a4e936383f 100644 --- a/bundles/mapping/mapmyplaces/domain/MyPlacesLayer.js +++ b/bundles/mapping/mapmyplaces/domain/MyPlacesLayer.js @@ -5,7 +5,7 @@ */ Oskari.clazz.define('Oskari.mapframework.bundle.mapmyplaces.domain.MyPlacesLayer', -/** + /** * @method create called automatically on construction * @static */ @@ -16,7 +16,7 @@ Oskari.clazz.define('Oskari.mapframework.bundle.mapmyplaces.domain.MyPlacesLayer }, { /* Layer type specific functions */ - /** + /** * Sets the wms url for the layer. * * @method setWmsUrl diff --git a/bundles/mapping/mapuserlayers/domain/UserLayer.js b/bundles/mapping/mapuserlayers/domain/UserLayer.js index 3f2a91b5fa..505dac0487 100755 --- a/bundles/mapping/mapuserlayers/domain/UserLayer.js +++ b/bundles/mapping/mapuserlayers/domain/UserLayer.js @@ -5,7 +5,7 @@ */ Oskari.clazz.define('Oskari.mapframework.bundle.myplacesimport.domain.UserLayer', -/** + /** * @method create called automatically on construction * @static */ diff --git a/bundles/mapping/mapwfs2/domain/WFSLayer.js b/bundles/mapping/mapwfs2/domain/WFSLayer.js index 7ec00f2da2..4039274659 100755 --- a/bundles/mapping/mapwfs2/domain/WFSLayer.js +++ b/bundles/mapping/mapwfs2/domain/WFSLayer.js @@ -279,7 +279,7 @@ Oskari.clazz.define('Oskari.mapframework.bundle.mapwfs2.domain.WFSLayer', */ getStyleDef (styleName) { if (styleName === 'oskari_custom') { - return {[this._layerName]: {featureStyle: this.getCustomStyle()}}; + return { [this._layerName]: { featureStyle: this.getCustomStyle() } }; } if (this._options.styles) { return this._options.styles[styleName]; diff --git a/bundles/mapping/mapwfs2/plugin/WfsLayerPlugin.ol.js b/bundles/mapping/mapwfs2/plugin/WfsLayerPlugin.ol.js index d5ec958fed..8e5f81b348 100644 --- a/bundles/mapping/mapwfs2/plugin/WfsLayerPlugin.ol.js +++ b/bundles/mapping/mapwfs2/plugin/WfsLayerPlugin.ol.js @@ -6,7 +6,7 @@ import olFormatGeoJSON from 'ol/format/GeoJSON'; import olTilegridTileGrid from 'ol/tilegrid/TileGrid'; import * as olProj from 'ol/proj'; -import {OskariAsyncTileImage} from './WfsLayerPlugin/OskariAsyncTileImage'; +import { OskariAsyncTileImage } from './WfsLayerPlugin/OskariAsyncTileImage'; /** * @class Oskari.mapframework.bundle.mapwfs2.plugin.WfsLayerPlugin @@ -220,16 +220,16 @@ Oskari.clazz.define( if (countInscale === countManu && loc.refresh_alert) { this.getElement().attr('refresh_status', refresh_status2); - this.getElement().css({'background-color': '#FF007F'}); + this.getElement().css({ 'background-color': '#FF007F' }); this.getElement().attr('title', loc.refresh_alert[refresh_status2]); } else { if (countInvisi === countManu && loc.refresh_alert) { this.getElement().attr('refresh_status', refresh_status1); - this.getElement().css({'background-color': '#FF007F'}); + this.getElement().css({ 'background-color': '#FF007F' }); this.getElement().attr('title', loc.refresh_alert[refresh_status1]); } else { this.getElement().removeAttr('refresh_status'); - this.getElement().css({'background-color': ''}); + this.getElement().css({ 'background-color': '' }); this.getElement().attr('title', loc.refresh_title); } } diff --git a/bundles/mapping/mapwfs2/plugin/WfsLayerPlugin/OskariAsyncTileImage.js b/bundles/mapping/mapwfs2/plugin/WfsLayerPlugin/OskariAsyncTileImage.js index bf9e83fe53..2ef6bc29e3 100644 --- a/bundles/mapping/mapwfs2/plugin/WfsLayerPlugin/OskariAsyncTileImage.js +++ b/bundles/mapping/mapwfs2/plugin/WfsLayerPlugin/OskariAsyncTileImage.js @@ -1,7 +1,7 @@ import olSourceTileImage from 'ol/source/TileImage'; import olTileState from 'ol/TileState'; -import {getKeyZXY as olTilecoordGetKeyZXY} from 'ol/tilecoord'; -import {listen as olEventsListen} from 'ol/events'; +import { getKeyZXY as olTilecoordGetKeyZXY } from 'ol/tilecoord'; +import { listen as olEventsListen } from 'ol/events'; import olEventsEventType from 'ol/events/EventType'; export class OskariAsyncTileImage extends olSourceTileImage { diff --git a/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/ReqEventHandler.js b/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/ReqEventHandler.js index 4b64ef93e6..81e384feb2 100644 --- a/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/ReqEventHandler.js +++ b/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/ReqEventHandler.js @@ -1,5 +1,5 @@ -import {propsAsArray, WFS_ID_KEY, WFS_FTR_ID_KEY} from './util/props'; -import {filterByAttribute, getFilterAlternativesAsArray} from './util/filter'; +import { propsAsArray, WFS_ID_KEY, WFS_FTR_ID_KEY } from './util/props'; +import { filterByAttribute, getFilterAlternativesAsArray } from './util/filter'; export class ReqEventHandler { constructor (sandbox) { @@ -23,7 +23,7 @@ export class ReqEventHandler { } const hits = []; plugin.getMap().forEachFeatureAtPixel([event.getMouseX(), event.getMouseY()], (feature, layer) => { - hits.push({feature, layer}); + hits.push({ feature, layer }); }, { layerFilter: layer => plugin.findLayerByOLLayer(layer) }); diff --git a/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/impl/MvtLayerHandler.ol.js b/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/impl/MvtLayerHandler.ol.js index 8d482f1aee..1ea866f499 100644 --- a/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/impl/MvtLayerHandler.ol.js +++ b/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/impl/MvtLayerHandler.ol.js @@ -27,9 +27,9 @@ export class MvtLayerHandler extends AbstractLayerHandler { }; } updateLayerProperties (layer, source = this._sourceFromLayer(layer)) { - const {left, bottom, right, top} = this.plugin.getSandbox().getMap().getBbox(); + const { left, bottom, right, top } = this.plugin.getSandbox().getMap().getBbox(); const propsList = source.getFeaturePropsInExtent([left, bottom, right, top]); - const {fields, properties} = getFieldsAndPropsArrays(propsList); + const { fields, properties } = getFieldsAndPropsArrays(propsList); layer.setActiveFeatures(properties); // Update fields and locales only if fields is not empty and it has changed if (fields && fields.length > 0 && !Oskari.util.arraysEqual(layer.getFields(), fields)) { @@ -51,8 +51,8 @@ export class MvtLayerHandler extends AbstractLayerHandler { const update = Oskari.util.throttle(() => { this.updateLayerProperties(layer, source); - }, 300, {leading: false}); - source.on('tileloadend', ({tile}) => { + }, 300, { leading: false }); + source.on('tileloadend', ({ tile }) => { if (tile.getState() === olTileState.ERROR) { return; } diff --git a/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/impl/MvtLayerHandler/FeatureExposingMVTSource.js b/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/impl/MvtLayerHandler/FeatureExposingMVTSource.js index c8444beba7..97ec474959 100644 --- a/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/impl/MvtLayerHandler/FeatureExposingMVTSource.js +++ b/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/impl/MvtLayerHandler/FeatureExposingMVTSource.js @@ -1,16 +1,16 @@ import olSourceVectorTile from 'ol/source/VectorTile'; -import {intersects} from 'ol/extent'; +import { intersects } from 'ol/extent'; import LinearRing from 'ol/geom/LinearRing'; import GeometryCollection from 'ol/geom/GeometryCollection'; import * as olGeom from 'ol/geom'; -import {fromKey as tileCoordFromKey} from 'ol/tilecoord'; +import { fromKey as tileCoordFromKey } from 'ol/tilecoord'; import GeoJSONReader from 'jsts/org/locationtech/jts/io/GeoJSONReader'; import OL3Parser from 'jsts/org/locationtech/jts/io/OL3Parser'; import RelateOp from 'jsts/org/locationtech/jts/operation/relate/RelateOp'; -import {WFS_ID_KEY} from '../../util/props'; -import {convertRenderFeatures} from './convertRenderFeatures'; +import { WFS_ID_KEY } from '../../util/props'; +import { convertRenderFeatures } from './convertRenderFeatures'; const reader = new GeoJSONReader(); const olParser = new OL3Parser(); diff --git a/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/impl/MvtLayerHandler/convertRenderFeatures.js b/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/impl/MvtLayerHandler/convertRenderFeatures.js index 72e86a1adf..01d19b11dc 100644 --- a/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/impl/MvtLayerHandler/convertRenderFeatures.js +++ b/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/impl/MvtLayerHandler/convertRenderFeatures.js @@ -1,5 +1,5 @@ import GeometryType from 'ol/geom/GeometryType'; -import {linearRingIsClockwise} from 'ol/geom/flat/orient'; +import { linearRingIsClockwise } from 'ol/geom/flat/orient'; import LineString from 'ol/geom/LineString'; import MultiLineString from 'ol/geom/MultiLineString'; import MultiPoint from 'ol/geom/MultiPoint'; @@ -9,11 +9,11 @@ import Polygon from 'ol/geom/Polygon'; import GeometryLayout from 'ol/geom/GeometryLayout'; import Feature from 'ol/Feature'; import RenderFeature from 'ol/render/Feature'; -import {equivalent, getTransform} from 'ol/proj'; +import { equivalent, getTransform } from 'ol/proj'; import Units from 'ol/proj/Units'; -import {create as createTransform, compose as composeTransform} from 'ol/transform'; -import {transform2D} from 'ol/geom/flat/transform'; -import {getHeight} from 'ol/extent'; +import { create as createTransform, compose as composeTransform } from 'ol/transform'; +import { transform2D } from 'ol/geom/flat/transform'; +import { getHeight } from 'ol/extent'; const tmpTransform = createTransform(); diff --git a/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/impl/VectorLayerHandler.ol.js b/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/impl/VectorLayerHandler.ol.js index 220bafcb51..12c0242503 100644 --- a/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/impl/VectorLayerHandler.ol.js +++ b/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/impl/VectorLayerHandler.ol.js @@ -2,7 +2,7 @@ import olSourceVector from 'ol/source/Vector'; import olLayerVector from 'ol/layer/Vector'; import olFormatGeoJSON from 'ol/format/GeoJSON'; -import {bbox as bboxStrategy} from 'ol/loadingstrategy'; +import { bbox as bboxStrategy } from 'ol/loadingstrategy'; import { AbstractLayerHandler } from './AbstractLayerHandler.ol'; import { applyOpacity } from '../util/style'; diff --git a/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/util/props.js b/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/util/props.js index 0dcc941b1c..af4e30acc3 100644 --- a/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/util/props.js +++ b/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/util/props.js @@ -20,7 +20,7 @@ export function propsAsArray (properties) { export function getFieldsAndPropsArrays (propsList) { if (!propsList.length) { - return {fields: [], properties: []}; + return { fields: [], properties: [] }; } const fields = sortedFieldsFromProps(propsList[0]); @@ -29,5 +29,5 @@ export function getFieldsAndPropsArrays (propsList) { fields.unshift('__fid'); - return {fields, properties}; + return { fields, properties }; } diff --git a/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/util/style.js b/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/util/style.js index ddb9725f4c..c1433a9b13 100644 --- a/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/util/style.js +++ b/bundles/mapping/mapwfs2/plugin/WfsVectorLayerPlugin/util/style.js @@ -85,7 +85,7 @@ const applyOpacityToColorable = (colorable, opacity) => { if (!rgb) { return; } - const {r, g, b} = rgb; + const { r, g, b } = rgb; colorable.setColor(`rgba(${r},${g},${b},${alpha})`); }; diff --git a/bundles/mapping/mapwfs2/service/StatusHandler.js b/bundles/mapping/mapwfs2/service/StatusHandler.js index 5552c2d21b..cec2877e05 100755 --- a/bundles/mapping/mapwfs2/service/StatusHandler.js +++ b/bundles/mapping/mapwfs2/service/StatusHandler.js @@ -129,7 +129,7 @@ Oskari.clazz.define( Oskari.log(this.getName()).info('no system-message started'); } this._errorLayer = error; - this._errorLayers.push({errorlayer: this._errorLayer}); + this._errorLayers.push({ errorlayer: this._errorLayer }); } if (error.level === 'warning') { if (requestBuilder) { @@ -139,7 +139,7 @@ Oskari.clazz.define( Oskari.log(this.getName()).info('no system-message started'); } this._errorLayer = error; - this._errorLayers.push({errorlayer: this._errorLayer}); + this._errorLayers.push({ errorlayer: this._errorLayer }); } if (error.key === 'layer_scale_out_of_range') { plugin.updateScale(layer, error.minscale, error.maxscale); diff --git a/bundles/mapping/mapwfs2/service/WFSLayerService.js b/bundles/mapping/mapwfs2/service/WFSLayerService.js index 1bc7823505..fd80429acd 100755 --- a/bundles/mapping/mapwfs2/service/WFSLayerService.js +++ b/bundles/mapping/mapwfs2/service/WFSLayerService.js @@ -144,10 +144,10 @@ Oskari.clazz.define( existingFeatureSelections; if (makeNewSelection) { - _.remove(me.WFSFeatureSelections, {'layerId': layerId}); - me.WFSFeatureSelections.push({'layerId': layerId, 'featureIds': featureIds}); + _.remove(me.WFSFeatureSelections, { 'layerId': layerId }); + me.WFSFeatureSelections.push({ 'layerId': layerId, 'featureIds': featureIds }); } else { - existingFeatureSelections = _.pluck(_.where(me.WFSFeatureSelections, {'layerId': layerId}), 'featureIds'); + existingFeatureSelections = _.pluck(_.where(me.WFSFeatureSelections, { 'layerId': layerId }), 'featureIds'); // no existing selections -> add all if (!existingFeatureSelections || existingFeatureSelections.length === 0) { existingFeatureSelections.push(featureIds); @@ -164,9 +164,9 @@ Oskari.clazz.define( }); } // clear old selection - _.remove(me.WFSFeatureSelections, {'layerId': layerId}); + _.remove(me.WFSFeatureSelections, { 'layerId': layerId }); // add the updated selection - me.WFSFeatureSelections.push({'layerId': layerId, 'featureIds': existingFeatureSelections[0]}); + me.WFSFeatureSelections.push({ 'layerId': layerId, 'featureIds': existingFeatureSelections[0] }); } }, @@ -192,7 +192,7 @@ Oskari.clazz.define( getSelectedFeatureIds: function (layerId) { var me = this, featureIds; - featureIds = _.pluck(_.where(me.WFSFeatureSelections, {'layerId': layerId}), 'featureIds'); + featureIds = _.pluck(_.where(me.WFSFeatureSelections, { 'layerId': layerId }), 'featureIds'); return featureIds[0]; }, @@ -207,7 +207,7 @@ Oskari.clazz.define( var me = this; if (me.getSelectedFeatureIds(layer._id)) { - _.remove(me.WFSFeatureSelections, {'layerId': layer._id}); + _.remove(me.WFSFeatureSelections, { 'layerId': layer._id }); var event = Oskari.eventBuilder('WFSFeaturesSelectedEvent')([], layer, false); me.sandbox.notifyAll(event); } diff --git a/bundles/mapping/mapwmts/service/WmtsLayerService.ol.js b/bundles/mapping/mapwmts/service/WmtsLayerService.ol.js index 2856a02412..cd677d452a 100644 --- a/bundles/mapping/mapwmts/service/WmtsLayerService.ol.js +++ b/bundles/mapping/mapwmts/service/WmtsLayerService.ol.js @@ -1,5 +1,5 @@ import olLayerTile from 'ol/layer/Tile'; -import olSourceWMTS, {optionsFromCapabilities} from 'ol/source/WMTS'; +import olSourceWMTS, { optionsFromCapabilities } from 'ol/source/WMTS'; import olFormatWMTSCapabilities from 'ol/format/WMTSCapabilities'; /** @@ -160,7 +160,7 @@ Oskari.clazz.define('Oskari.mapframework.wmts.service.WMTSLayerService', functio crossOrigin: layer.getAttributes('crossOrigin') }; - // override default params and options from layer + // override default params and options from layer _.each(layer.getOptions(), function (value, key) { config[key] = value; }); diff --git a/bundles/mapping/toolbar/request/ToolButtonRequestHandler.js b/bundles/mapping/toolbar/request/ToolButtonRequestHandler.js index c5eea74c4f..e9759e3147 100755 --- a/bundles/mapping/toolbar/request/ToolButtonRequestHandler.js +++ b/bundles/mapping/toolbar/request/ToolButtonRequestHandler.js @@ -7,7 +7,7 @@ */ Oskari.clazz.define('Oskari.mapframework.bundle.toolbar.request.ToolButtonRequestHandler', -/** + /** * @method create called automatically on construction * @static * @param {Oskari.mapframework.bundle.toolbar.ToolbarBundleInstance} toolbar diff --git a/bundles/sample/myfourthbundle/instance.js b/bundles/sample/myfourthbundle/instance.js index 789774e5fd..fc9233c31c 100644 --- a/bundles/sample/myfourthbundle/instance.js +++ b/bundles/sample/myfourthbundle/instance.js @@ -12,7 +12,7 @@ */ Oskari.clazz.define('Oskari.sample.bundle.myfourthbundle.ToolbarRequestBundleInstance', -/** + /** * @method create called automatically on construction * @static */ diff --git a/bundles/sample/tetris/Tile.js b/bundles/sample/tetris/Tile.js index 0c6055de83..785deada60 100755 --- a/bundles/sample/tetris/Tile.js +++ b/bundles/sample/tetris/Tile.js @@ -5,7 +5,7 @@ */ Oskari.clazz.define('Oskari.sample.bundle.tetris.Tile', -/** + /** * @method create called automatically on construction * @static * @param diff --git a/bundles/statistics/statsgrid2016/MyIndicatorsTab.js b/bundles/statistics/statsgrid2016/MyIndicatorsTab.js index 2edb03cf2d..e951d07777 100644 --- a/bundles/statistics/statsgrid2016/MyIndicatorsTab.js +++ b/bundles/statistics/statsgrid2016/MyIndicatorsTab.js @@ -131,7 +131,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.MyIndicatorsTab', }); dialog.show( me.loc('tab.popup.deletetitle'), - me.loc('tab.popup.deletemsg', {name: indicator.name}), + me.loc('tab.popup.deletemsg', { name: indicator.name }), [cancelBtn, okBtn] ); me.popupOpen = true; diff --git a/bundles/statistics/statsgrid2016/components/Datatable.js b/bundles/statistics/statsgrid2016/components/Datatable.js index 44779ab3b3..e85a1b3055 100755 --- a/bundles/statistics/statsgrid2016/components/Datatable.js +++ b/bundles/statistics/statsgrid2016/components/Datatable.js @@ -443,7 +443,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.Datatable', function (sandbox, if (event.getTriggeredBy() === 'map' && parent.length > 0) { scrollableElement = parent; } - me.grid.select(event.getRegion(), false, {element: scrollableElement, fixTopPosition: jQuery('.oskari-flyout.statsgrid-data-flyout .oskari-flyouttoolbar').height()}); + me.grid.select(event.getRegion(), false, { element: scrollableElement, fixTopPosition: jQuery('.oskari-flyout.statsgrid-data-flyout .oskari-flyouttoolbar').height() }); }); this.service.on('StatsGrid.ActiveIndicatorChangedEvent', function (event) { diff --git a/bundles/statistics/statsgrid2016/components/Diagram.js b/bundles/statistics/statsgrid2016/components/Diagram.js index a36da6d088..c04d34fb24 100755 --- a/bundles/statistics/statsgrid2016/components/Diagram.js +++ b/bundles/statistics/statsgrid2016/components/Diagram.js @@ -256,7 +256,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.Diagram', function (service, lo var classificationOpts = stateService.getClassificationOpts(activeIndicator.hash); var classification = me.service.getClassificationService().getClassification(numericData, classificationOpts); var colors = this.service.getColorService().getColorsForClassification(classificationOpts, true); - return classification.maxBounds && colors ? {bounds: classification.maxBounds, values: colors} : {bounds: [], values: ['#555', '#555']}; + return classification.maxBounds && colors ? { bounds: classification.maxBounds, values: colors } : { bounds: [], values: ['#555', '#555'] }; }, events: function () { var me = this; diff --git a/bundles/statistics/statsgrid2016/components/EditClassification.js b/bundles/statistics/statsgrid2016/components/EditClassification.js index acf6d131ba..765e68236b 100755 --- a/bundles/statistics/statsgrid2016/components/EditClassification.js +++ b/bundles/statistics/statsgrid2016/components/EditClassification.js @@ -1,4 +1,4 @@ -import {ManualClassificationView} from './manualClassification/View'; +import { ManualClassificationView } from './manualClassification/View'; Oskari.clazz.define('Oskari.statistics.statsgrid.EditClassification', function (sandbox, locale) { this.sb = sandbox; diff --git a/bundles/statistics/statsgrid2016/components/IndicatorDataForm.js b/bundles/statistics/statsgrid2016/components/IndicatorDataForm.js index 8c28949b20..9983f7284d 100644 --- a/bundles/statistics/statsgrid2016/components/IndicatorDataForm.js +++ b/bundles/statistics/statsgrid2016/components/IndicatorDataForm.js @@ -43,7 +43,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.IndicatorDataForm', function (l me.clearUi(); me.trigger('cancel'); }); - jQuery(cancelBtn.getElement()).css({'margin-left': '6px'}); + jQuery(cancelBtn.getElement()).css({ 'margin-left': '6px' }); this.buttons.push(cancelBtn); var importClipboard = Oskari.clazz.create('Oskari.userinterface.component.Button'); diff --git a/bundles/statistics/statsgrid2016/components/IndicatorList.js b/bundles/statistics/statsgrid2016/components/IndicatorList.js index 06e1722bb4..7031251701 100644 --- a/bundles/statistics/statsgrid2016/components/IndicatorList.js +++ b/bundles/statistics/statsgrid2016/components/IndicatorList.js @@ -1,4 +1,4 @@ -import {MetadataPopup} from './MetadataPopup'; +import { MetadataPopup } from './MetadataPopup'; Oskari.clazz.define('Oskari.statistics.statsgrid.IndicatorList', function (service) { this.loc = Oskari.getMsg.bind(null, 'StatsGrid'); diff --git a/bundles/statistics/statsgrid2016/components/IndicatorParameters.js b/bundles/statistics/statsgrid2016/components/IndicatorParameters.js index 7e56c2884b..71d3f5ca00 100755 --- a/bundles/statistics/statsgrid2016/components/IndicatorParameters.js +++ b/bundles/statistics/statsgrid2016/components/IndicatorParameters.js @@ -1,4 +1,4 @@ -import {SelectList} from './SelectList'; +import { SelectList } from './SelectList'; Oskari.clazz.define('Oskari.statistics.statsgrid.IndicatorParameters', function (locale, sandbox) { this.locale = locale; @@ -124,10 +124,10 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.IndicatorParameters', function if (selections[selected].time) { options.multi = true; } - var tempSelect = jQuery(me.__templates.select({id: selected, label: label})); + var tempSelect = jQuery(me.__templates.select({ id: selected, label: label })); var select = new SelectList(selected); dropdown = selections !== null ? select.create(selections[selected].values, options) : select.create(selections, options); - dropdown.css({width: '205px'}); + dropdown.css({ width: '205px' }); var previousSelections = []; for (var i in indicators) { previousSelections.push(indicators[i].selections[selected]); diff --git a/bundles/statistics/statsgrid2016/components/IndicatorSelection.js b/bundles/statistics/statsgrid2016/components/IndicatorSelection.js index 1b6ef936c1..5b2b542b35 100755 --- a/bundles/statistics/statsgrid2016/components/IndicatorSelection.js +++ b/bundles/statistics/statsgrid2016/components/IndicatorSelection.js @@ -1,5 +1,5 @@ -import {SelectList} from './SelectList'; -import {MetadataPopup} from './MetadataPopup'; +import { SelectList } from './SelectList'; +import { MetadataPopup } from './MetadataPopup'; Oskari.clazz.define('Oskari.statistics.statsgrid.IndicatorSelection', function (instance, sandbox) { this.instance = instance; @@ -118,7 +118,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.IndicatorSelection', function ( var panelLoc = locale('panels.newSearch'); // Series checkbox - main.append(jQuery(this.__templates.select({name: panelLoc.seriesTitle, clazz: 'stats-series-selection'}))); + main.append(jQuery(this.__templates.select({ name: panelLoc.seriesTitle, clazz: 'stats-series-selection' }))); var seriesInput = Oskari.clazz.create('Oskari.userinterface.component.CheckboxInput'); seriesInput.setTitle(panelLoc.seriesLabel); seriesInput.setChecked(false); @@ -127,7 +127,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.IndicatorSelection', function ( seriesSelection.append(seriesInput.getElement()); // Regionsets - main.append(jQuery(this.__templates.select({name: panelLoc.regionsetTitle, clazz: 'stats-rs-selector'}))); + main.append(jQuery(this.__templates.select({ name: panelLoc.regionsetTitle, clazz: 'stats-rs-selector' }))); var regionsetFilterElement = main.find('.stats-rs-selector'); var regionOptions = { placeholder: panelLoc.selectRegionsetPlaceholder, @@ -136,7 +136,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.IndicatorSelection', function ( var regionFilterSelect = new SelectList(); var regionFilterDropdown = regionFilterSelect.create(this.service.getRegionsets(), regionOptions); - regionFilterDropdown.css({width: '100%'}); + regionFilterDropdown.css({ width: '100%' }); regionsetFilterElement.append(regionFilterDropdown); regionFilterSelect.update(); @@ -150,7 +150,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.IndicatorSelection', function ( sources.push(dataObj); }); // Datasources - main.append(jQuery(this.__templates.select({name: panelLoc.datasourceTitle, clazz: 'stats-ds-selector'}))); + main.append(jQuery(this.__templates.select({ name: panelLoc.datasourceTitle, clazz: 'stats-ds-selector' }))); var dsSelector = main.find('.stats-ds-selector'); var options = { placeholder: panelLoc.selectDatasourcePlaceholder, @@ -158,11 +158,11 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.IndicatorSelection', function ( }; var dsSelect = new SelectList(); var dropdown = dsSelect.create(sources, options); - dropdown.css({width: '100%'}); + dropdown.css({ width: '100%' }); dsSelector.append(dropdown); // Indicator list - main.append(jQuery(this.__templates.select({name: panelLoc.indicatorTitle, clazz: 'stats-ind-selector'}))); + main.append(jQuery(this.__templates.select({ name: panelLoc.indicatorTitle, clazz: 'stats-ind-selector' }))); var indicatorSelector = main.find('.stats-ind-selector'); me.spinner.insertTo(indicatorSelector); var indicOptions = { @@ -171,7 +171,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.IndicatorSelection', function ( }; var indicSelect = new SelectList(); var indicDropdown = indicSelect.create(null, indicOptions); - indicDropdown.css({width: '100%'}); + indicDropdown.css({ width: '100%' }); indicatorSelector.append(indicDropdown); var indicDescriptionLink = jQuery(this.__templates.link()); @@ -259,7 +259,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.IndicatorSelection', function ( var formFlyout = me.instance.getFlyoutManager().getFlyout('indicatorForm'); formFlyout.showForm(dsSelect.getValue(), indId[0]); }); - indicDescriptionLink.html(locale('metadataPopup.open', {indicators: indId.length})); + indicDescriptionLink.html(locale('metadataPopup.open', { indicators: indId.length })); if (me.metadataPopup.isVisible()) { me.metadataPopup.show(dsSelect.getValue(), indId); } diff --git a/bundles/statistics/statsgrid2016/components/Legend.js b/bundles/statistics/statsgrid2016/components/Legend.js index 34cecd8d14..09a409a6ee 100755 --- a/bundles/statistics/statsgrid2016/components/Legend.js +++ b/bundles/statistics/statsgrid2016/components/Legend.js @@ -48,7 +48,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.Legend', function (sandbox, loc if (!this._renderState.inProgress) { me._renderState.inProgress = true; } else { - me._renderQueue.push({el: el, event: event}); + me._renderQueue.push({ el: el, event: event }); return; } var container = this._element; diff --git a/bundles/statistics/statsgrid2016/components/MetadataPopup.js b/bundles/statistics/statsgrid2016/components/MetadataPopup.js index 9c96db4d8b..4a4c586a37 100644 --- a/bundles/statistics/statsgrid2016/components/MetadataPopup.js +++ b/bundles/statistics/statsgrid2016/components/MetadataPopup.js @@ -84,7 +84,7 @@ export class MetadataPopup extends Popup { _openPopup () { const container = jQuery('
'); if (this._accordions.length === 0) { - container.html(this.loc('metadataPopup.noMetadata', {indicators: this.indicators.length})); + container.html(this.loc('metadataPopup.noMetadata', { indicators: this.indicators.length })); } else { const content = this.getJqueryContent(); if (!content.hasClass('indicator-metadata')) { @@ -94,7 +94,7 @@ export class MetadataPopup extends Popup { // Open the last panel this._accordions[this._accordions.length - 1].getPanels()[0].open(); } - const title = this.loc('metadataPopup.title', {indicators: this._accordions.length}); + const title = this.loc('metadataPopup.title', { indicators: this._accordions.length }); const okButton = Oskari.clazz.create('Oskari.userinterface.component.buttons.OkButton'); okButton.setHandler(() => this.close()); super.show(title, container, [okButton]); diff --git a/bundles/statistics/statsgrid2016/components/RegionsetSelector.js b/bundles/statistics/statsgrid2016/components/RegionsetSelector.js index b234282a68..1d0edda1b0 100755 --- a/bundles/statistics/statsgrid2016/components/RegionsetSelector.js +++ b/bundles/statistics/statsgrid2016/components/RegionsetSelector.js @@ -1,4 +1,4 @@ -import {SelectList} from './SelectList'; +import { SelectList } from './SelectList'; Oskari.clazz.define('Oskari.statistics.statsgrid.RegionsetSelector', function (service, locale) { this.service = service; diff --git a/bundles/statistics/statsgrid2016/components/RegionsetViewer.js b/bundles/statistics/statsgrid2016/components/RegionsetViewer.js index 58c3619f77..338e7742b0 100755 --- a/bundles/statistics/statsgrid2016/components/RegionsetViewer.js +++ b/bundles/statistics/statsgrid2016/components/RegionsetViewer.js @@ -165,12 +165,12 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.RegionsetViewer', function (ins } } if (updates.length !== 0) { - const searchOptions = {'id': updates}; + const searchOptions = { 'id': updates }; addFeaturesRequestParams.push([searchOptions, regionRequestOptions]); if (classification.mapStyle === 'points') { - const borderUpdates = updates.map(updateParams => Object.assign({}, updateParams, {value: 'border' + updateParams.value})); - const borderSearchOptions = {'id': borderUpdates}; + const borderUpdates = updates.map(updateParams => Object.assign({}, updateParams, { value: 'border' + updateParams.value })); + const borderSearchOptions = { 'id': borderUpdates }; addFeaturesRequestParams.push([borderSearchOptions, borderRequestOptions]); } } @@ -427,12 +427,12 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.RegionsetViewer', function (ins layerId: me.LAYER_ID, prio: highlight ? HIGHLIGHT_PRIO : REGION_PRIO + groupIndex }; - const searchOptions = {id: regionId}; + const searchOptions = { id: regionId }; me.sb.postRequestByName('MapModulePlugin.AddFeaturesToMapRequest', [searchOptions, requestOptions]); if (classification.mapStyle && classification.mapStyle === 'points') { - const borderRequestOptions = {...requestOptions}; - const borderSearchOptions = {...searchOptions}; + const borderRequestOptions = { ...requestOptions }; + const borderSearchOptions = { ...searchOptions }; delete borderRequestOptions.prio; borderSearchOptions.id = 'border' + regionId; me.sb.postRequestByName('MapModulePlugin.AddFeaturesToMapRequest', [borderSearchOptions, borderRequestOptions]); diff --git a/bundles/statistics/statsgrid2016/components/SpanSelect.js b/bundles/statistics/statsgrid2016/components/SpanSelect.js index bcf90ecaf1..f2b8c78c42 100644 --- a/bundles/statistics/statsgrid2016/components/SpanSelect.js +++ b/bundles/statistics/statsgrid2016/components/SpanSelect.js @@ -1,4 +1,4 @@ -import {SelectList} from './SelectList'; +import { SelectList } from './SelectList'; Oskari.clazz.define('Oskari.statistics.statsgrid.SpanSelect', function (locale, id, label, values, options) { this.locale = locale; @@ -36,13 +36,13 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.SpanSelect', function (locale, var cont = jQuery(this.__templates.main()); var lblFrom = this.label + ' ' + this.locale.parameters.from; var lblTo = this.label + ' ' + this.locale.parameters.to; - var tempFrom = jQuery(this.__templates.select({label: lblFrom})); - var tempTo = jQuery(this.__templates.select({label: lblTo})); + var tempFrom = jQuery(this.__templates.select({ label: lblFrom })); + var tempTo = jQuery(this.__templates.select({ label: lblTo })); var from = new SelectList(this.id + '_from'); var to = new SelectList(this.id + '_to'); - var styleDef = {'min-width': '150px'}; + var styleDef = { 'min-width': '150px' }; var dropdown = to.create(this.values, this.options); dropdown.css(styleDef); diff --git a/bundles/statistics/statsgrid2016/components/classification/Classification.jsx b/bundles/statistics/statsgrid2016/components/classification/Classification.jsx new file mode 100644 index 0000000000..592813b93b --- /dev/null +++ b/bundles/statistics/statsgrid2016/components/classification/Classification.jsx @@ -0,0 +1,60 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import {withContext, handleBinder} from '../../../../../src/react/util.jsx'; +import {EditClassification} from './editclassification/EditClassification'; +import {Legend} from './Legend'; +import {Header} from './Header'; +import './classification.scss'; + +class Classification extends React.Component { + constructor (props) { + super(props); + this.state = { + isEdit: props.isEdit + }; + handleBinder(this); + } + componentDidMount () { + this.props.onRenderChange(); + } + componentDidUpdate () { + this.props.onRenderChange(true, this.state.isEdit); + } + handleToggleClassification () { + this.setState(oldState => ({ isEdit: !oldState.isEdit })); + } + + render () { + const classifications = this.props.classifications; + const isEdit = this.state.isEdit; + + return ( +
+
+ {isEdit && + + } + +
+ ); + } +} + +Classification.propTypes = { + indicators: PropTypes.object, + classifications: PropTypes.object, + state: PropTypes.object, + isEdit: PropTypes.bool, + legendProps: PropTypes.object, + onRenderChange: PropTypes.func, + service: PropTypes.object, + loc: PropTypes.func +}; + +const cls = withContext(Classification); +export {cls as Classification}; diff --git a/bundles/statistics/statsgrid2016/components/classification/Header.jsx b/bundles/statistics/statsgrid2016/components/classification/Header.jsx new file mode 100644 index 0000000000..fff9360cf3 --- /dev/null +++ b/bundles/statistics/statsgrid2016/components/classification/Header.jsx @@ -0,0 +1,52 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import {withContext} from '../../../../../src/react/util.jsx'; +import './header.scss'; + +const handleIndicatorChange = (service, value) => { + service.getStateService().setActiveIndicator(value); +}; + +const getTitleComponent = (indicators, active, service, title) => { + if (indicators.length > 1) { + return ( + + ); + } + return ( +
{title}
+ ); +}; + +const Header = props => { + const {indicators, active, service} = props; + const headerClass = indicators.length > 1 ? 'active-header multi-selected' : 'active-header single-selected'; + const {title} = indicators.find(indicator => active.hash === indicator.id) || {title: ''}; + let buttonClass = 'edit-button'; + let buttonTooltip = 'classify.edit.open'; + if (props.isEdit) { + buttonClass = 'edit-button edit-active'; + buttonTooltip = 'classify.edit.close'; + } + + return ( +
+ {getTitleComponent(indicators, active, service, title)} +
+
+ ); +}; + +Header.propTypes = { + indicators: PropTypes.array, + active: PropTypes.object, + isEdit: PropTypes.bool, + handleClick: PropTypes.func, + service: PropTypes.object, + loc: PropTypes.func +}; + +const contextWrapped = withContext(Header); +export {contextWrapped as Header}; diff --git a/bundles/statistics/statsgrid2016/components/classification/Legend.jsx b/bundles/statistics/statsgrid2016/components/classification/Legend.jsx new file mode 100644 index 0000000000..0e00cb5ba2 --- /dev/null +++ b/bundles/statistics/statsgrid2016/components/classification/Legend.jsx @@ -0,0 +1,68 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import {withContext} from '../../../../../src/react/util.jsx'; +import './legend.scss'; + +const createLegendHTML = props => { + const {loc, legendProps, indicatorData} = props; + const classification = legendProps.classification; + const colors = legendProps.colors; + const log = Oskari.log('Oskari.statistics.statsgrid.Classification'); + if (Object.keys(indicatorData).length === 0) { + return {error: loc('legend.noData')}; + } + if (!classification) { + log.warn('Error getting indicator classification', indicatorData); + return {error: loc('legend.noEnough')}; + } + const opacity = props.transparency / 100 || 1; + let legend; + if (opacity !== 1) { + const rgba = colors.map(color => { + const {r, g, b} = Oskari.util.hexToRgb(color); + return 'rgba(' + r + ', ' + g + ', ' + b + ', ' + opacity + ')'; + }); + legend = classification.createLegend(rgba); + } else { + legend = classification.createLegend(colors); + } + + if (!legend) { + return {error: loc('legend.cannotCreateLegend')}; + } else if (legend instanceof jQuery) { + return {__html: legend.prop('outerHTML')}; // points legend + } else { + return {__html: legend}; + } +}; + +const getNoActiveElem = text => { + return ( +
+ {text} +
+ ); +}; + +const Legend = props => { + const legendHTML = createLegendHTML(props); + + if (legendHTML.__html) { + return ( +
+ ); + } else if (legendHTML.error) { + return getNoActiveElem(legendHTML.error); + } + return getNoActiveElem(''); +}; + +Legend.propTypes = { + indicatorData: PropTypes.object, + transparency: PropTypes.number, + legendProps: PropTypes.object, + loc: PropTypes.func +}; + +const contextWrapped = withContext(Legend); +export {contextWrapped as Legend}; diff --git a/bundles/statistics/statsgrid2016/components/classification/classification.scss b/bundles/statistics/statsgrid2016/components/classification/classification.scss new file mode 100644 index 0000000000..6bf7be3fa5 --- /dev/null +++ b/bundles/statistics/statsgrid2016/components/classification/classification.scss @@ -0,0 +1,21 @@ +.statsgrid-classification-container { + background-color: #FFFFFF; + width: 300px; + font-size: 12px; + border: 1px solid rgba(0,0,0,0.2); + pointer-events: auto; + text-align: left; +} + +.statsgrid-classification-plugin-transparent { + .statsgrid-classification-container { + background-color: transparent; + border: 1px solid transparent; + color:#FFFFFF; + text-shadow: + -1px -1px 0 #000, + 1px -1px 0 #000, + -1px 1px 0 #000, + 1px 1px 0 #000; + } +} diff --git a/bundles/statistics/statsgrid2016/components/classification/editclassification/Checkbox.jsx b/bundles/statistics/statsgrid2016/components/classification/editclassification/Checkbox.jsx new file mode 100644 index 0000000000..5a82cff9f2 --- /dev/null +++ b/bundles/statistics/statsgrid2016/components/classification/editclassification/Checkbox.jsx @@ -0,0 +1,25 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import {withContext} from '../../../../../../src/react/util.jsx'; + +const Checkbox = ({properties, value, handleChange, disabled}) => { + return ( +
+ +
+ ); +}; + +Checkbox.propTypes = { + properties: PropTypes.object, + disabled: PropTypes.bool, + value: PropTypes.bool, + handleChange: PropTypes.func +}; + +const contextWrapped = withContext(Checkbox); +export {contextWrapped as Checkbox}; diff --git a/bundles/statistics/statsgrid2016/components/classification/editclassification/Color.jsx b/bundles/statistics/statsgrid2016/components/classification/editclassification/Color.jsx new file mode 100644 index 0000000000..a4dc2b416d --- /dev/null +++ b/bundles/statistics/statsgrid2016/components/classification/editclassification/Color.jsx @@ -0,0 +1,48 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import {withContext} from '../../../../../../src/react/util.jsx'; +import {ColorSelect} from './ColorSelect'; +import './color.scss'; + +const handleReverseColors = (service, isReverse) => { + service.getStateService().updateActiveClassification('reverseColors', isReverse); +}; +const handleColorChange = (service, value) => { + service.getStateService().updateActiveClassification('name', value); +}; + +const Color = ({colors, values, loc, service, disabled}) => { + let label = loc('colorset.button'); + const isSimple = values.mapStyle !== 'choropleth'; + const opacity = values.transparency / 100 || 1; + if (isSimple) { + label = loc('classify.map.color'); + } + return ( +
+
{label}
+
+ handleColorChange(service, value)}/> + {!isSimple && + + handleReverseColors(service, evt.target.checked)}/> + + + } +
+
+ ); +}; +Color.propTypes = { + colors: PropTypes.array, + values: PropTypes.object, + disabled: PropTypes.bool, + service: PropTypes.object, + loc: PropTypes.func +}; + +const contextWrapped = withContext(Color); +export {contextWrapped as Color}; diff --git a/bundles/statistics/statsgrid2016/components/classification/editclassification/ColorSelect.jsx b/bundles/statistics/statsgrid2016/components/classification/editclassification/ColorSelect.jsx new file mode 100644 index 0000000000..5cc0db675b --- /dev/null +++ b/bundles/statistics/statsgrid2016/components/classification/editclassification/ColorSelect.jsx @@ -0,0 +1,133 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import {withContext, handleBinder} from '../../../../../../src/react/util.jsx'; +import {colorSetColorWidth} from './colorselect.scss'; + +class ColorSelect extends React.Component { + constructor (props) { + super(props); + this.state = { + isOpen: false + }; + handleBinder(this); + } + componentDidMount () { + document.addEventListener('mouseup', this.handleClick); + } + componentWillUnmount () { + document.removeEventListener('mouseup', this.handleClick); + } + handleClick (event) { + if (this.props.disabled) { + return; + } + const outside = this.wrapperRef && !this.wrapperRef.contains(event.target); + if (outside && this.state.isOpen) { + this.setState({isOpen: false}); + } else if (!outside) { + this.setState(oldState => ({ isOpen: !oldState.isOpen })); + } + } + handleWrapperRef (node) { + this.wrapperRef = node; + } + + // color: 'deebf7' + getSimpleColorElement (color) { + return ( +
+
+
+ ); + } + + // color: {id:'Blues', value:['deebf7','9ecae1','3182bd']} + getMultiColorElement (color) { + const colors = color.value; + const width = parseInt(colorSetColorWidth) * colors.length; + return ( +
+ {colors.map(color => +
+ )} +
+ ); + } + + getColorSelection () { + if (!this.state.isOpen) { + return; + } + const colors = this.props.colors; + return ( +
+ {colors.map((color, index) => { + if (this.props.isSimple) { + return ( +
this.props.handleColorChange(index)}> + {this.getSimpleColorElement(color)} +
+ ); + } else { + return ( +
this.props.handleColorChange(color.id)}> + {this.getMultiColorElement(color)} +
+ ); + } + })} +
+ ); + } + getSelectedColor () { + const value = this.props.value; + const colors = this.props.colors; + let selected; + if (this.props.isSimple) { + selected = colors[value]; + } else { + selected = colors.find(color => color.id === value); + } + if (selected) { + return selected; + } + return colors[0]; + } + + render () { + const selected = this.getSelectedColor(); + const className = this.props.disabled ? 'oskari-color-selection-main disabled' : 'oskari-color-selection-main'; + return ( +
+
+
+
+ {this.props.isSimple ? this.getSimpleColorElement(selected) : this.getMultiColorElement(selected)} +
+
+
+
+
+
+ {this.getColorSelection()} +
+ ); + } +}; + +ColorSelect.propTypes = { + colors: PropTypes.array, + value: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.number + ]), + disabled: PropTypes.bool, + isSimple: PropTypes.bool, + opacity: PropTypes.number, + handleColorChange: PropTypes.func, + service: PropTypes.object, + loc: PropTypes.func +}; + +const contextWrapped = withContext(ColorSelect); +export {contextWrapped as ColorSelect}; diff --git a/bundles/statistics/statsgrid2016/components/classification/editclassification/EditClassification.jsx b/bundles/statistics/statsgrid2016/components/classification/editclassification/EditClassification.jsx new file mode 100644 index 0000000000..e842c8728b --- /dev/null +++ b/bundles/statistics/statsgrid2016/components/classification/editclassification/EditClassification.jsx @@ -0,0 +1,188 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import {withContext} from '../../../../../../src/react/util.jsx'; +import {Select} from './Select'; +import {Slider} from './Slider'; +import {Checkbox} from './Checkbox'; +import {Color} from './Color'; +import {ManualClassification} from '../../manualClassification/ManualClassification'; +import './editclassification.scss'; + +const getLocalizedOptions = (options, locObj, disabledOptions) => { + if (!Array.isArray(options)) { + return []; + } + return options.map(option => { + const obj = { + value: option + }; + if (locObj[option]) { + obj.text = locObj[option]; + } + if (Array.isArray(disabledOptions) && disabledOptions.includes(option)) { + obj.disabled = true; + } + return obj; + }); +}; +const getTransparencyOptions = transparency => { + var options = []; + for (var i = 100; i >= 30; i -= 10) { + options.push({ + value: i, + text: i + ' %' + }); + } + options.push({ + value: transparency, + text: transparency + ' %', + hidden: true + }); + return options; +}; + +const getValidCountRange = classifications => { + const validOptions = classifications.validOptions; + const range = classifications.countRange; + if (validOptions && validOptions.maxCount) { + return range.map(count => { + let disabled = false; + if (count > validOptions.maxCount) { + disabled = true; + } + return { + value: count, + disabled: disabled + }; + }); + } + return range; +}; +const getDisabledOptions = props => { + const disabled = {}; + // Discontinous mode causes trouble with manually set bounds. Causes error if some class gets no hits. + // Disabling it for data series + if (props.indicators.active.series) { + disabled.mode = ['discontinuous']; + } + return disabled; +}; + +const handleSelectChange = (service, properties, value) => { + if (properties.valueType === 'int') { + value = parseInt(value); + } + service.getStateService().updateActiveClassification(properties.id, value); +}; + +const handleCheckboxChange = (service, id, isSelected) => { + service.getStateService().updateActiveClassification(id, isSelected); +}; + +const EditClassification = props => { + const {indicators, service, loc} = props; + const {methods, values, disabled, modes, colors, types, mapStyles} = props.classifications; + const disabledOptions = getDisabledOptions(props); + + return ( +
+
+ handleSelectChange(service, properties, value)} + options = {getLocalizedOptions(methods, loc('classify.methods'))} + properties = {{ + id: 'method', + class: 'classification-method', + label: loc('classify.classifymethod') + }}/> + + {values.method === 'manual' && + + } + + handleSelectChange(service, properties, value)} + options = {getLocalizedOptions(modes, loc('classify.modes'), disabledOptions.mode)} + properties = {{ + id: 'mode', + class: 'classification-mode', + label: loc('classify.mode') + }}/> + + {values.mapStyle !== 'choropleth' && + + } + + handleCheckboxChange(service, id, isSelected)} + properties = {{ + id: 'showValues', + class: 'show-values', + label: loc('classify.map.showValues') + }}/> + + + + handleSelectChange(service, properties, value)} + options = {getLocalizedOptions(types, loc('colorset'))} + properties = {{ + id: 'type', + class: 'classification-type', + label: loc('colorset.setselection') + }}/> + } + + handleChange(properties, evt.target.value)}> + {options.map(opt => { + if (opt.value !== undefined && opt.hidden) { + return ; + } else if (opt.value !== undefined) { + return ; + } + return ; + })} + +
+
+ ); +}; +Select.propTypes = { + properties: PropTypes.object, + options: PropTypes.array, + disabled: PropTypes.bool, + value: PropTypes.any, + handleChange: PropTypes.func +}; + +const contextWrapped = withContext(Select); +export {contextWrapped as Select}; diff --git a/bundles/statistics/statsgrid2016/components/classification/editclassification/Slider.jsx b/bundles/statistics/statsgrid2016/components/classification/editclassification/Slider.jsx new file mode 100644 index 0000000000..a2a96e60fd --- /dev/null +++ b/bundles/statistics/statsgrid2016/components/classification/editclassification/Slider.jsx @@ -0,0 +1,78 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import {withContext} from '../../../../../../src/react/util.jsx'; +import './slider.scss'; + +class Slider extends React.Component { + constructor (props) { + super(props); + this._rangeSlider = { + min: 10, + max: 120, + step: 5 + }; + } + componentDidMount () { + const minRange = this.props.values.count * this._rangeSlider.step; + this.$el = jQuery(this.el); + this.$el.slider({ + min: this._rangeSlider.min, + max: this._rangeSlider.max, + step: this._rangeSlider.step, + range: true, + disabled: this.props.disabled, + values: [this.props.values.min, this.props.values.max], + slide: (event, ui) => { + const min = ui.values[0]; + const max = ui.values[1]; + if (max - min >= minRange) { + return true; + } + return false; + }, + stop: (event, ui) => { + const value = { + min: ui.values[0], + max: ui.values[1] + }; + this.props.service.getStateService().updateActiveClassificationObj(value); + } + }); + } + componentDidUpdate () { + if (!this.$el) { + return; + } + if (this.props.disabled) { + this.$el.slider('disable'); + } else { + this.$el.slider('enable'); + } + } + componentWillUnmount () { + this.$el.slider('destroy'); + } + render () { + const loc = this.props.loc; + return ( +
+
{loc('classify.map.pointSize')}
+
+
{loc('classify.map.min')}
+
{loc('classify.map.max')}
+
+
{ + this.el = el; + }}/> +
+ ); + } +}; +Slider.propTypes = { + values: PropTypes.object, + disabled: PropTypes.bool, + service: PropTypes.object, + loc: PropTypes.func +}; +const cls = withContext(Slider); +export {cls as Slider}; diff --git a/bundles/statistics/statsgrid2016/components/classification/editclassification/color.scss b/bundles/statistics/statsgrid2016/components/classification/editclassification/color.scss new file mode 100644 index 0000000000..843681c7f8 --- /dev/null +++ b/bundles/statistics/statsgrid2016/components/classification/editclassification/color.scss @@ -0,0 +1,30 @@ +.statsgrid-classification-container { + .classification-colors { + .flip-colors { + margin-left: 10px; + line-height: 27px; + } + } +} + +.statsgrid-classification-plugin-transparent { + .oskari-color-selection-main { + .color-selection-arrow { + display: none; + } + .oskari-selected-color { + border: 1px solid transparent; + } + .oskari-color-selection { + border: 1px solid transparent; + } + &.disabled { + .oskari-color-option { + cursor: auto; + } + .oskari-selected-color, .color-selection-arrow { + cursor: auto; + } + } + } +} diff --git a/bundles/statistics/statsgrid2016/components/classification/editclassification/colorselect.scss b/bundles/statistics/statsgrid2016/components/classification/editclassification/colorselect.scss new file mode 100644 index 0000000000..a33010f32e --- /dev/null +++ b/bundles/statistics/statsgrid2016/components/classification/editclassification/colorselect.scss @@ -0,0 +1,87 @@ +$borderColor: #AAAAAA; +$disabledBorderColor: #DDDDDD; +$colorBorder: 1px solid #555555; +$hoverColor: #306BC8; +$simpleColorWidth: 16px; +$colorSetColorWidth: 6px; +$colorHeight: 16px; + +.oskari-color-selection-main { + position: relative; + + &.disabled { + .oskari-selected-color { + border: 1px solid $disabledBorderColor; + } + .color-selection-arrow { + border: 1px solid $disabledBorderColor; + .icon-arrow-down { + opacity: 0.6; + } + } + } + .oskari-color-option { + cursor: pointer; + .oskari-color { + height: 100%; + width: 100%; + float: left; + } + .oskari-color-set { + border: $colorBorder; + height: $colorHeight; + .oskari-color { + width: $colorSetColorWidth; + } + } + .oskari-color-simple { + border: $colorBorder; + height: $colorHeight; + width: $simpleColorWidth; + } + } + .oskari-color-selection { + top: 28px; + left: 0px; + width: 101px; + z-index: 10; + border: 1px solid $borderColor; + border-top: none; + max-height: 100px; + overflow: auto; + position: absolute; + .oskari-color-option { + padding: 2px; + background-color: #FFFFFF; + } + .oskari-color-option:hover{ + background-color: $hoverColor; + } + + } + + .oskari-selected-color { + border: 1px solid $borderColor; + padding: 4px; + width: 80px; + height: 18px; + cursor: pointer; + float: left; + .oskari-color-option { + background-color: transparent; + } + } + .color-selection-arrow { + float: left; + padding-top: 6px; + width: 12px; + height: 20px; + border: 1px solid $borderColor; + border-left: none; + cursor: pointer; + } +} + +:export { + colorSetColorWidth: $colorSetColorWidth +} diff --git a/bundles/statistics/statsgrid2016/components/classification/editclassification/editclassification.scss b/bundles/statistics/statsgrid2016/components/classification/editclassification/editclassification.scss new file mode 100644 index 0000000000..007f4cd1ea --- /dev/null +++ b/bundles/statistics/statsgrid2016/components/classification/editclassification/editclassification.scss @@ -0,0 +1,64 @@ +.statsgrid-classification-container { + .classification-edit { + background-color: #fafafa; + + .classification-options { + margin-left: 8px; + padding: 5px; + .option { + clear: both; + } + .select { + width: 96%; + font-size: 12px; + padding: 1px 2px; + } + .select-label { + font-weight: bold; + } + .show-values { + .label { + display: block; + margin-bottom: 4px; + margin-top: 8px; + } + } + } + } +} + +/* published/embedded map classification background transparent */ +.statsgrid-classification-plugin-transparent { + .classification-edit { + background-color: transparent; + } + .dropdown { + text-shadow: none; + color: #000; + } + .select { + cursor: pointer; + appearance: none; + -webkit-appearance: none; + margin-left: 12px; + background-color: transparent; + background: none; + border: none; + color: #ffffff; + text-shadow: + -1px -1px 0 #000, + 1px -1px 0 #000, + -1px 1px 0 #000, + 1px 1px 0 #000; + &:disabled { + cursor: auto; + } + } + option { + color: #3c3c3c; + &:disabled { + color: graytext; + } + } + +} diff --git a/bundles/statistics/statsgrid2016/components/classification/editclassification/slider.scss b/bundles/statistics/statsgrid2016/components/classification/editclassification/slider.scss new file mode 100644 index 0000000000..29bc393e17 --- /dev/null +++ b/bundles/statistics/statsgrid2016/components/classification/editclassification/slider.scss @@ -0,0 +1,21 @@ +.oskari-slider { + .slider-label { + font-weight: bold; + } + .minmaxlabels { + margin-bottom: '25px'; + .min { + float:left; + } + .max { + float:right; + margin-right: 4%; + } + } + .point-range { + clear: both; + width: 90%; + background-image: url(../../../resources/images/opacity_slider_long.png); + background-repeat: no-repeat; + } +} \ No newline at end of file diff --git a/bundles/statistics/statsgrid2016/components/classification/header.scss b/bundles/statistics/statsgrid2016/components/classification/header.scss new file mode 100644 index 0000000000..4a9b89a47a --- /dev/null +++ b/bundles/statistics/statsgrid2016/components/classification/header.scss @@ -0,0 +1,71 @@ +.statsgrid-classification-container { + .active-header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 5px; + position: relative; + &.multi-selected select { + width: 94%; + padding: 2px; + } + &.multi-selected:hover:after { + content: attr(data-selected-indicator); + display: block; + position: absolute; + bottom: 32px; + background: #ffffff; + border: 1px solid #ddd; + padding: 5px; + font-size: 10px; + line-height: 17px; + } + + .title { + width: 90%; + font-weight: bold; + } + } + + .edit-button { + cursor: pointer; + height: 16px; + width: 16px; + margin-left: 2px; + margin-right: -2px; + right: 0 !important; + background-image: url(../../resources/images/edit-dark.png); + } + + .edit-active { + height: 16px; + width: 16px; + right: 0 !important; + background-image: url(../../resources/images/edit-hover.png); + } +} + +.statsgrid-classification-plugin-transparent { + .active-header.multi-selected:hover:after { + background-color: transparent; + border: none; + font-size: 12px; + } + + .active-header.single-selected { + border: 1px solid #aaa; + color: #444; + background-color: #fff;; + border-radius: 5px; + text-shadow: none; + padding: 3px 5px; + font-size: 13px; + background: linear-gradient(#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4); + box-shadow: inset 0 0 3px #fff, 0 1px 1px rgba(0,0,0,.1); + margin-bottom: 6px; + .title { + font-weight: 400; + } + + } +} diff --git a/bundles/statistics/statsgrid2016/components/classification/legend.scss b/bundles/statistics/statsgrid2016/components/classification/legend.scss new file mode 100644 index 0000000000..a29422250b --- /dev/null +++ b/bundles/statistics/statsgrid2016/components/classification/legend.scss @@ -0,0 +1,41 @@ +.statsgrid-classification-container { + + .active-legend { + height: 100%; + } + + /* overrides for geostats CSS */ + .active-legend div { + clear: both; + } + .geostats-legend-title { + display: none; + } + .legend-noactive { + padding: 3px 10px 5px 10px; + } + .statsgrid-svg { + float: left; + } + .statsgrid-svg-legend { + margin: 0 auto; + width: 90%; + overflow: hidden; + } + .statsgrid-counter { + float: left; + } + .statsgrid-range { + float: left; + } +} + +.statsgrid-classification-plugin-transparent { + .geostats-legend-counter { + color: #ffffff; + } + .statsgrid-svg-legend { + text-shadow: none; + color: #000; + } +} diff --git a/bundles/statistics/statsgrid2016/components/manualClassification/ManualClassification.jsx b/bundles/statistics/statsgrid2016/components/manualClassification/ManualClassification.jsx new file mode 100644 index 0000000000..d116969f19 --- /dev/null +++ b/bundles/statistics/statsgrid2016/components/manualClassification/ManualClassification.jsx @@ -0,0 +1,47 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import {withContext} from '../../../../../src/react/util.jsx'; +import {ManualClassificationView} from './View'; + +// TODO: change to use general oskari react button and pass props.handleClick = handleManualClassification + +const update = (stateService, bounds) => { + stateService.updateActiveClassification('manualBounds', bounds); +}; + +const handleManualClassification = ({service, indicators}) => { + const {series, state, classification, color} = service.getAllServices(); + const ind = indicators.active; + const view = new ManualClassificationView(classification, color, ind.classification); + + if (ind.series && indicators.serieStats && indicators.serieStats.serie) { + view.setData(indicators.serieStats.serie); + } else if (indicators.data) { + view.setData(indicators.data); + } else { + return; // failed to get serie or data -> don't open + } + series.setAnimating(false); + view.openEditor(bounds => update(state, bounds)); +}; + +const ManualClassification = props => { + return ( +
+ handleManualClassification(props)}/> +
+ ); +}; + +ManualClassification.propTypes = { + disabled: PropTypes.bool, + service: PropTypes.object, + indicators: PropTypes.object, + loc: PropTypes.func +}; +const contextWrapped = withContext(ManualClassification); +export {contextWrapped as ManualClassification}; diff --git a/bundles/statistics/statsgrid2016/components/manualClassification/View.js b/bundles/statistics/statsgrid2016/components/manualClassification/View.js index a173e390d2..d073ac82ac 100644 --- a/bundles/statistics/statsgrid2016/components/manualClassification/View.js +++ b/bundles/statistics/statsgrid2016/components/manualClassification/View.js @@ -1,4 +1,4 @@ -import {manualClassificationEditor} from './editor'; +import { manualClassificationEditor } from './editor'; import '../../resources/scss/manualClassification.scss'; const loc = Oskari.getMsg.bind(null, 'StatsGrid'); @@ -52,7 +52,7 @@ export class ManualClassificationView { okButton.setHandler(() => { dialog.close(); this.manualBounds = editedBounds; - okCallback(); + okCallback(this.manualBounds); }); const buttons = [dialog.createCloseButton(), okButton]; const content = jQuery('
'); diff --git a/bundles/statistics/statsgrid2016/components/manualClassification/editor.js b/bundles/statistics/statsgrid2016/components/manualClassification/editor.js index 5eb50bc9dc..af3ae639cf 100644 --- a/bundles/statistics/statsgrid2016/components/manualClassification/editor.js +++ b/bundles/statistics/statsgrid2016/components/manualClassification/editor.js @@ -1,8 +1,8 @@ -import {histogram} from './histogram'; -import {edgeLines} from './edgeLines'; -import {inputGuide} from './inputGuide'; -import {updateBandBlocks} from './updateBandBlocks'; -import {updateDragHandles} from './updateDragHandles'; +import { histogram } from './histogram'; +import { edgeLines } from './edgeLines'; +import { inputGuide } from './inputGuide'; +import { updateBandBlocks } from './updateBandBlocks'; +import { updateDragHandles } from './updateDragHandles'; const width = 500; const height = 303; diff --git a/bundles/statistics/statsgrid2016/instance.js b/bundles/statistics/statsgrid2016/instance.js index 4249e4ee4d..54106bb9c3 100755 --- a/bundles/statistics/statsgrid2016/instance.js +++ b/bundles/statistics/statsgrid2016/instance.js @@ -34,6 +34,7 @@ Oskari.clazz.define( this.regionsetViewer = null; this.flyoutManager = null; + this._layerId = 'STATS_LAYER'; }, { afterStart: function (sandbox) { var me = this; @@ -151,12 +152,15 @@ Oskari.clazz.define( hasData: function () { return !!this.statsService.getDatasource().length; }, + getLayerId: function () { + return this._layerId; + }, /** * Update visibility of classification / legend based on idicators length & stats layer visibility */ _updateClassficationViewVisibility: function () { var indicatorsExist = this.statsService.getStateService().getIndicators().length > 0; - var layer = this.getLayerService().findMapLayer('STATS_LAYER'); + var layer = this.getLayerService().findMapLayer(this._layerId); var layerVisible = layer ? layer.isVisible() : true; this.createClassficationView(indicatorsExist && layerVisible); @@ -167,7 +171,7 @@ Oskari.clazz.define( _updateSeriesControlVisibility: function () { const ind = this.statsService.getStateService().getActiveIndicator(); const isSeriesActive = ind && !!ind.series; - const layer = this.getLayerService().findMapLayer('STATS_LAYER'); + const layer = this.getLayerService().findMapLayer(this._layerId); const layerVisible = layer ? layer.isVisible() : true; this.setSeriesControlVisible(isSeriesActive && layerVisible); @@ -290,7 +294,7 @@ Oskari.clazz.define( }, AfterMapLayerRemoveEvent: function (event) { var layer = event.getMapLayer(); - if (!layer || layer.getId() !== 'STATS_LAYER') { + if (!layer || layer.getId() !== this._layerId) { return; } var emptyState = {}; @@ -321,7 +325,7 @@ Oskari.clazz.define( }, MapLayerVisibilityChangedEvent: function (event) { var layer = event.getMapLayer(); - if (!layer || layer.getId() !== 'STATS_LAYER') { + if (!layer || layer.getId() !== this._layerId) { return; } this._updateClassficationViewVisibility(); @@ -331,6 +335,9 @@ Oskari.clazz.define( this.statsService.notifyOskariEvent(evt); }, AfterChangeMapLayerOpacityEvent: function (evt) { + if (evt.getMapLayer().getId() !== this._layerId) { + return; + } this.statsService.notifyOskariEvent(evt); // record opacity for published map etc var ind = this.statsService.getStateService().getActiveIndicator(); diff --git a/bundles/statistics/statsgrid2016/plugin/ClassificationPlugin.js b/bundles/statistics/statsgrid2016/plugin/ClassificationPlugin.js index ec0b9c5012..835ef23fdc 100755 --- a/bundles/statistics/statsgrid2016/plugin/ClassificationPlugin.js +++ b/bundles/statistics/statsgrid2016/plugin/ClassificationPlugin.js @@ -1,3 +1,8 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import { GenericContext } from '../../../../src/react/util.jsx'; +import { Classification } from '../components/classification/Classification'; +import '../resources/scss/classificationplugin.scss'; /** * @class Oskari.statistics.statsgrid.ClassificationPlugin */ @@ -21,7 +26,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.ClassificationPlugin', me._name = 'ClassificationPlugin'; me.element = null; me._templates = { - main: jQuery('
') + main: jQuery('
') }; // for publisher dragndrop to work needs to have at least: // - mapplugin-class in parent template @@ -34,21 +39,11 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.ClassificationPlugin', me.log = Oskari.log('Oskari.statistics.statsgrid.ClassificationPlugin'); Oskari.makeObservable(this); - this.__legend = Oskari.clazz.create('Oskari.statistics.statsgrid.Legend', sandbox, this._locale); - this.__legend.on('rendered', function () { - me._calculatePluginSize(); - }); - this.__legend.on('edit-legend', function (isEdit) { - if (isEdit) { - me._overflowCheck(true); - } else { - me._restoreOverflow(); - } - }); - this.__legend.on('content-rendered', function () { - me._overflowCheck(); - }); + this.service = sandbox.getService('Oskari.statistics.statsgrid.StatisticsService'); this._overflowedOffset = null; + this._previousIsEdit = false; + this._transparent = false; + this._bindToEvents(); }, { _setLayerToolsEditModeImpl: function () { if (!this.getElement()) { @@ -68,9 +63,114 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.ClassificationPlugin', } this.element = this._templates.main.clone(); this.element.css('z-index', 15001); - this.__legend.render(this.element); + this.render(); return this.element; }, + rendered: function (isUpdate, isEdit) { + if (isUpdate) { + // check if edit classification state is changed + if (isEdit !== this._previousIsEdit) { + if (isEdit) { + this._overflowCheck(true); + } else { + this._restoreOverflow(); + } + this._previousIsEdit = isEdit; + } + this._overflowCheck(); + } else { + this._calculatePluginSize(); + this._overflowCheck(); + } + }, + render: function (activeClassfication) { + if (!this.element) return; + const node = this.element.get(0); + const indicators = this.getIndicatorProps(); + const classifications = this.getClassificationProps(indicators, activeClassfication); + const legendProps = this.getLegendProps(indicators, classifications); + const classification = legendProps.classification; + if (classification && classifications.values.count !== classification.getGroups().length) { + // classification count changed!! + this.service.getStateService().updateActiveClassification('count', classification.getGroups().length); + return; + } + + ReactDOM.render(( + + + + ), node); + }, + getIndicatorProps: function () { + const indicators = { + selected: [], + data: {} + }; + const state = this.service.getStateService(); + const active = state.getActiveIndicator(); + indicators.active = active; + indicators.regionset = state.getRegionset(); + if (active.series) { + indicators.serieStats = this.service.getSeriesService().getSeriesStats(active.hash); + } + this.service.getStateService().getIndicators().forEach((ind) => { + this.service.getUILabels(ind, label => { + indicators.selected.push({ + id: ind.hash, + title: label.full + }); + }); + }); + this.service.getIndicatorData(active.datasource, active.indicator, active.selections, active.series, indicators.regionset, (err, data) => { + if (data) { + indicators.data = data; + } + if (err) { + this.log.warn('Error getting indicator data', active, indicators.regionset); + } + }); + return indicators; + }, + getClassificationProps: function (indicators, classification) { + const props = { + countRange: [] + }; + const service = this.service.getClassificationService(); + const colorsService = this.service.getColorService(); + const values = classification || this.service.getStateService().getClassificationOpts(indicators.active.hash); + props.values = values; + props.methods = service.getAvailableMethods(); + props.modes = service.getAvailableModes(); + props.mapStyles = service.getAvailableMapStyles(); + props.types = colorsService.getAvailableTypes(); + props.validOptions = service.getAvailableOptions(indicators.data); + props.disabled = !this.service.getStateService().isClassificationEnabled(); + if (values.mapStyle !== 'choropleth') { + props.colors = colorsService.getDefaultSimpleColors(); + } else { + props.colors = colorsService.getOptionsForType(values.type, values.count, values.reverseColors); + } + const range = colorsService.getRange(values.type, values.style); + for (let i = range.min; i <= range.max; i++) { + props.countRange.push(i); + } + return props; + }, + getLegendProps: function (indicators, classifications) { + const data = indicators.data; + const serieStats = indicators.serieStats; + const classificationOpts = classifications.values; + const props = {}; + if (Object.keys(data).length !== 0) { + props.classification = this.service.getClassificationService().getClassification(data, classificationOpts, serieStats); + } + props.colors = this.service.getColorService().getColorsForClassification(classificationOpts, true); + return props; + }, + redrawUI: function () { this.teardownUI(); this._buildUI(); @@ -84,6 +184,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.ClassificationPlugin', var element = this.getElement(); // detach old element from screen if (element) { + ReactDOM.unmountComponentAtNode(element.get(0)); this.removeFromPluginContainer(element, true); this.element = null; this.trigger('hide'); @@ -95,6 +196,8 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.ClassificationPlugin', this._overflowCheck(); if (this._instance.isEmbedded() && this._config.transparent) { this.makeTransparent(true); + } else if (this._transparent === true) { + this.makeTransparent(true); } this.trigger('show'); }, @@ -102,25 +205,24 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.ClassificationPlugin', this.getElement().draggable(); }, makeTransparent: function (transparent) { + this._transparent = transparent; var element = this.getElement(); if (!element) { return; } if (transparent) { - element.removeClass('statsgrid-legend-plugin'); - element.addClass('statsgrid-legend-plugin-transparent'); - element.find('.statsgrid-legend-container').addClass('legend-transparent'); + element.removeClass('statsgrid-classification-plugin'); + element.addClass('statsgrid-classification-plugin-transparent'); } else { - element.removeClass('statsgrid-legend-plugin-transparent'); - element.addClass('statsgrid-legend-plugin'); - element.find('.statsgrid-legend-container').removeClass('legend-transparent'); + element.removeClass('statsgrid-classification-plugin-transparent'); + element.addClass('statsgrid-classification-plugin'); } }, getElement: function () { return this.element; }, enableClassification: function (enabled) { - this.__legend.allowClassification(enabled); + this.service.getStateService().enableClassification(enabled); }, stopPlugin: function () { this.teardownUI(); @@ -146,7 +248,6 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.ClassificationPlugin', var headerHeight = element.find('.active-header').first().height(); if (Oskari.util.isMobile()) { element.find('.accordion').css({ - 'overflow': 'auto', 'max-height': (height * 0.8 - headerHeight) + 'px' }); } else if (!Oskari.util.isMobile()) { @@ -193,6 +294,24 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.ClassificationPlugin', // otherwise publisher would stop this plugin and start it again when leaving the publisher, // resulting a misfuctioning duplicate classification element on screen. return false; + }, + _bindToEvents: function () { + // if indicator is removed/added - recalculate the source 1/2 etc links + this.service.on('StatsGrid.IndicatorEvent', event => this.render()); + + // Always show the active indicator - also handles "no indicator selected" + // if the selected indicator has no data & edit panel is open -> close it + this.service.on('StatsGrid.ActiveIndicatorChangedEvent', event => this.render()); + + // need to update the legend as data changes when regionset changes + this.service.on('StatsGrid.RegionsetChangedEvent', event => this.render()); + + this.service.on('StatsGrid.ClassificationChangedEvent', event => this.render(event.getCurrent())); + + // UI styling changes e.g. disable classification editing, make transparent + this.service.getStateService().on('ClassificationContainerChanged', () => this.render()); + + this.service.on('AfterChangeMapLayerOpacityEvent', (event) => this.render()); } }, { 'extend': ['Oskari.mapping.mapmodule.plugin.BasicMapModulePlugin'], diff --git a/bundles/statistics/statsgrid2016/resources/scss/classificationplugin.scss b/bundles/statistics/statsgrid2016/resources/scss/classificationplugin.scss new file mode 100644 index 0000000000..18e83fd990 --- /dev/null +++ b/bundles/statistics/statsgrid2016/resources/scss/classificationplugin.scss @@ -0,0 +1,4 @@ +.statsgrid-classification-plugin, .statsgrid-classification-plugin-transparent { + /* Float right to not overlap with other plugins */ + float: right; +} diff --git a/bundles/statistics/statsgrid2016/resources/scss/manualClassification.scss b/bundles/statistics/statsgrid2016/resources/scss/manualClassification.scss index 355a320e42..7da7885c8f 100644 --- a/bundles/statistics/statsgrid2016/resources/scss/manualClassification.scss +++ b/bundles/statistics/statsgrid2016/resources/scss/manualClassification.scss @@ -33,4 +33,25 @@ background-color: #faa; } } -} \ No newline at end of file +} + +.classification-manual .oskari-button { + margin-bottom: 4px; + margin-top: 8px; + padding: 2px 5px; + font-size: 12px; +} + +.statsgrid-classification-plugin-transparent .classification-manual{ + .oskari-button, .oskari-button:hover:enabled { + background-color: transparent; + background: none; + border: none; + color: #ffffff; + text-shadow: + -1px -1px 0 #000, + 1px -1px 0 #000, + -1px 1px 0 #000, + 1px 1px 0 #000; + } +} diff --git a/bundles/statistics/statsgrid2016/resources/scss/style.scss b/bundles/statistics/statsgrid2016/resources/scss/style.scss index 1118b50c27..e5e5bbb1c6 100755 --- a/bundles/statistics/statsgrid2016/resources/scss/style.scss +++ b/bundles/statistics/statsgrid2016/resources/scss/style.scss @@ -8,16 +8,6 @@ $buttonWidth: 86%; $flyoutPadding: 16px; -/* overrides for geostats CSS */ -.statsgrid-legend-container .active-legend div { - clear: both; -} - -.statsgrid-legend-container .geostats-legend-title { - display: none; -} - - /* ******************************************** * These are for common code in statsgrid * ******************************************* */ @@ -560,249 +550,6 @@ div.oskari-flyout { display: flex; } -/* ******************************************** - * Statsgrid legend - * ******************************************* */ -.statsgrid-legend-plugin { - border: 1px solid rgba(0,0,0,0.2); - pointer-events: auto; - text-align: left; - /* Float right to not overlap with other plugins */ - float: right; -} -.statsgrid-legend-plugin-transparent { - color:#FFFFFF; - text-shadow: - -1px -1px 0 #000, - 1px -1px 0 #000, - -1px 1px 0 #000, - 1px 1px 0 #000; - pointer-events: auto; - text-align: left; - /* Float right to not overlap with other plugins */ - float: right; } - .statsgrid-legend-plugin-transparent .geostats-legend-counter { - color: #ffffff; - } - .statsgrid-legend-plugin-transparent .accordion .accordion_panel { - background-color: transparent; - } - .statsgrid-legend-plugin-transparent .accordion .accordion_panel.open { - background-color: transparent; - } - .statsgrid-legend-plugin-transparent .dropdown { - text-shadow: none; - color: #000; - } - .statsgrid-legend-plugin-transparent .statsgrid-svg-legend { - text-shadow: none; - color: #000; - } -.active-header { - display: flex; - justify-content: space-between; - align-items: center; - padding: 5px; - position: relative; - - &.multi-select-legend:hover:after { - content: attr(data-selected-indicator); - display: block; - position: absolute; - bottom: 32px; - background: #ffffff; - border: 1px solid #ddd; - padding: 5px; - font-size: 10px; - line-height: 17px; - } -} -.active-header > .title { - width: 90%; - font-weight: bold; -} -.active-legend { - height:100%; -} - -.edit-legend { - cursor: pointer; - height: 16px; - width: 16px; - margin-left: 2px; - margin-right: -2px; - right: 0 !important; - background-image: url(../images/edit-dark.png); -} -.edit-active { - height: 16px; - width: 16px; - right: 0 !important; - background-image: url(../images/edit-hover.png); -} -.statsgrid-legend-container { - background-color: #FFFFFF; - width: 300px; - font-size: 12px; - - .classification-colors.value { - display: inline-block; - vertical-align: top; - } - - .visible-map-style-choropleth.flip-colors { - margin-left: 10px; - line-height: 27px; - } - - >div.header { - background-color: #fdf8d9; - margin: 0; - height:auto; - padding: 6px; - width: auto; - font-weight: bold; - - div.title { - font-size: 14px; - } - div.link { - cursor:pointer; - color:#4292c5; - float: right; - text-decoration: underline; - } - div.sourcename { - font-weight: normal; - } - } - - .legend-noactive { - padding: 3px 10px 5px 10px; - } - - div.accordion { - div.content { - padding: 0; - margin: 0; - margin-left: 8px; - } - - - div.geostats-legend div { - margin: 2px 6px 2px 2px; - } - } - - > .classification .accordion .accordion_panel { - border: 0px; - overflow: visible; - - .header .headerIcon { - margin: 0; - margin-left: 4px; - } - - .header .headerText { - font-size: 12px; - padding: 0; - font-weight: normal; - } - - .content .classifications { - .classification-options { - .numeric-value { - .oskari-formcomponent { - margin-bottom: 4px; - margin-top: 8px; - } - } - } - .label { - font-weight: bold; - } - - select { - width: 96%; - font-size: 12px; - padding: 1px 2px; - } - - .classification-manual input { - margin-bottom: 4px; - margin-top: 8px; - padding: 2px 5px; - font-size: 12px; - } - - .point-size { - .minmaxlabels { - .min { - float:left; - } - .max { - float:right; - margin-right: 4%; - } - .clear { - clear:both; - } - } - .point-range { - width: 90%; - background-image: url(../images/opacity_slider_long.png); - background-repeat: no-repeat; - } - } - } - - .oskari-color-selection { - z-index: 10; - } - } - - .statsgrid-svg { - float: left; - } - .statsgrid-svg-legend { - margin: 0 auto; - width: 90%; - overflow: hidden; - } - .statsgrid-range { - float: left; - } - .statsgrid-counter { - float: left; - } - .clear { - clear: both; - } -} -.legend-transparent { - background-color: transparent; -} -/* Mobile popup tuning */ -.divmanazerpopup.statsgrid-mobile-legend { - .popup-body { - >div.content { - margin: 0px; - } - - div.accordion { - div.content { - padding: 0; - margin: 0; - margin-left: 8px; - } - } - - div.geostats-legend div { - margin: 2px 6px 2px 2px; - } - } -} - /** Toggle buttons */ div.mapplugins .mappluginsContainer .mappluginsContent .mapplugin.statsgrid-published-toggle-buttons { border: 1px solid rgba(0, 0, 0, 0.2); @@ -882,13 +629,6 @@ div.mapplugins .mappluginsContainer .mappluginsContent .mapplugin.statsgrid-publ } -.statsgrid-legend-flyout { - .oskari-flyoutcontentcontainer{ - overflow-x:hidden; - overflow-y: auto; - } -} - /* ******************************************** * Statsgrid tile styles diff --git a/bundles/statistics/statsgrid2016/service/ClassificationService.js b/bundles/statistics/statsgrid2016/service/ClassificationService.js index 23700e2379..16171b1671 100755 --- a/bundles/statistics/statsgrid2016/service/ClassificationService.js +++ b/bundles/statistics/statsgrid2016/service/ClassificationService.js @@ -1,4 +1,4 @@ -import {equalSizeBands} from '../util/equalSizeBands'; +import { equalSizeBands } from '../util/equalSizeBands'; import geostats from 'geostats/lib/geostats.min.js'; import 'geostats/lib/geostats.css'; @@ -35,7 +35,9 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.ClassificationService', // values recognized by the code (and geostats) method: ['jenks', 'quantile', 'equal', 'manual'], // values recognized by the code (and geostats) - mode: ['distinct', 'discontinuous'] + mode: ['distinct', 'discontinuous'], + // values recognized by the code (and geostats) + mapStyle: ['choropleth', 'points'] }, getAvailableMethods: function () { return this.limits.method.slice(0); @@ -43,6 +45,9 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.ClassificationService', getAvailableModes: function () { return this.limits.mode.slice(0); }, + getAvailableMapStyles: function () { + return this.limits.mapStyle.slice(0); + }, getAvailableOptions: function (data) { var validOpts = {}; var list = Array.isArray(data) ? data : this._getDataAsList(data); @@ -224,9 +229,9 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.ClassificationService', formatter ); } - // Choropleth legend stats.setColors(colors); + return stats.getHtmlLegend(null, title || '', true, formatter.format, opts.mode); }; this.lastUsedBounds = response.bounds; @@ -398,7 +403,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.ClassificationService', var circle = point.find('circle'); circle.attr({ - 'fill': '#' + color + 'fill': color }); svg.find('svg.symbols').prepend(point.html()); diff --git a/bundles/statistics/statsgrid2016/service/ColorService.js b/bundles/statistics/statsgrid2016/service/ColorService.js index 1ccf9b5d2f..abf4aad67e 100755 --- a/bundles/statistics/statsgrid2016/service/ColorService.js +++ b/bundles/statistics/statsgrid2016/service/ColorService.js @@ -63,28 +63,24 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.ColorService', * @return {Object[]} array of colors to use for legend and map */ getColorsForClassification: function (classification, includeHash) { - var colors = []; - var set = null; if (classification.mapStyle !== 'points') { - set = this.getColorset(classification.count, classification.type, classification.name); - set.forEach(function (color) { - if (includeHash) { - color = '#' + color; - } - colors.push(color); - }); - } else { - var colorIndex = 0; - if (classification.name) { - colorIndex = !isNaN(classification.name) ? parseFloat(classification.name) : 0; + let set = this.getColorset(classification.count, classification.type, classification.name); + if (classification.reverseColors) { + set.reverse(); + } + if (includeHash) { + return set.map(color => '#' + color); } - colors = Array.apply(null, Array(this._basicColors.length)).map(String.prototype.valueOf, this._basicColors[colorIndex]); + return set; } - - if (classification.mapStyle !== 'points' && classification.reverseColors) { - colors.reverse(); + let color = this._basicColors[0]; + if (classification.name) { + const colorIndex = !isNaN(classification.name) ? parseFloat(classification.name) : 0; + if (colorIndex < this._basicColors.length) { + color = this._basicColors[colorIndex]; + } } - return colors; + return Array.apply(null, Array(this._basicColors.length)).map(String.prototype.valueOf, (includeHash ? '#' + color : color)); }, /** * Tries to return an array of colors where length equals count parameter. diff --git a/bundles/statistics/statsgrid2016/service/StateService.js b/bundles/statistics/statsgrid2016/service/StateService.js index 26921ec01b..87ad221688 100755 --- a/bundles/statistics/statsgrid2016/service/StateService.js +++ b/bundles/statistics/statsgrid2016/service/StateService.js @@ -23,10 +23,18 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.StateService', name: 'Blues', type: 'seq', mode: 'discontinuous', - reverseColors: false + reverseColors: false, + mapStyle: 'choropleth', + transparency: 100, // or from statslayer + min: 10, + max: 60, + showValues: false, + fractionDigits: 0 } }; this._timers = {}; + this.classificationEnabled = true; + Oskari.makeObservable(this); }, { __name: 'StatsGrid.StateService', __qname: 'Oskari.statistics.statsgrid.StateService', @@ -37,6 +45,13 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.StateService', getName: function () { return this.__name; }, + isClassificationEnabled: function () { + return this.classificationEnabled; + }, + enableClassification: function (enable) { + this.classificationEnabled = !!enable; + this.trigger('ClassificationContainerChanged'); + }, /** * Resets the current state and sends events about the changes. * Removes all selected indicators, selected region and regionset is set to undefined @@ -134,6 +149,28 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.StateService', } } }, + updateActiveClassification: function (key, value) { + const indicator = this.getActiveIndicator(); + if (indicator) { + indicator.classification[key] = value; + var eventBuilder = Oskari.eventBuilder('StatsGrid.ClassificationChangedEvent'); + if (eventBuilder) { + this.sandbox.notifyAll(eventBuilder(indicator.classification)); + } + } + }, + updateActiveClassificationObj: function (valueObj) { + const indicator = this.getActiveIndicator(); + if (indicator) { + Object.keys(valueObj).forEach(key => { + indicator.classification[key] = valueObj[key]; + }); + const eventBuilder = Oskari.eventBuilder('StatsGrid.ClassificationChangedEvent'); + if (eventBuilder) { + this.sandbox.notifyAll(eventBuilder(indicator.classification)); + } + } + }, /** * Gets getClassificationOpts * @param {String} indicatorHash indicator hash @@ -281,7 +318,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.StateService', ind.selections[series.id] = this.seriesService.getValue(); // Discontinuos mode is problematic for series data, // because each class has to get at least one hit -> set distinct mode. - ind.classification = jQuery.extend({}, ind.classification || {}, {mode: 'distinct'}); + ind.classification = jQuery.extend({}, ind.classification || {}, { mode: 'distinct' }); } this.indicators.push(ind); diff --git a/bundles/statistics/statsgrid2016/service/StatisticsService.js b/bundles/statistics/statsgrid2016/service/StatisticsService.js index 60953f26c9..2655e6a3f1 100755 --- a/bundles/statistics/statsgrid2016/service/StatisticsService.js +++ b/bundles/statistics/statsgrid2016/service/StatisticsService.js @@ -82,6 +82,15 @@ getErrorService: function () { return this.error; }, + getAllServices: function () { + return { + series: this.series, + state: this.state, + classification: this.classification, + color: this.colors, + error: this.error + }; + }, addDatasource: function (ds) { if (!ds) { // log error message diff --git a/bundles/statistics/statsgrid2016/view/DiagramFlyout.js b/bundles/statistics/statsgrid2016/view/DiagramFlyout.js index 01691b50a4..1f6930fce7 100755 --- a/bundles/statistics/statsgrid2016/view/DiagramFlyout.js +++ b/bundles/statistics/statsgrid2016/view/DiagramFlyout.js @@ -60,7 +60,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.view.DiagramFlyout', function ( this._diagram.createDataSortOption(el.find('.chart-controls .dropdown')); // this.loc.datacharts.descColor // Oskari.clazz.define('Oskari.statistics.statsgrid.SelectedIndicatorsMenu'); - var options = {resizable: this.isResizable()}; + var options = { resizable: this.isResizable() }; this._diagram.render(el.find('.chart'), options); this.setElement(el); } diff --git a/bundles/statistics/statsgrid2016/view/SearchFlyout.js b/bundles/statistics/statsgrid2016/view/SearchFlyout.js index 16623f9421..29789ab74b 100755 --- a/bundles/statistics/statsgrid2016/view/SearchFlyout.js +++ b/bundles/statistics/statsgrid2016/view/SearchFlyout.js @@ -161,8 +161,8 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.view.SearchFlyout', function (t // Overrides selection key and value from provided search values. const getSearchWithModifiedParam = (values, paramKey, paramValue) => { - const modSelection = {...values.selection, [paramKey]: paramValue}; - return {...values, selections: modSelection}; + const modSelection = { ...values.selection, [paramKey]: paramValue }; + return { ...values, selections: modSelection }; }; let metadataCounter = 0; @@ -181,14 +181,14 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.view.SearchFlyout', function (t } // Overrides indicator array to make this search indicator specific. const addSearchValues = values => { - refinedSearchValues.push({...values, indicator}); + refinedSearchValues.push({ ...values, indicator }); }; // Get indicator metadata to check the search valididty this.service.getIndicatorMetadata(commonSearchValues.datasource, indicator, (err, metadata) => { // Map possible errors by indicator name const indicatorName = metadata && metadata.name ? Oskari.getLocalized(metadata.name) : indicator; if (err || !metadata) { - errorMap.set(indicatorName, {metadataNotFound: true}); + errorMap.set(indicatorName, { metadataNotFound: true }); checkDone(); return; } @@ -246,10 +246,10 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.view.SearchFlyout', function (t _getRefinedSearch (metadata, commonSearchValues) { // Make a deep clone of search values var indSearchValues = jQuery.extend(true, {}, commonSearchValues); - const {regionset, selections, series} = indSearchValues; + const { regionset, selections, series } = indSearchValues; if (Array.isArray(metadata.regionsets) && !metadata.regionsets.includes(Number(regionset))) { - indSearchValues.error = {notAllowed: 'regionset'}; + indSearchValues.error = { notAllowed: 'regionset' }; return indSearchValues; } if (!selections) { @@ -268,7 +268,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.view.SearchFlyout', function (t if (!Array.isArray(value)) { // Single option if (!selector.allowedValues.includes(value)) { - indSearchValues.error = {notAllowed: selectionKey}; + indSearchValues.error = { notAllowed: selectionKey }; } return; } @@ -278,7 +278,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.view.SearchFlyout', function (t !selector.allowedValues.includes(cur) && !selector.allowedValues.find(obj => obj.id === cur)); // Set multiselect status for search - indSearchValues.multiselectStatus = {selector: selectionKey, invalid: notAllowed, requested: [...value]}; + indSearchValues.multiselectStatus = { selector: selectionKey, invalid: notAllowed, requested: [...value] }; if (notAllowed.length === 0) { // Selected values are valid @@ -287,7 +287,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.view.SearchFlyout', function (t if (notAllowed.length === value.length) { // All selected values are out of range delete selections[selectionKey]; - indSearchValues.error = {notAllowed: selectionKey}; + indSearchValues.error = { notAllowed: selectionKey }; return; } // Filter out unsupported search param values @@ -370,7 +370,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.view.SearchFlyout', function (t const consumeBatch = batch => { const dataPromises = []; batch.forEach((search, index) => { - const {datasource, indicator, selections, series, regionset} = search; + const { datasource, indicator, selections, series, regionset } = search; const promise = new Promise((resolve, reject) => { this.service.getIndicatorData(datasource, indicator, selections, series, regionset, (err, data) => { if (err || !data) { @@ -401,7 +401,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.view.SearchFlyout', function (t return; } if (!indicatorsHavingData.has(failedSearch.indicator)) { - errors.set(failedSearch.indicatorName, {datasetEmpty: true}); + errors.set(failedSearch.indicatorName, { datasetEmpty: true }); return; } const multiselectStatus = multiselectStatusMap.get(failedSearch.indicatorName); @@ -437,7 +437,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.view.SearchFlyout', function (t if (indicatorMessages.length > 0) { const dialog = Oskari.clazz.create('Oskari.userinterface.component.Popup'); const okBtn = dialog.createCloseButton('OK'); - const title = this.loc('errors.noDataForIndicators', {indicators: indicatorMessages.length}); + const title = this.loc('errors.noDataForIndicators', { indicators: indicatorMessages.length }); dialog.show(title, indicatorMessages.join('
'), [okBtn]); } }, @@ -492,7 +492,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.view.SearchFlyout', function (t _addIndicators: function (searchValues) { let latestNewSearch = null; searchValues.forEach(values => { - const {datasource, indicator, selections, series} = values; + const { datasource, indicator, selections, series } = values; if (this.service.getStateService().addIndicator(datasource, indicator, selections, series)) { // Indicator was not already present at the service latestNewSearch = values; @@ -500,7 +500,7 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.view.SearchFlyout', function (t }); if (latestNewSearch) { // Search added some new indicators, let's set the last one as the active indicator. - const {datasource, indicator, selections, series} = latestNewSearch; + const { datasource, indicator, selections, series } = latestNewSearch; const hash = this.service.getStateService().getHash(datasource, indicator, selections, series); this.service.getStateService().setActiveIndicator(hash); } diff --git a/package.json b/package.json index 81d2f70241..9168b17ff2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "oskari-frontend", - "version": "0.0.1", + "version": "1.52.0-dev", "description": "Build tools for Oskari core", "homepage": "http://oskari.org", "keywords": [ @@ -9,6 +9,7 @@ "main": "grunt.js", "scripts": { "test": "eslint . --quiet", + "lintfix": "eslint . --quiet --fix", "build": "webpack --progress --mode production --env.appdef=devapp:applications/sample", "start": "webpack-dev-server --hot --env.appdef=devapp:applications/sample", "sprite": "node webpack/sprite.js", @@ -23,51 +24,51 @@ }, "license": "MIT", "dependencies": { - "antd": "3.15.0", - "jsts": "2.0.0", - "ol": "5.3.0", - "ol-mapbox-style": "3.3.0", - "react": "16.7.0", - "react-dom": "16.7.0", - "styled-components": "^4.1.3" + "antd": "3.15.2", + "jsts": "2.0.3", + "ol": "5.3.1", + "ol-mapbox-style": "4.2.1", + "react": "16.8.5", + "react-dom": "16.8.5", + "lodash": "4.17.11", + "styled-components": "4.1.3" }, "devDependencies": { - "@babel/core": "7.1.2", - "@babel/polyfill": "7.0.0", - "@babel/preset-env": "7.1.0", + "@babel/core": "7.4.0", + "@babel/polyfill": "7.4.0", + "@babel/preset-env": "7.4.2", "@babel/preset-react": "7.0.0", - "@storybook/react": "^5.0.1", - "babel-loader": "8.0.4", - "babel-plugin-styled-components": "^1.10.0", + "@storybook/react": "5.0.3", + "babel-loader": "8.0.5", + "babel-plugin-styled-components": "1.10.0", "babel-plugin-transform-remove-strict-mode": "0.0.2", - "copy-webpack-plugin": "4.5.2", - "css-loader": "0.28.11", - "eslint": "4.19.1", - "eslint-config-standard": "10.2.1", - "eslint-plugin-import": "2.14.0", - "eslint-plugin-node": "5.2.1", - "eslint-plugin-promise": "3.8.0", + "copy-webpack-plugin": "5.0.2", + "css-loader": "2.1.1", + "eslint": "5.15.3", + "eslint-config-standard": "12.0.0", + "eslint-plugin-import": "2.16.0", + "eslint-plugin-node": "8.0.1", + "eslint-plugin-promise": "4.0.1", "eslint-plugin-react": "7.12.4", - "eslint-plugin-standard": "3.1.0", + "eslint-plugin-standard": "4.0.0", "expose-loader": "0.7.5", - "file-loader": "1.1.11", - "fs-extra": "0.26.7", + "file-loader": "3.0.1", + "fs-extra": "7.0.1", "geostats": "1.7.0", - "gm": "1.21.1", + "gm": "1.23.1", "imports-loader": "0.8.0", - "loader-utils": "1.1.0", - "lodash": "4.12.0", - "merge": "1.2.0", - "mini-css-extract-plugin": "0.4.5", - "node-sass": "4.9.0", - "sass-loader": "7.0.3", + "loader-utils": "1.2.3", + "merge": "1.2.1", + "mini-css-extract-plugin": "0.5.0", + "node-sass": "4.11.0", + "sass-loader": "7.1.0", "script-loader": "0.7.2", - "style-loader": "0.21.0", + "style-loader": "0.23.1", "sumoselect": "3.0.5", - "uglifyjs-webpack-plugin": "1.2.7", - "webpack": "4.25.1", - "webpack-cli": "3.1.2", - "webpack-dev-server": "3.1.10" + "uglifyjs-webpack-plugin": "2.1.2", + "webpack": "4.29.6", + "webpack-cli": "3.3.0", + "webpack-dev-server": "3.2.1" }, "private": true } diff --git a/packages/framework/bundle/divmanazer/bundle.js b/packages/framework/bundle/divmanazer/bundle.js index ed32e4efa8..4faa06552c 100755 --- a/packages/framework/bundle/divmanazer/bundle.js +++ b/packages/framework/bundle/divmanazer/bundle.js @@ -160,9 +160,6 @@ Oskari.clazz.define("Oskari.userinterface.bundle.ui.UserInterfaceBundle", functi }, { "type": "text/javascript", "src": "../../../../bundles/framework/divmanazer/component/Chart.js" - }, { - "type": "text/javascript", - "src": "../../../../bundles/framework/divmanazer/component/ColorSelect.js" }, { "type": "text/javascript", "src": "../../../../bundles/framework/divmanazer/component/LanguageSelect.js" @@ -317,9 +314,6 @@ Oskari.clazz.define("Oskari.userinterface.bundle.ui.UserInterfaceBundle", functi }, { "type": "text/css", "src": "../../../../bundles/framework/divmanazer/resources/scss/popover.scss" - }, { - "type": "text/css", - "src": "../../../../bundles/framework/divmanazer/resources/scss/colorselect.scss" }, { "type": "text/javascript", "src": "../../../../libraries/jquery/plugins/jquery-placeholder/jquery.placeholder.js" diff --git a/packages/statistics/statsgrid/bundle.js b/packages/statistics/statsgrid/bundle.js index 18e1a71de4..16a89ce1d3 100755 --- a/packages/statistics/statsgrid/bundle.js +++ b/packages/statistics/statsgrid/bundle.js @@ -109,18 +109,12 @@ Oskari.clazz.define("Oskari.statistics.statsgrid.StatsGridBundle", }, { "type": "text/javascript", "src": "../../../bundles/statistics/statsgrid2016/plugin/TogglePlugin.js" - }, { - "type": "text/javascript", - "src": "../../../bundles/statistics/statsgrid2016/components/Legend.js" }, { "type": "text/javascript", "src": "../../../bundles/statistics/statsgrid2016/components/SeriesControl.js" }, { "type": "text/javascript", "src": "../../../bundles/statistics/statsgrid2016/publisher/SeriesToggleTool.js" - }, { - "type": "text/javascript", - "src": "../../../bundles/statistics/statsgrid2016/components/EditClassification.js" }, { "type": "text/javascript", "src": "../../../bundles/statistics/statsgrid2016/components/RegionsetViewer.js" diff --git a/webpack.config.js b/webpack.config.js index 27f269d8fc..4f1524285b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -10,13 +10,13 @@ const proxyPort = 8081; module.exports = (env, argv) => { const isProd = argv.mode === 'production'; - const {version, pathParam, publicPathPrefix} = parseParams(env); + const { version, pathParam, publicPathPrefix } = parseParams(env); const isDirectory = source => lstatSync(source).isDirectory(); const getDirectories = source => readdirSync(source).map(name => path.join(source, name)).filter(isDirectory); const appsetupPaths = getDirectories(path.resolve(pathParam)); - const {entries, plugins} = generateEntries(appsetupPaths, isProd, __dirname); + const { entries, plugins } = generateEntries(appsetupPaths, isProd, __dirname); plugins.push(new MiniCssExtractPlugin({ filename: '[name]/oskari.min.css' })); @@ -71,14 +71,18 @@ module.exports = (env, argv) => { test: /\.css$/, use: [ styleLoaderImpl, - { loader: 'css-loader', options: { minimize: true } } + { loader: 'css-loader', options: { } } + // https://github.com/webpack-contrib/css-loader/issues/863 + // { loader: 'css-loader', options: { minimize: true } } ] }, { test: /\.scss$/, use: [ styleLoaderImpl, - { loader: 'css-loader', options: { minimize: true } }, + // https://github.com/webpack-contrib/css-loader/issues/863 + // { loader: 'css-loader', options: { minimize: true } }, + { loader: 'css-loader', options: { } }, 'sass-loader' // compiles Sass to CSS ] }, diff --git a/webpack/generateEntries.js b/webpack/generateEntries.js index b37913c829..a76b5c13a0 100644 --- a/webpack/generateEntries.js +++ b/webpack/generateEntries.js @@ -47,5 +47,5 @@ module.exports = function generateEntries (appsetupPaths, isProd, context) { plugins.push(new LocalizationPlugin(appName)); }); - return {entries, plugins}; + return { entries, plugins }; }; diff --git a/webpack/oskariLazyLoader.js b/webpack/oskariLazyLoader.js index 4672d6087a..2f2c4d86fe 100644 --- a/webpack/oskariLazyLoader.js +++ b/webpack/oskariLazyLoader.js @@ -1,4 +1,4 @@ -const {stringifyRequest} = require('loader-utils'); +const { stringifyRequest } = require('loader-utils'); module.exports = function (source) { if (!this.query) {