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

View File

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

View File

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

View File

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