mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-07 05:26:57 +02:00
Show error message instead of pushing to Error view
This commit is contained in:
parent
ee02fb5d92
commit
0451888b84
@ -4,16 +4,20 @@
|
|||||||
|
|
||||||
const appSettings = useAppSettingsStore()
|
const appSettings = useAppSettingsStore()
|
||||||
const isScanning = ref(false)
|
const isScanning = ref(false)
|
||||||
const isUpToDate = ref(null)
|
const isUpToDate = ref()
|
||||||
|
|
||||||
async function getLatestRelease() {
|
async function getLatestRelease() {
|
||||||
isScanning.value = true;
|
isScanning.value = true;
|
||||||
|
isUpToDate.value = undefined
|
||||||
|
|
||||||
await systemService.getLastRelease()
|
await systemService.getLastRelease({returnError: true})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
appSettings.latestRelease = response.data.newRelease
|
appSettings.latestRelease = response.data.newRelease
|
||||||
isUpToDate.value = response.data.newRelease === false
|
isUpToDate.value = response.data.newRelease === false
|
||||||
})
|
})
|
||||||
|
.catch(() => {
|
||||||
|
isUpToDate.value = null
|
||||||
|
})
|
||||||
|
|
||||||
isScanning.value = false;
|
isScanning.value = false;
|
||||||
}
|
}
|
||||||
@ -30,7 +34,10 @@
|
|||||||
<span class="release-flag"></span>{{ appSettings.latestRelease }} is available <a class="is-size-7" href="https://github.com/Bubka/2FAuth/releases">View on Github</a>
|
<span class="release-flag"></span>{{ appSettings.latestRelease }} is available <a class="is-size-7" href="https://github.com/Bubka/2FAuth/releases">View on Github</a>
|
||||||
</span>
|
</span>
|
||||||
<span v-if="isUpToDate" class="has-text-grey">
|
<span v-if="isUpToDate" class="has-text-grey">
|
||||||
{{ $t('commons.you_are_up_to_date') }}
|
<FontAwesomeIcon :icon="['fas', 'check']" class="mr-1 has-text-success" /> {{ $t('commons.you_are_up_to_date') }}
|
||||||
|
</span>
|
||||||
|
<span v-else-if="isUpToDate === null" class="has-text-grey">
|
||||||
|
<FontAwesomeIcon :icon="['fas', 'times']" class="mr-1 has-text-danger" />{{ $t('errors.check_failed_try_later') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
8
resources/js_vue3/services/systemService.js
vendored
8
resources/js_vue3/services/systemService.js
vendored
@ -7,16 +7,16 @@ export default {
|
|||||||
*
|
*
|
||||||
* @returns Promise
|
* @returns Promise
|
||||||
*/
|
*/
|
||||||
getSystemInfos() {
|
getSystemInfos(config = {}) {
|
||||||
return webClient.get('infos')
|
return webClient.get('infos', { ...config })
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @returns Promise
|
* @returns Promise
|
||||||
*/
|
*/
|
||||||
getLastRelease() {
|
getLastRelease(config = {}) {
|
||||||
return webClient.get('latestRelease')
|
return webClient.get('latestRelease', { ...config })
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -17,7 +17,7 @@
|
|||||||
const listAdminSettings = ref(null)
|
const listAdminSettings = ref(null)
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
systemService.getSystemInfos().then(response => {
|
systemService.getSystemInfos({returnError: true}).then(response => {
|
||||||
infos.value = response.data.common
|
infos.value = response.data.common
|
||||||
|
|
||||||
if (response.data.admin_settings) {
|
if (response.data.admin_settings) {
|
||||||
@ -28,6 +28,9 @@
|
|||||||
userPreferences.value = response.data.user_preferences
|
userPreferences.value = response.data.user_preferences
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.catch(() => {
|
||||||
|
infos.value = null
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
function copyToClipboard(data) {
|
function copyToClipboard(data) {
|
||||||
@ -94,7 +97,7 @@
|
|||||||
<h2 class="title is-5 has-text-grey-light">
|
<h2 class="title is-5 has-text-grey-light">
|
||||||
{{ $t('commons.environment') }}
|
{{ $t('commons.environment') }}
|
||||||
</h2>
|
</h2>
|
||||||
<div class="about-debug box is-family-monospace is-size-7">
|
<div v-if="infos" class="about-debug box is-family-monospace is-size-7">
|
||||||
<button id="btnCopyEnvVars" :aria-label="$t('commons.copy_to_clipboard')" class="button is-like-text is-pulled-right is-small is-text" @click.stop="copyToClipboard(listInfos.innerText)">
|
<button id="btnCopyEnvVars" :aria-label="$t('commons.copy_to_clipboard')" class="button is-like-text is-pulled-right is-small is-text" @click.stop="copyToClipboard(listInfos.innerText)">
|
||||||
<FontAwesomeIcon :icon="['fas', 'copy']" />
|
<FontAwesomeIcon :icon="['fas', 'copy']" />
|
||||||
</button>
|
</button>
|
||||||
@ -102,6 +105,9 @@
|
|||||||
<li v-for="(value, key) in infos" :value="value" :key="key"><b>{{key}}</b>: {{value}}</li>
|
<li v-for="(value, key) in infos" :value="value" :key="key"><b>{{key}}</b>: {{value}}</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else-if="infos === null" class="about-debug box is-family-monospace is-size-7 has-text-warning-dark">
|
||||||
|
{{ $t('errors.error_during_data_fetching') }}
|
||||||
|
</div>
|
||||||
<h2 v-if="adminSettings" class="title is-5 has-text-grey-light">
|
<h2 v-if="adminSettings" class="title is-5 has-text-grey-light">
|
||||||
{{ $t('settings.admin_settings') }}
|
{{ $t('settings.admin_settings') }}
|
||||||
</h2>
|
</h2>
|
||||||
|
@ -56,5 +56,7 @@ return [
|
|||||||
'file_upload_failed' => 'File upload failed',
|
'file_upload_failed' => 'File upload failed',
|
||||||
'unauthorized' => 'Unauthorized',
|
'unauthorized' => 'Unauthorized',
|
||||||
'unauthorized_legend' => 'You do not have permissions to view this resource or to perform this action',
|
'unauthorized_legend' => 'You do not have permissions to view this resource or to perform this action',
|
||||||
'cannot_delete_the_only_admin' => 'Cannot delete the only admin account'
|
'cannot_delete_the_only_admin' => 'Cannot delete the only admin account',
|
||||||
|
'error_during_data_fetching' => '💀 Something went wrong during data fetching',
|
||||||
|
'check_failed_try_later' => 'Check failed, please retry later',
|
||||||
];
|
];
|
Loading…
x
Reference in New Issue
Block a user