Compare commits

..

2 Commits

Author SHA1 Message Date
Stefan Zermatten
11a2851ac4 Fixed slots with computed expected quantity not hiding when full 2021-03-10 14:51:38 +02:00
Stefan Zermatten
313382fb82 Fixed library subscription issues 2021-03-10 14:40:14 +02:00
4 changed files with 37 additions and 26 deletions

View File

@@ -130,7 +130,7 @@ export default {
}).map(slot => {
if (
!this.showHiddenSlots &&
slot.quantityExpected === 0 &&
slot.quantityExpectedResult === 0 &&
slot.hideWhenFull
){
slot.children = []
@@ -144,11 +144,12 @@ export default {
}
return slot;
}).filter(slot => !( // Hide full and ignored slots
!this.showHiddenSlots &&
slot.hideWhenFull &&
slot.quantityExpected > 0 &&
slot.totalFilled >= slot.quantityExpected ||
slot.ignored
!this.showHiddenSlots && (
slot.hideWhenFull &&
slot.quantityExpectedResult > 0 &&
slot.spaceLeft <= 0 ||
slot.ignored
)
));
},
},

View File

@@ -19,7 +19,7 @@
>
<v-spacer />
<v-switch
v-if="!$route.params.id || canEditLibrary"
v-if="!libraryId || canEditLibrary"
v-model="organize"
label="Organize"
class="mx-3"
@@ -27,11 +27,11 @@
/>
</v-toolbar>
<div
v-if="$route.params.id"
v-if="libraryId"
style="width: 100%; height: 100%; overflow: auto;"
>
<library-contents-container
:library-id="$route.params.id"
:library-id="libraryId"
:organize-mode="organize"
:selected-node-id="selected"
should-subscribe
@@ -81,6 +81,10 @@ export default {
},
props: {
selection: Boolean,
libraryId: {
type: String,
default: undefined,
},
},
data(){ return {
organize: false,
@@ -131,8 +135,8 @@ export default {
meteor: {
$subscribe: {
'library'(){
if (this.$route.params.id){
return [this.$route.params.id];
if (this.libraryId){
return [this.libraryId]
} else {
return [];
}
@@ -144,12 +148,12 @@ export default {
}).fetch();
},
library(){
let libraryId = this.$route.params.id;
let libraryId = this.libraryId;
if (!libraryId) return;
return Libraries.findOne(libraryId);
},
canEditLibrary(){
if (!this.$route.params.id) return;
if (!this.libraryId) return;
try {
assertEditPermission(this.library, Meteor.userId());
return true;

View File

@@ -6,13 +6,13 @@
"
>
<v-expansion-panel
v-model="expandedLibrary"
style="box-shadow: none;"
expand
>
<v-expansion-panel-content
v-for="(library, index) in libraries"
:key="library._id"
v-model="expandedLibrary[index]"
lazy
:data-id="library._id"
>
@@ -87,11 +87,25 @@ export default {
props: {
organizeMode: Boolean,
editMode: Boolean,
selectedNodeId: String,
selectedNodeId: {
type: String,
default: undefined,
},
},
data(){ return {
expandedLibrary: [],
expandedLibraryContent: [],
};},
computed: {
noLibrariesExpanded(){
if (!this.expandedLibrary) return true;
let noneExpanded = true;
this.expandedLibrary.forEach(lib => {
if(lib) noneExpanded = false;
});
return noneExpanded;
},
},
meteor: {
$subscribe: {
'libraries': [],
@@ -106,16 +120,6 @@ export default {
return tier && tier.paidBenefits;
},
},
computed: {
noLibrariesExpanded(){
if (!this.expandedLibrary) return true;
let noneExpanded = true;
this.expandedLibrary.forEach(lib => {
if(lib) noneExpanded = false;
});
return noneExpanded;
},
},
methods: {
log: console.log,
insertLibrary(){

View File

@@ -1,6 +1,8 @@
<template lang="html">
<single-card-layout>
<library-and-node />
<library-and-node
:library-id="$route.params.id"
/>
</single-card-layout>
</template>