mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 14:54:05 +00:00
Compare commits
7 commits
727cee2829
...
6681145bf9
Author | SHA1 | Date | |
---|---|---|---|
|
6681145bf9 | ||
|
8a432ac937 | ||
|
061b549d16 | ||
|
d3c3808dae | ||
|
61c68e2305 | ||
|
2fb3638bd7 | ||
|
9af201924f |
3 changed files with 19 additions and 22 deletions
|
@ -48,14 +48,11 @@ class Monitor extends BeanModel {
|
||||||
let obj = {
|
let obj = {
|
||||||
id: this.id,
|
id: this.id,
|
||||||
name: this.name,
|
name: this.name,
|
||||||
sendUrl: this.sendUrl,
|
sendUrl: !!this.sendUrl,
|
||||||
|
url: this.url,
|
||||||
type: this.type,
|
type: this.type,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.sendUrl) {
|
|
||||||
obj.url = this.url;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showTags) {
|
if (showTags) {
|
||||||
obj.tags = await this.getTags();
|
obj.tags = await this.getTags();
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,13 +220,17 @@ module.exports.statusPageSocketHandler = (socket) => {
|
||||||
|
|
||||||
// Delete groups that are not in the list
|
// Delete groups that are not in the list
|
||||||
log.debug("socket", "Delete groups that are not in the list");
|
log.debug("socket", "Delete groups that are not in the list");
|
||||||
const slots = groupIDList.map(() => "?").join(",");
|
if (groupIDList.length === 0) {
|
||||||
|
await R.exec("DELETE FROM `group` WHERE status_page_id = ?", [ statusPage.id ]);
|
||||||
|
} else {
|
||||||
|
const slots = groupIDList.map(() => "?").join(",");
|
||||||
|
|
||||||
const data = [
|
const data = [
|
||||||
...groupIDList,
|
...groupIDList,
|
||||||
statusPage.id
|
statusPage.id
|
||||||
];
|
];
|
||||||
await R.exec(`DELETE FROM \`group\` WHERE id NOT IN (${slots}) AND status_page_id = ?`, data);
|
await R.exec(`DELETE FROM \`group\` WHERE id NOT IN (${slots}) AND status_page_id = ?`, data);
|
||||||
|
}
|
||||||
|
|
||||||
const server = UptimeKumaServer.getInstance();
|
const server = UptimeKumaServer.getInstance();
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="my-3 form-check">
|
<div class="my-3 form-check">
|
||||||
<input id="show-clickable-link" v-model="monitor.isClickAble" class="form-check-input" type="checkbox" @click="toggleLink(monitor.group_index, monitor.monitor_index)" />
|
<input id="show-clickable-link" v-model="monitor.isClickable" class="form-check-input" type="checkbox" @click="toggleLink(monitor.group_index, monitor.monitor_index)" />
|
||||||
<label class="form-check-label" for="show-clickable-link">
|
<label class="form-check-label" for="show-clickable-link">
|
||||||
{{ $t("Show Clickable Link") }}
|
{{ $t("Show Clickable Link") }}
|
||||||
</label>
|
</label>
|
||||||
|
@ -54,6 +54,9 @@ export default {
|
||||||
monitor: {
|
monitor: {
|
||||||
id: null,
|
id: null,
|
||||||
name: null,
|
name: null,
|
||||||
|
monitor_index: null,
|
||||||
|
group_index: null,
|
||||||
|
isClickable: null,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -77,7 +80,7 @@ export default {
|
||||||
name: monitor.element.name,
|
name: monitor.element.name,
|
||||||
monitor_index: monitor.index,
|
monitor_index: monitor.index,
|
||||||
group_index: group.index,
|
group_index: group.index,
|
||||||
isClickAble: this.showLink(monitor),
|
isClickable: this.showLink(monitor),
|
||||||
};
|
};
|
||||||
|
|
||||||
this.MonitorSettingDialog.show();
|
this.MonitorSettingDialog.show();
|
||||||
|
@ -98,17 +101,10 @@ export default {
|
||||||
* Attempts to guess if a link should be shown based upon if
|
* Attempts to guess if a link should be shown based upon if
|
||||||
* sendUrl is set and if the URL is default or not.
|
* sendUrl is set and if the URL is default or not.
|
||||||
* @param {object} monitor Monitor to check
|
* @param {object} monitor Monitor to check
|
||||||
* @param {boolean} ignoreSendUrl Should the presence of the sendUrl
|
|
||||||
* property be ignored. This will only work in edit mode.
|
|
||||||
* @returns {boolean} Should the link be shown?
|
* @returns {boolean} Should the link be shown?
|
||||||
*/
|
*/
|
||||||
showLink(monitor, ignoreSendUrl = false) {
|
showLink(monitor) {
|
||||||
// We must check if there are any elements in monitorList to
|
return monitor.element.sendUrl && monitor.element.url && monitor.element.url !== "https://";
|
||||||
// prevent undefined errors if it hasn't been loaded yet
|
|
||||||
if (this.$parent.editMode && ignoreSendUrl && Object.keys(this.$root.monitorList).length) {
|
|
||||||
return this.$root.monitorList[monitor.element.id].type === "http" || this.$root.monitorList[monitor.element.id].type === "keyword" || this.$root.monitorList[monitor.element.id].type === "json-query";
|
|
||||||
}
|
|
||||||
return monitor.element.sendUrl && monitor.element.url && monitor.element.url !== "https://" && !this.editMode;
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue