changeset 3835:49052775f57f sld-colors

Merged default into sld-colors branch.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 05 Jul 2019 10:31:23 +0200
parents d68c6be758b6 (current diff) 33180c25bd87 (diff)
children 631f5eaf29de
files
diffstat 8 files changed, 302 insertions(+), 218 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/Search.vue	Thu Jul 04 18:05:08 2019 +0200
+++ b/client/src/components/Search.vue	Fri Jul 05 10:31:23 2019 +0200
@@ -70,7 +70,12 @@
             class="mr-1"
             fixed-width
           />
-          {{ entry.name }} {{ entry.locationcode }}
+          {{ entry.name }}
+          <span v-if="entry.location || entry.locationcode"
+            >({{ entry.location
+            }}<span v-if="entry.location && entry.locationcode">, </span
+            >{{ entry.locationcode }})</span
+          >
         </a>
       </div>
     </div>
--- a/client/src/components/importconfiguration/ScheduledImports.vue	Thu Jul 04 18:05:08 2019 +0200
+++ b/client/src/components/importconfiguration/ScheduledImports.vue	Fri Jul 05 10:31:23 2019 +0200
@@ -132,241 +132,281 @@
       :sortBy="sortBy"
     />
 
-    <div class="d-flex p-2">
-      <template v-if="!directImport || !directImportAvailable">
-        <div class="flex-column mr-4">
-          <div class="flex-row text-left">
-            <small class="text-muted">
-              <translate>Scheduled</translate>?
-            </small>
-          </div>
-          <div class="flex-flex-row text-left">
-            <toggle-button
-              :value="scheduled"
-              v-model="scheduled"
-              :sync="true"
-              class="mt-2"
-              :speed="100"
-              :labels="{
-                checked: this.$options.on,
-                unchecked: this.$options.off
-              }"
-              :width="60"
-              :height="30"
-            />
-          </div>
-        </div>
-        <div class="flex-column mr-2">
-          <div class="flex-row text-left">
-            <small class="text-muted">
-              <translate>Simple</translate>
-            </small>
-          </div>
-          <div class="flex-flex-row text-left">
-            <toggle-button
-              :disabled="!scheduled"
-              :value="easyCron"
-              v-model="easyCron"
-              :sync="true"
-              class="mt-2"
-              :speed="100"
-              :labels="{
-                checked: this.$options.on,
-                unchecked: this.$options.off
-              }"
-              :width="60"
-              :height="30"
-            />
+    <template v-if="!directImport || !directImportAvailable">
+      <div class="d-flex p-2">
+        <div class="flex-column w-50">
+          <div class="d-flex flex-row">
+            <div class="flex-column mr-4">
+              <div class="flex-row text-left">
+                <small class="text-muted">
+                  <translate>Scheduled</translate>?
+                </small>
+              </div>
+              <div class="flex-row text-left">
+                <toggle-button
+                  :value="scheduled"
+                  v-model="scheduled"
+                  :sync="true"
+                  class="mt-2"
+                  :speed="100"
+                  :labels="{
+                    checked: this.$options.on,
+                    unchecked: this.$options.off
+                  }"
+                  :width="60"
+                  :height="30"
+                />
+              </div>
+            </div>
+            <div class="flex-column mr-2">
+              <div class="flex-row text-left">
+                <small class="text-muted">
+                  <translate>Simple</translate>
+                </small>
+              </div>
+              <div class="flex-flex-row text-left">
+                <toggle-button
+                  :disabled="!scheduled"
+                  :value="easyCron"
+                  v-model="easyCron"
+                  :sync="true"
+                  class="mt-2"
+                  :speed="100"
+                  :labels="{
+                    checked: this.$options.on,
+                    unchecked: this.$options.off
+                  }"
+                  :width="60"
+                  :height="30"
+                />
+              </div>
+            </div>
           </div>
         </div>
-        <div class="ml-auto flex-column">
+        <div class="flex-column ml-2">
+          <div class="ml-auto flex-column">
+            <div class="flex-row text-left">
+              <small class="text-muted">
+                <translate>Retry on failure</translate>
+              </small>
+            </div>
+            <div class="flex-row text-left">
+              <toggle-button
+                :value="retry"
+                v-model="retry"
+                :sync="true"
+                class="mt-2"
+                :speed="100"
+                :labels="{
+                  checked: this.$options.on,
+                  unchecked: this.$options.off
+                }"
+                v-tooltip.bottom="ttRetry"
+                :width="60"
+                :height="30"
+              />
+            </div>
+          </div>
+        </div>
+      </div>
+    </template>
+    <template v-if="!directImport || !directImportAvailable">
+      <div class="d-flex flex-row">
+        <div class="flex-column w-50 px-2 pb-3">
           <div class="flex-row text-left">
             <small class="text-muted">
-              <translate>Tries</translate>
-            </small>
-          </div>
-          <div>
-            <input
-              style="width:120px;"
-              v-model="trys"
-              class="mr-1 form-control form-control-sm"
-              type="number"
-            />
-          </div>
-        </div>
-        <div class="flex-column">
-          <div class="flex-row text-left">
-            <small class="text-muted">
-              <translate>Wait to retry</translate>
+              <translate>Schedule</translate>
             </small>
           </div>
-          <div>
-            <input
-              style="width:120px;"
-              v-model="waitRetry"
-              class="ml-1 form-control form-control-sm"
-            />
-          </div>
-        </div>
-      </template>
-    </div>
-    <template v-if="!directImport || !directImportAvailable">
-      <div class="flex-column w-100 px-2 pb-3">
-        <div class="flex-row text-left">
-          <small class="text-muted">
-            <translate>Schedule</translate>
-          </small>
-        </div>
-        <div v-if="easyCron" class="text-left w-50">
-          <select
-            :disabled="!scheduled"
-            v-model="simple"
-            class="form-control form-control-sm"
-            ><option value="weekly"><translate>Weekly</translate></option>
-            <option value="monthly"><translate>Monthly</translate> </option>
-          </select>
-        </div>
-        <div v-if="!easyCron" class="text-left w-100">
-          <div class="d-flex flex-row">
-            <div class="my-auto mr-2">{{ $options.EVERY }}</div>
+          <div v-if="easyCron" class="text-left w-100">
             <select
               :disabled="!scheduled"
-              style="width: 130px;"
-              v-model="cronMode"
+              v-model="simple"
               class="form-control form-control-sm"
-              @change="clearInputs"
             >
-              <option :value="null"></option>
-              <option
-                v-for="(option, key) in $options.CRONMODE"
-                :value="key"
-                :key="key"
-                >{{ option }}</option
-              >
+              <option value="weekly"><translate>Weekly</translate></option>
+              <option value="monthly"><translate>Monthly</translate> </option>
             </select>
-            <div v-if="cronMode == 'hour'" class="ml-1 d-flex flex-row">
-              <div class="mt-auto mb-auto">{{ $options.ON }}</div>
-              <input
-                :disabled="!scheduled"
-                v-model="minutes"
-                class="cronfield ml-1 mr-1 form-control form-control-sm"
-                type="number"
-              />
-              <div class="mt-auto mb-auto">{{ $options.MINUTESPAST }}</div>
-            </div>
-            <div v-if="cronMode == 'day'" class="ml-1 d-flex flex-row">
-              <div class="mt-auto mb-auto">{{ $options.AT }}</div>
-              <input
-                :disabled="!scheduled"
-                v-model="hour"
-                class="cronfield ml-1 mr-1 form-control form-control-sm"
-                type="number"
-              />
-              <input
-                :disabled="!scheduled"
-                v-model="minutes"
-                class="cronfield ml-1 mr-1 form-control form-control-sm"
-                type="number"
-              />
-              <div class="mt-auto mb-auto">{{ $options.OCLOCK }}</div>
-            </div>
-            <div v-if="cronMode == 'week'" class="ml-1 d-flex flex-row">
-              <div class="ml-1 mr-1 mt-auto mb-auto">{{ $options.ON }}</div>
+          </div>
+          <div v-if="!easyCron" class="text-left w-100">
+            <div class="d-flex flex-row">
+              <div class="my-auto mr-2">{{ $options.EVERY }}</div>
               <select
                 :disabled="!scheduled"
-                v-model="day"
+                style="width: 130px;"
+                v-model="cronMode"
                 class="form-control form-control-sm"
+                @change="clearInputs"
               >
+                <option :value="null"></option>
                 <option
-                  v-for="(option, key) in $options.DAYSOFWEEK"
-                  :key="key"
-                  :value="key"
-                  >{{ option }}</option
-                >
-              </select>
-              <div class="ml-1 mt-auto mb-auto">{{ $options.AT }}</div>
-              <input
-                :disabled="!scheduled"
-                v-model="hour"
-                class="cronfield ml-1 mr-1 form-control form-control-sm"
-                type="number"
-              />
-              <input
-                :disabled="!scheduled"
-                v-model="minutes"
-                class="cronfield ml-1 mr-1 form-control form-control-sm"
-                type="number"
-              />
-            </div>
-            <div v-if="cronMode == 'month'" class="ml-1 d-flex flex-row">
-              <div class="ml-1 mt-auto mb-auto">{{ $options.ON }}</div>
-              <input
-                :disabled="!scheduled"
-                v-model="dayOfMonth"
-                class="cronfield ml-1 mr-1 form-control form-control-sm"
-                type="number"
-              />
-              <div class="mt-auto mb-auto">{{ $options.AT }}</div>
-              <input
-                :disabled="!scheduled"
-                v-model="hour"
-                class="cronfield ml-1 mr-2 form-control form-control-sm"
-                type="number"
-              />
-              <input
-                :disabled="!scheduled"
-                v-model="minutes"
-                class="cronfield ml-1 mr-2 form-control form-control-sm"
-                type="number"
-              />
-              <div class="mt-auto mb-auto">{{ $options.OCLOCK }}</div>
-            </div>
-            <div v-if="cronMode == 'year'" class="ml-1 d-flex flex-row">
-              <div class="ml-1 mt-auto mb-auto">{{ $options.ON }}</div>
-              <input
-                :disabled="!scheduled"
-                v-model="dayOfMonth"
-                class="cronfield ml-1 mr-1 form-control form-control-sm"
-                type="number"
-              />
-              <div class="mt-auto mb-auto">{{ $options.OF }}</div>
-              <select
-                :disabled="!scheduled"
-                v-model="month"
-                class="ml-1 mr-1 form-control form-control-sm"
-              >
-                <option
-                  v-for="(option, key) in $options.MONTHS"
+                  v-for="(option, key) in $options.CRONMODE"
                   :value="key"
                   :key="key"
                   >{{ option }}</option
                 >
               </select>
-              <div class="mt-auto mb-auto">{{ $options.ON }}</div>
+              <div v-if="cronMode == 'hour'" class="ml-1 d-flex flex-row">
+                <div class="mt-auto mb-auto">{{ $options.ON }}</div>
+                <input
+                  :disabled="!scheduled"
+                  v-model="minutes"
+                  class="cronfield ml-1 mr-1 form-control form-control-sm"
+                  type="number"
+                />
+                <div class="mt-auto mb-auto">{{ $options.MINUTESPAST }}</div>
+              </div>
+              <div v-if="cronMode == 'day'" class="ml-1 d-flex flex-row">
+                <div class="mt-auto mb-auto">{{ $options.AT }}</div>
+                <input
+                  :disabled="!scheduled"
+                  v-model="hour"
+                  class="cronfield ml-1 mr-1 form-control form-control-sm"
+                  type="number"
+                />
+                <input
+                  :disabled="!scheduled"
+                  v-model="minutes"
+                  class="cronfield ml-1 mr-1 form-control form-control-sm"
+                  type="number"
+                />
+                <div class="mt-auto mb-auto">{{ $options.OCLOCK }}</div>
+              </div>
+              <div v-if="cronMode == 'week'" class="ml-1 d-flex flex-row">
+                <div class="ml-1 mr-1 mt-auto mb-auto">{{ $options.ON }}</div>
+                <select
+                  :disabled="!scheduled"
+                  v-model="day"
+                  class="form-control form-control-sm"
+                >
+                  <option
+                    v-for="(option, key) in $options.DAYSOFWEEK"
+                    :key="key"
+                    :value="key"
+                    >{{ option }}</option
+                  >
+                </select>
+                <div class="ml-1 mt-auto mb-auto">{{ $options.AT }}</div>
+                <input
+                  :disabled="!scheduled"
+                  v-model="hour"
+                  class="cronfield ml-1 mr-1 form-control form-control-sm"
+                  type="number"
+                />
+                <input
+                  :disabled="!scheduled"
+                  v-model="minutes"
+                  class="cronfield ml-1 mr-1 form-control form-control-sm"
+                  type="number"
+                />
+              </div>
+              <div v-if="cronMode == 'month'" class="ml-1 d-flex flex-row">
+                <div class="ml-1 mt-auto mb-auto">{{ $options.ON }}</div>
+                <input
+                  :disabled="!scheduled"
+                  v-model="dayOfMonth"
+                  class="cronfield ml-1 mr-1 form-control form-control-sm"
+                  type="number"
+                />
+                <div class="mt-auto mb-auto">{{ $options.AT }}</div>
+                <input
+                  :disabled="!scheduled"
+                  v-model="hour"
+                  class="cronfield ml-1 mr-2 form-control form-control-sm"
+                  type="number"
+                />
+                <input
+                  :disabled="!scheduled"
+                  v-model="minutes"
+                  class="cronfield ml-1 mr-2 form-control form-control-sm"
+                  type="number"
+                />
+                <div class="mt-auto mb-auto">{{ $options.OCLOCK }}</div>
+              </div>
+              <div v-if="cronMode == 'year'" class="ml-1 d-flex flex-row">
+                <div class="ml-1 mt-auto mb-auto">{{ $options.ON }}</div>
+                <input
+                  :disabled="!scheduled"
+                  v-model="dayOfMonth"
+                  class="cronfield ml-1 mr-1 form-control form-control-sm"
+                  type="number"
+                />
+                <div class="mt-auto mb-auto">{{ $options.OF }}</div>
+                <select
+                  :disabled="!scheduled"
+                  v-model="month"
+                  class="ml-1 mr-1 form-control form-control-sm"
+                >
+                  <option
+                    v-for="(option, key) in $options.MONTHS"
+                    :value="key"
+                    :key="key"
+                    >{{ option }}</option
+                  >
+                </select>
+                <div class="mt-auto mb-auto">{{ $options.ON }}</div>
+                <input
+                  :disabled="!scheduled"
+                  v-model="hour"
+                  class="cronfield ml-1 mr-1 form-control form-control-sm"
+                  type="number"
+                />
+                <input
+                  :disabled="!scheduled"
+                  v-model="minutes"
+                  class="cronfield ml-1 mr-1 form-control form-control-sm"
+                  type="number"
+                />
+              </div>
+            </div>
+            <div class="mt-3 w-50 d-flex">
+              <div class="my-auto mr-2">
+                <translate>Cronstring</translate>
+              </div>
               <input
                 :disabled="!scheduled"
-                v-model="hour"
-                class="cronfield ml-1 mr-1 form-control form-control-sm"
-                type="number"
-              />
-              <input
-                :disabled="!scheduled"
-                v-model="minutes"
-                class="cronfield ml-1 mr-1 form-control form-control-sm"
-                type="number"
+                class="form-control form-control-sm"
+                v-model="cronString"
+                type="text"
               />
             </div>
           </div>
-          <div class="mt-3 w-50 d-flex">
-            <div class="my-auto mr-2">
-              <translate>Cronstring</translate>
+        </div>
+        <div class="d-flex flex-column ml-2">
+          <div class="d-flex flex-row ">
+            <div class="ml-1 flex-column">
+              <div class="flex-row text-left">
+                <small class="text-muted">
+                  <translate>Tries</translate>
+                </small>
+              </div>
+              <div>
+                <input
+                  :disabled="!retry"
+                  style="width:120px;"
+                  v-model="trys"
+                  class="mr-1 form-control form-control-sm"
+                  v-tooltip.bottom="ttRetries"
+                  type="number"
+                />
+              </div>
             </div>
-            <input
-              :disabled="!scheduled"
-              class="form-control form-control-sm"
-              v-model="cronString"
-              type="text"
-            />
+            <div class="flex-column">
+              <div class="flex-row text-left">
+                <small class="text-muted">
+                  <translate>Wait to retry</translate>
+                </small>
+              </div>
+              <div>
+                <input
+                  :disabled="!retry"
+                  style="width:120px;"
+                  v-model="waitRetry"
+                  v-tooltip.bottom="ttWaitRetry"
+                  class="ml-1 form-control form-control-sm"
+                />
+              </div>
+            </div>
           </div>
         </div>
       </div>
@@ -458,6 +498,7 @@
       passwordVisible: false,
       uploadLabel: this.$gettext("choose file to upload"),
       uploadFile: null,
+      retry: false,
       ...initializeCurrentSchedule()
     };
   },
@@ -493,6 +534,12 @@
       if (this.isMonthly(this.cronString)) {
         this.simple = "monthly";
       }
+    },
+    retry() {
+      if (!this.retry) {
+        this.trys = 0;
+        this.waitRetry = "";
+      }
     }
   },
   computed: {
@@ -606,6 +653,15 @@
         }
       }
       return true;
+    },
+    ttWaitRetry() {
+      return this.$gettext("retryDescription");
+    },
+    ttRetries() {
+      return this.$gettext("retryCountDescription");
+    },
+    ttRetry() {
+      return this.$gettext("retryDelayDescription");
     }
   },
   methods: {
@@ -704,6 +760,10 @@
       this.directImport = false;
       this.trys = this.currentSchedule.trys;
       this.waitRetry = this.currentSchedule.waitRetry;
+      this.retry =
+        this.currentSchedule.trys === null ||
+        this.currentSchedule.trys === undefined ||
+        this.currentSchedule === 0 ? false : true;
     },
     isWeekly(cron) {
       return /0 \d{1,2} \d{1,2} \* \* \d{1}/.test(cron);
--- a/client/src/store/importschedule.js	Thu Jul 04 18:05:08 2019 +0200
+++ b/client/src/store/importschedule.js	Fri Jul 05 10:31:23 2019 +0200
@@ -140,11 +140,11 @@
       const { cron, url } = config;
       Vue.set(state.currentSchedule, "importType", KINDIMPORTTYPE[kind]);
       Vue.set(state.currentSchedule, "id", id);
+      Vue.set(state.currentSchedule, "trys", config["trys"]);
+      Vue.set(state.currentSchedule, "waitRetry", config["wait-retry"]);
       if (cron) {
         Vue.set(state.currentSchedule, "scheduled", true);
         Vue.set(state.currentSchedule, "cronString", cron);
-        Vue.set(state.currentSchedule, "trys", config["trys"]);
-        Vue.set(state.currentSchedule, "waitRetry", config["wait-retry"]);
         // simple weekly  or monthly?
         if (cron === "0 0 0 * * 0") {
           Vue.set(state.currentSchedule, "simple", "weekly");
--- a/pkg/imports/dmv.go	Thu Jul 04 18:05:08 2019 +0200
+++ b/pkg/imports/dmv.go	Fri Jul 05 10:31:23 2019 +0200
@@ -66,15 +66,18 @@
 INSERT INTO waterway.distance_marks_virtual (
   location_code,
   geom,
-  related_enc
+  related_enc,
+  wwname
 )
 VALUES (
   ($1::char(2), $2::char(3), $3::char(5), $4::char(5), $5::int),
   ST_SetSRID(ST_MakePoint($6, $7), 4326)::geography,
-  $8
+  $8,
+  $9
 ) ON CONFLICT (location_code) DO UPDATE SET
   geom = ST_SetSRID(ST_MakePoint($6, $7), 4326)::geography,
-  related_enc = $8
+  related_enc = $8,
+  wwname = $9
 `
 )
 
@@ -140,6 +143,12 @@
 				continue
 			}
 
+			if dr.Wwname.Loc == nil {
+				feedback.Warn("missing wwname: %s", code)
+				ignored++
+				continue
+			}
+
 			if _, err := insertStmt.ExecContext(
 				ctx,
 				code.CountryCode,
@@ -149,6 +158,7 @@
 				code.Hectometre,
 				float64(*dr.Lon), float64(*dr.Lat),
 				string(*dr.Relenc),
+				string(*dr.Wwname.Loc),
 			); err != nil {
 				return nil, err
 			}
--- a/schema/gemma.sql	Thu Jul 04 18:05:08 2019 +0200
+++ b/schema/gemma.sql	Fri Jul 05 10:31:23 2019 +0200
@@ -504,7 +504,8 @@
     CREATE TABLE distance_marks_virtual (
         location_code isrs PRIMARY KEY,
         geom geography(POINT, 4326) NOT NULL,
-        related_enc varchar(12) NOT NULL
+        related_enc varchar(12) NOT NULL,
+        wwname varchar
     )
 
     CREATE TABLE distance_marks (
--- a/schema/search_functions.sql	Thu Jul 04 18:05:08 2019 +0200
+++ b/schema/search_functions.sql	Fri Jul 05 10:31:23 2019 +0200
@@ -22,6 +22,7 @@
       INTO _result
       FROM (SELECT (location_code).hectometre || ' rhm' AS name,
                         isrs_asText(location_code) AS locationcode,
+                        wwname AS location,
                ST_AsGeoJSON(geom)::json AS geom, 'rhm' AS type
         FROM waterway.distance_marks_virtual
         WHERE (location_code).hectometre = search_string::int) r;
@@ -30,6 +31,7 @@
       INTO _result
       FROM (SELECT (location_code).hectometre || ' rhm' AS name,
                         isrs_asText(location_code) AS locationcode,
+                        wwname AS location,
                ST_AsGeoJSON(geom)::json AS geom, 'rhm' AS type
         FROM waterway.distance_marks_virtual
         WHERE location_code = isrs_fromText(search_string)) r;
@@ -66,7 +68,8 @@
 BEGIN
   SELECT COALESCE(json_agg(r),'[]')
     INTO _result
-    FROM (SELECT name || ' (' || country_code || ')' AS name,
+    FROM (SELECT name,
+                 country_code AS location,
                  ST_AsGeoJSON(location)::json AS geom,
                  'city' AS type
             FROM waterway.geonames
@@ -92,7 +95,8 @@
       FROM (
          SELECT objname AS name,
                    ST_AsGeoJSON(geom)::json AS geom,
-                   'gauge' AS type
+                   'gauge' AS type,
+                   isrs_asText(location) AS locationcode
               FROM waterway.gauges
               WHERE NOT erased AND location = isrs_fromText(search_string)
             ORDER BY name) r;
@@ -102,7 +106,8 @@
       FROM (
          SELECT objname AS name,
                    ST_AsGeoJSON(geom)::json AS geom,
-                   'gauge' AS type
+                   'gauge' AS type,
+                   isrs_asText(location) AS locationcode
               FROM waterway.gauges
               WHERE NOT erased AND objname ILIKE '%' || search_string || '%'
             ORDER BY name) r;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/schema/updates_3.0.1/01.dismar-wwname.sql	Fri Jul 05 10:31:23 2019 +0200
@@ -0,0 +1,2 @@
+ALTER TABLE waterway.distance_marks_virtual
+  ADD COLUMN IF NOT EXISTS wwname varchar;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/schema/updates_3.0.1/02.search_functions.sql	Fri Jul 05 10:31:23 2019 +0200
@@ -0,0 +1,1 @@
+../search_functions.sql
\ No newline at end of file