Add description to monitor

* Add description to monitor model
* Add description field to database
* Add english and spanish translation for description
* Closes: #482
This commit is contained in:
Juan Cruz Vincenti 2021-11-11 20:06:32 -03:00
parent 5bc68d7f3b
commit 934d633d4d
10 changed files with 26 additions and 0 deletions

View file

@ -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;

View file

@ -53,6 +53,7 @@ class Database {
"patch-2fa-invalidate-used-token.sql": true, "patch-2fa-invalidate-used-token.sql": true,
"patch-notification_sent_history.sql": true, "patch-notification_sent_history.sql": true,
"patch-monitor-basic-auth.sql": true, "patch-monitor-basic-auth.sql": true,
"patch-add-description-monitor.sql": true,
} }
/** /**

View file

@ -31,6 +31,7 @@ class Monitor extends BeanModel {
return { return {
id: this.id, id: this.id,
name: this.name, name: this.name,
description: this.description,
}; };
} }
@ -54,6 +55,7 @@ class Monitor extends BeanModel {
return { return {
id: this.id, id: this.id,
name: this.name, name: this.name,
description: this.description,
url: this.url, url: this.url,
method: this.method, method: this.method,
body: this.body, body: this.body,

View file

@ -568,6 +568,7 @@ exports.entryPage = "dashboard";
} }
bean.name = monitor.name; bean.name = monitor.name;
bean.description = monitor.description;
bean.type = monitor.type; bean.type = monitor.type;
bean.url = monitor.url; bean.url = monitor.url;
bean.method = monitor.method; bean.method = monitor.method;
@ -1134,6 +1135,7 @@ exports.entryPage = "dashboard";
let monitor = { let monitor = {
// Define the new variable from earlier here // Define the new variable from earlier here
name: monitorListData[i].name, name: monitorListData[i].name,
description: monitorListData[i].description,
type: monitorListData[i].type, type: monitorListData[i].type,
url: monitorListData[i].url, url: monitorListData[i].url,
method: monitorListData[i].method || "GET", method: monitorListData[i].method || "GET",

View file

@ -23,6 +23,9 @@
<div class="info"> <div class="info">
<Uptime :monitor="item" type="24" :pill="true" /> <Uptime :monitor="item" type="24" :pill="true" />
{{ item.name }} {{ item.name }}
<span :title="item.description">
<font-awesome-icon icon="info-circle" />
</span>
</div> </div>
<div class="tags"> <div class="tags">
<Tag v-for="tag in item.tags" :key="tag" :item="tag" :size="'sm'" /> <Tag v-for="tag in item.tags" :key="tag" :item="tag" :size="'sm'" />

View file

@ -33,6 +33,7 @@ import {
faFile, faFile,
faAward, faAward,
faLink, faLink,
faInfoCircle,
} from "@fortawesome/free-solid-svg-icons"; } from "@fortawesome/free-solid-svg-icons";
library.add( library.add(
@ -65,6 +66,7 @@ library.add(
faFile, faFile,
faAward, faAward,
faLink, faLink,
faInfoCircle,
); );
export { FontAwesomeIcon }; export { FontAwesomeIcon };

View file

@ -46,6 +46,7 @@ export default {
Unknown: "Unknown", Unknown: "Unknown",
Pause: "Pause", Pause: "Pause",
Name: "Name", Name: "Name",
Description: "Description",
Status: "Status", Status: "Status",
DateTime: "DateTime", DateTime: "DateTime",
Message: "Message", Message: "Message",

View file

@ -34,6 +34,7 @@ export default {
Unknown: "Desconocido", Unknown: "Desconocido",
Pause: "Pausar", Pause: "Pausar",
Name: "Nombre", Name: "Nombre",
Description: "Descripción",
Status: "Estado", Status: "Estado",
DateTime: "Fecha y Hora", DateTime: "Fecha y Hora",
Message: "Mensaje", Message: "Mensaje",

View file

@ -2,6 +2,7 @@
<transition name="slide-fade" appear> <transition name="slide-fade" appear>
<div v-if="monitor"> <div v-if="monitor">
<h1> {{ monitor.name }}</h1> <h1> {{ monitor.name }}</h1>
<p>{{ monitor.description }}</p>
<div class="tags"> <div class="tags">
<Tag v-for="tag in monitor.tags" :key="tag.id" :item="tag" :size="'sm'" /> <Tag v-for="tag in monitor.tags" :key="tag.id" :item="tag" :size="'sm'" />
</div> </div>

View file

@ -41,6 +41,12 @@
<input id="name" v-model="monitor.name" type="text" class="form-control" required> <input id="name" v-model="monitor.name" type="text" class="form-control" required>
</div> </div>
<!-- Description -->
<div class="my-3">
<label for="description" class="form-label">{{ $t("Description") }}</label>
<input id="description" v-model="monitor.description" type="text" class="form-control">
</div>
<!-- URL --> <!-- URL -->
<div v-if="monitor.type === 'http' || monitor.type === 'keyword' " class="my-3"> <div v-if="monitor.type === 'http' || monitor.type === 'keyword' " class="my-3">
<label for="url" class="form-label">{{ $t("URL") }}</label> <label for="url" class="form-label">{{ $t("URL") }}</label>