Loading openflexure_microscope/api/static/src/components/tabContentComponents/galleryContent.vue +42 −34 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ <a href="#">Filter</a> <div :class="{ 'uk-light uk-background-secondary': $store.state.darkMode, 'uk-light uk-background-secondary': $store.state.darkMode }" class="uk-navbar-dropdown" > Loading Loading @@ -159,7 +159,7 @@ export default { captureCard, scanCard, ZipDownloader, Paginate, Paginate }, data: function() { Loading @@ -171,7 +171,7 @@ export default { scanTag: "scan", unwatchStoreFunction: null, maxitems: 10, page: 1, page: 1 }; }, Loading @@ -197,11 +197,7 @@ export default { var captures = []; for (var capture of this.captures) { // Add to capture list if matched if ( !capture.dataset || // If no dataset key (capture.dataset.constructor === Object && // Or dataset is an object... Object.keys(capture.dataset).length === 0) // ...but it's empty ) { if (!this.isDatasetPopulated(capture.dataset)) { captures.push(capture); } } Loading @@ -216,7 +212,7 @@ export default { for (var capture of this.captures) { var dataset = capture.dataset; if (dataset) { if (this.isDatasetPopulated(dataset)) { var id = dataset["id"]; // If this scan ID hasn't been seen before Loading Loading @@ -304,7 +300,7 @@ export default { numberOfPages: function() { return Math.floor(this.sortedItems.length / this.maxitems); }, } }, mounted() { Loading @@ -322,7 +318,7 @@ export default { (state, getters) => { return getters.ready; }, (ready) => { ready => { if (ready) { // If the connection is now ready, update capture list this.updateCaptures(); Loading Loading @@ -356,15 +352,27 @@ export default { if (this.$store.state.available) { axios .get(this.capturesUri) .then((response) => { .then(response => { this.captures = response.data; }) .catch((error) => { .catch(error => { this.modalError(error); // Let mixin handle error }); } }, isDatasetPopulated: function(dataset) { if ( !dataset || // If no dataset key (dataset.constructor === Object && // Or dataset is an object... Object.keys(dataset).length === 0) // ...but it's empty ) { return false; } else { return true; } }, filterCaptures: function(list, filterTags) { // Filter a list of captures by an array of tags var result = []; Loading @@ -374,7 +382,7 @@ export default { // Filter by selected tags var tags = capture.tags; let checker = (arr, target) => target.every((v) => arr.includes(v)); let checker = (arr, target) => target.every(v => arr.includes(v)); // True if all tags match includeCapture = checker(tags, filterTags); Loading Loading @@ -409,8 +417,8 @@ export default { selectFolder: function(folderID) { this.galleryFolder = folderID; }, }, } } }; </script> Loading Loading
openflexure_microscope/api/static/src/components/tabContentComponents/galleryContent.vue +42 −34 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ <a href="#">Filter</a> <div :class="{ 'uk-light uk-background-secondary': $store.state.darkMode, 'uk-light uk-background-secondary': $store.state.darkMode }" class="uk-navbar-dropdown" > Loading Loading @@ -159,7 +159,7 @@ export default { captureCard, scanCard, ZipDownloader, Paginate, Paginate }, data: function() { Loading @@ -171,7 +171,7 @@ export default { scanTag: "scan", unwatchStoreFunction: null, maxitems: 10, page: 1, page: 1 }; }, Loading @@ -197,11 +197,7 @@ export default { var captures = []; for (var capture of this.captures) { // Add to capture list if matched if ( !capture.dataset || // If no dataset key (capture.dataset.constructor === Object && // Or dataset is an object... Object.keys(capture.dataset).length === 0) // ...but it's empty ) { if (!this.isDatasetPopulated(capture.dataset)) { captures.push(capture); } } Loading @@ -216,7 +212,7 @@ export default { for (var capture of this.captures) { var dataset = capture.dataset; if (dataset) { if (this.isDatasetPopulated(dataset)) { var id = dataset["id"]; // If this scan ID hasn't been seen before Loading Loading @@ -304,7 +300,7 @@ export default { numberOfPages: function() { return Math.floor(this.sortedItems.length / this.maxitems); }, } }, mounted() { Loading @@ -322,7 +318,7 @@ export default { (state, getters) => { return getters.ready; }, (ready) => { ready => { if (ready) { // If the connection is now ready, update capture list this.updateCaptures(); Loading Loading @@ -356,15 +352,27 @@ export default { if (this.$store.state.available) { axios .get(this.capturesUri) .then((response) => { .then(response => { this.captures = response.data; }) .catch((error) => { .catch(error => { this.modalError(error); // Let mixin handle error }); } }, isDatasetPopulated: function(dataset) { if ( !dataset || // If no dataset key (dataset.constructor === Object && // Or dataset is an object... Object.keys(dataset).length === 0) // ...but it's empty ) { return false; } else { return true; } }, filterCaptures: function(list, filterTags) { // Filter a list of captures by an array of tags var result = []; Loading @@ -374,7 +382,7 @@ export default { // Filter by selected tags var tags = capture.tags; let checker = (arr, target) => target.every((v) => arr.includes(v)); let checker = (arr, target) => target.every(v => arr.includes(v)); // True if all tags match includeCapture = checker(tags, filterTags); Loading Loading @@ -409,8 +417,8 @@ export default { selectFolder: function(folderID) { this.galleryFolder = folderID; }, }, } } }; </script> Loading