diff --git a/src/lang/en.json b/src/lang/en.json
index df1677290..84ff347a3 100644
--- a/src/lang/en.json
+++ b/src/lang/en.json
@@ -518,6 +518,12 @@
"Effective Date Range": "Effective Date Range (Optional)",
"Schedule Maintenance": "Schedule Maintenance",
"Edit Maintenance": "Edit Maintenance",
+ "Clone Maintenance": "Clone Maintenance",
+ "ariaPauseMaintenance": "Pause this maintenance schedule",
+ "ariaResumeMaintenance": "Resume this maintenance schedule",
+ "ariaCloneMaintenance": "Create a copy of this maintenance schedule",
+ "ariaEditMaintenance": "Edit this maintenance schedule",
+ "ariaDeleteMaintenance": "Delete this maintenance schedule",
"Date and Time": "Date and Time",
"DateTime Range": "DateTime Range",
"loadingError": "Cannot fetch the data, please try again later.",
diff --git a/src/pages/EditMaintenance.vue b/src/pages/EditMaintenance.vue
index 6341c5bed..70742a9c6 100644
--- a/src/pages/EditMaintenance.vue
+++ b/src/pages/EditMaintenance.vue
@@ -354,7 +354,14 @@ export default {
},
pageName() {
- return this.$t((this.isAdd) ? "Schedule Maintenance" : "Edit Maintenance");
+ let name = "Schedule Maintenance";
+
+ if (this.isEdit) {
+ name = "Edit Maintenance";
+ } else if (this.isClone) {
+ name = "Clone Maintenance";
+ }
+ return this.$t(name);
},
isAdd() {
@@ -365,6 +372,9 @@ export default {
return this.$route.path.startsWith("/maintenance/edit");
},
+ isClone() {
+ return this.$route.path.startsWith("/maintenance/clone");
+ }
},
watch: {
"$route.fullPath"() {
@@ -443,11 +453,16 @@ export default {
daysOfMonth: [],
timezoneOption: null,
};
- } else if (this.isEdit) {
+ } else if (this.isEdit || this.isClone) {
this.$root.getSocket().emit("getMaintenance", this.$route.params.id, (res) => {
if (res.ok) {
this.maintenance = res.maintenance;
+ if (this.isClone) {
+ this.maintenance.id = undefined; // Remove id when cloning as we want a new id
+ this.maintenance.title = this.$t("cloneOf", [ this.maintenance.title ]);
+ }
+
this.$root.getSocket().emit("getMonitorMaintenance", this.$route.params.id, (res) => {
if (res.ok) {
Object.values(res.monitors).map(monitor => {
@@ -491,7 +506,7 @@ export default {
return this.processing = false;
}
- if (this.isAdd) {
+ if (this.isAdd || this.isClone) {
this.$root.addMaintenance(this.maintenance, async (res) => {
if (res.ok) {
await this.addMonitorMaintenance(res.maintenanceID, async () => {
diff --git a/src/pages/ManageMaintenance.vue b/src/pages/ManageMaintenance.vue
index 8378736a7..dc457d8db 100644
--- a/src/pages/ManageMaintenance.vue
+++ b/src/pages/ManageMaintenance.vue
@@ -41,19 +41,23 @@