mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-06-14 00:22:34 +02:00
parent
210566c7af
commit
86d3d99c3b
2 changed files with 40 additions and 5 deletions
|
@ -32,6 +32,9 @@
|
||||||
<button class="btn btn-danger" @click="deleteDialog">
|
<button class="btn btn-danger" @click="deleteDialog">
|
||||||
<font-awesome-icon icon="trash" /> {{ $t("Delete") }}
|
<font-awesome-icon icon="trash" /> {{ $t("Delete") }}
|
||||||
</button>
|
</button>
|
||||||
|
<button class="btn btn-secondary" @click="duplicate">
|
||||||
|
<font-awesome-icon icon="copy" /> {{ $t("Duplicate") }}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="shadow-box">
|
<div class="shadow-box">
|
||||||
|
@ -314,6 +317,13 @@ export default {
|
||||||
this.$refs.confirmDelete.show();
|
this.$refs.confirmDelete.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
duplicate() {
|
||||||
|
this.$router.push({
|
||||||
|
path: "/add",
|
||||||
|
query: { monitor: JSON.stringify(Object.assign({}, this.monitor, { id: undefined })) }
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
clearEventsDialog() {
|
clearEventsDialog() {
|
||||||
this.$refs.confirmClearEvents.show();
|
this.$refs.confirmClearEvents.show();
|
||||||
},
|
},
|
||||||
|
|
|
@ -351,6 +351,22 @@ export default {
|
||||||
{
|
{
|
||||||
"HeaderName": "HeaderValue"
|
"HeaderName": "HeaderValue"
|
||||||
}`;
|
}`;
|
||||||
|
},
|
||||||
|
|
||||||
|
model() {
|
||||||
|
// parse monitor model eventually found in querystring
|
||||||
|
let model = null;
|
||||||
|
try {
|
||||||
|
model = JSON.parse(this.$route.query.monitor);
|
||||||
|
model.name = `${model.name} (duplicate)`;
|
||||||
|
delete model.id;
|
||||||
|
model.tags = model.tags.map(tag => {
|
||||||
|
tag.new = true;
|
||||||
|
delete tag.monitor_id;
|
||||||
|
return tag;
|
||||||
|
});
|
||||||
|
} catch {}
|
||||||
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -410,8 +426,7 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
init() {
|
init() {
|
||||||
if (this.isAdd) {
|
if (this.isAdd) {
|
||||||
|
const monitorDefaults = {
|
||||||
this.monitor = {
|
|
||||||
type: "http",
|
type: "http",
|
||||||
name: "",
|
name: "",
|
||||||
url: "https://",
|
url: "https://",
|
||||||
|
@ -428,15 +443,25 @@ export default {
|
||||||
dns_resolve_server: "1.1.1.1",
|
dns_resolve_server: "1.1.1.1",
|
||||||
};
|
};
|
||||||
|
|
||||||
for (let i = 0; i < this.$root.notificationList.length; i++) {
|
if (this.model) {
|
||||||
if (this.$root.notificationList[i].isDefault == true) {
|
this.$refs.tagsManager.$data.newTags = this.model.tags;
|
||||||
this.monitor.notificationIDList[this.$root.notificationList[i].id] = true;
|
}
|
||||||
|
this.monitor = Object.assign({}, monitorDefaults, this.model, { tags: undefined });
|
||||||
|
|
||||||
|
if (this.model && this.model.notificationIDList) {
|
||||||
|
this.monitor.notificationIDList = this.model.notificationIDList;
|
||||||
|
} else {
|
||||||
|
for (let i = 0; i < this.$root.notificationList.length; i++) {
|
||||||
|
if (this.$root.notificationList[i].isDefault == true) {
|
||||||
|
this.monitor.notificationIDList[this.$root.notificationList[i].id] = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (this.isEdit) {
|
} else if (this.isEdit) {
|
||||||
this.$root.getSocket().emit("getMonitor", this.$route.params.id, (res) => {
|
this.$root.getSocket().emit("getMonitor", this.$route.params.id, (res) => {
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
this.monitor = res.monitor;
|
this.monitor = res.monitor;
|
||||||
|
this.preselectedTags = res.monitor.tags;
|
||||||
|
|
||||||
// Handling for monitors that are created before 1.7.0
|
// Handling for monitors that are created before 1.7.0
|
||||||
if (this.monitor.retryInterval === 0) {
|
if (this.monitor.retryInterval === 0) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue