diff --git a/web/client/actions/importer.js b/web/client/actions/importer.js index bb216a29f6..614e69ca08 100644 --- a/web/client/actions/importer.js +++ b/web/client/actions/importer.js @@ -94,7 +94,7 @@ const applyPlaceholders = function(preset, model) { return assign({}, preset, { changes: assign({}, preset.changes, { target: assign({}, preset.changes.target, { - dataStore: assign(preset.changes.target.dataStore, { + dataStore: assign({}, preset.changes.target.dataStore, { name: replaceTargetWorkspace(preset.changes.target.dataStore.name) }) }) @@ -646,7 +646,6 @@ function dismissWorkspaceCreationStatus() { /** UPLOAD **/ function uploadImportFiles(geoserverRestURL, importId, files, presets) { return (dispatch, getState) => { - let state = getState(); dispatch(loading({importId: importId, uploadingFiles: files})); let progressOpts = { progress: (progressEvent) => { @@ -657,7 +656,8 @@ function uploadImportFiles(geoserverRestURL, importId, files, presets) { let tasks = response && response.data && response.data.tasks || response && response.data && [response.data.task]; dispatch(fileUploaded(files)); dispatch(importTaskCreated(importId, tasks)); - let impState = getState().importer; + let state = getState(); + let impState = state.importer; if (impState && impState.selectedImport && impState.selectedImport.id === importId && tasks && tasks.length > 1) { dispatch(loadImport(geoserverRestURL, importId)); } diff --git a/web/client/api/geoserver/Styles.js b/web/client/api/geoserver/Styles.js index b28a86eeed..7d5614e674 100644 --- a/web/client/api/geoserver/Styles.js +++ b/web/client/api/geoserver/Styles.js @@ -10,7 +10,7 @@ const assign = require('object-assign'); var Api = { saveStyle: function(geoserverBaseUrl, styleName, body, options) { - let url = geoserverBaseUrl + "styles/" + styleName; + let url = geoserverBaseUrl + "styles/" + encodeURI(styleName); let opts = assign({}, options); opts.headers = assign({}, opts.headers, {"Content-Type": "application/vnd.ogc.sld+xml"}); return axios.put(url, body, opts); diff --git a/web/client/components/file/FileUploader.jsx b/web/client/components/file/FileUploader.jsx index 783ba26bad..c307113ef6 100644 --- a/web/client/components/file/FileUploader.jsx +++ b/web/client/components/file/FileUploader.jsx @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. */ const React = require('react'); - +const {round} = require('lodash'); const {Message, DateFormat} = require('../I18N/I18N'); const Spinner = require('react-spinkit'); const {Glyphicon, ProgressBar, Table, Alert} = require('react-bootstrap'); @@ -58,8 +58,8 @@ const FileUploader = React.createClass({ }, renderProgress(uploading) { if (uploading && uploading.progress) { - let precent = (uploading.progress * 100).toFixed(2); - return ; + let percent = round(uploading.progress * 100, 2); + return ; } }, @@ -75,7 +75,7 @@ const FileUploader = React.createClass({ {this.state.fileList && this.state.fileList.map((file) => - ( + ( {file.name} {this.humanFileSize(file.size)} {file.type} diff --git a/web/client/reducers/importer.js b/web/client/reducers/importer.js index 0b6ae6c9fb..d9326e8357 100644 --- a/web/client/reducers/importer.js +++ b/web/client/reducers/importer.js @@ -41,6 +41,10 @@ const { const assign = require('object-assign'); +// constant used to reset the state only if the importer tool is passed to the reducer +// see case: MANAGER_ITEM_SELECTED +const importerTool = "importer"; + /******************************************************************************/ /* UTILITY FUNCTIONS **********************************************************/ /******************************************************************************/ @@ -131,11 +135,7 @@ function updateImportTaskLoadingStatus(state, action, loading = true) { /* REDUCER ********************************************************************/ /******************************************************************************/ -const initialState = { - importerTool: "importer" -}; - -function importer(state = initialState, action) { +function importer(state = {}, action) { switch (action.type) { case IMPORTS_LOADING: { if (!action.details) { @@ -152,7 +152,7 @@ function importer(state = initialState, action) { return state; case MANAGER_ITEM_SELECTED: { const toolId = action.toolId; - if (toolId === state.importerTool) { + if (toolId === importerTool) { return assign({}, state, { loadingError: null, imports: state.imports, diff --git a/web/client/translations/data.en-US b/web/client/translations/data.en-US index b92be10512..9a48fbb453 100644 --- a/web/client/translations/data.en-US +++ b/web/client/translations/data.en-US @@ -540,9 +540,9 @@ "create": "Create", "createWS": "create a new workspace: ", "target": "target workspace: ", + "failure": "Error creating workspace: {statusWS}", + "success": "Workspace {statusWS} successfully created", "select": "Select TargetWorkspace", - "success": "Error creating workspace: {statusWS}", - "failure": "Workspace {statusWS} successfully created", "new": "New workspace name..." }, "import": { diff --git a/web/client/translations/data.fr-FR b/web/client/translations/data.fr-FR index d0f3878b16..101dc9ea02 100644 --- a/web/client/translations/data.fr-FR +++ b/web/client/translations/data.fr-FR @@ -542,8 +542,8 @@ "create": "Créer", "createWS": "créer un nouvel espace de travail: ", "target": "cible espace de travail: ", - "success": "Erreur de création espace de travail: {statusWS}", - "failure": "Espace de travail {statusWS} créé avec succès", + "failure": "Erreur de création espace de travail: {statusWS}", + "success": "Espace de travail {statusWS} créé avec succès", "select": "Sélectionnez l'espace de travail cible", "new": "Nom..." }, diff --git a/web/client/translations/data.it-IT b/web/client/translations/data.it-IT index 22a30b762b..299d59a348 100644 --- a/web/client/translations/data.it-IT +++ b/web/client/translations/data.it-IT @@ -541,8 +541,8 @@ "create": "Crea", "createWS": "Crea un nuovo workspace: ", "target": "Workspace di destinazione: ", - "success": "Errore durante la creazione del workspace: {statusWS}", - "failure": "Workspace {statusWS} creato correttamente", + "failure": "Errore durante la creazione del workspace: {statusWS}", + "success": "Workspace {statusWS} creato correttamente", "select": "Seleziona il workspace di destinazione", "new": "Nome del workspace..." },