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)">
<b-icon-trash></b-icon-trash>
</a>
<router-link v-if="shortIdLink(location)" :to="shortIdLink(location)">
<b-icon-link></b-icon-link>
</router-link>
</td>
</tr>
</tbody>
@ -72,6 +75,10 @@
<router-link :to="`/storage-locations/${location.id}/edit`"
class="btn btn-primary btn-sm">Edit
</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>
@ -92,9 +99,10 @@
</template>
<script>
import {mapActions, mapState} from "vuex";
import {mapActions, mapGetters, mapState} from "vuex";
import * as BIcons from "bootstrap-icons-vue";
import BaseLayout from "@/components/BaseLayout.vue";
import {shortenedRoute} from "@/router";
export default {
name: "StorageLocation",
@ -108,13 +116,20 @@ export default {
...BIcons
},
computed: {
...mapGetters(["identityIdByHandle"]),
...mapState(["user", "storage_locations"]),
},
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() {
await this.fetchStorageLocations()
await this.fetchIdMap()
}
}
</script>