From 934d633d4d693b808db4c6afa524f7b7f51595ff Mon Sep 17 00:00:00 2001 From: Juan Cruz Vincenti Date: Thu, 11 Nov 2021 20:06:32 -0300 Subject: [PATCH 1/4] Add description to monitor * Add description to monitor model * Add description field to database * Add english and spanish translation for description * Closes: #482 --- db/patch-add-description-monitor.sql | 7 +++++++ server/database.js | 1 + server/model/monitor.js | 2 ++ server/server.js | 2 ++ src/components/MonitorList.vue | 3 +++ src/icon.js | 2 ++ src/languages/en.js | 1 + src/languages/es-ES.js | 1 + src/pages/Details.vue | 1 + src/pages/EditMonitor.vue | 6 ++++++ 10 files changed, 26 insertions(+) create mode 100644 db/patch-add-description-monitor.sql diff --git a/db/patch-add-description-monitor.sql b/db/patch-add-description-monitor.sql new file mode 100644 index 000000000..da1aa55bc --- /dev/null +++ b/db/patch-add-description-monitor.sql @@ -0,0 +1,7 @@ +-- You should not modify if this have pushed to Github, unless it does serious wrong with the db. +BEGIN TRANSACTION; + +ALTER TABLE monitor + ADD description TEXT default null; + +COMMIT; diff --git a/server/database.js b/server/database.js index afcace705..55f08a0c7 100644 --- a/server/database.js +++ b/server/database.js @@ -53,6 +53,7 @@ class Database { "patch-2fa-invalidate-used-token.sql": true, "patch-notification_sent_history.sql": true, "patch-monitor-basic-auth.sql": true, + "patch-add-description-monitor.sql": true, } /** diff --git a/server/model/monitor.js b/server/model/monitor.js index 6aa614b74..50f11e879 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -31,6 +31,7 @@ class Monitor extends BeanModel { return { id: this.id, name: this.name, + description: this.description, }; } @@ -54,6 +55,7 @@ class Monitor extends BeanModel { return { id: this.id, name: this.name, + description: this.description, url: this.url, method: this.method, body: this.body, diff --git a/server/server.js b/server/server.js index 868bbd5ef..794f67b42 100644 --- a/server/server.js +++ b/server/server.js @@ -568,6 +568,7 @@ exports.entryPage = "dashboard"; } bean.name = monitor.name; + bean.description = monitor.description; bean.type = monitor.type; bean.url = monitor.url; bean.method = monitor.method; @@ -1134,6 +1135,7 @@ exports.entryPage = "dashboard"; let monitor = { // Define the new variable from earlier here name: monitorListData[i].name, + description: monitorListData[i].description, type: monitorListData[i].type, url: monitorListData[i].url, method: monitorListData[i].method || "GET", diff --git a/src/components/MonitorList.vue b/src/components/MonitorList.vue index ef51e89cd..29d14d1f9 100644 --- a/src/components/MonitorList.vue +++ b/src/components/MonitorList.vue @@ -23,6 +23,9 @@
{{ item.name }} + + +
diff --git a/src/icon.js b/src/icon.js index e78992f20..55e662917 100644 --- a/src/icon.js +++ b/src/icon.js @@ -33,6 +33,7 @@ import { faFile, faAward, faLink, + faInfoCircle, } from "@fortawesome/free-solid-svg-icons"; library.add( @@ -65,6 +66,7 @@ library.add( faFile, faAward, faLink, + faInfoCircle, ); export { FontAwesomeIcon }; diff --git a/src/languages/en.js b/src/languages/en.js index fee80a760..d238bb666 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -46,6 +46,7 @@ export default { Unknown: "Unknown", Pause: "Pause", Name: "Name", + Description: "Description", Status: "Status", DateTime: "DateTime", Message: "Message", diff --git a/src/languages/es-ES.js b/src/languages/es-ES.js index d772db060..fe04d86a0 100644 --- a/src/languages/es-ES.js +++ b/src/languages/es-ES.js @@ -34,6 +34,7 @@ export default { Unknown: "Desconocido", Pause: "Pausar", Name: "Nombre", + Description: "DescripciĆ³n", Status: "Estado", DateTime: "Fecha y Hora", Message: "Mensaje", diff --git a/src/pages/Details.vue b/src/pages/Details.vue index d40561fe0..12e86df4a 100644 --- a/src/pages/Details.vue +++ b/src/pages/Details.vue @@ -2,6 +2,7 @@

{{ monitor.name }}

+

{{ monitor.description }}

diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index 4a0d0408b..a0e68676b 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -41,6 +41,12 @@
+ +
+ + +
+
From fbf2df9e7af19bee7f02ea41d2ead5b90ccd2882 Mon Sep 17 00:00:00 2001 From: Juan Cruz Vincenti Date: Thu, 25 Nov 2021 18:11:13 -0300 Subject: [PATCH 2/4] Add conditional rendering to description * Modify Details component * Modify MonitorList component --- src/components/MonitorList.vue | 2 +- src/pages/Details.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/MonitorList.vue b/src/components/MonitorList.vue index 29d14d1f9..19f2c837c 100644 --- a/src/components/MonitorList.vue +++ b/src/components/MonitorList.vue @@ -23,7 +23,7 @@
{{ item.name }} - +
diff --git a/src/pages/Details.vue b/src/pages/Details.vue index 12e86df4a..d96e42eb9 100644 --- a/src/pages/Details.vue +++ b/src/pages/Details.vue @@ -2,7 +2,7 @@

{{ monitor.name }}

-

{{ monitor.description }}

+

{{ monitor.description }}

From 48c6f0578cda06c6633d42684b8db3a1f70dc521 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Sat, 25 Feb 2023 19:16:33 +0800 Subject: [PATCH 3/4] Merge manually --- src/lang/en.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lang/en.json b/src/lang/en.json index ad55fe6e8..c9889fad6 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -442,6 +442,7 @@ "Clone Monitor": "Clone Monitor", "Clone": "Clone", "cloneOf": "Clone of {0}", + "Description": "Description", "smtp": "Email (SMTP)", "secureOptionNone": "None / STARTTLS (25, 587)", "secureOptionTLS": "TLS (465)", From ea3b3abe367371797fc00b1d9934873522d510cb Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Sat, 25 Feb 2023 20:13:46 +0800 Subject: [PATCH 4/4] Fine tune --- server/model/monitor.js | 1 - src/components/MonitorList.vue | 5 +---- src/pages/EditMonitor.vue | 12 ++++++------ 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index 0d915c375..312ac732b 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -39,7 +39,6 @@ class Monitor extends BeanModel { id: this.id, name: this.name, sendUrl: this.sendUrl, - description: this.description, }; if (this.sendUrl) { diff --git a/src/components/MonitorList.vue b/src/components/MonitorList.vue index 5a6e5ef4c..d64b43c18 100644 --- a/src/components/MonitorList.vue +++ b/src/components/MonitorList.vue @@ -19,15 +19,12 @@ {{ $t("No Monitors, please") }} {{ $t("add one") }}
- +
{{ item.name }} - - -
diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index f13060c25..fa1935b0c 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -89,12 +89,6 @@
- -
- - -
-
@@ -420,6 +414,12 @@
+ +
+ + +
+