From 03fe3d8eb47b7153caf695e888413a477b7d338f Mon Sep 17 00:00:00 2001 From: Cyberes Date: Tue, 20 Aug 2024 16:35:22 -0600 Subject: [PATCH] start working on import frontend processing --- .gitignore | 1 - .../workers/workers_lib/importer/tagging.py | 6 +- src/geo-frontend/src/assets/js/authMixin.js | 2 +- src/geo-frontend/src/assets/js/store.ts | 4 +- .../src/assets/js/types/geofeature-strings.ts | 5 ++ .../src/assets/js/types/geofeature-types.ts | 59 +++++++++++++ .../js/{import => types}/import-types.ts | 0 .../src/assets/js/{ => types}/store-types.ts | 2 +- .../src/components/import/ImportHome.vue | 7 +- .../src/components/import/Process.vue | 21 ++++- .../src/components/import/Upload.vue | 3 +- .../components/import/parts/importqueue.vue | 84 +++++++++++++++++++ 12 files changed, 179 insertions(+), 15 deletions(-) create mode 100644 src/geo-frontend/src/assets/js/types/geofeature-strings.ts create mode 100644 src/geo-frontend/src/assets/js/types/geofeature-types.ts rename src/geo-frontend/src/assets/js/{import => types}/import-types.ts (100%) rename src/geo-frontend/src/assets/js/{ => types}/store-types.ts (87%) create mode 100644 src/geo-frontend/src/components/import/parts/importqueue.vue diff --git a/.gitignore b/.gitignore index c7be515..433bcd3 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,6 @@ eggs/ .eggs/ lib/ lib64/ -parts/ sdist/ var/ wheels/ diff --git a/src/geo-backend/geo_lib/daemon/workers/workers_lib/importer/tagging.py b/src/geo-backend/geo_lib/daemon/workers/workers_lib/importer/tagging.py index 8b8ff0d..ca8fdf3 100644 --- a/src/geo-backend/geo_lib/daemon/workers/workers_lib/importer/tagging.py +++ b/src/geo-backend/geo_lib/daemon/workers/workers_lib/importer/tagging.py @@ -5,8 +5,10 @@ from geo_lib.types.feature import GeoFeatureSupported def generate_auto_tags(feature: GeoFeatureSupported) -> List[str]: - tags = [] - tags.append(f'type:{feature.type.value}') + tags = [ + f'type:{feature.type.value.lower()}' + ] + now = datetime.now() tags.append(f'year:{now.year}') tags.append(f'month:{now.strftime("%B")}') diff --git a/src/geo-frontend/src/assets/js/authMixin.js b/src/geo-frontend/src/assets/js/authMixin.js index 73e4dc5..9ebdc96 100644 --- a/src/geo-frontend/src/assets/js/authMixin.js +++ b/src/geo-frontend/src/assets/js/authMixin.js @@ -1,4 +1,4 @@ -import {UserInfo} from "@/assets/js/store-types.ts"; +import {UserInfo} from "@/assets/js/types/store-types"; import {getUserInfo} from "@/assets/js/auth.js"; export const authMixin = { diff --git a/src/geo-frontend/src/assets/js/store.ts b/src/geo-frontend/src/assets/js/store.ts index 758db2f..eac3d6f 100644 --- a/src/geo-frontend/src/assets/js/store.ts +++ b/src/geo-frontend/src/assets/js/store.ts @@ -1,6 +1,6 @@ import {createStore} from 'vuex' -import {UserInfo} from './store-types' -import {ImportQueueItem} from "@/assets/js/import/import-types"; +import {UserInfo} from './types/store-types' +import {ImportQueueItem} from "@/assets/js/types/import-types"; export default createStore({ diff --git a/src/geo-frontend/src/assets/js/types/geofeature-strings.ts b/src/geo-frontend/src/assets/js/types/geofeature-strings.ts new file mode 100644 index 0000000..940e031 --- /dev/null +++ b/src/geo-frontend/src/assets/js/types/geofeature-strings.ts @@ -0,0 +1,5 @@ +export const GeoFeatureTypeStrings = { + Point: "Point", + LineString: "LineString", + Polygon: "Polygon" +} \ No newline at end of file diff --git a/src/geo-frontend/src/assets/js/types/geofeature-types.ts b/src/geo-frontend/src/assets/js/types/geofeature-types.ts new file mode 100644 index 0000000..7240923 --- /dev/null +++ b/src/geo-frontend/src/assets/js/types/geofeature-types.ts @@ -0,0 +1,59 @@ +enum GeoFeatureType { + POINT = 'Point', + LINESTRING = 'LineString', + POLYGON = 'Polygon' +} + +interface GeoFeatureProps { + name: string; + id: number; + type: GeoFeatureType; + description?: string; + tags?: string[]; + geometry: any[]; +} + +class GeoFeature { + name: string; + id: number; + type: GeoFeatureType; + description?: string; + tags: string[] = []; + geometry: any[]; + + constructor(props: GeoFeatureProps) { + this.name = props.name; + this.id = props.id; + this.type = props.type; + this.description = props.description; + this.tags = props.tags || []; + this.geometry = props.geometry || []; + } +} + +export class GeoPoint extends GeoFeature { + type: GeoFeatureType = GeoFeatureType.POINT; + geometry: number[]; + + constructor(props: GeoFeatureProps) { + super({...props, type: GeoFeatureType.POINT}); + } +} + +export class GeoLineString extends GeoFeature { + type: GeoFeatureType = GeoFeatureType.LINESTRING; + geometry: number[][]; + + constructor(props: GeoFeatureProps) { + super({...props, type: GeoFeatureType.LINESTRING}); + } +} + +export class GeoPolygon extends GeoFeature { + type: GeoFeatureType = GeoFeatureType.POLYGON; + geometry: number[][][]; + + constructor(props: GeoFeatureProps) { + super({...props, type: GeoFeatureType.POLYGON}); + } +} diff --git a/src/geo-frontend/src/assets/js/import/import-types.ts b/src/geo-frontend/src/assets/js/types/import-types.ts similarity index 100% rename from src/geo-frontend/src/assets/js/import/import-types.ts rename to src/geo-frontend/src/assets/js/types/import-types.ts diff --git a/src/geo-frontend/src/assets/js/store-types.ts b/src/geo-frontend/src/assets/js/types/store-types.ts similarity index 87% rename from src/geo-frontend/src/assets/js/store-types.ts rename to src/geo-frontend/src/assets/js/types/store-types.ts index bbf8a9e..cb95f2a 100644 --- a/src/geo-frontend/src/assets/js/store-types.ts +++ b/src/geo-frontend/src/assets/js/types/store-types.ts @@ -1,4 +1,4 @@ -import {getCookie} from "./auth.js" +import {getCookie} from "../auth.js" export class UserInfo { username: String; diff --git a/src/geo-frontend/src/components/import/ImportHome.vue b/src/geo-frontend/src/components/import/ImportHome.vue index 3063986..375bb15 100644 --- a/src/geo-frontend/src/components/import/ImportHome.vue +++ b/src/geo-frontend/src/components/import/ImportHome.vue @@ -13,7 +13,7 @@ import {mapState} from "vuex" import {authMixin} from "@/assets/js/authMixin.js"; import axios from "axios"; import {IMPORT_QUEUE_LIST_URL} from "@/assets/js/import/url.js"; -import {ImportQueueItem} from "@/assets/js/import/import-types.ts" +import {ImportQueueItem} from "@/assets/js/types/import-types" import Importqueue from "@/components/import/parts/importqueue.vue"; export default { @@ -51,9 +51,8 @@ export default { } } }, - async created() { - await this.fetchQueueList() - }, + // async created() { + // }, // async mounted() { // }, // beforeRouteEnter(to, from, next) { diff --git a/src/geo-frontend/src/components/import/Process.vue b/src/geo-frontend/src/components/import/Process.vue index 33fa9dc..6655142 100644 --- a/src/geo-frontend/src/components/import/Process.vue +++ b/src/geo-frontend/src/components/import/Process.vue @@ -18,6 +18,11 @@ + + + + \ No newline at end of file