diff --git a/src/components/Explore.vue b/src/components/Explore.vue index dac91e45..f1b9b4e6 100644 --- a/src/components/Explore.vue +++ b/src/components/Explore.vue @@ -59,6 +59,7 @@ import CogIcon from 'vue-material-design-icons/Cog.vue'; import config from '../services/static-config'; import { API } from '../services/API'; +import * as dav from '../services/dav'; import type { ICluster, IConfig } from '../types'; @@ -160,25 +161,19 @@ export default defineComponent({ }, async getRecognize() { - const res = await axios.get(API.FACE_LIST('recognize')); - this.recognize = res.data.slice(0, 10); + this.recognize = (await dav.getFaceList('recognize')).slice(0, 10); }, async getFaceRecognition() { - const res = await axios.get(API.FACE_LIST('facerecognition')); - this.facerecognition = res.data.slice(0, 10); + this.facerecognition = (await dav.getFaceList('facerecognition')).slice(0, 10); }, async getPlaces() { - const res = await axios.get(API.PLACE_LIST()); - const places = res.data; // FIXME: performance - this.places = places.slice(0, 10); + this.places = (await dav.getPlaces()).slice(0, 10); }, async getTags() { - const res = await axios.get(API.TAG_LIST()); - const tags = res.data.sort((a, b) => b.count - a.count); // FIXME: performance - this.tags = tags.slice(0, 10); + this.tags = (await dav.getTags()).sort((a, b) => b.count - a.count).slice(0, 10); }, }, }); diff --git a/src/components/frame/Cluster.vue b/src/components/frame/Cluster.vue index 41f2d38a..b9ae1a22 100644 --- a/src/components/frame/Cluster.vue +++ b/src/components/frame/Cluster.vue @@ -79,11 +79,7 @@ export default defineComponent({ }, title() { - if (this.tag) { - return this.t('recognize', this.tag.name); - } - - return this.data.name; + return this.data.display_name || this.data.name; }, subtitle() { @@ -109,26 +105,28 @@ export default defineComponent({ return ''; }, + type() { + return this.data.cluster_type; + }, + plus() { - return this.data.cluster_type === 'plus'; + return this.type === 'plus'; }, tag() { - return this.data.cluster_type === 'tags' && this.data; + return this.type === 'tags' && this.data; }, face() { - return ( - (this.data.cluster_type === 'recognize' || this.data.cluster_type === 'facerecognition') && (this.data as IFace) - ); + return (this.type === 'recognize' || this.type === 'facerecognition') && (this.data as IFace); }, place() { - return this.data.cluster_type === 'places' && this.data; + return this.type === 'places' && this.data; }, album() { - return this.data.cluster_type === 'albums' && (this.data as IAlbum); + return this.type === 'albums' && (this.data as IAlbum); }, /** Target URL to navigate to */ diff --git a/src/components/modal/FaceList.vue b/src/components/modal/FaceList.vue index f9bedee8..58dec743 100644 --- a/src/components/modal/FaceList.vue +++ b/src/components/modal/FaceList.vue @@ -90,10 +90,8 @@ export default defineComponent({ this.list = null; this.search = ''; - this.list = (await dav.getFaceList(this.$route.name as any)).filter((c: IFace) => { - const clusterName = String(c.name || c.cluster_id); - return c.user_id === this.user && clusterName !== this.name; - }); + const faces = await dav.getFaceList(this.$route.name as any); + this.list = faces.filter((c: IFace) => c.user_id === this.user && String(c.name || c.cluster_id) !== this.name); this.fuse = new Fuse(this.list, { keys: ['name'] }); }, diff --git a/src/components/top-matter/ClusterTopMatter.vue b/src/components/top-matter/ClusterTopMatter.vue index b9171d1a..29085cbd 100644 --- a/src/components/top-matter/ClusterTopMatter.vue +++ b/src/components/top-matter/ClusterTopMatter.vue @@ -35,7 +35,7 @@ export default defineComponent({ name(): string | null { switch (this.$route.name) { case 'tags': - return this.$route.params.name; + return this.t('recognize', this.$route.params.name); case 'places': return this.$route.params.name?.split('-').slice(1).join('-'); default: diff --git a/src/components/viewer/ImageEditor.vue b/src/components/viewer/ImageEditor.vue index 5cae3a09..8820a810 100644 --- a/src/components/viewer/ImageEditor.vue +++ b/src/components/viewer/ImageEditor.vue @@ -5,8 +5,9 @@