mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 12:11:08 -04:00
fix update-app screen spacing and alerts
This commit is contained in:
@ -26,7 +26,7 @@ class Updater
|
|||||||
if ($response instanceof RequestException) {
|
if ($response instanceof RequestException) {
|
||||||
return [
|
return [
|
||||||
'success' => false,
|
'success' => false,
|
||||||
'errors' => 'Download Exception',
|
'error' => 'Download Exception',
|
||||||
'data' => [
|
'data' => [
|
||||||
'path' => $path
|
'path' => $path
|
||||||
]
|
]
|
||||||
@ -84,13 +84,13 @@ class Updater
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'errors' => false,
|
'error' => false,
|
||||||
'data' => []
|
'data' => []
|
||||||
];
|
];
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return [
|
return [
|
||||||
'success' => false,
|
'success' => false,
|
||||||
'errors' => 'Update error',
|
'error' => 'Update error',
|
||||||
'data' => []
|
'data' => []
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -672,9 +672,11 @@ export default {
|
|||||||
check_update: 'Check for updates',
|
check_update: 'Check for updates',
|
||||||
avail_update: 'New Update available',
|
avail_update: 'New Update available',
|
||||||
next_version: 'Next version',
|
next_version: 'Next version',
|
||||||
update: 'Update',
|
update: 'Update Now',
|
||||||
update_progress: 'Update in progress...',
|
update_progress: 'Update in progress...',
|
||||||
progress_text: 'It will just take a few minutes. Please do not refresh the screen or close the window before the update finishes'
|
progress_text: 'It will just take a few minutes. Please do not refresh the screen or close the window before the update finishes',
|
||||||
|
update_success: 'App has been updated successfully',
|
||||||
|
latest_message: 'No update available! You are on the latest version.'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
wizard: {
|
wizard: {
|
||||||
|
|||||||
@ -7,24 +7,24 @@
|
|||||||
{{ $t('settings.update_app.description') }}
|
{{ $t('settings.update_app.description') }}
|
||||||
</p>
|
</p>
|
||||||
<label class="input-label">Current version</label><br>
|
<label class="input-label">Current version</label><br>
|
||||||
<label class="version">1.0.0</label>
|
<label class="version mb-4">{{ currentVersion }}</label>
|
||||||
<base-button :outline="true" :disabled="isCheckingforUpdate" size="large" color="theme" @click="checkUpdate" >
|
<base-button :outline="true" :disabled="isCheckingforUpdate || isUpdating" size="large" color="theme" @click="checkUpdate" class="mb-4">
|
||||||
<font-awesome-icon :class="{'update': isCheckingforUpdate}" style="margin-right: 10px;" icon="sync-alt" />
|
<font-awesome-icon :class="{'update': isCheckingforUpdate}" style="margin-right: 10px;" icon="sync-alt" />
|
||||||
{{ $t('settings.update_app.check_update') }}
|
{{ $t('settings.update_app.check_update') }}
|
||||||
</base-button>
|
</base-button>
|
||||||
<hr>
|
<hr>
|
||||||
<div v-show="!isUpdating" v-if="isUpdateAvailable" class="mt-4 content">
|
<div v-show="!isUpdating" v-if="isUpdateAvailable" class="mt-4 content">
|
||||||
<h3 class="page-title">{{ $t('settings.update_app.avail_update') }}</h3>
|
<h3 class="page-title mb-3">{{ $t('settings.update_app.avail_update') }}</h3>
|
||||||
<label class="input-label">{{ $t('settings.update_app.next_version') }}</label><br>
|
<label class="input-label">{{ $t('settings.update_app.next_version') }}</label><br>
|
||||||
<label class="version">{{ updateData.version }}</label>
|
<label class="version">{{ updateData.version }}</label>
|
||||||
<p class="page-sub-title">
|
<p class="page-sub-title">
|
||||||
{{ description }}
|
{{ description }}
|
||||||
</p>
|
</p>
|
||||||
<base-button size="large" color="theme" @click="onUpdateApp">
|
<base-button size="large" icon="rocket" color="theme" @click="onUpdateApp">
|
||||||
{{ $t('settings.update_app.update') }}
|
{{ $t('settings.update_app.update') }}
|
||||||
</base-button>
|
</base-button>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="isUpdating">
|
<div v-if="isUpdating" class="mt-4 content">
|
||||||
<h3 class="page-title">{{ $t('settings.update_app.update_progress') }}</h3>
|
<h3 class="page-title">{{ $t('settings.update_app.update_progress') }}</h3>
|
||||||
<p class="page-sub-title">
|
<p class="page-sub-title">
|
||||||
{{ $t('settings.update_app.progress_text') }}
|
{{ $t('settings.update_app.progress_text') }}
|
||||||
@ -35,8 +35,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapActions, mapGetters } from 'vuex'
|
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
@ -47,6 +47,7 @@ export default {
|
|||||||
progress: 10,
|
progress: 10,
|
||||||
interval: null,
|
interval: null,
|
||||||
description: '',
|
description: '',
|
||||||
|
currentVersion: '',
|
||||||
updateData: {
|
updateData: {
|
||||||
isMinor: Boolean,
|
isMinor: Boolean,
|
||||||
installed: '',
|
installed: '',
|
||||||
@ -54,26 +55,44 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
},
|
|
||||||
mounted () {
|
mounted () {
|
||||||
|
window.axios.get('/api/settings/app/version').then((res) => {
|
||||||
|
this.currentVersion = res.data.version
|
||||||
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async onUpdateApp () {
|
async onUpdateApp () {
|
||||||
this.isUpdating = true
|
try {
|
||||||
const data = this.updateData
|
this.isUpdating = true
|
||||||
let response = await axios.post('/api/update', data)
|
let res = await window.axios.post('/api/update', this.updateData)
|
||||||
|
if (res.data.success) {
|
||||||
|
this.isUpdateAvailable = false
|
||||||
|
window.toastr['success'](this.$t('settings.update_app.update_success'))
|
||||||
|
this.currentVersion = this.updateData.version
|
||||||
|
} else {
|
||||||
|
console.log(res.data)
|
||||||
|
window.toastr['error'](res.data.error)
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
window.toastr['error']('Something went wrong')
|
||||||
|
}
|
||||||
|
|
||||||
this.isUpdating = false
|
this.isUpdating = false
|
||||||
this.isUpdateAvailable = false
|
|
||||||
},
|
},
|
||||||
async checkUpdate () {
|
async checkUpdate () {
|
||||||
try {
|
try {
|
||||||
this.isCheckingforUpdate = true
|
this.isCheckingforUpdate = true
|
||||||
let response = await axios.get('/api/check/update')
|
let response = await window.axios.get('/api/check/update')
|
||||||
this.isCheckingforUpdate = false
|
this.isCheckingforUpdate = false
|
||||||
|
|
||||||
|
if (!response.data.version) {
|
||||||
|
window.toastr['warning'](this.$t('settings.update_app.latest_message'))
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
this.updateData.isMinor = response.data.is_minor
|
this.updateData.isMinor = response.data.is_minor
|
||||||
this.updateData.version = response.data.version
|
this.updateData.version = response.data.version
|
||||||
|
|||||||
@ -52,7 +52,8 @@ import {
|
|||||||
faCopy,
|
faCopy,
|
||||||
faPaperPlane,
|
faPaperPlane,
|
||||||
faEyeSlash,
|
faEyeSlash,
|
||||||
faSyncAlt
|
faSyncAlt,
|
||||||
|
faRocket
|
||||||
} from '@fortawesome/free-solid-svg-icons'
|
} from '@fortawesome/free-solid-svg-icons'
|
||||||
import { far } from '@fortawesome/free-regular-svg-icons'
|
import { far } from '@fortawesome/free-regular-svg-icons'
|
||||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
|
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
|
||||||
@ -115,7 +116,8 @@ library.add(
|
|||||||
faEllipsisH,
|
faEllipsisH,
|
||||||
faCopy,
|
faCopy,
|
||||||
faPaperPlane,
|
faPaperPlane,
|
||||||
faSyncAlt
|
faSyncAlt,
|
||||||
|
faRocket
|
||||||
)
|
)
|
||||||
|
|
||||||
Vue.component('font-awesome-icon', FontAwesomeIcon)
|
Vue.component('font-awesome-icon', FontAwesomeIcon)
|
||||||
|
|||||||
Reference in New Issue
Block a user