changeset 1205:5ba14f7f5bdc

merge
author Markus Kottlaender <markus@intevation.de>
date Mon, 19 Nov 2018 12:40:56 +0100
parents ddfdf440da24 (current diff) 49eead4fad3a (diff)
children 0900b341cef0
files client/src/App.vue client/src/application/Search.vue pkg/controllers/imports.go
diffstat 3 files changed, 113 insertions(+), 108 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/identify/Identify.vue	Mon Nov 19 11:23:00 2018 +0100
+++ b/client/src/identify/Identify.vue	Mon Nov 19 12:40:56 2018 +0100
@@ -1,6 +1,9 @@
 <template>
     <div class="identifymenu">
-        <div @click="$store.commit('application/showIdentify', !showIdentify)" class="d-flex flex-column ui-element minimizer">
+        <div
+            @click="$store.commit('application/showIdentify', !showIdentify)"
+            class="d-flex flex-column ui-element minimizer"
+        >
             <div :class="infoStyle">
                 <i class="fa fa-info"></i>
             </div>
@@ -13,26 +16,28 @@
                 <hr>
                 <div class="d-flex flex-column features">
                     <small v-if="currentMeasurement">
-                      {{ currentMeasurement.quantity }}
-                      ({{ currentMeasurement.unitSymbol }}):
-                      {{ currentMeasurement.value }}
+                        {{ currentMeasurement.quantity }}
+                        ({{ currentMeasurement.unitSymbol }}):
+                        {{ currentMeasurement.value }}
                     </small>
                     <div v-for="feature of identifiedFeatures" :key="feature.getId()">
                         <div v-if="feature.getId()">
                             {{ feature.getId().replace(/[.][^.]*$/,"") /* cut away everything from the last . to the end */}}:
-                            <small v-for="(value, key) in prepareProperties(feature)" :key="key">
+                            <small
+                                v-for="(value, key) in prepareProperties(feature)"
+                                :key="key"
+                            >
                                 <div v-if="value">{{key}}:{{value}}</div>
                             </small>
                         </div>
                     </div>
                 </div>
                 <div class="versioninfo">
-                    <hr />
-                    gemma <a href="https://hg.intevation.de/gemma/file/tip">source-code</a> {{ versionStr }}
-                    <br />
-                    Some data ©
-                    <a href="https://www.openstreetmap.org/copyright">OpenSteetMap</a> contributors
-
+                    <hr>gemma
+                    <a href="https://hg.intevation.de/gemma/file/tip">source-code</a>
+                    {{ versionStr }}
+                    <br>Some data ©
+                    <a href="https://www.openstreetmap.org/copyright">OpenSteetMap</a>contributors
                 </div>
             </div>
         </div>
--- a/pkg/controllers/imports.go	Mon Nov 19 11:23:00 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-// 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):
-//  * Sascha L. Teichmann <sascha.teichmann@intevation.de>
-
-package controllers
-
-import (
-	"bufio"
-	"io"
-	"io/ioutil"
-	"log"
-	"net/http"
-	"os"
-	"path/filepath"
-
-	"gemma.intevation.de/gemma/pkg/auth"
-	"gemma.intevation.de/gemma/pkg/config"
-	"gemma.intevation.de/gemma/pkg/imports"
-)
-
-const (
-	maxSoundingResultSize = 25 * 1024 * 1024
-	soundingResultName    = "soundingresult"
-)
-
-func downloadSoundingResult(req *http.Request) (string, error) {
-
-	f, _, err := req.FormFile(soundingResultName)
-	if err != nil {
-		return "", err
-	}
-	defer f.Close()
-
-	dir, err := ioutil.TempDir(config.TmpDir(), soundingResultName)
-	if err != nil {
-		return "", err
-	}
-
-	o, err := os.Create(filepath.Join(dir, "sr.zip"))
-	if err != nil {
-		os.RemoveAll(dir)
-		return "", err
-	}
-
-	out := bufio.NewWriter(o)
-
-	if _, err = io.Copy(out, io.LimitReader(f, maxSoundingResultSize)); err != nil {
-		o.Close()
-		os.RemoveAll(dir)
-		return "", err
-	}
-
-	if err = out.Flush(); err != nil {
-		o.Close()
-		os.RemoveAll(dir)
-		return "", err
-	}
-
-	return dir, nil
-}
-
-func importSoundingResult(rw http.ResponseWriter, req *http.Request) {
-
-	dir, err := downloadSoundingResult(req)
-	if err != nil {
-		log.Printf("error: %v\n", err)
-		http.Error(rw, "error: "+err.Error(), http.StatusInternalServerError)
-		return
-	}
-
-	session, _ := auth.GetSession(req)
-
-	jobID, err := imports.AddJob(imports.SRJobKind, session.User, dir)
-	if err != nil {
-		log.Printf("error: %v\n", err)
-		http.Error(rw, "error: "+err.Error(), http.StatusInternalServerError)
-		return
-	}
-
-	log.Printf("info: added import #%d to queue\n", jobID)
-
-	result := struct {
-		ID int64 `json:"id"`
-	}{
-		ID: jobID,
-	}
-	SendJSON(rw, http.StatusCreated, &result)
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pkg/controllers/srimports.go	Mon Nov 19 12:40:56 2018 +0100
@@ -0,0 +1,97 @@
+// 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):
+//  * Sascha L. Teichmann <sascha.teichmann@intevation.de>
+
+package controllers
+
+import (
+	"bufio"
+	"io"
+	"io/ioutil"
+	"log"
+	"net/http"
+	"os"
+	"path/filepath"
+
+	"gemma.intevation.de/gemma/pkg/auth"
+	"gemma.intevation.de/gemma/pkg/config"
+	"gemma.intevation.de/gemma/pkg/imports"
+)
+
+const (
+	maxSoundingResultSize = 25 * 1024 * 1024
+	soundingResultName    = "soundingresult"
+)
+
+func downloadSoundingResult(req *http.Request) (string, error) {
+
+	f, _, err := req.FormFile(soundingResultName)
+	if err != nil {
+		return "", err
+	}
+	defer f.Close()
+
+	dir, err := ioutil.TempDir(config.TmpDir(), soundingResultName)
+	if err != nil {
+		return "", err
+	}
+
+	o, err := os.Create(filepath.Join(dir, "sr.zip"))
+	if err != nil {
+		os.RemoveAll(dir)
+		return "", err
+	}
+
+	out := bufio.NewWriter(o)
+
+	if _, err = io.Copy(out, io.LimitReader(f, maxSoundingResultSize)); err != nil {
+		o.Close()
+		os.RemoveAll(dir)
+		return "", err
+	}
+
+	if err = out.Flush(); err != nil {
+		o.Close()
+		os.RemoveAll(dir)
+		return "", err
+	}
+
+	return dir, nil
+}
+
+func importSoundingResult(rw http.ResponseWriter, req *http.Request) {
+
+	dir, err := downloadSoundingResult(req)
+	if err != nil {
+		log.Printf("error: %v\n", err)
+		http.Error(rw, "error: "+err.Error(), http.StatusInternalServerError)
+		return
+	}
+
+	session, _ := auth.GetSession(req)
+
+	jobID, err := imports.AddJob(imports.SRJobKind, session.User, dir)
+	if err != nil {
+		log.Printf("error: %v\n", err)
+		http.Error(rw, "error: "+err.Error(), http.StatusInternalServerError)
+		return
+	}
+
+	log.Printf("info: added import #%d to queue\n", jobID)
+
+	result := struct {
+		ID int64 `json:"id"`
+	}{
+		ID: jobID,
+	}
+	SendJSON(rw, http.StatusCreated, &result)
+}