annotate client/src/components/fairway/BottleneckDialogue.vue @ 4868:008bc1ae8897

exception handling
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 17 Dec 2019 15:05:56 +0100
parents 00a2c761493e
children 6b054b91d9b2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
1 <template>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
2 <div
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
3 :class="[
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
4 'box ui-element rounded bg-white text-nowrap',
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
5 { expanded: showProfiles }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
6 ]"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
7 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
8 <div style="width: 18rem">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
9 <UIBoxHeader
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
10 icon="chart-area"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
11 :title="profilesLable"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
12 :closeCallback="close"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
13 />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
14 <div class="box-body">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
15 <UISpinnerOverlay v-if="surveysLoading || profileLoading" />
4479
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
16 <div class="d-flex flex-row">
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
17 <select
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
18 v-model="selectedBottleneck"
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
19 class="form-control font-weight-bold"
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
20 >
4479
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
21 <option :value="null">
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
22 <translate>Select Bottleneck</translate>
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
23 </option>
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
24 <optgroup
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
25 v-for="(bottlenecksForCountry, cc) in orderedBottlenecks"
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
26 :key="cc"
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
27 :label="cc"
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
28 >
4479
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
29 <option
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
30 v-for="bn in bottlenecksForCountry"
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
31 :key="bn.properties.id"
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
32 :value="bn.properties.name"
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
33 >
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
34 {{ bn.properties.name }}
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
35 </option>
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
36 </optgroup>
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
37 </select>
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
38 <button @click="takeMeThere" class="btn btn-sm btn-info">
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
39 <font-awesome-icon icon="crosshairs" />
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
40 </button>
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
41 </div>
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
42 <div v-if="selectedBottleneck">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
43 <div class="d-flex flex-column mt-2">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
44 <div class="flex-fill">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
45 <small class="text-muted">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
46 <translate>Waterlevel</translate>:
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
47 </small>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
48 <select
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
49 v-model="selectedWaterLevel"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
50 class="form-control form-control-sm small"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
51 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
52 <option value="ref">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
53 <translate>Depth Reference</translate>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
54 <template v-if="selectedSurvey">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
55 ({{ selectedSurvey.depth_reference }}/{{
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
56 $options.filters.waterlevel(
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
57 selectedSurvey.waterlevel_value
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
58 )
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
59 }}
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
60 m)
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
61 </template>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
62 </option>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
63 <option value="current">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
64 <translate>Current Waterlevel</translate>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
65 <template v-if="bottleneck">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
66 ({{
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
67 $options.filters.waterlevel(
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
68 bottleneck.get("gm_waterlevel")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
69 )
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
70 }}
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
71 m)
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
72 </template>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
73 </option>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
74 </select>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
75 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
76 <div class="flex-fill">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
77 <small class="text-muted"> <translate>Survey</translate>: </small>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
78 <div class="d-flex">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
79 <select
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
80 v-model="selectedSurvey"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
81 class="form-control form-control-sm small"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
82 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
83 <option
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
84 v-for="survey in surveys"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
85 :key="survey.date_info"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
86 :value="survey"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
87 >{{ survey.date_info | surveyDate }}</option
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
88 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
89 </select>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
90 <button
4521
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
91 v-if="isAllowedToDelete"
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
92 class="btn btn-dark btn-xs ml-2"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
93 @click="deleteSelectedSurvey"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
94 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
95 <font-awesome-icon icon="trash" />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
96 </button>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
97 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
98 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
99 <div class="flex-fill" v-if="selectedSurvey && surveys.length > 1">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
100 <small class="text-muted mt-1">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
101 <translate>Compare with</translate>:
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
102 </small>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
103 <select
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
104 v-model="additionalSurvey"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
105 class="form-control form-control-sm small"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
106 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
107 <option :value="null">None</option>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
108 <option
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
109 v-for="survey in additionalSurveys"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
110 :key="survey.date_info"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
111 :value="survey"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
112 >{{ survey.date_info | surveyDate }}</option
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
113 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
114 </select>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
115 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
116 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
117 <div class="mt-2 d-flex" v-if="additionalSurvey">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
118 <button
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
119 v-if="differencesLoading"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
120 class="btn btn-info btn-xs flex-fill"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
121 disabled
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
122 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
123 <font-awesome-icon icon="spinner" spin class="mr-1" />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
124 <translate>Calculating differences</translate>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
125 </button>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
126 <button
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
127 class="btn btn-info btn-xs flex-fill"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
128 @click="differencesVisible ? showSurvey() : showDifferences()"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
129 v-else
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
130 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
131 <translate v-if="differencesVisible" key="showsurvey"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
132 >Show survey</translate
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
133 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
134 <translate v-else key="showdifferences"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
135 >Show differences</translate
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
136 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
137 </button>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
138 <button
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
139 v-if="!paneSetup.includes('FAIRWAYPROFILE')"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
140 class="btn btn-info btn-xs ml-2"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
141 @click="$store.commit('application/paneRotate')"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
142 v-tooltip="rotatePanesTooltip"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
143 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
144 <font-awesome-icon icon="redo" fixed-width />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
145 </button>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
146 <button
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
147 class="btn btn-info btn-xs ml-2"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
148 @click="toggleSyncMaps()"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
149 v-tooltip="syncMapsTooltip"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
150 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
151 <font-awesome-icon
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
152 :icon="mapsAreSynced ? 'unlink' : 'link'"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
153 fixed-width
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
154 />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
155 </button>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
156 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
157 <hr class="w-100 mb-0" />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
158 <small class="text-muted d-block mt-2">
4502
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
159 <translate>Custom Depth</translate>:
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
160 </small>
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
161 <div class="d-flex">
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
162 <input
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
163 class="form-control form-control-sm w-100 mt-1"
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
164 v-model.number="depth"
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
165 type="number"
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
166 step="0.1"
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
167 min="0"
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
168 />
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
169 <button
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
170 @click="useCustomDepth = !useCustomDepth"
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
171 :class="[
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
172 'btn',
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
173 'btn-xs',
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
174 'ml-2',
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
175 {
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
176 'btn-info': useCustomDepth,
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
177 'btn-secondary': !useCustomDepth
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
178 }
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
179 ]"
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
180 >
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
181 {{ useCustomDepth ? "disable" : "enable" }}
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
182 </button>
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
183 </div>
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
184 <small class="text-muted d-block mt-2">
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
185 <translate>Saved cross profiles</translate>:
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
186 </small>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
187 <div class="d-flex">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
188 <select
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
189 :class="[
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
190 'form-control form-control-sm flex-fill',
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
191 { 'rounded-left-only': selectedCut }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
192 ]"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
193 v-model="selectedCut"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
194 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
195 <option></option>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
196 <option
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
197 v-for="(cut, index) in previousCuts"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
198 :value="cut"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
199 :key="index"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
200 >{{ cut.label }}</option
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
201 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
202 </select>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
203 <button
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
204 class="btn btn-xs btn-dark ml-2"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
205 @click="deleteSelectedCut(selectedCut)"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
206 v-if="selectedCut"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
207 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
208 <font-awesome-icon icon="trash" />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
209 </button>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
210 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
211 <small class="text-muted d-block mt-2">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
212 <translate>Enter coordinates manually</translate>:
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
213 </small>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
214 <div class="position-relative">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
215 <input
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
216 class="form-control form-control-sm pr-5"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
217 placeholder="Lat,Lon,Lat,Lon"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
218 v-model="coordinatesInput"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
219 />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
220 <button
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
221 class="btn btn-sm btn-info position-absolute input-button-right"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
222 @click="applyManualCoordinates"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
223 style="top: 0; right: 0;"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
224 v-if="coordinatesInputIsValid"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
225 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
226 <font-awesome-icon icon="check" />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
227 </button>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
228 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
229 <small class="d-flex text-left mt-2" v-if="startPoint && endPoint">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
230 <div class="text-nowrap mr-3">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
231 <b> <translate>Start</translate>: </b> <br />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
232 Lat: {{ startPoint[1] }} <br />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
233 Lon: {{ startPoint[0] }}
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
234 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
235 <div class="text-nowrap">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
236 <b>End:</b> <br />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
237 Lat: {{ endPoint[1] }} <br />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
238 Lon: {{ endPoint[0] }}
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
239 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
240 <button
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
241 v-clipboard:copy="coordinatesForClipboard"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
242 v-clipboard:success="onCopyCoordinates"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
243 class="btn btn-info btn-sm ml-auto mt-auto"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
244 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
245 <font-awesome-icon icon="copy" />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
246 </button>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
247 </small>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
248 <div class="d-flex mt-3">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
249 <div
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
250 class="pr-3 w-50"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
251 v-if="startPoint && endPoint && !selectedCut"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
252 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
253 <button
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
254 class="btn btn-info btn-sm w-100"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
255 @click="showLabelInput = !showLabelInput"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
256 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
257 <font-awesome-icon :icon="showLabelInput ? 'times' : 'check'" />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
258 {{ showLabelInput ? "Cancel" : "Save" }}
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
259 </button>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
260 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
261 <div
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
262 :class="startPoint && endPoint && !selectedCut ? 'w-50' : 'w-100'"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
263 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
264 <button
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
265 class="btn btn-info btn-sm w-100"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
266 @click="toggleCutTool"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
267 :disabled="!selectedSurvey"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
268 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
269 <font-awesome-icon :icon="cutToolEnabled ? 'times' : 'plus'" />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
270 {{ cutToolEnabled ? "Cancel" : "New" }}
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
271 </button>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
272 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
273 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
274 <div v-if="showLabelInput" class="mt-2">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
275 <small class="text-muted">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
276 <translate>Enter label for cross profile</translate>:
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
277 </small>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
278 <div class="position-relative">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
279 <input
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
280 class="form-control form-control-sm pr-5"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
281 v-model="cutLabel"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
282 />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
283 <button
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
284 class="btn btn-sm btn-info position-absolute input-button-right"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
285 @click="saveCut"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
286 v-if="cutLabel"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
287 style="top: 0; right: 0;"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
288 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
289 <font-awesome-icon icon="check" />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
290 </button>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
291 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
292 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
293 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
294 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
295 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
296 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
297 </template>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
298
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
299 <style lang="scss" scoped>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
300 .input-button-right {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
301 border-top-right-radius: $border-radius;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
302 border-bottom-right-radius: $border-radius;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
303 border-top-left-radius: 0 !important;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
304 border-bottom-left-radius: 0 !important;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
305 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
306
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
307 .rounded-left-only {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
308 border-top-right-radius: 0 !important;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
309 border-bottom-right-radius: 0 !important;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
310 border-top-left-radius: $border-radius;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
311 border-bottom-left-radius: $border-radius;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
312 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
313
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
314 input,
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
315 select {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
316 font-size: 0.8em;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
317 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
318 </style>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
319
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
320 <script>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
321 /* This is Free Software under GNU Affero General Public License v >= 3.0
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
322 * without warranty, see README.md and license for details.
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
323 *
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
324 * SPDX-License-Identifier: AGPL-3.0-or-later
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
325 * License-Filename: LICENSES/AGPL-3.0.txt
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
326 *
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
327 * Copyright (C) 2018 by via donau
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
328 * – Österreichische Wasserstraßen-Gesellschaft mbH
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
329 * Software engineering by Intevation GmbH
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
330 *
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
331 * Author(s):
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
332 * Markus Kottländer <markus.kottlaender@intevation.de>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
333 */
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
334 import { mapState, mapGetters } from "vuex";
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
335 import Feature from "ol/Feature";
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
336 import LineString from "ol/geom/LineString";
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
337 import { displayError, displayInfo } from "@/lib/errors";
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
338 import { HTTP } from "@/lib/http";
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
339 import { COMPARESURVEYS } from "@/components/paneSetups";
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
340
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
341 export default {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
342 name: "profiles",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
343 data() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
344 return {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
345 coordinatesInput: "",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
346 cutLabel: "",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
347 showLabelInput: false
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
348 };
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
349 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
350 computed: {
4521
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
351 ...mapState("user", ["user"]),
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
352 ...mapGetters("user", ["isWaterwayAdmin", "isSysAdmin"]),
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
353 ...mapGetters("usermanagement", ["userCountries"]),
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
354 ...mapState("application", ["showProfiles", "paneSetup"]),
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
355 ...mapState("map", ["openLayersMaps", "syncedMaps", "cutToolEnabled"]),
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
356 ...mapState("bottlenecks", [
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
357 "bottlenecksList",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
358 "surveys",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
359 "surveysLoading"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
360 ]),
4521
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
361 isAllowedToDelete() {
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
362 const userCountryCode = this.userCountries[this.user];
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
363 const bottleneck = this.bottlenecksList.find(
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
364 bn => bn.properties.name === this.selectedBottleneck
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
365 );
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
366 if (!bottleneck) return;
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
367 if (this.isWaterwayAdmin || this.isSysAdmin) {
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
368 if (
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
369 userCountryCode === "global" ||
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
370 bottleneck.properties.responsible_country === userCountryCode
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
371 ) {
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
372 return true;
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
373 }
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
374 }
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
375 return false;
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
376 },
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
377 ...mapState("fairwayprofile", [
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
378 "previousCuts",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
379 "startPoint",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
380 "endPoint",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
381 "profileLoading",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
382 "differencesLoading",
4525
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
383 "currentDifference",
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
384 "waterLevels",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
385 "currentProfile"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
386 ]),
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
387 ...mapGetters("map", ["openLayersMap"]),
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
388 ...mapGetters("bottlenecks", ["orderedBottlenecks"]),
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
389 profilesLable() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
390 return this.$gettext("Bottleneck Surveys");
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
391 },
4502
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
392 useCustomDepth: {
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
393 get() {
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
394 return this.$store.state.fairwayprofile.useCustomDepth;
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
395 },
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
396 set(value) {
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
397 this.$store.commit("fairwayprofile/setUseCustomDepth", value);
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
398 }
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
399 },
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
400 depth: {
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
401 get() {
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
402 return this.$store.state.fairwayprofile.depth;
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
403 },
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
404 set(value) {
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
405 this.$store.commit("fairwayprofile/setDepth", value);
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
406 }
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
407 },
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
408 selectedBottleneck: {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
409 get() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
410 return this.$store.state.bottlenecks.selectedBottleneck;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
411 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
412 set(name) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
413 this.$store.dispatch("bottlenecks/setSelectedBottleneck", name);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
414 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
415 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
416 selectedWaterLevel: {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
417 get() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
418 return this.$store.state.fairwayprofile.selectedWaterLevel;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
419 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
420 set(value) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
421 this.$store.commit("fairwayprofile/setSelectedWaterLevel", value);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
422 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
423 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
424 selectedSurvey: {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
425 get() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
426 return this.$store.state.bottlenecks.selectedSurvey;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
427 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
428 set(survey) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
429 this.$store.commit("fairwayprofile/additionalSurvey", null);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
430 this.$store.commit("bottlenecks/selectedSurvey", survey);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
431 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
432 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
433 additionalSurvey: {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
434 get() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
435 return this.$store.state.fairwayprofile.additionalSurvey;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
436 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
437 set(survey) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
438 this.$store.commit("fairwayprofile/additionalSurvey", survey);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
439 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
440 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
441 selectedCut: {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
442 get() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
443 return this.$store.state.fairwayprofile.selectedCut;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
444 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
445 set(cut) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
446 this.$store.commit("fairwayprofile/selectedCut", cut);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
447 if (!cut) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
448 this.$store.commit("fairwayprofile/clearCurrentProfile");
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
449 this.openLayersMaps.forEach(m => {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
450 m.getLayer("CUTTOOL")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
451 .getSource()
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
452 .clear();
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
453 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
454 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
455 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
456 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
457 additionalSurveys() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
458 return this.surveys.filter(
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
459 survey => survey.date_info !== this.selectedSurvey.date_info
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
460 );
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
461 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
462 coordinatesForClipboard() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
463 return (
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
464 this.startPoint[1] +
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
465 "," +
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
466 this.startPoint[0] +
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
467 "," +
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
468 this.endPoint[1] +
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
469 "," +
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
470 this.endPoint[0]
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
471 );
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
472 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
473 coordinatesInputIsValid() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
474 const coordinates = this.coordinatesInput
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
475 .split(",")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
476 .map(coord => parseFloat(coord.trim()))
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
477 .filter(c => Number(c) === c);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
478 return coordinates.length === 4;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
479 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
480 differencesVisible() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
481 return (
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
482 this.openLayersMap(COMPARESURVEYS.compare.id) &&
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
483 !this.openLayersMap(COMPARESURVEYS.compare.id)
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
484 .getLayer("BOTTLENECKISOLINE")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
485 .getVisible() &&
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
486 this.openLayersMap(COMPARESURVEYS.compare.id)
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
487 .getLayer("DIFFERENCES")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
488 .getVisible()
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
489 );
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
490 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
491 rotatePanesTooltip() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
492 return this.$gettext("Rotate Maps");
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
493 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
494 syncMapsTooltip() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
495 return this.$gettext(
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
496 this.mapsAreSynced ? "Unsynchronize Maps" : "Synchronize Maps"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
497 );
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
498 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
499 mapsAreSynced() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
500 return this.syncedMaps.includes(COMPARESURVEYS.compare.id);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
501 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
502 bottleneck() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
503 return this.openLayersMap()
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
504 ? this.openLayersMap()
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
505 .getLayer("BOTTLENECKS")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
506 .getSource()
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
507 .getFeatures()
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
508 .find(f => f.get("objnam") === this.selectedBottleneck)
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
509 : null;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
510 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
511 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
512 watch: {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
513 selectedBottleneck() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
514 this.$store.dispatch("fairwayprofile/previousCuts");
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
515 this.cutLabel =
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
516 this.selectedBottleneck + " (" + new Date().toISOString() + ")";
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
517 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
518 selectedSurvey(survey) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
519 this.loadProfile(survey);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
520 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
521 additionalSurvey(survey) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
522 if (survey) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
523 this.loadDifferences();
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
524 this.$store.commit(
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
525 "application/paneSetup",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
526 Object.keys(this.currentProfile).length
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
527 ? "COMPARESURVEYS_FAIRWAYPROFILE"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
528 : "COMPARESURVEYS"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
529 );
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
530 this.$store.commit("map/syncedMaps", [COMPARESURVEYS.compare.id]);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
531 } else {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
532 this.$store.commit(
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
533 "application/paneSetup",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
534 Object.keys(this.currentProfile).length ? "FAIRWAYPROFILE" : "DEFAULT"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
535 );
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
536 this.$store.commit("map/syncedMaps", []);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
537 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
538 this.loadProfile(survey);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
539 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
540 selectedCut(cut) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
541 if (cut) {
4502
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
542 if (cut.depth) {
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
543 this.depth = cut.depth;
4528
0bad1dcdb044 client: Fairwayprofile: save the state of the enable/disable button for custom depth
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4526
diff changeset
544 this.useCustomDepth = cut.useCustomDepth;
4502
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
545 }
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
546 this.applyCoordinates(cut.coordinates);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
547 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
548 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
549 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
550 methods: {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
551 toggleSyncMaps() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
552 if (this.mapsAreSynced) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
553 this.$store.commit(
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
554 "map/syncedMaps",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
555 this.syncedMaps.filter(m => m !== COMPARESURVEYS.compare.id)
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
556 );
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
557 } else {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
558 this.$store.commit("map/syncedMaps", [COMPARESURVEYS.compare.id]);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
559 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
560 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
561 loadDifferences() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
562 this.$store.commit("fairwayprofile/setDifferencesLoading", true);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
563 HTTP.post(
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
564 "/diff",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
565 {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
566 bottleneck: this.selectedSurvey.bottleneck_id,
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
567 minuend: this.selectedSurvey.date_info,
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
568 subtrahend: this.additionalSurvey.date_info
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
569 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
570 {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
571 headers: {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
572 "X-Gemma-Auth": localStorage.getItem("token")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
573 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
574 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
575 )
4525
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
576 .then(response => {
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
577 this.$store.commit(
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
578 "fairwayprofile/setCurrentDifference",
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
579 response.data.id
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
580 );
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
581 if (this.openLayersMap(COMPARESURVEYS.compare.id)) {
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
582 this.openLayersMap(COMPARESURVEYS.compare.id)
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
583 .getLayer("DIFFERENCES")
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
584 .getSource()
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
585 .updateParams({
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
586 LAYERS: "sounding_differences",
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
587 VERSION: "1.1.1",
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
588 TILED: true,
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
589 CQL_FILTER: "id=" + response.data.id
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
590 });
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
591 this.openLayersMap(COMPARESURVEYS.compare.id)
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
592 .getLayer("DIFFERENCES")
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
593 .getSource()
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
594 .refresh();
4526
b3261790a9b2 Set differences layers visibility to false on survey change to avoid showing both layers.
Raimund Renkert <raimund@renkert.org>
parents: 4525
diff changeset
595 this.openLayersMap(COMPARESURVEYS.compare.id)
b3261790a9b2 Set differences layers visibility to false on survey change to avoid showing both layers.
Raimund Renkert <raimund@renkert.org>
parents: 4525
diff changeset
596 .getLayer("DIFFERENCES")
b3261790a9b2 Set differences layers visibility to false on survey change to avoid showing both layers.
Raimund Renkert <raimund@renkert.org>
parents: 4525
diff changeset
597 .setVisible(false);
4525
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
598 }
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
599 })
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
600 .catch(error => {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
601 let status, data, message;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
602 if (error.response) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
603 status = error.response.status;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
604 data = error.response.data;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
605 message = `${status}: ${data.message || data}`;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
606 } else {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
607 message = error;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
608 }
4683
c15185297fff info about ongoing difference calculations
Thomas Junk <thomas.junk@intevation.de>
parents: 4528
diff changeset
609 if (status === 429) {
c15185297fff info about ongoing difference calculations
Thomas Junk <thomas.junk@intevation.de>
parents: 4528
diff changeset
610 displayInfo({
c15185297fff info about ongoing difference calculations
Thomas Junk <thomas.junk@intevation.de>
parents: 4528
diff changeset
611 message: this.$gettext(
4684
00a2c761493e changed error message for too many ongoing difference calcs
Thomas Junk <thomas.junk@intevation.de>
parents: 4683
diff changeset
612 "Too many difference calculations already in progress. Please try again later."
4683
c15185297fff info about ongoing difference calculations
Thomas Junk <thomas.junk@intevation.de>
parents: 4528
diff changeset
613 )
c15185297fff info about ongoing difference calculations
Thomas Junk <thomas.junk@intevation.de>
parents: 4528
diff changeset
614 });
c15185297fff info about ongoing difference calculations
Thomas Junk <thomas.junk@intevation.de>
parents: 4528
diff changeset
615 } else {
c15185297fff info about ongoing difference calculations
Thomas Junk <thomas.junk@intevation.de>
parents: 4528
diff changeset
616 displayError({
c15185297fff info about ongoing difference calculations
Thomas Junk <thomas.junk@intevation.de>
parents: 4528
diff changeset
617 title: this.$gettext("Backend Error"),
c15185297fff info about ongoing difference calculations
Thomas Junk <thomas.junk@intevation.de>
parents: 4528
diff changeset
618 message: message
c15185297fff info about ongoing difference calculations
Thomas Junk <thomas.junk@intevation.de>
parents: 4528
diff changeset
619 });
c15185297fff info about ongoing difference calculations
Thomas Junk <thomas.junk@intevation.de>
parents: 4528
diff changeset
620 }
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
621 })
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
622 .finally(() => {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
623 this.$store.commit("fairwayprofile/setDifferencesLoading", false);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
624 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
625 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
626 showDifferences() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
627 this.openLayersMap(COMPARESURVEYS.compare.id)
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
628 .getLayer("BOTTLENECKISOLINE")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
629 .setVisible(false);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
630 this.openLayersMap(COMPARESURVEYS.compare.id)
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
631 .getLayer("DIFFERENCES")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
632 .setVisible(true);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
633 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
634 showSurvey() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
635 this.openLayersMap(COMPARESURVEYS.compare.id)
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
636 .getLayer("BOTTLENECKISOLINE")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
637 .setVisible(true);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
638 this.openLayersMap(COMPARESURVEYS.compare.id)
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
639 .getLayer("DIFFERENCES")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
640 .setVisible(false);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
641 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
642 close() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
643 this.$store.commit("application/showProfiles", false);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
644 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
645 loadProfile(survey) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
646 if (survey) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
647 this.$store.commit("fairwayprofile/profileLoading", true);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
648 this.$store
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
649 .dispatch("fairwayprofile/loadProfile", survey)
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
650 .finally(() => {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
651 this.$store.commit("fairwayprofile/profileLoading", false);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
652 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
653 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
654 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
655 toggleCutTool() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
656 this.$store.commit("map/cutToolEnabled", !this.cutToolEnabled);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
657 this.$store.commit("map/lineToolEnabled", false);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
658 this.$store.commit("map/polygonToolEnabled", false);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
659 this.$store.commit("map/setCurrentMeasurement", null);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
660 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
661 onCopyCoordinates() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
662 displayInfo({
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
663 message: this.$gettext("Coordinates copied to clipboard!")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
664 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
665 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
666 applyManualCoordinates() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
667 const coordinates = this.coordinatesInput
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
668 .split(",")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
669 .map(coord => parseFloat(coord.trim()));
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
670 this.selectedCut = null;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
671 this.coordinatesInput = "";
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
672 this.applyCoordinates([
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
673 coordinates[1],
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
674 coordinates[0],
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
675 coordinates[3],
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
676 coordinates[2]
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
677 ]);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
678 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
679 applyCoordinates(coordinates) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
680 // allow only numbers
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
681 coordinates = coordinates.filter(c => Number(c) === c);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
682 if (coordinates.length === 4) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
683 // draw line on map
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
684 this.openLayersMaps.forEach(m => {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
685 m.getLayer("CUTTOOL")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
686 .getSource()
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
687 .clear();
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
688 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
689 const cut = new Feature({
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
690 geometry: new LineString([
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
691 [coordinates[0], coordinates[1]],
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
692 [coordinates[2], coordinates[3]]
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
693 ]).transform("EPSG:4326", "EPSG:3857")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
694 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
695 this.openLayersMaps.forEach(m => {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
696 m.getLayer("CUTTOOL")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
697 .getSource()
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
698 .addFeature(cut);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
699 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
700
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
701 // draw diagram
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
702 this.$store.dispatch("fairwayprofile/cut", cut);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
703 } else {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
704 displayError({
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
705 title: this.$gettext("Invalid input"),
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
706 message: this.$gettext(
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
707 "Please enter correct coordinates in the format: Lat,Lon,Lat,Lon"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
708 )
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
709 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
710 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
711 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
712 saveCut() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
713 const previousCuts =
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
714 JSON.parse(localStorage.getItem("previousCuts")) || [];
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
715 const newEntry = {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
716 label: this.cutLabel,
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
717 bottleneckName: this.selectedBottleneck,
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
718 coordinates: [...this.startPoint, ...this.endPoint],
4502
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
719 timestamp: new Date().getTime(),
4528
0bad1dcdb044 client: Fairwayprofile: save the state of the enable/disable button for custom depth
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4526
diff changeset
720 depth: this.depth,
0bad1dcdb044 client: Fairwayprofile: save the state of the enable/disable button for custom depth
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4526
diff changeset
721 useCustomDepth: this.useCustomDepth
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
722 };
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
723 const existingEntry = previousCuts.find(cut => {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
724 return JSON.stringify(cut) === JSON.stringify(newEntry);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
725 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
726 if (!existingEntry) previousCuts.push(newEntry);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
727 if (previousCuts.length > 100) previousCuts.shift();
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
728 localStorage.setItem("previousCuts", JSON.stringify(previousCuts));
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
729 this.$store.dispatch("fairwayprofile/previousCuts");
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
730
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
731 this.showLabelInput = false;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
732 displayInfo({
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
733 title: this.$gettext("Profile saved!"),
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
734 message: this.$gettext(
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
735 'You can now select these coordinates from the "Saved cross profiles" menu to restore this cross profile.'
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
736 )
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
737 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
738 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
739 deleteSelectedSurvey() {
4402
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
740 HTTP.post(
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
741 "/imports/dsr",
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
742 {
4406
d336a78985ad bottleneck_dialogue: send correct bottleneck_id
Thomas Junk <thomas.junk@intevation.de>
parents: 4402
diff changeset
743 "bottleneck-id": this.selectedSurvey.bottleneck_id,
4402
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
744 "date-info": this.selectedSurvey.date_info
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
745 },
4402
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
746 {
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
747 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
748 }
4402
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
749 )
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
750 .then(() => {
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
751 displayInfo({
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
752 title: this.$gettext("Survey"),
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
753 message:
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
754 this.$gettext("Deleting ") +
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
755 `${this.selectedBottleneck}: ${this.selectedSurvey.date_info}`
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
756 });
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
757 })
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
758 .catch(error => {
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4684
diff changeset
759 let message = "Problems with backend";
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4684
diff changeset
760 if (error.response) {
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4684
diff changeset
761 const { status, data } = error.response;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4684
diff changeset
762 message = `${status}: ${data.message || data}`;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4684
diff changeset
763 }
4402
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
764 displayError({
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
765 title: this.$gettext("Backend Error"),
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4684
diff changeset
766 message: message
4402
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
767 });
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
768 });
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
769 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
770 deleteSelectedCut(cut) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
771 this.$store.commit("application/popup", {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
772 icon: "trash",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
773 title: this.$gettext("Delete cross profile"),
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
774 content:
4324
36d384326407 BottleneckDialogue: Prototype for delete of surveys implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 4322
diff changeset
775 `<small><b>` +
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
776 this.$gettext("Do you really want to delete the cross profile:") +
4324
36d384326407 BottleneckDialogue: Prototype for delete of surveys implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 4322
diff changeset
777 `</b><br>
36d384326407 BottleneckDialogue: Prototype for delete of surveys implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 4322
diff changeset
778 ${cut.label}</small>`,
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
779 confirm: {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
780 label: this.$gettext("Delete"),
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
781 icon: "trash",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
782 callback: () => {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
783 let previousCuts =
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
784 JSON.parse(localStorage.getItem("previousCuts")) || [];
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
785 previousCuts = previousCuts.filter(cut => {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
786 return JSON.stringify(cut) !== JSON.stringify(this.selectedCut);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
787 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
788 localStorage.setItem("previousCuts", JSON.stringify(previousCuts));
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
789 this.$store.commit("fairwayprofile/selectedCut", null);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
790 this.$store.dispatch("fairwayprofile/previousCuts");
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
791 displayInfo({ title: this.$gettext("Profile deleted!") });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
792 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
793 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
794 cancel: {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
795 label: this.$gettext("Cancel"),
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
796 icon: "times"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
797 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
798 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
799 },
4479
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
800 takeMeThere() {
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
801 const bottleneck = this.bottlenecksList.find(
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
802 bn => bn.properties.name === this.selectedBottleneck
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
803 );
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
804 if (!bottleneck) return;
4488
bff6c5c1db4f client: pdf-gen: improve adding bottleneck info to pdf
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4479
diff changeset
805 this.$store.commit(
bff6c5c1db4f client: pdf-gen: improve adding bottleneck info to pdf
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4479
diff changeset
806 "bottlenecks/setBottleneckForPrint",
bff6c5c1db4f client: pdf-gen: improve adding bottleneck info to pdf
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4479
diff changeset
807 this.selectedBottleneck
bff6c5c1db4f client: pdf-gen: improve adding bottleneck info to pdf
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4479
diff changeset
808 );
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
809 this.$store.dispatch("map/moveToFeauture", {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
810 feature: bottleneck,
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
811 zoom: 17,
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
812 preventZoomOut: true
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
813 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
814 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
815 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
816 mounted() {
4521
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
817 this.$store.dispatch("usermanagement/loadUsers").catch(error => {
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4684
diff changeset
818 let message = "Problems with backend";
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4684
diff changeset
819 if (error.response) {
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4684
diff changeset
820 const { status, data } = error.response;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4684
diff changeset
821 message = `${status}: ${data.message || data}`;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4684
diff changeset
822 }
4521
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
823 displayError({
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
824 title: this.$gettext("Backend Error"),
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4684
diff changeset
825 message: message
4521
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
826 });
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
827 });
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
828 this.$store.dispatch("bottlenecks/loadBottlenecksList");
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
829 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
830 };
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
831 </script>