Prevent fresh install with no packages selected

This commit is contained in:
James Rowe 2019-12-08 17:26:42 -07:00
parent 6210a2668f
commit d9e4e5ecc2

View file

@ -30,11 +30,6 @@
</div> </div>
</div> </div>
<div class="subtitle is-6" v-if="!$root.$data.metadata.preexisting_install && advanced">
</div>
<div class="subtitle is-6" v-if="!$root.$data.metadata.preexisting_install && advanced">Install Location</div> <div class="subtitle is-6" v-if="!$root.$data.metadata.preexisting_install && advanced">Install Location</div>
<div class="field has-addons" v-if="!$root.$data.metadata.preexisting_install && advanced"> <div class="field has-addons" v-if="!$root.$data.metadata.preexisting_install && advanced">
<div class="control is-expanded"> <div class="control is-expanded">
@ -55,12 +50,13 @@
v-on:click="advanced = true">Advanced...</a> v-on:click="advanced = true">Advanced...</a>
</p> </p>
<p class="control"> <p class="control">
<a class="button is-dark is-medium" v-if="!$root.$data.metadata.preexisting_install" <!-- Disable the Install button on a fresh install with no packages selected -->
v-on:click="install">Install</a> <button v-if="$root.$data.metadata.preexisting_install" class="button is-medium is-dark" v-on:click="install">
</p> Modify
<p class="control"> </button>
<a class="button is-dark is-medium" v-if="$root.$data.metadata.preexisting_install" <button v-else class="button is-medium is-dark" v-on:click="install" :disabled="!this.has_package_selected">
v-on:click="install">Modify</a> Install
</button>
</p> </p>
</div> </div>
</div> </div>
@ -94,6 +90,17 @@
installDesktopShortcut: true installDesktopShortcut: true
} }
}, },
computed: {
has_package_selected: function() {
for (let i=0; i < this.$root.config.packages.length; ++i) {
let pkg = this.$root.config.packages[i];
if (pkg.default) {
return true;
}
}
return false;
}
},
methods: { methods: {
select_file: function () { select_file: function () {
window.external.invoke(JSON.stringify({ window.external.invoke(JSON.stringify({