fix update validation toaster

This commit is contained in:
yogesh_gohil
2020-11-06 19:09:17 +05:30
parent 4484765358
commit e379e13802
2 changed files with 14 additions and 18 deletions

View File

@ -33,10 +33,10 @@ class Updater
if ($data->success && $data->version) {
$extensions = $data->version->extensions;
$extensionData = [];
foreach ($extensions as $extension) {
$extensionData[$extension] = phpversion($extension);
foreach (json_decode($extensions) as $extension) {
$extensionData[$extension] = phpversion($extension) ? true : false;
}
$extensionData['php'] = phpversion();
$extensionData['php'. '('.$data->version->minimum_php_version.')'] = version_compare(phpversion(), $data->version->minimum_php_version, ">=");
$data->version->extensions = $extensionData;
}

View File

@ -48,15 +48,7 @@
class="col-md-8 p-0"
>
<div class="update-requirements">
<div v-if="i == 'php'" class="d-flex justify-content-between">
<span>{{ i }}({{ minPhpVesrion }})</span>
<span
v-if="$utils.compareVersion(ext, minPhpVesrion) != -1"
class="verified"
/>
<span v-else class="not-verified" />
</div>
<div v-else class="d-flex justify-content-between">
<div class="d-flex justify-content-between">
<span>{{ i }}</span>
<span v-if="ext" class="verified" />
<span v-else class="not-verified" />
@ -163,6 +155,15 @@ export default {
minPhpVesrion: null,
}
},
computed: {
allowToUpdate() {
if (this.requiredExtentions !== null) {
return Object.keys(this.requiredExtentions).every((k) => {
return this.requiredExtentions[k]
})
}
},
},
created() {
window.addEventListener('beforeunload', (event) => {
if (this.isUpdating) {
@ -218,12 +219,7 @@ export default {
},
async onUpdateApp() {
let path = null
if (
this.$utils.compareVersion(
this.requiredExtentions.php,
this.minPhpVesrion
) == -1
) {
if (!this.allowToUpdate) {
window.toastr['error'](
'Your current configuration does not match the update requirements. Please try again after all the requirements are fulfilled. '
)