If connected, update components on mount
This commit is contained in:
parent
5a0370a7b7
commit
a8730d0a15
2 changed files with 59 additions and 39 deletions
|
|
@ -63,6 +63,10 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mounted: function() {
|
||||||
|
this.updateZipperUri();
|
||||||
|
},
|
||||||
|
|
||||||
created: function() {
|
created: function() {
|
||||||
// Watch for host 'ready', then update status
|
// Watch for host 'ready', then update status
|
||||||
this.unwatchStoreFunction = this.$store.watch(
|
this.unwatchStoreFunction = this.$store.watch(
|
||||||
|
|
@ -80,23 +84,28 @@ export default {
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
updateZipperUri: function() {
|
updateZipperUri: function() {
|
||||||
axios
|
if (this.$store.state.available) {
|
||||||
.get(this.pluginsUri) // Get a list of plugins
|
axios
|
||||||
.then(response => {
|
.get(this.pluginsUri) // Get a list of plugins
|
||||||
var plugins = response.data;
|
.then(response => {
|
||||||
var foundExtension = plugins.find(
|
var plugins = response.data;
|
||||||
e => e.title === "org.openflexure.zipbuilder"
|
var foundExtension = plugins.find(
|
||||||
);
|
e => e.title === "org.openflexure.zipbuilder"
|
||||||
// if ZipBuilderPlugin is enabled
|
);
|
||||||
if (foundExtension) {
|
// if ZipBuilderPlugin is enabled
|
||||||
// Get plugin action links
|
if (foundExtension) {
|
||||||
this.zipBuilderUri = foundExtension.links.build.href;
|
// Get plugin action links
|
||||||
this.zipGetterUri = foundExtension.links.get.href;
|
this.zipBuilderUri = foundExtension.links.build.href;
|
||||||
}
|
this.zipGetterUri = foundExtension.links.get.href;
|
||||||
})
|
}
|
||||||
.catch(error => {
|
})
|
||||||
this.modalError(error); // Let mixin handle error
|
.catch(error => {
|
||||||
});
|
this.modalError(error); // Let mixin handle error
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.zipBuilderUri = null;
|
||||||
|
this.zipGetterUri = null;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
resetZipper: function() {
|
resetZipper: function() {
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,14 @@
|
||||||
>
|
>
|
||||||
<ul class="uk-navbar-nav">
|
<ul class="uk-navbar-nav">
|
||||||
<li :class="[sortDescending ? 'uk-active' : '']">
|
<li :class="[sortDescending ? 'uk-active' : '']">
|
||||||
<a class="uk-icon" href="#" @click="sortDescending = true"
|
<a class="uk-icon" href="#" @click="sortDescending = true">
|
||||||
><i class="material-icons">keyboard_arrow_down</i></a
|
<i class="material-icons">keyboard_arrow_down</i>
|
||||||
>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li :class="[!sortDescending ? 'uk-active' : '']">
|
<li :class="[!sortDescending ? 'uk-active' : '']">
|
||||||
<a class="uk-icon" href="#" @click="sortDescending = false"
|
<a class="uk-icon" href="#" @click="sortDescending = false">
|
||||||
><i class="material-icons">keyboard_arrow_up</i></a
|
<i class="material-icons">keyboard_arrow_up</i>
|
||||||
>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="#">Filter</a>
|
<a href="#">Filter</a>
|
||||||
|
|
@ -34,8 +34,8 @@
|
||||||
:key="tag"
|
:key="tag"
|
||||||
class="uk-margin-small"
|
class="uk-margin-small"
|
||||||
>
|
>
|
||||||
<label
|
<label>
|
||||||
><input
|
<input
|
||||||
:id="tag"
|
:id="tag"
|
||||||
v-model="checkedTags"
|
v-model="checkedTags"
|
||||||
class="uk-checkbox"
|
class="uk-checkbox"
|
||||||
|
|
@ -43,8 +43,8 @@
|
||||||
:value="tag"
|
:value="tag"
|
||||||
checked
|
checked
|
||||||
/>
|
/>
|
||||||
{{ tag }}</label
|
{{ tag }}
|
||||||
>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
@ -80,12 +80,17 @@
|
||||||
v-if="galleryFolder"
|
v-if="galleryFolder"
|
||||||
class="uk-flex uk-flex-middle uk-padding uk-padding-remove-horizontal uk-padding-remove-bottom"
|
class="uk-flex uk-flex-middle uk-padding uk-padding-remove-horizontal uk-padding-remove-bottom"
|
||||||
>
|
>
|
||||||
<a href="#" class="uk-icon uk-margin-remove" @click="galleryFolder = ''"
|
<a
|
||||||
><i class="material-icons">arrow_back</i></a
|
href="#"
|
||||||
|
class="uk-icon uk-margin-remove"
|
||||||
|
@click="galleryFolder = ''"
|
||||||
>
|
>
|
||||||
|
<i class="material-icons">arrow_back</i>
|
||||||
|
</a>
|
||||||
<div class="uk-margin-left">
|
<div class="uk-margin-left">
|
||||||
<h3 class="uk-margin-remove uk-margin-left">
|
<h3 class="uk-margin-remove uk-margin-left">
|
||||||
<b>SCAN</b> {{ allScans[galleryFolder].metadata.image.name }}
|
<b>SCAN</b>
|
||||||
|
{{ allScans[galleryFolder].metadata.image.name }}
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -267,6 +272,8 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
|
// Update on mount (does nothing if not connected)
|
||||||
|
this.updateCaptures();
|
||||||
// A global signal listener to perform a gallery refresh
|
// A global signal listener to perform a gallery refresh
|
||||||
this.$root.$on("globalUpdateCaptures", () => {
|
this.$root.$on("globalUpdateCaptures", () => {
|
||||||
this.updateCaptures();
|
this.updateCaptures();
|
||||||
|
|
@ -309,15 +316,19 @@ export default {
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
updateCaptures: function() {
|
updateCaptures: function() {
|
||||||
console.log("Updating capture list...");
|
if (this.$store.state.available) {
|
||||||
axios
|
console.log("Updating capture list...");
|
||||||
.get(this.capturesUri)
|
axios
|
||||||
.then(response => {
|
.get(this.capturesUri)
|
||||||
this.captures = response.data;
|
.then(response => {
|
||||||
})
|
this.captures = response.data;
|
||||||
.catch(error => {
|
})
|
||||||
this.modalError(error); // Let mixin handle error
|
.catch(error => {
|
||||||
});
|
this.modalError(error); // Let mixin handle error
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log("Delaying capture update until connection is available");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
filterCaptures: function(list, filterTags) {
|
filterCaptures: function(list, filterTags) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue