Merge pull request #939 from jcvincenti/feature/482-add-description-to-monitor

Add description to monitor
This commit is contained in:
Louis Lam 2023-02-25 20:14:27 +08:00 committed by GitHub
commit a80f228136
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 21 additions and 2 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

@ -70,7 +70,8 @@ class Database {
"patch-maintenance-table2.sql": true, "patch-maintenance-table2.sql": true,
"patch-add-gamedig-monitor.sql": true, "patch-add-gamedig-monitor.sql": true,
"patch-add-google-analytics-status-page-tag.sql": true, "patch-add-google-analytics-status-page-tag.sql": true,
"patch-http-body-encoding.sql": true "patch-http-body-encoding.sql": true,
"patch-add-description-monitor.sql": true,
}; };
/** /**

View file

@ -72,6 +72,7 @@ class Monitor extends BeanModel {
let data = { let data = {
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,
hostname: this.hostname, hostname: this.hostname,

View file

@ -678,6 +678,7 @@ let needSetup = false;
} }
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;
@ -1318,6 +1319,7 @@ let needSetup = false;
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

@ -19,7 +19,7 @@
{{ $t("No Monitors, please") }} <router-link to="/add">{{ $t("add one") }}</router-link> {{ $t("No Monitors, please") }} <router-link to="/add">{{ $t("add one") }}</router-link>
</div> </div>
<router-link v-for="(item, index) in sortedMonitorList" :key="index" :to="monitorURL(item.id)" class="item" :class="{ 'disabled': ! item.active }"> <router-link v-for="(item, index) in sortedMonitorList" :key="index" :to="monitorURL(item.id)" class="item" :class="{ 'disabled': ! item.active }" :title="item.description">
<div class="row"> <div class="row">
<div class="col-9 col-md-8 small-padding" :class="{ 'monitor-item': $root.userHeartbeatBar == 'bottom' || $root.userHeartbeatBar == 'none' }"> <div class="col-9 col-md-8 small-padding" :class="{ 'monitor-item': $root.userHeartbeatBar == 'bottom' || $root.userHeartbeatBar == 'none' }">
<div class="info"> <div class="info">

View file

@ -442,6 +442,7 @@
"Clone Monitor": "Clone Monitor", "Clone Monitor": "Clone Monitor",
"Clone": "Clone", "Clone": "Clone",
"cloneOf": "Clone of {0}", "cloneOf": "Clone of {0}",
"Description": "Description",
"smtp": "Email (SMTP)", "smtp": "Email (SMTP)",
"secureOptionNone": "None / STARTTLS (25, 587)", "secureOptionNone": "None / STARTTLS (25, 587)",
"secureOptionTLS": "TLS (465)", "secureOptionTLS": "TLS (465)",

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 v-if="monitor.description">{{ 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

@ -414,6 +414,12 @@
</div> </div>
</template> </template>
<!-- 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>
<div class="my-3"> <div class="my-3">
<tags-manager ref="tagsManager" :pre-selected-tags="monitor.tags"></tags-manager> <tags-manager ref="tagsManager" :pre-selected-tags="monitor.tags"></tags-manager>
</div> </div>