Skip to content

Commit e81c54d

Browse files
committed
fix: review ideas merge into staging
1 parent 96da407 commit e81c54d

File tree

2 files changed

+50
-193
lines changed

2 files changed

+50
-193
lines changed

app/src/components/DataPanel.vue

Lines changed: 50 additions & 183 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
class="pt-0 pb-0"
2626
id="data-panel"
2727
:class="$vuetify.breakpoint.xsOnly ? 'mx-0' : ''">
28-
<v-row v-if="indicatorObject" class="d-flex ma-0">
28+
<div v-if="indicatorObject" class="d-flex ma-0">
2929
<v-col
3030
:cols="12"
3131
class="pa-0"
@@ -50,20 +50,19 @@
5050
<SelectionInfoBar class="pb-2"
5151
:selectableLayerConfigs="selectableLayerConfigs"/>
5252
</template>
53-
<div v-if="showCustomAreaCard && (mergedConfigsData[0].customAreaIndicator &&
53+
<div v-if="showCustomAreaCard" ref="chart-div">
54+
<div v-if="(mergedConfigsData[0].customAreaIndicator &&
5455
!hasSelectionEnabled) && !customAreaIndicator" class="justify-center align-center">
5556
<p class="justify-self-start px-2 py-0">
5657
<v-icon color="black">mdi-shape-polygon-plus</v-icon>
5758
Draw a polygon in order to start analysis
5859
</p>
5960
</div>
60-
<div v-else-if="showCustomAreaCard"
61+
<div v-else-if="showingChart"
6162
class="pb-2 col"
6263
>
6364
<v-card
64-
class="pb-2 col chartareapanel"
65-
ref="mapPanel"
66-
>
65+
class="pb-2 col chartareapanel">
6766
<v-card-title
6867
v-if="customAreaIndicator"
6968
style="padding-top: 10px; padding-bottom: 0px;">
@@ -93,114 +92,52 @@
9392
color="secondary"
9493
></v-progress-circular>
9594
</div>
96-
<v-row
97-
v-if="(customAreaIndicator && !customAreaIndicator.isEmpty)
98-
&& (!showMap || !customAreaIndicator.isEmpty)
99-
&& $route.name !== 'demo'"
100-
class="mt-6"
101-
>
102-
<v-col cols="12" sm="5" ></v-col>
103-
<v-col
104-
cols="12"
105-
sm="7"
106-
ref="customButtonRow"
107-
style="margin-top: 10px;"
108-
>
109-
<div :class="$vuetify.breakpoint.xsOnly ? 'text-center' : 'text-right'">
110-
<v-btn
111-
color="primary"
112-
text
113-
small
114-
:href="dataCustomHrefCSV"
115-
:download="customAOIDownloadFilename"
116-
target="_blank"
117-
v-if="
118-
customAreaIndicator
119-
"
120-
>
121-
<v-icon left>mdi-download</v-icon>
122-
download csv
123-
</v-btn>
124-
<add-to-dashboard-button
125-
v-if="customAreaIndicator
126-
&& (appConfig.id !== 'gtif' || $route.query.customDashboard)"
127-
:indicatorObject="customAreaIndicator"
128-
:featureObject="featureObject"
129-
>
130-
</add-to-dashboard-button>
131-
</div>
132-
</v-col>
133-
</v-row>
134-
<v-row
95+
<div
13596
v-else-if="showCustomAreaCard"
136-
:class="customAreaIndicator ? 'mt-6' : 'mt-0'"
97+
class="ma-0 pa-2"
13798
>
138-
<v-col
139-
cols="12"
140-
sm="5"
141-
class="d-flex align-center"
142-
:class="$vuetify.breakpoint.xsOnly ? 'justify-center' : 'justify-space-between'"
143-
>
144-
<small v-if="indicatorObject && indicatorObject.updateFrequency">
145-
<span
146-
v-if="indicatorObject.updateFrequency === 'Retired'"
147-
>This indicator is no longer updated</span>
148-
<span
149-
v-else-if="indicatorObject.updateFrequency === 'EndSeason'"
150-
>Due to end of season, this indicator is no longer updated</span>
151-
<span v-else>This data is updated: {{ indicatorObject.updateFrequency }}</span>
152-
</small>
153-
<small v-else> </small>
154-
</v-col>
15599
<v-col
156100
v-if="$route.name !== 'demo'"
157101
cols="12"
158-
sm="7"
159-
ref="buttonRow"
160102
>
161-
<div :class="$vuetify.breakpoint.xsOnly ? 'text-center' : 'text-right'">
162-
<v-btn
163-
color="primary"
164-
text
165-
small
166-
:href="dataHrefCSV"
167-
:download="downloadFileName"
168-
target="_blank"
169-
v-if="dataObject && dataObject.time
170-
&& !showMap"
171-
>
172-
<v-icon left>mdi-download</v-icon>
173-
download csv
174-
</v-btn>
175-
<iframe-button
176-
:indicatorObject="indicatorObject"
177-
:featureObject="featureObject"
178-
v-if="!customAreaIndicator"
179-
/>
180-
<v-btn
181-
color="primary"
182-
text
183-
small
184-
style="margin-top:50px;"
185-
:href="dataCustomHrefCSV"
186-
:download="customAOIDownloadFilename"
187-
target="_blank"
188-
v-if="
189-
customAreaIndicator &&
190-
!showMap
191-
"
192-
>
193-
<v-icon left>mdi-download</v-icon>
194-
download csv
195-
</v-btn>
196-
<add-to-dashboard-button
197-
v-else-if="!showMap && (appConfig.id !== 'gtif' || $route.query.customDashboard)"
198-
:indicatorObject="indicatorObject"
199-
:featureObject="featureObject"
200-
/>
201-
</div>
103+
<v-btn
104+
color="primary"
105+
text
106+
small
107+
:href="dataHrefCSV"
108+
:download="downloadFileName"
109+
target="_blank"
110+
v-if="dataObject && dataObject.time
111+
&& !showMap"
112+
>
113+
<v-icon left>mdi-download</v-icon>
114+
download csv
115+
</v-btn>
116+
<iframe-button
117+
:indicatorObject="indicatorObject"
118+
:featureObject="featureObject"
119+
v-if="indicatorObject && featureObject && !customAreaIndicator"
120+
/>
121+
<v-btn
122+
color="primary"
123+
text
124+
small
125+
:href="dataCustomHrefCSV"
126+
:download="customAOIDownloadFilename"
127+
target="_blank"
128+
v-if="customAreaIndicator"
129+
>
130+
<v-icon left>mdi-download</v-icon>
131+
download csv area
132+
</v-btn>
133+
<add-to-dashboard-button
134+
v-if="(indicatorObject && featureObject && !customAreaIndicator) && (appConfig.id !== 'gtif' || $route.query.customDashboard)"
135+
:indicatorObject="indicatorObject"
136+
:featureObject="featureObject"
137+
/>
202138
</v-col>
203-
</v-row>
139+
</div>
140+
</div>
204141
<data-mockup-view v-if="appConfig.id === 'gtif'"
205142
:indicatorObject="indicatorObject"
206143
:adminLayer="$store.state.features.adminBorderLayerSelected"
@@ -247,33 +184,7 @@
247184
>
248185
</FeatureQueryParams>
249186
</v-col>
250-
<v-col
251-
:cols="12"
252-
class="py-0"
253-
:class="$vuetify.breakpoint.smAndUp ? 'scrollContainer' : ''"
254-
v-if="indicatorObject && externalData"
255-
>
256-
<v-row
257-
class="mt-0 fill-height pb-2"
258-
>
259-
<v-col
260-
cols="12"
261-
class="pb-0"
262-
>
263-
<v-btn
264-
:href= "externalData.url"
265-
target="_blank"
266-
color="primary"
267-
ref="externalDataBtn"
268-
large
269-
block
270-
class="my-1"
271-
><span><v-icon left>mdi-open-in-new</v-icon>{{externalData.label}}</span>
272-
</v-btn>
273-
</v-col>
274-
</v-row>
275-
</v-col>
276-
</v-row>
187+
</div>
277188
<div v-if="indicatorObject.features?.length && !featureObject">
278189
<p class="pa-2">
279190
<v-icon color="black">mdi-chart-areaspline</v-icon>
@@ -387,7 +298,7 @@ export default {
387298
'customAreaIndicator',
388299
]),
389300
showingChart() {
390-
return this.customAreaIndicator || this.customAreaIndicator || this.dataObject?.time;
301+
return this.customAreaIndicator || this.dataObject?.time;
391302
},
392303
indicatorObject() {
393304
return this.$store.state.indicators.selectedIndicator;
@@ -414,7 +325,7 @@ export default {
414325
dataHrefCSV() {
415326
let dataHref = 'data:text/csv;charset=utf-8,';
416327
const exportKeys = [
417-
'time', 'aoi', 'measurement',
328+
'time', 'siteName', 'measurement',
418329
'indicatorValue', 'referenceTime', 'eoSensor', 'colorCode', 'inputData',
419330
];
420331
const header = `${exportKeys.join()}\n`;
@@ -423,12 +334,7 @@ export default {
423334
let row = '';
424335
for (let kk = 0; kk < exportKeys.length; kk++) {
425336
const cKey = exportKeys[kk];
426-
let txtVal = '';
427-
if (cKey === 'aoi') {
428-
txtVal = `"${this.dataObject[cKey]}",`;
429-
} else {
430-
txtVal = `"${this.dataObject[cKey][i]}",`;
431-
}
337+
const txtVal = `"${this.dataObject[cKey][i]}",`;
432338
row += txtVal;
433339
}
434340
row = `${row.slice(0, -1)}\n`;
@@ -447,7 +353,7 @@ export default {
447353
const wkt = new Wkt();
448354
const header = `${exportKeys.join()}\n`;
449355
let csv = header;
450-
if (this.customAreaIndicator.time) {
356+
if (this.customAreaIndicator?.time) {
451357
for (let i = 0; i < this.customAreaIndicator.time.length; i++) {
452358
let row = '';
453359
for (let kk = 0; kk < exportKeys.length; kk++) {
@@ -477,7 +383,7 @@ export default {
477383
const currDate = DateTime.utc().toFormat('yyyy-LL-dd');
478384
const currInd = this.indicatorObject;
479385
const city = currInd.city || currInd.country || 'global';
480-
return `${city}_${currDate}_${currInd.aoiID}-${currInd.indicator}.csv`;
386+
return `${city}_${currDate}_${currInd.siteName}-${currInd.indicator}.csv`;
481387
},
482388
customAOIDownloadFilename() {
483389
const currDate = DateTime.utc().toFormat('yyyy-LL-dd');
@@ -501,35 +407,6 @@ export default {
501407
// customarea seems to be handled differently
502408
return !this.indicatorObject.features?.length;
503409
},
504-
externalData() {
505-
const dataFromDefinition = this.indicatorObject.externalData;
506-
const dataFromIndicator = this.dataObject ? this.dataObject.externalData : null;
507-
if (dataFromDefinition) {
508-
return dataFromDefinition;
509-
}
510-
if (dataFromIndicator) {
511-
return dataFromIndicator;
512-
}
513-
return null;
514-
},
515-
wrapperHeight() {
516-
if (this.mounted && this.$refs.wrapper != null) {
517-
return this.$refs.wrapper.clientHeight;
518-
}
519-
return 0;
520-
},
521-
buttonRowHeight() {
522-
if (this.mounted && this.$refs.buttonRow != null) {
523-
return this.$refs.buttonRow.clientHeight;
524-
}
525-
return 0;
526-
},
527-
mapPanelHeight() {
528-
if (this.mounted && this.$refs.mapPanel != null) {
529-
return this.$refs.mapPanel.$el.clientHeight;
530-
}
531-
return 0;
532-
},
533410
mergedConfigsData() {
534411
if (!this.indicatorObject) {
535412
return [];
@@ -592,16 +469,6 @@ export default {
592469
},
593470
},
594471
watch: {
595-
showingChart() {
596-
if (this.showingChart) {
597-
// we only want to open if it is closed
598-
if (!this.$parent.$parent.$el.classList.contains('v-expansion-panel--active')) {
599-
this.$parent.$parent.$parent.$refs.header.$emit('click', {
600-
currentTarget: this.$parent.$parent.$parent.$refs.header.$el,
601-
});
602-
}
603-
}
604-
},
605472
async selectedArea(area) {
606473
this.showRegenerateButton = this.customAreaIndicator && !!area;
607474
this.refreshSpeciesInfo();

app/src/views/EmbedIframe.vue

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,6 @@
5555
class="pa-5 fill-height"
5656
/>
5757
</div>
58-
<v-card-text v-if="selectedIndicator && selectedIndicator.updateFrequency"
59-
class="flex-grow-0">
60-
<small>
61-
<span v-if="selectedIndicator.updateFrequency
62-
=== 'Retired'">This indicator is no longer updated</span>
63-
<span v-else-if="selectedIndicator.updateFrequency
64-
=== 'EndSeason'">Due to end of season, this indicator is no longer updated</span>
65-
<span v-else>This data is updated: {{ selectedIndicator.updateFrequency }}</span>
66-
</small>
67-
</v-card-text>
6858
<v-card-actions
6959
v-if="!enableScrollyMode"
7060
:style="`background: ${$vuetify.theme.themes.light.primary}`"

0 commit comments

Comments
 (0)