This commit is contained in:
j3d1 2026-08-22 23:48:31 +02:00
parent de7d9426be
commit 5c3b7fc252

View file

@ -43,6 +43,9 @@
<a :href="`/storage-locations/${location.id}/delete`" @click.prevent="deleteStorageLocation(location)"> <a :href="`/storage-locations/${location.id}/delete`" @click.prevent="deleteStorageLocation(location)">
<b-icon-trash></b-icon-trash> <b-icon-trash></b-icon-trash>
</a> </a>
<router-link v-if="shortIdLink(location)" :to="shortIdLink(location)">
<b-icon-link></b-icon-link>
</router-link>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@ -72,6 +75,10 @@
<router-link :to="`/storage-locations/${location.id}/edit`" <router-link :to="`/storage-locations/${location.id}/edit`"
class="btn btn-primary btn-sm">Edit class="btn btn-primary btn-sm">Edit
</router-link> </router-link>
<router-link v-if="shortIdLink(location)" :to="shortIdLink(location)"
class="btn btn-secondary btn-sm">
<b-icon-link></b-icon-link>
</router-link>
</div> </div>
</div> </div>
</div> </div>
@ -92,9 +99,10 @@
</template> </template>
<script> <script>
import {mapActions, mapState} from "vuex"; import {mapActions, mapGetters, mapState} from "vuex";
import * as BIcons from "bootstrap-icons-vue"; import * as BIcons from "bootstrap-icons-vue";
import BaseLayout from "@/components/BaseLayout.vue"; import BaseLayout from "@/components/BaseLayout.vue";
import {shortenedRoute} from "@/router";
export default { export default {
name: "StorageLocation", name: "StorageLocation",
@ -108,13 +116,20 @@ export default {
...BIcons ...BIcons
}, },
computed: { computed: {
...mapGetters(["identityIdByHandle"]),
...mapState(["user", "storage_locations"]), ...mapState(["user", "storage_locations"]),
}, },
methods: { methods: {
...mapActions(["fetchStorageLocations", "deleteStorageLocation"]), ...mapActions(["fetchStorageLocations", "deleteStorageLocation", "fetchIdMap"]),
shortIdLink(location) {
const owner_identity_id = this.identityIdByHandle[location.owner]
if (owner_identity_id === undefined) return null
return shortenedRoute({kind: 'storage_location', owner_identity_id, storage_location_id: location.id})
},
}, },
async mounted() { async mounted() {
await this.fetchStorageLocations() await this.fetchStorageLocations()
await this.fetchIdMap()
} }
} }
</script> </script>