add map webapp
This commit is contained in:
parent
a146ae77f1
commit
0c95c7b2e9
25 changed files with 7590 additions and 0 deletions
|
@ -48,6 +48,8 @@
|
|||
doxygen
|
||||
graphviz
|
||||
texlive-env
|
||||
nodejs
|
||||
yarn
|
||||
];
|
||||
# override the aapt2 that gradle uses with the nix-shipped version
|
||||
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${androidSdk}/share/android-sdk/build-tools/33.0.0/aapt2";
|
||||
|
|
2
map-desktop/.gitignore
vendored
Normal file
2
map-desktop/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
node_modules/
|
||||
dist/
|
46
map-desktop/README.md
Normal file
46
map-desktop/README.md
Normal file
|
@ -0,0 +1,46 @@
|
|||
# map-desktop
|
||||
|
||||
This template should help get you started developing with Vue 3 in Vite.
|
||||
|
||||
## Recommended IDE Setup
|
||||
|
||||
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
|
||||
|
||||
## Type Support for `.vue` Imports in TS
|
||||
|
||||
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
|
||||
|
||||
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
|
||||
|
||||
1. Disable the built-in TypeScript Extension
|
||||
1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette
|
||||
2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
|
||||
2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
|
||||
|
||||
## Customize configuration
|
||||
|
||||
See [Vite Configuration Reference](https://vitejs.dev/config/).
|
||||
|
||||
## Project Setup
|
||||
|
||||
```sh
|
||||
npm install
|
||||
```
|
||||
|
||||
### Compile and Hot-Reload for Development
|
||||
|
||||
```sh
|
||||
npm run dev
|
||||
```
|
||||
|
||||
### Type-Check, Compile and Minify for Production
|
||||
|
||||
```sh
|
||||
npm run build
|
||||
```
|
||||
|
||||
### Lint with [ESLint](https://eslint.org/)
|
||||
|
||||
```sh
|
||||
npm run lint
|
||||
```
|
1
map-desktop/env.d.ts
vendored
Normal file
1
map-desktop/env.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/// <reference types="vite/client" />
|
12
map-desktop/index.html
Normal file
12
map-desktop/index.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Invtracker Web</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
41
map-desktop/package.json
Normal file
41
map-desktop/package.json
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"name": "map-desktop",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"build": "run-p type-check build-only",
|
||||
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
||||
"build-only": "vite build",
|
||||
"dev": "vite",
|
||||
"preview": "vite preview --port 4173",
|
||||
"type-check": "vue-tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mdi/font": "5.9.55",
|
||||
"@vue-leaflet/vue-leaflet": "^0.6.1",
|
||||
"@vue/cli": "^5.0.8",
|
||||
"leaflet": "^1.8.0",
|
||||
"roboto-fontface": "*",
|
||||
"vue": "^3.2.37",
|
||||
"vue-router": "^4.1.3",
|
||||
"vuetify": "^3.0.0-beta.0",
|
||||
"webfontloader": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rushstack/eslint-patch": "^1.1.4",
|
||||
"@types/node": "^16.11.47",
|
||||
"@types/webfontloader": "^1.0.0",
|
||||
"@vitejs/plugin-vue": "^3.0.1",
|
||||
"@vue/eslint-config-prettier": "^7.0.0",
|
||||
"@vue/eslint-config-typescript": "^11.0.0",
|
||||
"@vue/tsconfig": "^0.1.3",
|
||||
"eslint": "^8.21.0",
|
||||
"eslint-plugin-vue": "^9.3.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.7.1",
|
||||
"typescript": "~4.7.4",
|
||||
"vite": "^3.0.4",
|
||||
"vue-cli-plugin-vuetify": "~2.5.4",
|
||||
"vue-tsc": "^0.39.5",
|
||||
"webpack-plugin-vuetify": "^2.0.0-alpha.0"
|
||||
}
|
||||
}
|
0
map-desktop/public/index.html
Normal file
0
map-desktop/public/index.html
Normal file
21
map-desktop/src/App.vue
Normal file
21
map-desktop/src/App.vue
Normal file
|
@ -0,0 +1,21 @@
|
|||
<template>
|
||||
<v-app>
|
||||
<v-main>
|
||||
<router-view/>
|
||||
</v-main>
|
||||
</v-app>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'App',
|
||||
|
||||
data () {
|
||||
return {
|
||||
//
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
145
map-desktop/src/api/listItems.ts
Normal file
145
map-desktop/src/api/listItems.ts
Normal file
|
@ -0,0 +1,145 @@
|
|||
export class GeoLocation {
|
||||
public latitude: number;
|
||||
public longitude: number;
|
||||
public altitude: number | null;
|
||||
public time: number;
|
||||
|
||||
constructor(latitude: number, longitude: number, altitude: number | null, time: number) {
|
||||
this.latitude = latitude;
|
||||
this.longitude = longitude;
|
||||
this.altitude = altitude;
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
static fromNode(node: Element): GeoLocation {
|
||||
const latitudeString = node.getElementsByTagName('lat')[0].textContent;
|
||||
if (latitudeString === null) {
|
||||
throw new Error('Missing latitude');
|
||||
}
|
||||
const latitude = parseFloat(latitudeString);
|
||||
const longitudeString = node.getElementsByTagName('lon')[0].textContent;
|
||||
if (longitudeString === null) {
|
||||
throw new Error('Missing longitude');
|
||||
}
|
||||
const longitude = parseFloat(longitudeString);
|
||||
const altitudeNode = node.getElementsByTagName('alt')[0];
|
||||
const altitude = altitudeNode !== undefined ? parseFloat(altitudeNode.textContent) : null;
|
||||
const timeString = node.getElementsByTagName('time')[0].textContent;
|
||||
if (timeString === null) {
|
||||
throw new Error('Missing time');
|
||||
}
|
||||
const time = parseInt(timeString, 10);
|
||||
|
||||
return new GeoLocation(latitude, longitude, altitude, time);
|
||||
}
|
||||
}
|
||||
|
||||
export class TrackedItem {
|
||||
public id: string;
|
||||
public name: string;
|
||||
public description: string;
|
||||
public picture: string | null;
|
||||
public lastKnownLocation: GeoLocation | null;
|
||||
|
||||
constructor(id: string, name: string, description: string, picture: string | null, lastKnownLocation: GeoLocation | null) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.picture = picture;
|
||||
this.lastKnownLocation = lastKnownLocation;
|
||||
}
|
||||
|
||||
static fromNode(node: Element): TrackedItem {
|
||||
const id = node.getAttribute('id');
|
||||
if (id === null) {
|
||||
throw new Error('Missing id');
|
||||
}
|
||||
const nameNode = node.getElementsByTagName('name')[0].textContent;
|
||||
if (name === null) {
|
||||
throw new Error('Missing name');
|
||||
}
|
||||
const description = node.getElementsByTagName('description')[0].textContent;
|
||||
if (description === null) {
|
||||
throw new Error('Missing description');
|
||||
}
|
||||
const pictureElement = node.getElementsByTagName('picture')[0];
|
||||
const picture = pictureElement !== undefined ? pictureElement.textContent : null;
|
||||
const lastKnownLocationElement = node.getElementsByTagName('geo')[0];
|
||||
const lastKnownLocation = lastKnownLocationElement === undefined ? null : GeoLocation.fromNode(lastKnownLocationElement);
|
||||
return new TrackedItem(id, name, description, picture, lastKnownLocation);
|
||||
}
|
||||
}
|
||||
|
||||
class TrackedItemCursor {
|
||||
public items: TrackedItem[];
|
||||
public next: string | null;
|
||||
|
||||
constructor(items: TrackedItem[], next: string | null) {
|
||||
this.items = items;
|
||||
this.next = next;
|
||||
}
|
||||
|
||||
static fromNode(node: Element): TrackedItemCursor {
|
||||
const next = node.getAttribute('next');
|
||||
const items = Array.from(node.getElementsByTagName('tracked-item')).map(item => TrackedItem.fromNode(item));
|
||||
return new TrackedItemCursor(items, next);
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchPage(lastId: string | null): Promise<TrackedItemCursor> {
|
||||
const url = "https://invtracker.chir.rs/" + (lastId === null ? '/objects' : `/objects?start=${lastId}`);
|
||||
const response = await fetch(url, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Authorization': `Bearer ${window.localStorage.getItem('token')}`
|
||||
}
|
||||
});
|
||||
if (response.status === 200) {
|
||||
const xml = await response.text();
|
||||
const parser = new DOMParser();
|
||||
const doc = parser.parseFromString(xml, 'text/xml');
|
||||
return TrackedItemCursor.fromNode(doc.getElementsByTagName('cursor')[0]);
|
||||
} else if (response.status === 401) {
|
||||
throw new Error('Unauthorized');
|
||||
} else {
|
||||
throw new Error(`Fetch failed with status ${response.status}`);
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchAll(): Promise<TrackedItem[]> {
|
||||
let page = null;
|
||||
let cursor = null;
|
||||
const items: TrackedItem[] = [];
|
||||
do {
|
||||
cursor = await fetchPage(page);
|
||||
items.push(...cursor.items);
|
||||
page = cursor.next;
|
||||
} while (page !== null && cursor.items.length > 0);
|
||||
return items;
|
||||
}
|
||||
|
||||
export async function fetchGeoJson() {
|
||||
const items = await fetchAll();
|
||||
const features = items.filter(item => item.lastKnownLocation !== null).map(item => {
|
||||
if(item.lastKnownLocation === null) {
|
||||
throw new Error("What");
|
||||
}
|
||||
const feature = {
|
||||
type: 'Feature',
|
||||
properties: {
|
||||
name: item.name,
|
||||
description: item.description,
|
||||
picture: item.picture,
|
||||
},
|
||||
geometry: {
|
||||
type: 'Point',
|
||||
coordinates: [item.lastKnownLocation.longitude, item.lastKnownLocation.latitude]
|
||||
}
|
||||
};
|
||||
return feature;
|
||||
});
|
||||
return {
|
||||
type: 'FeatureCollection',
|
||||
features: features
|
||||
};
|
||||
}
|
24
map-desktop/src/api/login.ts
Normal file
24
map-desktop/src/api/login.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
export async function login(username: string, password: string): Promise<string> {
|
||||
const authInner = btoa(`${username}:${password}`);
|
||||
const auth = `Basic ${authInner}`;
|
||||
|
||||
const response = await fetch(`https://invtracker.chir.rs/login`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': auth
|
||||
}
|
||||
});
|
||||
|
||||
if (response.status === 200) {
|
||||
const parser = new DOMParser();
|
||||
const xml = await response.text();
|
||||
const doc = parser.parseFromString(xml, 'text/xml');
|
||||
const tokenValue = doc.getElementsByTagName('token')[0].textContent;
|
||||
if (tokenValue === null) {
|
||||
throw new Error('Missing token');
|
||||
}
|
||||
return tokenValue;
|
||||
} else {
|
||||
throw new Error(`Login failed with status ${response.status}`);
|
||||
}
|
||||
}
|
74
map-desktop/src/assets/base.css
Normal file
74
map-desktop/src/assets/base.css
Normal file
|
@ -0,0 +1,74 @@
|
|||
/* color palette from <https://github.com/vuejs/theme> */
|
||||
:root {
|
||||
--vt-c-white: #ffffff;
|
||||
--vt-c-white-soft: #f8f8f8;
|
||||
--vt-c-white-mute: #f2f2f2;
|
||||
|
||||
--vt-c-black: #181818;
|
||||
--vt-c-black-soft: #222222;
|
||||
--vt-c-black-mute: #282828;
|
||||
|
||||
--vt-c-indigo: #2c3e50;
|
||||
|
||||
--vt-c-divider-light-1: rgba(60, 60, 60, 0.29);
|
||||
--vt-c-divider-light-2: rgba(60, 60, 60, 0.12);
|
||||
--vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
|
||||
--vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);
|
||||
|
||||
--vt-c-text-light-1: var(--vt-c-indigo);
|
||||
--vt-c-text-light-2: rgba(60, 60, 60, 0.66);
|
||||
--vt-c-text-dark-1: var(--vt-c-white);
|
||||
--vt-c-text-dark-2: rgba(235, 235, 235, 0.64);
|
||||
}
|
||||
|
||||
/* semantic color variables for this project */
|
||||
:root {
|
||||
--color-background: var(--vt-c-white);
|
||||
--color-background-soft: var(--vt-c-white-soft);
|
||||
--color-background-mute: var(--vt-c-white-mute);
|
||||
|
||||
--color-border: var(--vt-c-divider-light-2);
|
||||
--color-border-hover: var(--vt-c-divider-light-1);
|
||||
|
||||
--color-heading: var(--vt-c-text-light-1);
|
||||
--color-text: var(--vt-c-text-light-1);
|
||||
|
||||
--section-gap: 160px;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--color-background: var(--vt-c-black);
|
||||
--color-background-soft: var(--vt-c-black-soft);
|
||||
--color-background-mute: var(--vt-c-black-mute);
|
||||
|
||||
--color-border: var(--vt-c-divider-dark-2);
|
||||
--color-border-hover: var(--vt-c-divider-dark-1);
|
||||
|
||||
--color-heading: var(--vt-c-text-dark-1);
|
||||
--color-text: var(--vt-c-text-dark-2);
|
||||
}
|
||||
}
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
body {
|
||||
min-height: 100vh;
|
||||
color: var(--color-text);
|
||||
background: var(--color-background);
|
||||
transition: color 0.5s, background-color 0.5s;
|
||||
line-height: 1.6;
|
||||
font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
|
||||
Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
|
||||
font-size: 15px;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
1
map-desktop/src/assets/logo.svg
Normal file
1
map-desktop/src/assets/logo.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 87.5 100"><defs><style>.cls-1{fill:#1697f6;}.cls-2{fill:#7bc6ff;}.cls-3{fill:#1867c0;}.cls-4{fill:#aeddff;}</style></defs><title>Artboard 46</title><polyline class="cls-1" points="43.75 0 23.31 0 43.75 48.32"/><polygon class="cls-2" points="43.75 62.5 43.75 100 0 14.58 22.92 14.58 43.75 62.5"/><polyline class="cls-3" points="43.75 0 64.19 0 43.75 48.32"/><polygon class="cls-4" points="64.58 14.58 87.5 14.58 43.75 100 43.75 62.5 64.58 14.58"/></svg>
|
After Width: | Height: | Size: 539 B |
35
map-desktop/src/assets/main.css
Normal file
35
map-desktop/src/assets/main.css
Normal file
|
@ -0,0 +1,35 @@
|
|||
@import "./base.css";
|
||||
|
||||
#app {
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
a,
|
||||
.green {
|
||||
text-decoration: none;
|
||||
color: hsla(160, 100%, 37%, 1);
|
||||
transition: 0.4s;
|
||||
}
|
||||
|
||||
@media (hover: hover) {
|
||||
a:hover {
|
||||
background-color: hsla(160, 100%, 37%, 0.2);
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
body {
|
||||
display: flex;
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
#app {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
padding: 0 2rem;
|
||||
}
|
||||
}
|
13
map-desktop/src/main.ts
Normal file
13
map-desktop/src/main.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import vuetify from './plugins/vuetify'
|
||||
import { loadFonts } from './plugins/webfontloader'
|
||||
|
||||
loadFonts()
|
||||
|
||||
createApp(App)
|
||||
.use(router)
|
||||
.use(vuetify)
|
||||
.mount('#app')
|
||||
|
13
map-desktop/src/plugins/vuetify.ts
Normal file
13
map-desktop/src/plugins/vuetify.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
// Styles
|
||||
import '@mdi/font/css/materialdesignicons.css'
|
||||
import 'vuetify/styles'
|
||||
|
||||
// Vuetify
|
||||
import { createVuetify } from 'vuetify'
|
||||
import * as components from 'vuetify/components'
|
||||
import * as directives from 'vuetify/directives'
|
||||
|
||||
export default createVuetify({
|
||||
components,
|
||||
directives,
|
||||
})
|
15
map-desktop/src/plugins/webfontloader.ts
Normal file
15
map-desktop/src/plugins/webfontloader.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
/**
|
||||
* plugins/webfontloader.js
|
||||
*
|
||||
* webfontloader documentation: https://github.com/typekit/webfontloader
|
||||
*/
|
||||
|
||||
export async function loadFonts () {
|
||||
const webFontLoader = await import(/* webpackChunkName: "webfontloader" */'webfontloader')
|
||||
|
||||
webFontLoader.load({
|
||||
google: {
|
||||
families: ['Roboto:100,300,400,500,700,900&display=swap'],
|
||||
},
|
||||
})
|
||||
}
|
24
map-desktop/src/router/index.ts
Normal file
24
map-desktop/src/router/index.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
name: 'load',
|
||||
component: () => import('../views/LoadingView.vue')
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
name: 'login',
|
||||
component: () => import('../views/LoginView.vue')
|
||||
},
|
||||
{
|
||||
path: '/map',
|
||||
name: 'map',
|
||||
component: () => import('../views/MapView.vue')
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
export default router
|
28
map-desktop/src/views/LoadingView.vue
Normal file
28
map-desktop/src/views/LoadingView.vue
Normal file
|
@ -0,0 +1,28 @@
|
|||
<template>
|
||||
<v-app-bar app>
|
||||
<v-toolbar-title>InvTracker</v-toolbar-title>
|
||||
</v-app-bar>
|
||||
|
||||
<v-main>
|
||||
<div class="text-center" style="padding-top: 2rem">
|
||||
<v-progress-circular
|
||||
indeterminate
|
||||
color="primary"
|
||||
></v-progress-circular>
|
||||
</div>
|
||||
</v-main>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'LoadingView',
|
||||
|
||||
mounted() {
|
||||
window.localStorage.getItem('token')
|
||||
? this.$router.push('/map')
|
||||
: this.$router.push('/login');
|
||||
}
|
||||
});
|
||||
</script>
|
74
map-desktop/src/views/LoginView.vue
Normal file
74
map-desktop/src/views/LoginView.vue
Normal file
|
@ -0,0 +1,74 @@
|
|||
<template>
|
||||
<v-app-bar app>
|
||||
<v-toolbar-title>In InvTracker Einloggen</v-toolbar-title>
|
||||
</v-app-bar>
|
||||
|
||||
<v-main>
|
||||
<div class="text-center">
|
||||
<v-alert type="error" v-if="error">
|
||||
{{ error }}
|
||||
</v-alert>
|
||||
<v-alert type="warning">Diese Website benutzt Cookies. Wenn sie auf Anmelden drücken, akzeptieren Sie die Speicherung und Übertragung von Cookies. Diese werden zur Speicherung der Anmeldeinformation genutzt.</v-alert>
|
||||
<v-form
|
||||
ref="form"
|
||||
v-model="valid"
|
||||
lazy-validation>
|
||||
<v-text-field
|
||||
v-model="username"
|
||||
:rules="[v => !!v || 'Bitte geben Sie Ihren Nutzernamen ein']"
|
||||
label="Nutzername"
|
||||
required
|
||||
></v-text-field>
|
||||
<v-text-field
|
||||
v-model="password"
|
||||
:rules="[v => !!v || 'Bitte geben Sie Ihr Passwort ein']"
|
||||
:append-icon="showPassword ? 'mdi-eye' : 'mdi-eye-off'"
|
||||
:type="showPassword ? 'text' : 'password'"
|
||||
label="Passwort"
|
||||
@click:append="showPassword = !showPassword"></v-text-field>
|
||||
<v-btn
|
||||
color="primary"
|
||||
@click="login"
|
||||
:disabled="!valid"
|
||||
:loading="loading">
|
||||
Anmelden</v-btn>
|
||||
</v-form>
|
||||
<v-progress-circular
|
||||
indeterminate
|
||||
color="primary"
|
||||
v-if="loading"></v-progress-circular>
|
||||
</div>
|
||||
</v-main>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
error: '',
|
||||
valid: true,
|
||||
username: '',
|
||||
password: '',
|
||||
showPassword: false,
|
||||
loading: false,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
async login() {
|
||||
this.loading = true;
|
||||
let loginApi = await import('../api/login');
|
||||
try {
|
||||
let token = await loginApi.login(this.username, this.password);
|
||||
window.localStorage.setItem('token', token);
|
||||
this.$router.go(-1);
|
||||
} catch (e) {
|
||||
this.valid = false;
|
||||
this.error = e.message;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
41
map-desktop/src/views/MapView.vue
Normal file
41
map-desktop/src/views/MapView.vue
Normal file
|
@ -0,0 +1,41 @@
|
|||
<template>
|
||||
<l-map style="height:100vh">
|
||||
<l-tile-layer
|
||||
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
||||
layer-type="base"
|
||||
name="OpenStreetMap"
|
||||
></l-tile-layer>
|
||||
<l-geo-json :geojson="geojson" />
|
||||
</l-map>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import "leaflet/dist/leaflet.css";
|
||||
import { LMap, LTileLayer, LGeoJson } from "@vue-leaflet/vue-leaflet";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
LMap,
|
||||
LTileLayer,
|
||||
LGeoJson
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
geojson: null
|
||||
};
|
||||
},
|
||||
async mounted() {
|
||||
const api = await import("../api/listItems");
|
||||
try {
|
||||
this.geojson = await api.fetchGeoJson();
|
||||
console.log(JSON.stringify(this.geojson));
|
||||
} catch (e) {
|
||||
if(e.message === "Unauthorized") {
|
||||
this.$router.push("/login");
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
8
map-desktop/tsconfig.config.json
Normal file
8
map-desktop/tsconfig.config.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"extends": "@vue/tsconfig/tsconfig.node.json",
|
||||
"include": ["vite.config.*", "vitest.config.*", "cypress.config.*"],
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"types": ["node"]
|
||||
}
|
||||
}
|
17
map-desktop/tsconfig.json
Normal file
17
map-desktop/tsconfig.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"extends": "@vue/tsconfig/tsconfig.web.json",
|
||||
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
},
|
||||
"allowJs": true
|
||||
},
|
||||
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.config.json"
|
||||
}
|
||||
]
|
||||
}
|
14
map-desktop/vite.config.ts
Normal file
14
map-desktop/vite.config.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { fileURLToPath, URL } from 'node:url'
|
||||
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||
}
|
||||
}
|
||||
})
|
8
map-desktop/vue.config.js
Normal file
8
map-desktop/vue.config.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
const { defineConfig } = require('@vue/cli-service')
|
||||
module.exports = defineConfig({
|
||||
pluginOptions: {
|
||||
vuetify: {
|
||||
// https://github.com/vuetifyjs/vuetify-loader/tree/next/packages/vuetify-loader
|
||||
}
|
||||
}
|
||||
})
|
6931
map-desktop/yarn.lock
Normal file
6931
map-desktop/yarn.lock
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue