mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 04:01:10 -04:00
Add steps for update app
This commit is contained in:
committed by
Mohit Panjwani
parent
e31b60bc48
commit
654395a175
@ -43,7 +43,7 @@ class UpdateController extends Controller
|
|||||||
return response()->json([
|
return response()->json([
|
||||||
'success' => false,
|
'success' => false,
|
||||||
'error' => $e->getMessage()
|
'error' => $e->getMessage()
|
||||||
]);
|
], 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,8 +23,6 @@ class CreateExpensesTable extends Migration
|
|||||||
$table->foreign('expense_category_id')->references('id')->on('expense_categories')->onDelete('cascade');
|
$table->foreign('expense_category_id')->references('id')->on('expense_categories')->onDelete('cascade');
|
||||||
$table->integer('company_id')->unsigned()->nullable();
|
$table->integer('company_id')->unsigned()->nullable();
|
||||||
$table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade');
|
$table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade');
|
||||||
$table->integer('user_id')->unsigned()->nullable();
|
|
||||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,14 +62,14 @@
|
|||||||
"four_zero_four": "404",
|
"four_zero_four": "404",
|
||||||
"you_got_lost": "عفواً! يبدو أنك قد تهت!",
|
"you_got_lost": "عفواً! يبدو أنك قد تهت!",
|
||||||
"go_home": "عودة إلى الرئيسية",
|
"go_home": "عودة إلى الرئيسية",
|
||||||
|
|
||||||
"setting_updated": "تم تحديث الإعدادات بنجاح",
|
"setting_updated": "تم تحديث الإعدادات بنجاح",
|
||||||
"select_state": "اختر الولاية/المنطقة",
|
"select_state": "اختر الولاية/المنطقة",
|
||||||
"select_country": "اختر الدولة",
|
"select_country": "اختر الدولة",
|
||||||
"select_city": "اختر المدينة",
|
"select_city": "اختر المدينة",
|
||||||
"street_1": "عنوان الشارع 1",
|
"street_1": "عنوان الشارع 1",
|
||||||
"street_2": "عنوان الشارع 2",
|
"street_2": "عنوان الشارع 2",
|
||||||
"action_failed": "فشلت العملية"
|
"action_failed": "فشلت العملية",
|
||||||
|
"retry": "أعد المحاولة"
|
||||||
},
|
},
|
||||||
"dashboard": {
|
"dashboard": {
|
||||||
"select_year": "اختر السنة",
|
"select_year": "اختر السنة",
|
||||||
@ -752,7 +752,14 @@
|
|||||||
"progress_text": "سوف يستغرق التحديث بضع دقائق. يرجى عدم تحديث الشاشة أو إغلاق النافذة قبل انتهاء التحديث",
|
"progress_text": "سوف يستغرق التحديث بضع دقائق. يرجى عدم تحديث الشاشة أو إغلاق النافذة قبل انتهاء التحديث",
|
||||||
"update_success": "تم تحديث النظام! يرجى الانتظار حتى يتم إعادة تحميل نافذة المتصفح تلقائيًا.",
|
"update_success": "تم تحديث النظام! يرجى الانتظار حتى يتم إعادة تحميل نافذة المتصفح تلقائيًا.",
|
||||||
"latest_message": "لا يوجد تحديثات متوفرة! لديك حالياً أحدث نسخة.",
|
"latest_message": "لا يوجد تحديثات متوفرة! لديك حالياً أحدث نسخة.",
|
||||||
"current_version": "النسخة الحالية"
|
"current_version": "النسخة الحالية",
|
||||||
|
"download_zip_file": "تنزيل ملف ZIP",
|
||||||
|
"unzipping_package": "حزمة فك الضغط",
|
||||||
|
"copying_files": "نسخ الملفات",
|
||||||
|
"running_migrations": "إدارة عمليات الترحيل",
|
||||||
|
"finishing_update": "تحديث التشطيب",
|
||||||
|
"update_failed": "فشل التحديث",
|
||||||
|
"update_failed_text": "آسف! فشل التحديث الخاص بك في: {step} خطوة"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"wizard": {
|
"wizard": {
|
||||||
|
|||||||
@ -76,7 +76,8 @@
|
|||||||
"select_city": "Stadt wählen",
|
"select_city": "Stadt wählen",
|
||||||
"street_1": "Straße",
|
"street_1": "Straße",
|
||||||
"street_2": "Zusatz Strasse",
|
"street_2": "Zusatz Strasse",
|
||||||
"action_failed": "Aktion fehlgeschlagen"
|
"action_failed": "Aktion fehlgeschlagen",
|
||||||
|
"retry": "Wiederholen"
|
||||||
},
|
},
|
||||||
"dashboard": {
|
"dashboard": {
|
||||||
"select_year": "Jahr wählen",
|
"select_year": "Jahr wählen",
|
||||||
@ -775,7 +776,14 @@
|
|||||||
"progress_text": "Es dauert nur ein paar Minuten. Bitte aktualisieren Sie den Bildschirm nicht und schließen Sie das Fenster nicht, bevor das Update abgeschlossen ist.",
|
"progress_text": "Es dauert nur ein paar Minuten. Bitte aktualisieren Sie den Bildschirm nicht und schließen Sie das Fenster nicht, bevor das Update abgeschlossen ist.",
|
||||||
"update_success": "App wurde aktualisiert! Bitte warten Sie, während Ihr Browserfenster automatisch neu geladen wird.",
|
"update_success": "App wurde aktualisiert! Bitte warten Sie, während Ihr Browserfenster automatisch neu geladen wird.",
|
||||||
"latest_message": "Kein Update verfügbar! Du bist auf der neuesten Version.",
|
"latest_message": "Kein Update verfügbar! Du bist auf der neuesten Version.",
|
||||||
"current_version": "Aktuelle Version"
|
"current_version": "Aktuelle Version",
|
||||||
|
"download_zip_file": "Laden Sie die ZIP-Datei herunter",
|
||||||
|
"unzipping_package": "Paket entpacken",
|
||||||
|
"copying_files": "Dateien kopieren",
|
||||||
|
"running_migrations": "Ausführen von Migrationen",
|
||||||
|
"finishing_update": "Update beenden",
|
||||||
|
"update_failed": "Update fehlgeschlagen",
|
||||||
|
"update_failed_text": "Es tut uns leid! Ihr Update ist am folgenden Schritt fehlgeschlagen: {step}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"wizard": {
|
"wizard": {
|
||||||
|
|||||||
@ -70,14 +70,14 @@
|
|||||||
"go_home": "Go Home",
|
"go_home": "Go Home",
|
||||||
"test_mail_conf": "Test Mail Configuration",
|
"test_mail_conf": "Test Mail Configuration",
|
||||||
"send_mail_successfully": "Mail sent successfully",
|
"send_mail_successfully": "Mail sent successfully",
|
||||||
|
|
||||||
"setting_updated": "Setting updated successfully",
|
"setting_updated": "Setting updated successfully",
|
||||||
"select_state": "Select state",
|
"select_state": "Select state",
|
||||||
"select_country": "Select Country",
|
"select_country": "Select Country",
|
||||||
"select_city": "Select City",
|
"select_city": "Select City",
|
||||||
"street_1": "Street 1",
|
"street_1": "Street 1",
|
||||||
"street_2": "Street 2",
|
"street_2": "Street 2",
|
||||||
"action_failed": "Action Failed"
|
"action_failed": "Action Failed",
|
||||||
|
"retry": "Retry"
|
||||||
},
|
},
|
||||||
"dashboard": {
|
"dashboard": {
|
||||||
"select_year": "Select year",
|
"select_year": "Select year",
|
||||||
@ -787,7 +787,14 @@
|
|||||||
"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! Please wait while your browser window gets reloaded automatically.",
|
"update_success": "App has been updated! Please wait while your browser window gets reloaded automatically.",
|
||||||
"latest_message": "No update available! You are on the latest version.",
|
"latest_message": "No update available! You are on the latest version.",
|
||||||
"current_version": "Current Version"
|
"current_version": "Current Version",
|
||||||
|
"download_zip_file": "Download ZIP file",
|
||||||
|
"unzipping_package": "Unzipping Package",
|
||||||
|
"copying_files": "Copying Files",
|
||||||
|
"running_migrations": "Running Migrations",
|
||||||
|
"finishing_update": "Finishing Update",
|
||||||
|
"update_failed": "Update Failed",
|
||||||
|
"update_failed_text": "Sorry! Your update failed on : {step} step"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"wizard": {
|
"wizard": {
|
||||||
|
|||||||
@ -62,14 +62,14 @@
|
|||||||
"four_zero_four": "404",
|
"four_zero_four": "404",
|
||||||
"you_got_lost": "Whoops! ¡Te perdiste!",
|
"you_got_lost": "Whoops! ¡Te perdiste!",
|
||||||
"go_home": "Volver al Inicio",
|
"go_home": "Volver al Inicio",
|
||||||
|
|
||||||
"setting_updated": "Configuración actualizada con éxito",
|
"setting_updated": "Configuración actualizada con éxito",
|
||||||
"select_state": "Seleccionar estado",
|
"select_state": "Seleccionar estado",
|
||||||
"select_country": "Seleccionar país",
|
"select_country": "Seleccionar país",
|
||||||
"select_city": "Seleccionar ciudad",
|
"select_city": "Seleccionar ciudad",
|
||||||
"street_1": "Calle 1",
|
"street_1": "Calle 1",
|
||||||
"street_2": "Calle 2",
|
"street_2": "Calle 2",
|
||||||
"action_failed": "Accion Fallida"
|
"action_failed": "Accion Fallida",
|
||||||
|
"retry": "Procesar de nuevo"
|
||||||
},
|
},
|
||||||
"dashboard": {
|
"dashboard": {
|
||||||
"select_year": "Seleccionar año",
|
"select_year": "Seleccionar año",
|
||||||
@ -751,7 +751,14 @@
|
|||||||
"progress_text": "Solo tomará unos minutos. No actualice la pantalla ni cierre la ventana antes de que finalice la actualización.",
|
"progress_text": "Solo tomará unos minutos. No actualice la pantalla ni cierre la ventana antes de que finalice la actualización.",
|
||||||
"update_success": "¡La aplicación ha sido actualizada! Espere mientras la ventana de su navegador se vuelve a cargar automáticamente.",
|
"update_success": "¡La aplicación ha sido actualizada! Espere mientras la ventana de su navegador se vuelve a cargar automáticamente.",
|
||||||
"latest_message": "¡Actualización no disponible! Estás en la última versión.",
|
"latest_message": "¡Actualización no disponible! Estás en la última versión.",
|
||||||
"current_version": "Versión actual"
|
"current_version": "Versión actual",
|
||||||
|
"download_zip_file": "Descargar archivo ZIP",
|
||||||
|
"unzipping_package": "Descomprimir paquete",
|
||||||
|
"copying_files": "Copiando documentos",
|
||||||
|
"running_migrations": "Ejecutar migraciones",
|
||||||
|
"finishing_update": "Actualización final",
|
||||||
|
"update_failed": "Actualización fallida",
|
||||||
|
"update_failed_text": "¡Lo siento! Su actualización falló el: {step} paso"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"wizard": {
|
"wizard": {
|
||||||
|
|||||||
@ -76,7 +76,8 @@
|
|||||||
"ascending": "Ascendant",
|
"ascending": "Ascendant",
|
||||||
"descending": "Descendant",
|
"descending": "Descendant",
|
||||||
"subject": "matière",
|
"subject": "matière",
|
||||||
"message": "Message"
|
"message": "Message",
|
||||||
|
"retry": "Réessayez"
|
||||||
},
|
},
|
||||||
"dashboard": {
|
"dashboard": {
|
||||||
"select_year": "Sélectionnez l'année",
|
"select_year": "Sélectionnez l'année",
|
||||||
@ -794,7 +795,14 @@
|
|||||||
"progress_text": "Cela ne prendra que quelques minutes. S'il vous plaît ne pas actualiser l'écran ou fermer la fenêtre avant la fin de la mise à jour",
|
"progress_text": "Cela ne prendra que quelques minutes. S'il vous plaît ne pas actualiser l'écran ou fermer la fenêtre avant la fin de la mise à jour",
|
||||||
"update_success": "App a été mis à jour! Veuillez patienter pendant le rechargement automatique de la fenêtre de votre navigateur.",
|
"update_success": "App a été mis à jour! Veuillez patienter pendant le rechargement automatique de la fenêtre de votre navigateur.",
|
||||||
"latest_message": "Pas de mise a jour disponible! Vous êtes sur la dernière version.",
|
"latest_message": "Pas de mise a jour disponible! Vous êtes sur la dernière version.",
|
||||||
"current_version": "Version actuelle"
|
"current_version": "Version actuelle",
|
||||||
|
"download_zip_file": "Télécharger le fichier ZIP",
|
||||||
|
"unzipping_package": "Dézipper le package",
|
||||||
|
"copying_files": "Copie de fichiers",
|
||||||
|
"running_migrations": "Exécution de migrations",
|
||||||
|
"finishing_update": "Mise à jour de finition",
|
||||||
|
"update_failed": "Mise à jour a échoué",
|
||||||
|
"update_failed_text": "Désolé! Votre mise à jour a échoué à: {step} étape"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"wizard": {
|
"wizard": {
|
||||||
|
|||||||
@ -71,14 +71,14 @@
|
|||||||
"go_home": "Vai alla Home",
|
"go_home": "Vai alla Home",
|
||||||
"test_mail_conf": "Configurazione della mail di test",
|
"test_mail_conf": "Configurazione della mail di test",
|
||||||
"send_mail_successfully": "Mail inviata con successo",
|
"send_mail_successfully": "Mail inviata con successo",
|
||||||
|
|
||||||
"setting_updated": "Configurazioni aggiornate con successo",
|
"setting_updated": "Configurazioni aggiornate con successo",
|
||||||
"select_state": "Seleziona lo Stato",
|
"select_state": "Seleziona lo Stato",
|
||||||
"select_country": "Seleziona Paese",
|
"select_country": "Seleziona Paese",
|
||||||
"select_city": "Seleziona Città",
|
"select_city": "Seleziona Città",
|
||||||
"street_1": "Indirizzo 1",
|
"street_1": "Indirizzo 1",
|
||||||
"street_2": "Indirizzo 2",
|
"street_2": "Indirizzo 2",
|
||||||
"action_failed": "Errore"
|
"action_failed": "Errore",
|
||||||
|
"retry": "Retry"
|
||||||
},
|
},
|
||||||
"dashboard": {
|
"dashboard": {
|
||||||
"select_year": "Seleziona anno",
|
"select_year": "Seleziona anno",
|
||||||
@ -786,7 +786,14 @@
|
|||||||
"progress_text": "Sarà necessario qualche minuto. Per favore non aggiornare la pagina e non chiudere la finestra prima che l'aggiornamento sia completato",
|
"progress_text": "Sarà necessario qualche minuto. Per favore non aggiornare la pagina e non chiudere la finestra prima che l'aggiornamento sia completato",
|
||||||
"update_success": "L'App è aggiornata! Attendi che la pagina venga ricaricata automaticamente.",
|
"update_success": "L'App è aggiornata! Attendi che la pagina venga ricaricata automaticamente.",
|
||||||
"latest_message": "Nessun aggiornamneto disponibile! Sei già alla versione più recente.",
|
"latest_message": "Nessun aggiornamneto disponibile! Sei già alla versione più recente.",
|
||||||
"current_version": "Versione corrente"
|
"current_version": "Versione corrente",
|
||||||
|
"download_zip_file": "Scarica il file ZIP",
|
||||||
|
"unzipping_package": "Pacchetto di decompressione",
|
||||||
|
"copying_files": "Copia dei file",
|
||||||
|
"running_migrations": "Esecuzione delle migrazioni",
|
||||||
|
"finishing_update": "Aggiornamento di finitura",
|
||||||
|
"update_failed": "Aggiornamento non riuscito",
|
||||||
|
"update_failed_text": "Scusate! L'aggiornamento non è riuscito il: passaggio {step}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"wizard": {
|
"wizard": {
|
||||||
|
|||||||
@ -62,14 +62,14 @@
|
|||||||
"four_zero_four": "404",
|
"four_zero_four": "404",
|
||||||
"you_got_lost": "Ops! Se perdeu!",
|
"you_got_lost": "Ops! Se perdeu!",
|
||||||
"go_home": "Ir para Home",
|
"go_home": "Ir para Home",
|
||||||
|
|
||||||
"setting_updated": "Configuração atualizada com sucesso",
|
"setting_updated": "Configuração atualizada com sucesso",
|
||||||
"select_state": "Selecione Estado",
|
"select_state": "Selecione Estado",
|
||||||
"select_country": "Selecionar pais",
|
"select_country": "Selecionar pais",
|
||||||
"select_city": "Selecionar cidade",
|
"select_city": "Selecionar cidade",
|
||||||
"street_1": "Rua 1",
|
"street_1": "Rua 1",
|
||||||
"street_2": "Rua # 2",
|
"street_2": "Rua # 2",
|
||||||
"action_failed": "Ação: Falhou"
|
"action_failed": "Ação: Falhou",
|
||||||
|
"retry": "Atualização falhou"
|
||||||
},
|
},
|
||||||
"dashboard": {
|
"dashboard": {
|
||||||
"select_year": "Selecione Ano",
|
"select_year": "Selecione Ano",
|
||||||
@ -751,7 +751,14 @@
|
|||||||
"progress_text": "Levará apenas alguns minutos. Não atualize a tela ou feche a janela antes que a atualização seja concluída",
|
"progress_text": "Levará apenas alguns minutos. Não atualize a tela ou feche a janela antes que a atualização seja concluída",
|
||||||
"update_success": "O aplicativo foi atualizado! Aguarde enquanto a janela do navegador é recarregada automaticamente.",
|
"update_success": "O aplicativo foi atualizado! Aguarde enquanto a janela do navegador é recarregada automaticamente.",
|
||||||
"latest_message": "Nenhuma atualização disponível! Você está na versão mais recente.",
|
"latest_message": "Nenhuma atualização disponível! Você está na versão mais recente.",
|
||||||
"current_version": "Versão Atual"
|
"current_version": "Versão Atual",
|
||||||
|
"download_zip_file": "Baixar arquivo ZIP",
|
||||||
|
"unzipping_package": "Descompactando o pacote",
|
||||||
|
"copying_files": "Copiando arquivos",
|
||||||
|
"running_migrations": "Executando migrações",
|
||||||
|
"finishing_update": "Atualização de acabamento",
|
||||||
|
"update_failed": "Atualização falhou",
|
||||||
|
"update_failed_text": "Desculpa! Sua atualização falhou em: {step} step"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"wizard": {
|
"wizard": {
|
||||||
|
|||||||
@ -1,33 +1,76 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="setting-main-container">
|
<div class="setting-main-container update-container">
|
||||||
<div class="card setting-card">
|
<div class="card setting-card">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h3 class="page-title">{{ $t('settings.update_app.title') }}</h3>
|
<h3 class="page-title">{{ $t('settings.update_app.title') }}</h3>
|
||||||
<p class="page-sub-title">
|
<p class="page-sub-title">
|
||||||
{{ $t('settings.update_app.description') }}
|
{{ $t('settings.update_app.description') }}
|
||||||
</p>
|
</p>
|
||||||
<label class="input-label">{{ $t('settings.update_app.current_version') }}</label><br>
|
<label class="input-label">{{
|
||||||
|
$t('settings.update_app.current_version')
|
||||||
|
}}</label
|
||||||
|
><br />
|
||||||
<label class="version mb-4">{{ currentVersion }}</label>
|
<label class="version mb-4">{{ currentVersion }}</label>
|
||||||
<base-button :outline="true" :disabled="isCheckingforUpdate || isUpdating" size="large" color="theme" class="mb-4" @click="checkUpdate">
|
<base-button
|
||||||
<font-awesome-icon :class="{'update': isCheckingforUpdate}" style="margin-right: 10px;" icon="sync-alt" />
|
:outline="true"
|
||||||
|
:disabled="isCheckingforUpdate || isUpdating"
|
||||||
|
size="large"
|
||||||
|
color="theme"
|
||||||
|
class="mb-4"
|
||||||
|
@click="checkUpdate"
|
||||||
|
>
|
||||||
|
<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 mb-3">{{ $t('settings.update_app.avail_update') }}</h3>
|
<h3 class="page-title mb-3">
|
||||||
<label class="input-label">{{ $t('settings.update_app.next_version') }}</label><br>
|
{{ $t('settings.update_app.avail_update') }}
|
||||||
|
</h3>
|
||||||
|
<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" style="white-space: pre-wrap;">{{ description }}</p>
|
<p class="page-sub-title" style="white-space: pre-wrap;">{{ description }}</p>
|
||||||
<base-button size="large" icon="rocket" 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" class="mt-4 content">
|
<div v-if="isUpdating" class="mt-4 content">
|
||||||
<h3 class="page-title">{{ $t('settings.update_app.update_progress') }}</h3>
|
<div class="d-flex flex-row justify-content-between">
|
||||||
<p class="page-sub-title">
|
<div>
|
||||||
{{ $t('settings.update_app.progress_text') }}
|
<h3 class="page-title">
|
||||||
</p>
|
{{ $t('settings.update_app.update_progress') }}
|
||||||
<font-awesome-icon icon="spinner" class="fa-spin"/>
|
</h3>
|
||||||
|
<p class="page-sub-title">
|
||||||
|
{{ $t('settings.update_app.progress_text') }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<font-awesome-icon icon="spinner" class="update-spinner fa-spin" />
|
||||||
|
</div>
|
||||||
|
<ul class="update-steps-container">
|
||||||
|
<li class="update-step" v-for="step in updateSteps">
|
||||||
|
<p class="update-step-text">{{ $t(step.translationKey) }}</p>
|
||||||
|
<div class="update-status-container">
|
||||||
|
<span v-if="step.time" class="update-time">{{
|
||||||
|
step.time
|
||||||
|
}}</span>
|
||||||
|
<span :class="'update-status status-' + getStatus(step)">{{
|
||||||
|
getStatus(step)
|
||||||
|
}}</span>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -36,7 +79,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data() {
|
||||||
return {
|
return {
|
||||||
isShowProgressBar: false,
|
isShowProgressBar: false,
|
||||||
isUpdateAvailable: false,
|
isUpdateAvailable: false,
|
||||||
@ -46,60 +89,78 @@ export default {
|
|||||||
interval: null,
|
interval: null,
|
||||||
description: '',
|
description: '',
|
||||||
currentVersion: '',
|
currentVersion: '',
|
||||||
|
updateSteps: [
|
||||||
|
{
|
||||||
|
translationKey: 'settings.update_app.download_zip_file',
|
||||||
|
stepUrl: '/api/update/download',
|
||||||
|
time: null,
|
||||||
|
started: false,
|
||||||
|
completed: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
translationKey: 'settings.update_app.unzipping_package',
|
||||||
|
stepUrl: '/api/update/unzip',
|
||||||
|
time: null,
|
||||||
|
started: false,
|
||||||
|
completed: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
translationKey: 'settings.update_app.copying_files',
|
||||||
|
stepUrl: '/api/update/copy',
|
||||||
|
time: null,
|
||||||
|
started: false,
|
||||||
|
completed: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
translationKey: 'settings.update_app.running_migrations',
|
||||||
|
stepUrl: '/api/update/migrate',
|
||||||
|
time: null,
|
||||||
|
started: false,
|
||||||
|
completed: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
translationKey: 'settings.update_app.finishing_update',
|
||||||
|
stepUrl: '/api/update/finish',
|
||||||
|
time: null,
|
||||||
|
started: false,
|
||||||
|
completed: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
updateData: {
|
updateData: {
|
||||||
isMinor: Boolean,
|
isMinor: Boolean,
|
||||||
installed: '',
|
installed: '',
|
||||||
version: ''
|
version: '',
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created() {
|
||||||
window.addEventListener('beforeunload', (event) => {
|
window.addEventListener('beforeunload', (event) => {
|
||||||
if (this.isUpdating) {
|
if (this.isUpdating) {
|
||||||
event.returnValue = 'Update is in progress!'
|
event.returnValue = 'Update is in progress!'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted() {
|
||||||
window.axios.get('/api/settings/app/version').then((res) => {
|
window.axios.get('/api/settings/app/version').then((res) => {
|
||||||
this.currentVersion = res.data.version
|
this.currentVersion = res.data.version
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
closeHandler () {
|
closeHandler() {
|
||||||
console.log('closing')
|
console.log('closing')
|
||||||
},
|
},
|
||||||
async onUpdateApp () {
|
getStatus(step) {
|
||||||
try {
|
if (step.started && step.completed) {
|
||||||
this.isUpdating = true
|
return 'finished'
|
||||||
this.updateData.installed = this.currentVersion
|
} else if (step.started && !step.completed) {
|
||||||
let res = await window.axios.post('/api/update', this.updateData)
|
return 'running'
|
||||||
|
} else if (!step.started && !step.completed) {
|
||||||
if (res.data.success) {
|
return 'pending'
|
||||||
setTimeout(async () => {
|
} else {
|
||||||
await window.axios.post('/api/update/finish', this.updateData)
|
return 'error'
|
||||||
|
|
||||||
window.toastr['success'](this.$t('settings.update_app.update_success'))
|
|
||||||
this.currentVersion = this.updateData.version
|
|
||||||
this.isUpdateAvailable = false
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
location.reload()
|
|
||||||
}, 2000)
|
|
||||||
}, 1000)
|
|
||||||
} 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
|
|
||||||
},
|
},
|
||||||
|
async checkUpdate() {
|
||||||
async checkUpdate () {
|
|
||||||
try {
|
try {
|
||||||
this.isCheckingforUpdate = true
|
this.isCheckingforUpdate = true
|
||||||
let response = await window.axios.get('/api/check/update')
|
let response = await window.axios.get('/api/check/update')
|
||||||
@ -122,8 +183,67 @@ export default {
|
|||||||
this.isCheckingforUpdate = false
|
this.isCheckingforUpdate = false
|
||||||
window.toastr['error']('Something went wrong')
|
window.toastr['error']('Something went wrong')
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
async onUpdateApp() {
|
||||||
|
let path = null
|
||||||
|
|
||||||
|
for (let index = 0; index < this.updateSteps.length; index++) {
|
||||||
|
let currentStep = this.updateSteps[index]
|
||||||
|
try {
|
||||||
|
this.isUpdating = true
|
||||||
|
currentStep.started = true
|
||||||
|
let updateParams = {
|
||||||
|
version: this.updateData.version,
|
||||||
|
installed: this.currentVersion,
|
||||||
|
path: path || null,
|
||||||
|
}
|
||||||
|
|
||||||
|
let requestResponse = await window.axios.post(
|
||||||
|
currentStep.stepUrl,
|
||||||
|
updateParams
|
||||||
|
)
|
||||||
|
currentStep.completed = true
|
||||||
|
if (requestResponse.data && requestResponse.data.path) {
|
||||||
|
path = requestResponse.data.path
|
||||||
|
}
|
||||||
|
|
||||||
|
// on finish
|
||||||
|
if (
|
||||||
|
currentStep.translationKey == 'settings.update_app.finishing_update'
|
||||||
|
) {
|
||||||
|
this.isUpdating = false
|
||||||
|
window.toastr['success'](
|
||||||
|
this.$t('settings.update_app.update_success')
|
||||||
|
)
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
location.reload()
|
||||||
|
}, 3000)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
currentStep.started = false
|
||||||
|
currentStep.completed = true
|
||||||
|
window.toastr['error'](this.$t('validation.something_went_wrong'))
|
||||||
|
this.onUpdateFailed(currentStep.translationKey)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onUpdateFailed(translationKey) {
|
||||||
|
let stepName = this.$t(translationKey)
|
||||||
|
swal({
|
||||||
|
title: this.$t('settings.update_app.update_failed'),
|
||||||
|
text: this.$tc('settings.update_app.update_failed_text', stepName, {step: stepName}),
|
||||||
|
buttons: [this.$t('general.cancel'), this.$t('general.retry')],
|
||||||
|
}).then(async (value) => {
|
||||||
|
if (value) {
|
||||||
|
this.onUpdateApp()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.isUpdating = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
78
resources/assets/sass/pages/settings.scss
vendored
78
resources/assets/sass/pages/settings.scss
vendored
@ -122,6 +122,84 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.update-container {
|
||||||
|
|
||||||
|
.update-spinner {
|
||||||
|
font-size: 30px;
|
||||||
|
color: $ls-color-gray--dark;
|
||||||
|
}
|
||||||
|
|
||||||
|
.update-steps-container {
|
||||||
|
list-style-type: none;
|
||||||
|
width: 100%;
|
||||||
|
padding: 0px;
|
||||||
|
|
||||||
|
.update-step {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 10px 0px;
|
||||||
|
border-bottom: 1px solid $ls-color-gray--light;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
border-bottom: 0px solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.update-step-text {
|
||||||
|
font-size: $font-size-base;
|
||||||
|
margin: 0px;
|
||||||
|
line-height: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.update-status-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.update-time {
|
||||||
|
font-size: 10px;
|
||||||
|
color: $ls-color-gray--dark;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.update-status {
|
||||||
|
font-size: 13px;
|
||||||
|
width: 88px;
|
||||||
|
height: 28px;
|
||||||
|
display: block;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 30px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
line-height: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-pending {
|
||||||
|
background-color: #EAF1FB;
|
||||||
|
color: $ls-color-secondary;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-running {
|
||||||
|
background-color: rgba(21, 178, 236, 0.15);
|
||||||
|
color: $ls-color-light-blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-finished {
|
||||||
|
background-color: #D4F6EE;
|
||||||
|
color: $ls-color-green;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-error {
|
||||||
|
background-color: rgba(251, 113, 120, 0.22);
|
||||||
|
color: $ls-color-red;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
.add-new-tax {
|
.add-new-tax {
|
||||||
height: 45px;
|
height: 45px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|||||||
Reference in New Issue
Block a user