map: rename from locations

pull/396/head
Varun Patil 2023-02-08 14:13:13 -08:00
parent 348c887499
commit adc16bec29
11 changed files with 25 additions and 43 deletions

View File

@ -21,7 +21,7 @@ return [
['name' => 'Page#videos', 'url' => '/videos', 'verb' => 'GET'],
['name' => 'Page#archive', 'url' => '/archive', 'verb' => 'GET'],
['name' => 'Page#thisday', 'url' => '/thisday', 'verb' => 'GET'],
['name' => 'Page#locations', 'url' => '/locations', 'verb' => 'GET'],
['name' => 'Page#map', 'url' => '/map', 'verb' => 'GET'],
// Routes with params
w(['name' => 'Page#folder', 'url' => '/folders/{path}', 'verb' => 'GET'], 'path'),
@ -66,6 +66,8 @@ return [
['name' => 'Places#places', 'url' => '/api/places', 'verb' => 'GET'],
['name' => 'Places#preview', 'url' => '/api/places/preview/{id}', 'verb' => 'GET'],
['name' => 'Map#clusters', 'url' => '/api/map/clusters', 'verb' => 'GET'],
['name' => 'Archive#archive', 'url' => '/api/archive/{id}', 'verb' => 'PATCH'],
['name' => 'Image#preview', 'url' => '/api/image/preview/{id}', 'verb' => 'GET'],
@ -81,8 +83,6 @@ return [
['name' => 'Download#file', 'url' => '/api/download/{handle}', 'verb' => 'GET'],
['name' => 'Download#one', 'url' => '/api/stream/{fileid}', 'verb' => 'GET'],
['name' => 'Location#clusters', 'url' => '/api/locations/clusters', 'verb' => 'GET'],
// Config API
['name' => 'Other#setUserConfig', 'url' => '/api/config/{key}', 'verb' => 'PUT'],

View File

@ -26,7 +26,7 @@ namespace OCA\Memories\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
class LocationController extends ApiBase
class MapController extends ApiBase
{
/**
* @NoAdminRequired
@ -35,13 +35,6 @@ class LocationController extends ApiBase
*/
public function clusters(): JSONResponse
{
// Get the folder to show
try {
$uid = $this->getUID();
} catch (\Exception $e) {
return new JSONResponse(['message' => $e->getMessage()], Http::STATUS_PRECONDITION_FAILED);
}
// Get the folder to show
$root = null;

View File

@ -84,7 +84,6 @@ class PageController extends Controller
// Apps enabled
$this->initialState->provideInitialState('systemtags', true === $this->appManager->isEnabledForUser('systemtags'));
$this->initialState->provideInitialState('maps', true === $this->appManager->isEnabledForUser('maps'));
$this->initialState->provideInitialState('recognize', \OCA\Memories\Util::recognizeIsEnabled($this->appManager));
$this->initialState->provideInitialState('facerecognitionInstalled', \OCA\Memories\Util::facerecognitionIsInstalled($this->appManager));
$this->initialState->provideInitialState('facerecognitionEnabled', \OCA\Memories\Util::facerecognitionIsEnabled($this->config, $uid));
@ -243,7 +242,7 @@ class PageController extends Controller
*
* @NoCSRFRequired
*/
public function locations()
public function map()
{
return $this->main();
}

View File

@ -151,7 +151,7 @@ export default defineComponent({
},
removeNavGap(): boolean {
return this.$route.name === "locations";
return this.$route.name === "map";
},
},
@ -263,23 +263,17 @@ export default defineComponent({
title: t("memories", "Places"),
if: this.config_placesGis > 0,
},
{
name: "map",
icon: MapIcon,
title: t("memories", "Map"),
},
{
name: "tags",
icon: TagsIcon,
title: t("memories", "Tags"),
if: this.config_tagsEnabled,
},
{
name: "maps",
icon: MapIcon,
title: t("memories", "Maps"),
if: this.config_mapsEnabled,
},
{
name: "locations",
icon: MapIcon,
title: t("memories", "Locations"),
},
];
},

View File

@ -12,7 +12,7 @@
<script lang="ts">
import { defineComponent } from "vue";
import Timeline from "./Timeline.vue";
import LocationTopMatter from "./top-matter/LocationTopMatter.vue";
import MapSplitMatter from "./top-matter/MapSplitMatter.vue";
export default defineComponent({
name: "SplitTimeline",
@ -24,8 +24,8 @@ export default defineComponent({
computed: {
primary() {
switch (this.$route.name) {
case "locations":
return LocationTopMatter;
case "map":
return MapSplitMatter;
default:
return "None";
}

View File

@ -395,9 +395,7 @@ export default defineComponent({
},
isMobileLayout() {
return (
globalThis.windowInnerWidth <= 600 || this.$route.name === "locations"
);
return globalThis.windowInnerWidth <= 600 || this.$route.name === "map";
},
allowBreakout() {
@ -690,7 +688,7 @@ export default defineComponent({
}
// Map Bounds
if (this.$route.name === "locations" && this.$route.query.b) {
if (this.$route.name === "map" && this.$route.query.b) {
query.set("mapbounds", <string>this.$route.query.b);
}

View File

@ -1,5 +1,5 @@
<template>
<div class="location-top-matter">
<div class="map-matter">
<l-map
class="map"
ref="map"
@ -46,7 +46,7 @@ Icon.Default.mergeOptions({
});
export default defineComponent({
name: "LocationTopMatter",
name: "MapSplitMatter",
components: {
LMap,
LTileLayer,
@ -97,7 +97,7 @@ export default defineComponent({
query.set("zoom", zoom);
// Make API call
const url = API.Q(API.CLUSTERS(), query);
const url = API.Q(API.MAP_CLUSTERS(), query);
const res = await axios.get(url);
this.clusters = res.data;
},
@ -106,7 +106,7 @@ export default defineComponent({
</script>
<style lang="scss" scoped>
.location-top-matter {
.map-matter {
height: 100%;
width: 100%;
}

View File

@ -36,7 +36,6 @@ export default defineComponent({
config_facerecognitionEnabled: Boolean(
loadState("memories", "facerecognitionEnabled", <string>"")
),
config_mapsEnabled: Boolean(loadState("memories", "maps", <string>"")),
config_albumsEnabled: Boolean(loadState("memories", "albums", <string>"")),
config_placesGis: Number(loadState("memories", "places_gis", <string>"-1")),

View File

@ -141,11 +141,11 @@ export default new Router({
},
{
path: "/locations",
path: "/map",
component: SplitTimeline,
name: "locations",
name: "map",
props: (route) => ({
rootTitle: t("memories", "Locations"),
rootTitle: t("memories", "Map"),
}),
},
],

View File

@ -123,7 +123,7 @@ export class API {
return gen(`${BASE}/config/{setting}`, { setting });
}
static CLUSTERS() {
return tok(gen(`${BASE}/locations/clusters`));
static MAP_CLUSTERS() {
return tok(gen(`${BASE}/map/clusters`));
}
}

View File

@ -21,7 +21,6 @@ declare module "vue" {
config_recognizeEnabled: boolean;
config_facerecognitionInstalled: boolean;
config_facerecognitionEnabled: boolean;
config_mapsEnabled: boolean;
config_albumsEnabled: boolean;
config_placesGis: number;
config_squareThumbs: boolean;