# HG changeset patch # User Thomas Junk # Date 1542031204 -3600 # Node ID dc3f0277628afbdfef78180ab560cc78cd7db945 # Parent 443fc80a315f476990feda2e428128416710e0f3 feat: Importqueue listing (Proof of concept) This is only a prototypical overview of importqueue data from backend. Uses GET to retrieve an overview of imports. Shows in separate tables. Further concept needs to be developed to progress.. diff -r 443fc80a315f -r dc3f0277628a client/src/application/Sidebar.vue --- a/client/src/application/Sidebar.vue Fri Nov 09 10:57:49 2018 +0100 +++ b/client/src/application/Sidebar.vue Mon Nov 12 15:00:04 2018 +0100 @@ -3,24 +3,31 @@
diff -r 443fc80a315f -r dc3f0277628a client/src/application/Topbar.vue --- a/client/src/application/Topbar.vue Fri Nov 09 10:57:49 2018 +0100 +++ b/client/src/application/Topbar.vue Mon Nov 12 15:00:04 2018 +0100 @@ -139,7 +139,11 @@ }; }, computed: { - ...mapState("application", ["showSidebar", "showSplitscreen", "showSearchbar"]), + ...mapState("application", [ + "showSidebar", + "showSplitscreen", + "showSearchbar" + ]), ...mapState("map", ["openLayersMap"]), ...mapState("fairwayprofile", ["currentProfile"]), searchIndicator: function() { @@ -216,10 +220,8 @@ let newZoom = 11; if (resultEntry.type === "bottleneck") newZoom = Math.max(17, currentZoom); - if (resultEntry.type === "rhm") - newZoom = Math.max(15, currentZoom); - if (resultEntry.type === "city") - newZoom = Math.max(13, currentZoom); + if (resultEntry.type === "rhm") newZoom = Math.max(15, currentZoom); + if (resultEntry.type === "city") newZoom = Math.max(13, currentZoom); view.animate( { zoom: newZoom, @@ -238,7 +240,7 @@ if (!this.showSearchbar) { setTimeout(setFocus, 300); } - this.$store.commit("application/showSearchbar", !this.showSearchbar) + this.$store.commit("application/showSearchbar", !this.showSearchbar); } } }; diff -r 443fc80a315f -r dc3f0277628a client/src/bottlenecks/Bottlenecks.vue --- a/client/src/bottlenecks/Bottlenecks.vue Fri Nov 09 10:57:49 2018 +0100 +++ b/client/src/bottlenecks/Bottlenecks.vue Mon Nov 12 15:00:04 2018 +0100 @@ -152,7 +152,10 @@ }); }, selectSurvey(survey, bottleneck) { - this.$store.dispatch("bottlenecks/setSelectedBottleneck", bottleneck.properties.name); + this.$store.dispatch( + "bottlenecks/setSelectedBottleneck", + bottleneck.properties.name + ); this.$store.commit("bottlenecks/setSelectedSurvey", survey); this.moveToBottleneck(bottleneck); }, @@ -182,7 +185,7 @@ this.openBottleneck = null; } else { this.openBottleneck = name; - + HTTP.get("/surveys/" + name, { headers: { "X-Gemma-Auth": localStorage.getItem("token"), @@ -205,9 +208,7 @@ return current ? current.substr(0, current.length - 1) : ""; }, displayCurrentChainage(from, to) { - return ( - from / 10 + " - " + to / 10 - ); + return from / 10 + " - " + to / 10; } }, mounted() { diff -r 443fc80a315f -r dc3f0277628a client/src/fairway/Fairwayprofile.vue --- a/client/src/fairway/Fairwayprofile.vue Fri Nov 09 10:57:49 2018 +0100 +++ b/client/src/fairway/Fairwayprofile.vue Mon Nov 12 15:00:04 2018 +0100 @@ -121,14 +121,16 @@ if ( !this.selectedSurvey || !this.currentProfile.hasOwnProperty(this.selectedSurvey.date_info) - ) return []; + ) + return []; return this.currentProfile[this.selectedSurvey.date_info]; }, additionalData() { if ( !this.additionalSurvey || !this.currentProfile.hasOwnProperty(this.additionalSurvey.date_info) - ) return []; + ) + return []; return this.currentProfile[this.additionalSurvey.date_info]; }, waterColor() { diff -r 443fc80a315f -r dc3f0277628a client/src/imports/Imports.vue --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/src/imports/Imports.vue Mon Nov 12 15:00:04 2018 +0100 @@ -0,0 +1,46 @@ + + + + + + diff -r 443fc80a315f -r dc3f0277628a client/src/imports/Job.vue --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/src/imports/Job.vue Mon Nov 12 15:00:04 2018 +0100 @@ -0,0 +1,36 @@ + + + + + + diff -r 443fc80a315f -r dc3f0277628a client/src/map/Maplayer.vue --- a/client/src/map/Maplayer.vue Fri Nov 09 10:57:49 2018 +0100 +++ b/client/src/map/Maplayer.vue Mon Nov 12 15:00:04 2018 +0100 @@ -81,7 +81,9 @@ methods: { removeCurrentInteraction() { this.$store.commit("map/setCurrentMeasurement", null); - this.getLayerByName("Draw Tool").data.getSource().clear(); + this.getLayerByName("Draw Tool") + .data.getSource() + .clear(); this.openLayersMap.removeInteraction(this.interaction); this.interaction = null; }, @@ -204,13 +206,16 @@ var features = this.openLayersMap.getFeaturesAtPixel(pixel); if (features) { this.$store.commit("map/setIdentifiedFeatures", features); - + // get selected bottleneck from identified features for (let feature of features) { let id = feature.getId(); // RegExp.prototype.test() works with number, str and undefined if (/^bottlenecks\./.test(id)) { - this.$store.dispatch("bottlenecks/setSelectedBottleneck", feature.get("objnam")); + this.$store.dispatch( + "bottlenecks/setSelectedBottleneck", + feature.get("objnam") + ); } } } diff -r 443fc80a315f -r dc3f0277628a client/src/router.js --- a/client/src/router.js Fri Nov 09 10:57:49 2018 +0100 +++ b/client/src/router.js Mon Nov 12 15:00:04 2018 +0100 @@ -1,14 +1,14 @@ /* * This is Free Software under GNU Affero General Public License v >= 3.0 * without warranty, see README.md and license for details. - * + * * SPDX-License-Identifier: AGPL-3.0-or-later * License-Filename: LICENSES/AGPL-3.0.txt - * - * Copyright (C) 2018 by via donau + * + * Copyright (C) 2018 by via donau * – Österreichische Wasserstraßen-Gesellschaft mbH * Software engineering by Intevation GmbH - * + * * Author(s): * Thomas Junk */ @@ -25,6 +25,7 @@ const Main = () => import("./application/Main.vue"); const Usermanagement = () => import("./usermanagement/Usermanagement.vue"); const Logs = () => import("./logs/logs.vue"); +const Imports = () => import("./imports/Imports.vue"); const Systemconfiguration = () => import("./systemconfiguration/systemconfiguration.vue"); @@ -86,6 +87,22 @@ } }, { + path: "/imports", + name: "imports", + component: Imports, + meta: { + requiresAuth: true + }, + beforeEnter: (to, from, next) => { + const isSysadmin = store.getters["user/isSysAdmin"]; + if (!isSysadmin) { + next("/"); + } else { + next(); + } + } + }, + { path: "/", name: "mainview", component: Main, diff -r 443fc80a315f -r dc3f0277628a client/src/store.js --- a/client/src/store.js Fri Nov 09 10:57:49 2018 +0100 +++ b/client/src/store.js Mon Nov 12 15:00:04 2018 +0100 @@ -1,14 +1,14 @@ /* * This is Free Software under GNU Affero General Public License v >= 3.0 * without warranty, see README.md and license for details. - * + * * SPDX-License-Identifier: AGPL-3.0-or-later * License-Filename: LICENSES/AGPL-3.0.txt - * - * Copyright (C) 2018 by via donau + * + * Copyright (C) 2018 by via donau * – Österreichische Wasserstraßen-Gesellschaft mbH * Software engineering by Intevation GmbH - * + * * Author(s): * Thomas Junk * Markus Kottländer @@ -22,6 +22,7 @@ import map from "./store/map"; import fairwayprofile from "./store/fairway"; import bottlenecks from "./store/bottlenecks"; +import imports from "./store/imports"; Vue.use(Vuex); @@ -29,6 +30,7 @@ modules: { application, fairwayprofile, + imports, bottlenecks, map, user, diff -r 443fc80a315f -r dc3f0277628a client/src/store/imports.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/src/store/imports.js Mon Nov 12 15:00:04 2018 +0100 @@ -0,0 +1,51 @@ +/* + * This is Free Software under GNU Affero General Public License v >= 3.0 + * without warranty, see README.md and license for details. + * + * SPDX-License-Identifier: AGPL-3.0-or-later + * License-Filename: LICENSES/AGPL-3.0.txt + * + * Copyright (C) 2018 by via donau + * – Österreichische Wasserstraßen-Gesellschaft mbH + * Software engineering by Intevation GmbH + * + * Author(s): + * Thomas Junk + */ + +import { HTTP } from "../application/lib/http"; + +const Imports = { + namespaced: true, + state: { + imports: {} + }, + mutations: { + setImports: (state, imports) => { + const groupedImports = imports.reduce((o, n) => { + if (!o[n.state]) o[n.state] = []; + o[n.state].push(n); + return o; + }, {}); + state.imports = groupedImports; + } + }, + actions: { + getImports({ commit }) { + return new Promise((resolve, reject) => { + HTTP.get("/imports", { + headers: { "X-Gemma-Auth": localStorage.getItem("token") } + }) + .then(response => { + commit("setImports", response.data.imports); + resolve(response); + }) + .catch(error => { + reject(error); + }); + }); + } + } +}; + +export default Imports; diff -r 443fc80a315f -r dc3f0277628a client/src/usermanagement/Usermanagement.vue --- a/client/src/usermanagement/Usermanagement.vue Fri Nov 09 10:57:49 2018 +0100 +++ b/client/src/usermanagement/Usermanagement.vue Mon Nov 12 15:00:04 2018 +0100 @@ -214,7 +214,7 @@ spacerStyle() { return { spacer: true, - "spacer-expanded": (this.showUsermenu && this.showSidebar), + "spacer-expanded": this.showUsermenu && this.showSidebar, "spacer-collapsed": !this.showUsermenu && this.showSidebar }; },