From a216187055b1ee6a3ecc9570f73b1d369c8cee5e Mon Sep 17 00:00:00 2001 From: Hunter Long Date: Mon, 14 Sep 2020 19:34:51 -0700 Subject: [PATCH] 0.90.67 (#817) * notifier panic fix * portainer template * remove default host from discord notifier * fix for updating fields * fix for updating fields * fixed notifier panic * fixed notifier panic * test fix * test fix * missing login banner image * dont delete admin if DEMO_MODE * updatess to service on Dashboard * notifier endpoint fixes, timeframe rounding chart data * modal for UI confirmations * UI fixes, import/export views * export HTTP test * start/end time * i18n language generate script from aws * i18n language generate script from aws * i18n language generate * bug: use v-model.number instead of v-model to capture notify_before (#813) Co-authored-by: Hunter Long * theme editor fixes, config changes * css fix Co-authored-by: Marc Binder --- CHANGELOG.md | 4 ++++ frontend/src/assets/scss/layout.scss | 2 +- frontend/src/languages/chinese.js | 10 ++++++++- frontend/src/languages/data.csv | 5 +++++ frontend/src/languages/english.js | 10 ++++++++- frontend/src/languages/french.js | 10 ++++++++- frontend/src/languages/german.js | 10 ++++++++- frontend/src/languages/italian.js | 10 ++++++++- frontend/src/languages/japanese.js | 10 ++++++++- frontend/src/languages/korean.js | 10 ++++++++- frontend/src/languages/russian.js | 10 ++++++++- frontend/src/languages/spanish.js | 10 ++++++++- handlers/api.go | 15 +++++++++++++- handlers/dashboard.go | 1 + types/configs/load.go | 31 ++++++++++++++++++++++++++++ version.txt | 2 +- 16 files changed, 138 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23f78053..6e8eef57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.90.67 (09-14-2020) +- Modified core settings to update config.yml on save +- Modified Theme Editor to restart the HTTP router on create/delete (fixing 404's) + # 0.90.66 (09-08-2020) - Added Import and Export views in Dashboard - Modified services list sparkline to use start/end of day timestamp diff --git a/frontend/src/assets/scss/layout.scss b/frontend/src/assets/scss/layout.scss index 974c9f39..acb16334 100644 --- a/frontend/src/assets/scss/layout.scss +++ b/frontend/src/assets/scss/layout.scss @@ -21,7 +21,7 @@ A:HOVER { z-index: 1040; width: 100%; height: 100%; - background-color: rgb(0 0 0 / 50%); + background-color: rgba(0, 0, 0, 0.5); } .modal { diff --git a/frontend/src/languages/chinese.js b/frontend/src/languages/chinese.js index f2e963b3..162e6d58 100755 --- a/frontend/src/languages/chinese.js +++ b/frontend/src/languages/chinese.js @@ -50,6 +50,11 @@ const chinese = { service_offline_time: "服务已脱机", days_ago: "天前", today: "今天", + week: "周", + month: "月份", + day: "日", + hour: "小时", + minute: "分钟", failures_24_hours: "过去 24 小时失败", no_services: "您目前没有任何服务!", theme: "主题", @@ -125,9 +130,12 @@ const chinese = { follow_redir: "跟随重定向", verify_ssl: "验证 SSL", tls_cert: "使用 TLS 证书", + notification_opts: "通知选项", notifications_enable: "启用通知", notify_after: "故障后通知", - notify_all: "通知所有更改" + notify_all: "通知所有更改", + service_update: "更新服务", + service_create: "创建服务" } export default chinese \ No newline at end of file diff --git a/frontend/src/languages/data.csv b/frontend/src/languages/data.csv index 7f8fa677..60d8250f 100644 --- a/frontend/src/languages/data.csv +++ b/frontend/src/languages/data.csv @@ -50,6 +50,11 @@ service_online_check,Online checked service_offline_time,Service has been offline for days_ago,Days Ago today,Today +week,Week +month,Month +day,Day +hour,Hour +minute,Minute failures_24_hours,Failures last 24 hours no_services,You currently don't have any services! theme,Theme diff --git a/frontend/src/languages/english.js b/frontend/src/languages/english.js index 36e9d6d6..c737223f 100644 --- a/frontend/src/languages/english.js +++ b/frontend/src/languages/english.js @@ -50,6 +50,11 @@ const english = { service_offline_time: "Service has been offline for", days_ago: "Days Ago", today: "Today", + week: "Week", + month: "Month", + day: "Day", + hour: "Hour", + minute: "Minute", failures_24_hours: "Failures last 24 hours", no_services: "You currently don't have any services!", theme: "Theme", @@ -125,9 +130,12 @@ const english = { follow_redir: "Follow Redirects", verify_ssl: "Verify SSL", tls_cert: "Use TLS Cert", + notification_opts: "Notification Options", notifications_enable: "Enable Notifications", notify_after: "Notify After Failures", - notify_all: "Notify All Changes" + notify_all: "Notify All Changes", + service_update: "Update Service", + service_create: "Create Service" } export default english \ No newline at end of file diff --git a/frontend/src/languages/french.js b/frontend/src/languages/french.js index 1eb00a30..d448af30 100644 --- a/frontend/src/languages/french.js +++ b/frontend/src/languages/french.js @@ -50,6 +50,11 @@ const french = { service_offline_time: "Le service a été hors ligne pour", days_ago: "Il y a jours", today: "Aujourd'hui", + week: "Semaine", + month: "Mois", + day: "Jour", + hour: "Heure", + minute: "Minute", failures_24_hours: "Les échecs durent 24 heures", no_services: "Vous n'avez actuellement aucun service !", theme: "Thème", @@ -125,9 +130,12 @@ const french = { follow_redir: "Suivre les redirections", verify_ssl: "Vérifier SSL", tls_cert: "Utiliser le certificat TLS", + notification_opts: "Options de notification", notifications_enable: "Activer les notifications", notify_after: "Notification après les échecs", - notify_all: "Notifier toutes les modifications" + notify_all: "Notifier toutes les modifications", + service_update: "Mise à jour Service", + service_create: "Créer un service" } export default french \ No newline at end of file diff --git a/frontend/src/languages/german.js b/frontend/src/languages/german.js index 92e7b2be..aabba35f 100644 --- a/frontend/src/languages/german.js +++ b/frontend/src/languages/german.js @@ -50,6 +50,11 @@ const german = { service_offline_time: "Dienst war offline für", days_ago: "Vor Tagen", today: "Heute", + week: "Woche", + month: "Monat", + day: "Tag", + hour: "Stunde", + minute: "Minute", failures_24_hours: "Ausfälle dauern 24 Stunden", no_services: "Sie haben derzeit keine Dienste!", theme: "Thema", @@ -125,9 +130,12 @@ const german = { follow_redir: "Weiterleitungen folgen", verify_ssl: "SSL verifizieren", tls_cert: "TLS-Zertifikat verwenden", + notification_opts: "Benachrichtigungsoptionen", notifications_enable: "Benachrichtigungen aktivieren", notify_after: "Benachrichtigung nach Fehlern", - notify_all: "Alle Änderungen benachrichtigen" + notify_all: "Alle Änderungen benachrichtigen", + service_update: "Dienst aktualisieren", + service_create: "Dienst erstellen" } export default german \ No newline at end of file diff --git a/frontend/src/languages/italian.js b/frontend/src/languages/italian.js index a5745f48..90cff78d 100755 --- a/frontend/src/languages/italian.js +++ b/frontend/src/languages/italian.js @@ -50,6 +50,11 @@ const italian = { service_offline_time: "Il servizio è stato offline per", days_ago: "Giorni fa", today: "Oggi", + week: "Settimana", + month: "Mese", + day: "Giorno", + hour: "Ora", + minute: "Minuti", failures_24_hours: "Errori nelle ultime 24 ore", no_services: "Al momento non hai alcun servizio!", theme: "Tema", @@ -125,9 +130,12 @@ const italian = { follow_redir: "Segui i reindirizzamenti", verify_ssl: "Verifica SSL", tls_cert: "Usa certificato TLS", + notification_opts: "Opzioni di notifica", notifications_enable: "Abilita notifiche", notify_after: "Notify dopo gli errori", - notify_all: "Notifichi tutte le modifiche" + notify_all: "Notifichi tutte le modifiche", + service_update: "Servizio di aggiornamento", + service_create: "Crea servizio" } export default italian \ No newline at end of file diff --git a/frontend/src/languages/japanese.js b/frontend/src/languages/japanese.js index 6512f8db..8e1c9cbf 100755 --- a/frontend/src/languages/japanese.js +++ b/frontend/src/languages/japanese.js @@ -50,6 +50,11 @@ const japanese = { service_offline_time: "のサービスがオフラインになりました", days_ago: "日前", today: "今日", + week: "週数", + month: "月", + day: "日", + hour: "アワー", + minute: "分", failures_24_hours: "過去 24 時間の障害", no_services: "現在、サービスをお持ちになりません。", theme: "テーマ", @@ -125,9 +130,12 @@ const japanese = { follow_redir: "リダイレクトに従う", verify_ssl: "SSL の確認", tls_cert: "TLS 証明書を使用", + notification_opts: "通知オプション", notifications_enable: "通知を有効にする", notify_after: "障害発生後に通知する", - notify_all: "すべての変更を通知" + notify_all: "すべての変更を通知", + service_update: "サービスの更新", + service_create: "サービスの作成" } export default japanese \ No newline at end of file diff --git a/frontend/src/languages/korean.js b/frontend/src/languages/korean.js index f30a738a..6939dec7 100755 --- a/frontend/src/languages/korean.js +++ b/frontend/src/languages/korean.js @@ -50,6 +50,11 @@ const korean = { service_offline_time: "서비스가 에 대해 오프라인되었습니다.", days_ago: "일 전", today: "오늘", + week: "주", + month: "월", + day: "일", + hour: "시간", + minute: "분", failures_24_hours: "지난 24시간 동안 장애 발생", no_services: "현재 서비스가 없습니다!", theme: "테마", @@ -125,9 +130,12 @@ const korean = { follow_redir: "리다이렉트 따르기", verify_ssl: "SSL 확인", tls_cert: "TLS 인증서 사용", + notification_opts: "알림 옵션", notifications_enable: "알림 활성화", notify_after: "실패 후 알림", - notify_all: "모든 변경 사항 알림" + notify_all: "모든 변경 사항 알림", + service_update: "서비스 업데이트", + service_create: "서비스 만들기" } export default korean \ No newline at end of file diff --git a/frontend/src/languages/russian.js b/frontend/src/languages/russian.js index ff126cfa..4f9d89e9 100644 --- a/frontend/src/languages/russian.js +++ b/frontend/src/languages/russian.js @@ -50,6 +50,11 @@ const russian = { service_offline_time: "Служба была отключена для", days_ago: "Дней назад", today: "Сегодня", + week: "Недели", + month: "Месяц", + day: "День", + hour: "Час", + minute: "Минута", failures_24_hours: "Сбои за 24 часа", no_services: "В настоящее время у вас нет услуг!", theme: "Тема", @@ -125,9 +130,12 @@ const russian = { follow_redir: "Следуйте за перенаправленными", verify_ssl: "Проверить SSL", tls_cert: "Использовать сертификат TLS", + notification_opts: "Параметры уведомления", notifications_enable: "Включить уведомления", notify_after: "Уведомлять после сбоев", - notify_all: "Уведомлять обо всех изменениях" + notify_all: "Уведомлять обо всех изменениях", + service_update: "Обновить службу", + service_create: "Создать службу" } export default russian \ No newline at end of file diff --git a/frontend/src/languages/spanish.js b/frontend/src/languages/spanish.js index 7728f71d..aa7457b6 100644 --- a/frontend/src/languages/spanish.js +++ b/frontend/src/languages/spanish.js @@ -50,6 +50,11 @@ const spanish = { service_offline_time: "El servicio ha estado desconectado para", days_ago: "Hace días", today: "Hoy", + week: "Semana", + month: "Mes", + day: "Día", + hour: "Hora", + minute: "Minuto", failures_24_hours: "Fallos de las últimas 24 horas", no_services: "¡Actualmente no tienes ningún servicio!", theme: "Tema", @@ -125,9 +130,12 @@ const spanish = { follow_redir: "Seguir redirecciones", verify_ssl: "Verificar SSL", tls_cert: "Usar Cert TLS", + notification_opts: "Opciones de notificación", notifications_enable: "Habilitar notificaciones", notify_after: "Notificar después de errores", - notify_all: "Notificar todos los cambios" + notify_all: "Notificar todos los cambios", + service_update: "Servicio de actualización", + service_create: "Crear servicio" } export default spanish \ No newline at end of file diff --git a/handlers/api.go b/handlers/api.go index e1d2cf38..9e19fd30 100644 --- a/handlers/api.go +++ b/handlers/api.go @@ -3,6 +3,7 @@ package handlers import ( "fmt" "github.com/statping/statping/types/checkins" + "github.com/statping/statping/types/configs" "github.com/statping/statping/types/core" "github.com/statping/statping/types/errors" "github.com/statping/statping/types/groups" @@ -90,10 +91,22 @@ func apiCoreHandler(w http.ResponseWriter, r *http.Request) { if c.Domain != app.Domain { app.Domain = c.Domain } + if c.Language != app.Language { + app.Language = c.Language + } + utils.Params.Set("LANGUAGE", app.Language) app.UseCdn = null.NewNullBool(c.UseCdn.Bool) app.AllowReports = null.NewNullBool(c.AllowReports.Bool) utils.SentryInit(app.AllowReports.Bool) - err = app.Update() + if err := app.Update(); err != nil { + sendErrorJson(err, w, r) + return + } + if err := configs.Save(); err != nil { + sendErrorJson(err, w, r) + return + } + returnJson(core.App, w, r) } diff --git a/handlers/dashboard.go b/handlers/dashboard.go index 79f3ea89..ca7ddceb 100644 --- a/handlers/dashboard.go +++ b/handlers/dashboard.go @@ -157,6 +157,7 @@ func apiThemeRemoveHandler(w http.ResponseWriter, r *http.Request) { if err := source.DeleteAllAssets(utils.Directory); err != nil { log.Errorln(fmt.Errorf("error deleting all assets %v", err)) } + resetRouter() sendJsonAction(utils.Directory+"/assets", "deleted", w, r) } diff --git a/types/configs/load.go b/types/configs/load.go index 798886e0..bc8db59f 100644 --- a/types/configs/load.go +++ b/types/configs/load.go @@ -7,6 +7,37 @@ import ( "os" ) +func Save() error { + p := utils.Params + configs := &DbConfig{ + DbConn: p.GetString("DB_CONN"), + DbHost: p.GetString("DB_HOST"), + DbUser: p.GetString("DB_USER"), + DbPass: p.GetString("DB_PASS"), + DbData: p.GetString("DB_DATABASE"), + DbPort: p.GetInt("DB_PORT"), + Project: p.GetString("NAME"), + Description: p.GetString("DESCRIPTION"), + Domain: p.GetString("DOMAIN"), + Email: p.GetString("EMAIL"), + Username: p.GetString("ADMIN_USER"), + Password: p.GetString("ADMIN_PASSWORD"), + Location: utils.Directory, + SqlFile: p.GetString("SQL_FILE"), + Language: p.GetString("LANGUAGE"), + AllowReports: p.GetBool("ALLOW_REPORTS"), + LetsEncryptEnable: p.GetBool("LETSENCRYPT_ENABLE"), + LetsEncryptHost: p.GetString("LETSENCRYPT_HOST"), + LetsEncryptEmail: p.GetString("LETSENCRYPT_EMAIL"), + ApiSecret: p.GetString("API_SECRET"), + SampleData: p.GetBool("SAMPLE_DATA"), + MaxOpenConnections: p.GetInt("MAX_OPEN_CONN"), + MaxIdleConnections: p.GetInt("MAX_IDLE_CONN"), + MaxLifeConnections: int(p.GetDuration("MAX_LIFE_CONN").Seconds()), + } + return configs.Save(utils.Directory) +} + func LoadConfigs(cfgFile string) (*DbConfig, error) { writeAble, err := utils.DirWritable(utils.Directory) if err != nil { diff --git a/version.txt b/version.txt index b7f9bf01..b102d03f 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.90.66 +0.90.67 \ No newline at end of file