feat: Switch owner subview to all subview if has shared resources (#4672)

This commit is contained in:
Alex Grozav 2022-11-22 09:27:45 +02:00 committed by GitHub
parent 753f4c9a7d
commit e3e17e5dac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -103,7 +103,7 @@
</ul>
<n8n-text color="text-base" size="medium" v-else>
{{ $locale.baseText(`${resourceKey}.noResults`) }}
<template v-if="!hasFilters && isOwnerSubview && resourcesNotOwned.length > 0">
<template v-if="shouldSwitchToAllSubview">
<span v-if="!filters.search">
({{ $locale.baseText(`${resourceKey}.noResults.switchToShared.preamble`) }}
<n8n-link @click="setOwnerSubview(false)">{{$locale.baseText(`${resourceKey}.noResults.switchToShared.link`) }}</n8n-link>)
@ -275,6 +275,9 @@ export default mixins(
return resource.ownedBy && resource.ownedBy.id !== this.usersStore.currentUser?.id;
});
},
shouldSwitchToAllSubview(): boolean {
return !this.hasFilters && this.isOwnerSubview && this.resourcesNotOwned.length > 0;
},
},
methods: {
async onMounted() {
@ -369,6 +372,11 @@ export default mixins(
sortBy() {
this.sendSortingTelemetry();
},
loading(value) {
if (!value && this.shouldSwitchToAllSubview) {
this.isOwnerSubview = false;
}
},
},
});
</script>