diff --git a/src/App.vue b/src/App.vue index e261ff9..0faf9e2 100644 --- a/src/App.vue +++ b/src/App.vue @@ -7,6 +7,23 @@ + + + {{ unsentReportsLength }} + cloud_upload + + more_vert @@ -31,6 +48,7 @@ + @@ -38,10 +56,14 @@ diff --git a/src/components/ReportDialog/index.vue b/src/components/ReportDialog/index.vue index fd74c22..e48e676 100644 --- a/src/components/ReportDialog/index.vue +++ b/src/components/ReportDialog/index.vue @@ -1,33 +1,19 @@ - - - {{ $t('reportDialog.unableToSendTitle') }} - - {{ $t('reportDialog.unableToSendDescription') }} - - - - - - {{ $t('misc.discard') }} - - - - - - + - + + @@ -38,7 +24,7 @@ diff --git a/src/constants.js b/src/constants.js index 43b2b22..158ddbc 100644 --- a/src/constants.js +++ b/src/constants.js @@ -139,3 +139,7 @@ export const TILE_SERVERS = { export const DEFAULT_TILE_SERVER = 'cartodb-voyager'; export const GEOCODING_API_ENDPOINT = 'https://api-adresse.data.gouv.fr/search/'; + +// Delay in milliseconds between two consecutive calls to the backend API when +// doing batch requests +export const DELAY_BETWEEN_API_BATCH_REQUESTS = 1000; diff --git a/src/i18n/en.json b/src/i18n/en.json index 7bf28fd..e7df162 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -14,6 +14,7 @@ "menu": "Menu", "recenterMap": "Recenter map", "reportProblem": "Report problem", + "uploadUnsents": "Upload unsent reports", "upvote": "Upvote" }, "geolocation": { diff --git a/src/store/actions.js b/src/store/actions.js index fe445dc..1a2693a 100644 --- a/src/store/actions.js +++ b/src/store/actions.js @@ -10,6 +10,7 @@ import { IS_LOADING, PUSH_REPORT, PUSH_UNSENT_REPORT, + REMOVE_UNSENT_REPORT, SET_CURRENT_MAP_CENTER, SET_CURRENT_MAP_ZOOM, SET_CURRENT_POSITION, @@ -48,6 +49,10 @@ export function saveUnsentReport({ commit }, { report }) { commit(PUSH_UNSENT_REPORT, { report }); } +export function removeUnsentReport({ commit }, { index }) { + commit(REMOVE_UNSENT_REPORT, { index }); +} + export function hideReportDetails({ commit }) { return commit(SHOW_REPORT_DETAILS, { id: null, userAsked: null }); } diff --git a/src/store/mutations-types.js b/src/store/mutations-types.js index e2e5378..069893d 100644 --- a/src/store/mutations-types.js +++ b/src/store/mutations-types.js @@ -3,6 +3,7 @@ export const IS_DONE_LOADING = 'IS_DONE_LOADING'; export const IS_LOADING = 'IS_LOADING'; export const PUSH_REPORT = 'PUSH_REPORT'; export const PUSH_UNSENT_REPORT = 'PUSH_UNSENT_REPORT'; +export const REMOVE_UNSENT_REPORT = 'REMOVE_UNSENT_REPORT'; export const SET_CURRENT_MAP_CENTER = 'SET_CURRENT_MAP_CENTER'; export const SET_CURRENT_MAP_ZOOM = 'SET_CURRENT_MAP_ZOOM'; export const SET_CURRENT_POSITION = 'SET_CURRENT_POSITION'; diff --git a/src/store/mutations.js b/src/store/mutations.js index 123b42f..628bb43 100644 --- a/src/store/mutations.js +++ b/src/store/mutations.js @@ -110,6 +110,12 @@ export const mutations = { localStorage.setItem('unsentReports', JSON.stringify(state.unsentReports)); } }, + [types.REMOVE_UNSENT_REPORT](state, { index }) { + state.unsentReports.splice(index, 1); + if (storageAvailable('localStorage')) { + localStorage.setItem('unsentReports', JSON.stringify(state.unsentReports)); + } + }, [types.SET_CURRENT_MAP_CENTER](state, { center }) { Vue.set(state.map, 'center', center); },