This commit is contained in:
j3d1 2026-09-06 02:56:05 +02:00
parent 181a7949fe
commit d0c9b22bb5
3 changed files with 22 additions and 14 deletions

View file

@ -83,6 +83,7 @@
<script> <script>
import * as BIcons from "bootstrap-icons-vue"; import * as BIcons from "bootstrap-icons-vue";
import {mapActions} from "vuex";
export default { export default {
name: "Sidebar", name: "Sidebar",
@ -102,12 +103,15 @@ export default {
}, },
async mounted() { async mounted() {
try { try {
const {commit} = await this.$store.dispatch('fetchBackendVersion') const {commit} = await this.fetchBackendVersion()
this.backendCommit = commit this.backendCommit = commit
} catch (e) { } catch (e) {
console.error('could not fetch backend version', e) console.error('could not fetch backend version', e)
} }
}, },
methods: {
...mapActions(['fetchBackendVersion']),
},
} }
</script> </script>

View file

@ -67,7 +67,7 @@
</template> </template>
<script> <script>
import {mapActions} from "vuex"; import {mapActions, mapGetters} from "vuex";
import BaseLayout from "@/components/BaseLayout.vue"; import BaseLayout from "@/components/BaseLayout.vue";
import CameraScanner from "@/components/CameraScanner.vue"; import CameraScanner from "@/components/CameraScanner.vue";
import {encodeHandleForUrl, expandedRoute, OWNED_KIND_FIELDS} from "@/router"; import {encodeHandleForUrl, expandedRoute, OWNED_KIND_FIELDS} from "@/router";
@ -143,6 +143,9 @@ export default {
cameraLog: [], cameraLog: [],
}; };
}, },
computed: {
...mapGetters(["identityHandleById", "groupHandleById"]),
},
methods: { methods: {
...mapActions(["fetchItemByHandle", "fetchStorageLocationByHandle", "fetchIdMap", "resolveShortId"]), ...mapActions(["fetchItemByHandle", "fetchStorageLocationByHandle", "fetchIdMap", "resolveShortId"]),
@ -193,37 +196,37 @@ export default {
} }
if (decoded.kind === "item" || decoded.kind === "group_item") { if (decoded.kind === "item" || decoded.kind === "group_item") {
const byId = decoded.kind === "item" const byId = decoded.kind === "item"
? this.$store.getters.identityHandleById ? this.identityHandleById
: this.$store.getters.groupHandleById; : this.groupHandleById;
const ownerId = decoded.kind === "item" ? decoded.owner_identity_id : decoded.owner_group_id; const ownerId = decoded.kind === "item" ? decoded.owner_identity_id : decoded.owner_group_id;
let handle = byId[ownerId]; let handle = byId[ownerId];
if (handle === undefined) { if (handle === undefined) {
await this.fetchIdMap(); await this.fetchIdMap();
handle = (decoded.kind === "item" handle = (decoded.kind === "item"
? this.$store.getters.identityHandleById ? this.identityHandleById
: this.$store.getters.groupHandleById)[ownerId]; : this.groupHandleById)[ownerId];
} }
return handle === undefined ? null : this.describeItem(handle, decoded.item_local_id); return handle === undefined ? null : this.describeItem(handle, decoded.item_local_id);
} }
if (decoded.kind === "group") { if (decoded.kind === "group") {
let handle = this.$store.getters.groupHandleById[decoded.group_id]; let handle = this.groupHandleById[decoded.group_id];
if (handle === undefined) { if (handle === undefined) {
await this.fetchIdMap(); await this.fetchIdMap();
handle = this.$store.getters.groupHandleById[decoded.group_id]; handle = this.groupHandleById[decoded.group_id];
} }
return handle === undefined ? null : handle; return handle === undefined ? null : handle;
} }
if (decoded.kind === "storage_location" || decoded.kind === "group_storage_location") { if (decoded.kind === "storage_location" || decoded.kind === "group_storage_location") {
const byId = decoded.kind === "storage_location" const byId = decoded.kind === "storage_location"
? this.$store.getters.identityHandleById ? this.identityHandleById
: this.$store.getters.groupHandleById; : this.groupHandleById;
const ownerId = decoded.kind === "storage_location" ? decoded.owner_identity_id : decoded.owner_group_id; const ownerId = decoded.kind === "storage_location" ? decoded.owner_identity_id : decoded.owner_group_id;
let handle = byId[ownerId]; let handle = byId[ownerId];
if (handle === undefined) { if (handle === undefined) {
await this.fetchIdMap(); await this.fetchIdMap();
handle = (decoded.kind === "storage_location" handle = (decoded.kind === "storage_location"
? this.$store.getters.identityHandleById ? this.identityHandleById
: this.$store.getters.groupHandleById)[ownerId]; : this.groupHandleById)[ownerId];
} }
return handle === undefined ? null : this.describeLocation(handle, decoded.storage_location_id); return handle === undefined ? null : this.describeLocation(handle, decoded.storage_location_id);
} }

View file

@ -66,7 +66,7 @@
</template> </template>
<script> <script>
import {mapActions} from 'vuex'; import {mapActions, mapState} from 'vuex';
import BaseLayout from '@/components/BaseLayout.vue'; import BaseLayout from '@/components/BaseLayout.vue';
import { import {
decodeShortId, deserializeShortId, encodeShortId, serializeShortId, decodeShortId, deserializeShortId, encodeShortId, serializeShortId,
@ -142,6 +142,7 @@ export default {
} }
}, },
computed: { computed: {
...mapState(['idmapLoaded']),
// '<domain>:~<token>' vs a bare '~<token>' - see docs/handles-and-shortids.md#domain-qualified-short-id. // '<domain>:~<token>' vs a bare '~<token>' - see docs/handles-and-shortids.md#domain-qualified-short-id.
qualified() { qualified() {
return isDomainQualifiedShortId(this.short_id) ? decodeDomainQualifiedShortId(this.short_id) : null; return isDomainQualifiedShortId(this.short_id) ? decodeDomainQualifiedShortId(this.short_id) : null;
@ -186,7 +187,7 @@ export default {
}, },
mounted() { mounted() {
this.resolveIfQualified(); this.resolveIfQualified();
if (NEEDS_IDMAP.has(this.deserialized.kind) && !this.$store.state.idmapLoaded) { if (NEEDS_IDMAP.has(this.deserialized.kind) && !this.idmapLoaded) {
this.fetchIdMap() this.fetchIdMap()
.then(() => this.resolveIfQualified()) .then(() => this.resolveIfQualified())
.catch(e => { .catch(e => {