mirror of
https://github.com/owntracks/frontend.git
synced 2024-11-15 09:18:17 -07:00
Remove the download modal
I have not used this once since adding it. Just use the API directly.
This commit is contained in:
parent
b5442363d6
commit
8df1f86ab9
@ -31,7 +31,6 @@ pages, this is a more advanced interface with more functionality, all in one pla
|
||||
- Display data in a specific date and time range
|
||||
- Filter by user or specific device
|
||||
- Calculation of distance travelled
|
||||
- Download selected location data as JSON
|
||||
- Highly customisable
|
||||
|
||||
## Installation
|
||||
|
19
package-lock.json
generated
19
package-lock.json
generated
@ -9,7 +9,6 @@
|
||||
"version": "2.12.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"clipboard-copy": "^4.0.1",
|
||||
"deepmerge": "^4.3.1",
|
||||
"leaflet": "^1.9.4",
|
||||
"leaflet.heat": "^0.2.0",
|
||||
@ -1573,24 +1572,6 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/clipboard-copy": {
|
||||
"version": "4.0.1",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/color-convert": {
|
||||
"version": "2.0.1",
|
||||
"dev": true,
|
||||
|
@ -25,7 +25,6 @@
|
||||
"test": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
"clipboard-copy": "^4.0.1",
|
||||
"deepmerge": "^4.3.1",
|
||||
"leaflet": "^1.9.4",
|
||||
"leaflet.heat": "^0.2.0",
|
||||
|
@ -4,7 +4,6 @@
|
||||
<main>
|
||||
<router-view />
|
||||
</main>
|
||||
<DownloadModal />
|
||||
<InformationModal />
|
||||
<LoadingModal />
|
||||
</div>
|
||||
@ -16,12 +15,11 @@ import { mapActions } from "vuex";
|
||||
import * as types from "@/store/mutation-types";
|
||||
import { log } from "@/logging";
|
||||
import AppHeader from "@/components/AppHeader.vue";
|
||||
import DownloadModal from "@/components/modals/DownloadModal.vue";
|
||||
import InformationModal from "@/components/modals/InformationModal.vue";
|
||||
import LoadingModal from "@/components/modals/LoadingModal.vue";
|
||||
|
||||
export default {
|
||||
components: { AppHeader, DownloadModal, InformationModal, LoadingModal },
|
||||
components: { AppHeader, InformationModal, LoadingModal },
|
||||
created() {
|
||||
document.documentElement.style.setProperty(
|
||||
"--color-primary",
|
||||
|
@ -135,19 +135,6 @@
|
||||
{{ humanReadableDistance(elevationLoss) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<button
|
||||
class="button button-flat button-icon"
|
||||
:title="$t('Download raw data')"
|
||||
@click="$modal.show('download')"
|
||||
>
|
||||
<DownloadIcon
|
||||
size="1x"
|
||||
:aria-label="$t('Download raw data')"
|
||||
role="img"
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<button
|
||||
class="button button-flat button-icon"
|
||||
@ -169,7 +156,6 @@ import {
|
||||
ArrowUpIcon,
|
||||
CalendarIcon,
|
||||
CrosshairIcon,
|
||||
DownloadIcon,
|
||||
InfoIcon,
|
||||
LayersIcon,
|
||||
MenuIcon,
|
||||
@ -190,7 +176,6 @@ export default {
|
||||
ArrowUpIcon,
|
||||
CalendarIcon,
|
||||
CrosshairIcon,
|
||||
DownloadIcon,
|
||||
InfoIcon,
|
||||
LayersIcon,
|
||||
MenuIcon,
|
||||
|
@ -1,110 +0,0 @@
|
||||
<template>
|
||||
<modal name="download" adaptive>
|
||||
<pre class="data"><code>{{ data }}</code></pre>
|
||||
<div class="options">
|
||||
<input
|
||||
id="option-minify-json"
|
||||
v-model="options.minifyJson"
|
||||
type="checkbox"
|
||||
/>
|
||||
<label for="option-minify-json">
|
||||
{{ $t("Minify JSON") }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<button
|
||||
class="button button-outline button-primary"
|
||||
:title="$t('Copy to clipboard')"
|
||||
@click="copy"
|
||||
>
|
||||
{{ $t("Copy to clipboard") }}
|
||||
</button>
|
||||
<button
|
||||
class="button button-primary"
|
||||
:title="$t('Download')"
|
||||
@click="download"
|
||||
>
|
||||
{{ $t("Download") }}
|
||||
</button>
|
||||
</div>
|
||||
</modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from "vuex";
|
||||
import copy from "clipboard-copy";
|
||||
|
||||
import { download } from "@/util";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
options: {
|
||||
minifyJson: false,
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState([
|
||||
"startDateTime",
|
||||
"endDateTime",
|
||||
"selectedUser",
|
||||
"selectedDevice",
|
||||
"locationHistory",
|
||||
]),
|
||||
data() {
|
||||
return this.locationHistory;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
copy() {
|
||||
const data = JSON.stringify(
|
||||
this.data,
|
||||
null,
|
||||
this.options.minifyJson ? 0 : 2
|
||||
);
|
||||
copy(data);
|
||||
},
|
||||
download() {
|
||||
const data = JSON.stringify(
|
||||
this.data,
|
||||
null,
|
||||
this.options.minifyJson ? 0 : 2
|
||||
);
|
||||
const start = this.startDateTime;
|
||||
const end = this.endDateTime;
|
||||
const user = this.selectedUser ? `_${this.selectedUser}` : "";
|
||||
const device = this.selectedDevice ? `_${this.selectedDevice}` : "";
|
||||
const filename = `data_${start}_${end}${user}${device}.json`;
|
||||
download(data, filename, "application/json");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.data {
|
||||
max-height: 300px;
|
||||
}
|
||||
|
||||
.options {
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.buttons {
|
||||
display: flex;
|
||||
margin-top: 30px;
|
||||
|
||||
button {
|
||||
flex: 1;
|
||||
|
||||
&:first-child {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@ -12,7 +12,6 @@
|
||||
"Select device": "Zvolit zařízení",
|
||||
"Distance travelled": "Procestovaná vzdálenost",
|
||||
"Elevation gain / loss": "Výškový výstup / pokles",
|
||||
"Download raw data": "Stáhnout čisté údaje",
|
||||
"Information": "Informace",
|
||||
"Show last known locations": "Zobrazit naposledy známé polohy",
|
||||
"Show location history (line)": "Zobrazit historii poloh (čára)",
|
||||
@ -20,7 +19,6 @@
|
||||
"Show location heatmap": "Zobrazit tepelnou mapu poloh",
|
||||
"Minify JSON": "Zminimalizovat JSON",
|
||||
"Copy to clipboard": "Zkopírovat do schránky",
|
||||
"Download": "Stáhnout",
|
||||
"Loading version...": "Nahrávám verzi...",
|
||||
"OwnTracks website": "Web Stránka OwnTracks",
|
||||
"OwnTracks documentation": "Dokumentace OwnTracks",
|
||||
|
@ -12,7 +12,6 @@
|
||||
"Select device": "Vælg enhed",
|
||||
"Distance travelled": "Afstand rejst",
|
||||
"Elevation gain / loss": "Højde vundet / tabt",
|
||||
"Download raw data": "Download rå data",
|
||||
"Information": "Information",
|
||||
"Show last known locations": "Vis sidst kendte positioner",
|
||||
"Show location history (line)": "Vis positionshistorik (linje)",
|
||||
@ -20,7 +19,6 @@
|
||||
"Show location heatmap": "Vis positions-heatmap",
|
||||
"Minify JSON": "Minificér JSON",
|
||||
"Copy to clipboard": "Kopiér til udklipsholder",
|
||||
"Download": "Download",
|
||||
"Loading version...": "Indlæser version...",
|
||||
"OwnTracks website": "OwnTracks hjemmeside",
|
||||
"OwnTracks documentation": "OwnTracks dokumentation",
|
||||
|
@ -12,7 +12,6 @@
|
||||
"Select device": "Gerät auswählen",
|
||||
"Distance travelled": "Gereiste Entfernung",
|
||||
"Elevation gain / loss": "Höhengewinn / -verlust",
|
||||
"Download raw data": "Rohdaten herunterladen",
|
||||
"Information": "Information",
|
||||
"Show last known locations": "Zeige letzte bekannte Standorte",
|
||||
"Show location history (line)": "Zeige Standortverlauf (Linie)",
|
||||
@ -20,7 +19,6 @@
|
||||
"Show location heatmap": "Zeige Standort-Heatmap",
|
||||
"Minify JSON": "JSON minimieren",
|
||||
"Copy to clipboard": "In die Zwischenablage kopieren",
|
||||
"Download": "Herunterladen",
|
||||
"Loading version...": "Version wird abgerufen...",
|
||||
"OwnTracks website": "OwnTracks Webseite",
|
||||
"OwnTracks documentation": "OwnTracks Dokumentation",
|
||||
|
@ -12,7 +12,6 @@
|
||||
"Select device": "Select device",
|
||||
"Distance travelled": "Distance travelled",
|
||||
"Elevation gain / loss": "Elevation gain / loss",
|
||||
"Download raw data": "Download raw data",
|
||||
"Information": "Information",
|
||||
"Show last known locations": "Show last known locations",
|
||||
"Show location history (line)": "Show location history (line)",
|
||||
@ -20,7 +19,6 @@
|
||||
"Show location heatmap": "Show location heatmap",
|
||||
"Minify JSON": "Minify JSON",
|
||||
"Copy to clipboard": "Copy to clipboard",
|
||||
"Download": "Download",
|
||||
"Loading version...": "Loading version...",
|
||||
"OwnTracks website": "OwnTracks website",
|
||||
"OwnTracks documentation": "OwnTracks documentation",
|
||||
|
@ -12,7 +12,6 @@
|
||||
"Select device": "Select device",
|
||||
"Distance travelled": "Distance traveled",
|
||||
"Elevation gain / loss": "Elevation gain / loss",
|
||||
"Download raw data": "Download raw data",
|
||||
"Information": "Information",
|
||||
"Show last known locations": "Show last known locations",
|
||||
"Show location history (line)": "Show location history (line)",
|
||||
@ -20,7 +19,6 @@
|
||||
"Show location heatmap": "Show location heatmap",
|
||||
"Minify JSON": "Minify JSON",
|
||||
"Copy to clipboard": "Copy to clipboard",
|
||||
"Download": "Download",
|
||||
"Loading version...": "Loading version...",
|
||||
"OwnTracks website": "OwnTracks website",
|
||||
"OwnTracks documentation": "OwnTracks documentation",
|
||||
|
@ -12,7 +12,6 @@
|
||||
"Select device": "Seleccionar dispositivo",
|
||||
"Distance travelled": "Distancia recorrida",
|
||||
"Elevation gain / loss": "Aumento / disminución de la altura",
|
||||
"Download raw data": "Descargar datos en crudo",
|
||||
"Information": "Información",
|
||||
"Show last known locations": "Mostrar última ubicación conocida",
|
||||
"Show location history (line)": "Mostrar historial (línea)",
|
||||
@ -20,7 +19,6 @@
|
||||
"Show location heatmap": "Mostra mapa de calor",
|
||||
"Minify JSON": "Reducir JSON",
|
||||
"Copy to clipboard": "Copiar al portapapeles",
|
||||
"Download": "Descarga",
|
||||
"Loading version...": "Cargando versión...",
|
||||
"OwnTracks website": "OwnTracks - Sitio web",
|
||||
"OwnTracks documentation": "OwnTracks - documentación",
|
||||
|
@ -12,7 +12,6 @@
|
||||
"Select device": "Sélectionner un appareil",
|
||||
"Distance travelled": "Distance parcourue",
|
||||
"Elevation gain / loss": "Augmentation / diminution de l'altitude",
|
||||
"Download raw data": "Télécharger les données brutes",
|
||||
"Information": "Informations",
|
||||
"Show last known locations": "Afficher les dernières localisations connues",
|
||||
"Show location history (line)": "Afficher l'historique de localisation (lignes)",
|
||||
@ -20,7 +19,6 @@
|
||||
"Show location heatmap": "Afficher la carte de fréquentation",
|
||||
"Minify JSON": "Minifier JSON",
|
||||
"Copy to clipboard": "Copier dans le presse-papier",
|
||||
"Download": "Télécharger",
|
||||
"Loading version...": "Chargement de la version...",
|
||||
"OwnTracks website": "Site d'OwnTracks",
|
||||
"OwnTracks documentation": "Documentation d'OwnTracks",
|
||||
|
@ -12,7 +12,6 @@
|
||||
"Select device": "Zvoliť zariadenie",
|
||||
"Distance travelled": "Prejdená vzdialenosť",
|
||||
"Elevation gain / loss": "Výškový výstup / pokles",
|
||||
"Download raw data": "Stiahnuť surové údaje",
|
||||
"Information": "Informácie",
|
||||
"Show last known locations": "Zobraziť posledné známe polohy",
|
||||
"Show location history (line)": "Zobraziť históriu polôh (čiara)",
|
||||
@ -20,7 +19,6 @@
|
||||
"Show location heatmap": "Zobraziť tepelnú mapu polôh",
|
||||
"Minify JSON": "Zostručniť JSON",
|
||||
"Copy to clipboard": "Skopírovať do schránky",
|
||||
"Download": "Stiahnuť",
|
||||
"Loading version...": "Nahrávam verziu...",
|
||||
"OwnTracks website": "Web Stránka OwnTracks",
|
||||
"OwnTracks documentation": "Dokumentácia OwnTracks",
|
||||
|
@ -12,7 +12,6 @@
|
||||
"Select device": "Cihaz Seç",
|
||||
"Distance travelled": "Gidilen mesafe",
|
||||
"Elevation gain / loss": "Yükseklik kazancı / kaybı",
|
||||
"Download raw data": "Ham verileri indir",
|
||||
"Information": "Bilgi",
|
||||
"Show last known locations": "Bilinen son yerleri göster",
|
||||
"Show location history (line)": "Konum geçmişini göster (çizgi)",
|
||||
@ -20,7 +19,6 @@
|
||||
"Show location heatmap": "Konum ısı haritasını göster",
|
||||
"Minify JSON": "JSON'u Küçült",
|
||||
"Copy to clipboard": "Panoya kopyala",
|
||||
"Download": "İndir",
|
||||
"Loading version...": "Versiyon yükleniyor...",
|
||||
"OwnTracks website": "OwnTracks internet sitesi",
|
||||
"OwnTracks documentation": "OwnTracks dokümanı",
|
||||
|
18
src/util.js
18
src/util.js
@ -64,24 +64,6 @@ export const distanceBetweenCoordinates = (c1, c2) => {
|
||||
return d;
|
||||
};
|
||||
|
||||
/**
|
||||
* Let the user download a string as file.
|
||||
*
|
||||
* @param {String} text Content of the file
|
||||
* @param {String} filename Suggested filename for the browser
|
||||
* @param {String} [mimeType] Content mime type
|
||||
*/
|
||||
export const download = (text, filename, mimeType = "text/plain") => {
|
||||
const dataUrl = `data:${mimeType},${encodeURIComponent(text)}`;
|
||||
const element = document.createElement("a");
|
||||
element.href = dataUrl;
|
||||
element.download = filename;
|
||||
element.style.display = "none";
|
||||
document.body.appendChild(element);
|
||||
element.click();
|
||||
document.body.removeChild(element);
|
||||
};
|
||||
|
||||
/**
|
||||
* Format a distance in meters into a human-readable string with unit.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user