2020-06-19 18:03:52 +02:00
|
|
|
<template>
|
|
|
|
<div class="empty">
|
|
|
|
<div class="empty-icon">
|
2020-08-12 10:48:18 +02:00
|
|
|
<i class="mdi mdi-48px mdi-cloud-download" />
|
2020-06-19 18:03:52 +02:00
|
|
|
</div>
|
|
|
|
<p class="empty-title h5">
|
|
|
|
{{ updateMessage }}
|
|
|
|
</p>
|
|
|
|
<div v-if="updateStatus === 'downloading'">
|
|
|
|
<progress
|
|
|
|
class="progress"
|
|
|
|
:value="downloadPercentage"
|
|
|
|
max="100"
|
|
|
|
/>
|
|
|
|
<p class="empty-subtitle">
|
|
|
|
{{ downloadPercentage }}%
|
|
|
|
</p>
|
|
|
|
</div>
|
2020-09-03 15:12:30 +02:00
|
|
|
<div v-if="updateStatus === 'available'">
|
|
|
|
<progress class="progress" max="100" />
|
|
|
|
</div>
|
2020-06-19 18:03:52 +02:00
|
|
|
<div class="empty-action">
|
|
|
|
<button
|
|
|
|
v-if="['noupdate', 'checking', 'nocheck'].includes(updateStatus)"
|
|
|
|
class="btn btn-primary"
|
|
|
|
:class="{'loading': updateStatus === 'checking'}"
|
|
|
|
@click="checkForUpdates"
|
|
|
|
>
|
|
|
|
{{ $t('message.checkForUpdates') }}
|
|
|
|
</button>
|
|
|
|
<button
|
2021-11-03 14:46:13 +01:00
|
|
|
v-else-if="updateStatus === 'downloaded'"
|
2020-06-19 18:03:52 +02:00
|
|
|
class="btn btn-primary"
|
|
|
|
@click="restartToUpdate"
|
|
|
|
>
|
|
|
|
{{ $t('message.restartToInstall') }}
|
|
|
|
</button>
|
2021-11-03 14:46:13 +01:00
|
|
|
<button
|
|
|
|
v-else-if="updateStatus === 'link'"
|
|
|
|
class="btn btn-primary"
|
|
|
|
@click="openOutside('https://antares-sql.app/download.html')"
|
|
|
|
>
|
|
|
|
{{ $t('message.goToDownloadPage') }}
|
|
|
|
</button>
|
2020-06-19 18:03:52 +02:00
|
|
|
</div>
|
2021-02-27 17:28:01 +01:00
|
|
|
<div class="form-group mt-4">
|
|
|
|
<label class="form-switch d-inline-block disabled" @click.prevent="toggleAllowPrerelease">
|
|
|
|
<input type="checkbox" :checked="allowPrerelease">
|
|
|
|
<i class="form-icon" /> {{ $t('message.includeBetaUpdates') }}
|
|
|
|
</label>
|
|
|
|
</div>
|
2020-06-19 18:03:52 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-02-27 17:28:01 +01:00
|
|
|
import { mapGetters, mapActions } from 'vuex';
|
2021-11-03 14:46:13 +01:00
|
|
|
import { ipcRenderer, shell } from 'electron';
|
2020-06-19 18:03:52 +02:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'ModalSettingsUpdate',
|
|
|
|
computed: {
|
|
|
|
...mapGetters({
|
|
|
|
updateStatus: 'application/getUpdateStatus',
|
2021-02-27 17:28:01 +01:00
|
|
|
downloadPercentage: 'application/getDownloadProgress',
|
|
|
|
allowPrerelease: 'settings/getAllowPrerelease'
|
2020-06-19 18:03:52 +02:00
|
|
|
}),
|
|
|
|
updateMessage () {
|
|
|
|
switch (this.updateStatus) {
|
|
|
|
case 'noupdate':
|
|
|
|
return this.$t('message.noUpdatesAvailable');
|
|
|
|
case 'checking':
|
|
|
|
return this.$t('message.checkingForUpdate');
|
|
|
|
case 'nocheck':
|
|
|
|
return this.$t('message.checkFailure');
|
|
|
|
case 'available':
|
|
|
|
return this.$t('message.updateAvailable');
|
|
|
|
case 'downloading':
|
|
|
|
return this.$t('message.downloadingUpdate');
|
|
|
|
case 'downloaded':
|
|
|
|
return this.$t('message.updateDownloaded');
|
2021-11-03 14:46:13 +01:00
|
|
|
case 'link':
|
|
|
|
return this.$t('message.updateAvailable');
|
2020-06-19 18:03:52 +02:00
|
|
|
default:
|
|
|
|
return this.updateStatus;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2021-02-27 17:28:01 +01:00
|
|
|
...mapActions({
|
|
|
|
changeAllowPrerelease: 'settings/changeAllowPrerelease'
|
|
|
|
}),
|
2021-11-03 14:46:13 +01:00
|
|
|
openOutside (link) {
|
|
|
|
shell.openExternal(link);
|
|
|
|
},
|
2020-06-19 18:03:52 +02:00
|
|
|
checkForUpdates () {
|
2020-08-18 18:03:59 +02:00
|
|
|
ipcRenderer.send('check-for-updates');
|
2020-06-19 18:03:52 +02:00
|
|
|
},
|
|
|
|
restartToUpdate () {
|
2020-08-18 18:03:59 +02:00
|
|
|
ipcRenderer.send('restart-to-update');
|
2021-02-27 17:28:01 +01:00
|
|
|
},
|
|
|
|
toggleAllowPrerelease () {
|
|
|
|
this.changeAllowPrerelease(!this.allowPrerelease);
|
2020-06-19 18:03:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|