Places: Improve routing when browsing pictures in a cluster #1187

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer 2023-09-20 23:51:57 +02:00
parent a865300666
commit cf0da6327f
4 changed files with 21 additions and 11 deletions

View file

@ -263,16 +263,25 @@ export default [
meta: { title: $gettext("Places"), auth: true },
},
{
name: "places_scope",
path: "/places/:s",
name: "places_view",
path: "/places/view/:s",
component: Places,
meta: { title: $gettext("Places"), auth: true },
},
{
name: "places_location",
path: "/location",
name: "places_browse",
path: "/places/browse",
component: Photos,
meta: { title: $gettext("Places"), auth: true },
beforeEnter: (to, from, next) => {
if (session.loginRequired()) {
next({ name: "login" });
} else if (config.deny("photos", "search")) {
next({ name: "albums" });
} else {
next();
}
},
},
{
name: "states",

View file

@ -56,7 +56,7 @@
</template>
<template v-else>
<v-spacer></v-spacer>
<v-btn v-if="canAccessLibrary" icon :title="$gettext('Open')" class="action-open-tab" @click.stop="openInTab">
<v-btn v-if="canAccessLibrary" icon :title="$gettext('Browse')" class="action-browse" @click.stop="onBrowse">
<v-icon size="20">tab</v-icon>
</v-btn>
<v-btn v-if="onClose !== undefined" icon :title="$gettext('Close')" class="action-close" @click.stop="onClose">
@ -334,10 +334,11 @@ export default {
clearLocation() {
this.$router.push({ name: "browse" });
},
openInTab() {
const url = this.$router.resolve({name: 'places_location', query: this.staticFilter}).href;
if (url) {
window.open(url, '_blank');
onBrowse() {
const route = {name: 'places_browse', query: this.staticFilter};
const routeUrl = this.$router.resolve(route).href;
if (routeUrl) {
window.open(routeUrl, '_blank');
}
},
batchDelete() {

View file

@ -198,7 +198,7 @@ export default {
if (this.canAccessLibrary && photo.CellID && photo.CellID !== "zz") {
this.$router.push({name: "places", query: {q: photo.CellID}});
} else if (this.uid) {
this.$router.push({name: "places_scope", params: {s: this.uid}, query: {q: photo.CellID}});
this.$router.push({name: "places_view", params: {s: this.uid}, query: {q: photo.CellID}});
}
},
editPhoto(index) {

View file

@ -441,7 +441,7 @@ export default {
if (this.query() !== this.filter.q) {
if (this.filter.s) {
this.$router.replace({name: "places_scope", params: {s: this.filter.s}, query: {q: this.filter.q}});
this.$router.replace({name: "places_view", params: {s: this.filter.s}, query: {q: this.filter.q}});
} else if (this.filter.q) {
this.$router.replace({name: "places", query: {q: this.filter.q}});
} else {