diff --git a/ui/src/components/CreateOrEditTask.vue b/ui/src/components/CreateOrEditTask.vue
index 6668013..86a962a 100644
--- a/ui/src/components/CreateOrEditTask.vue
+++ b/ui/src/components/CreateOrEditTask.vue
@@ -30,7 +30,7 @@
-
+
@@ -174,7 +174,7 @@
:name="'radio-group-delete_local'"
:label="$t('tasks.delete_on_remote')"
value="delete_remote"
- v-model="task.delete"
+ v-model="delete_msg"
:disabled="loading.createTask"
/>
@@ -241,6 +241,16 @@ export default {
loading: {
createTask: false,
},
+ localuser: "",
+ remoteusername: "",
+ remotepassword: "",
+ remotehostname: "",
+ remoteport: "",
+ security: "",
+ foldersynchronization: "all",
+ exclude: "",
+ delete_msg: "no_delete",
+ cron: "0",
error: {
enabled_mailboxe: "",
createTask: "",
@@ -256,12 +266,49 @@ export default {
computed: {
...mapState(["instanceName", "core", "appName"]),
},
+ watch: {
+ isShown: function () {
+ if (this.isShown) {
+ this.clearErrors();
+ this.localuser = this.task.localuser;
+ this.remoteusername = this.task.remoteusername;
+ this.remotepassword = "";
+ this.remotehostname = this.task.remotehostname;
+ this.remoteport = this.task.remoteport;
+ this.security = this.task.security;
+ this.foldersynchronization = this.task.foldersynchronization;
+ this.exclude = this.task.exclude;
+ this.delete_msg = this.task.delete;
+ this.cron = this.task.cron;
+ this.cron_enabled = this.task.cron_enabled;
+ } else {
+ // hiding modal
+
+ if (this.isEditing) {
+ this.clearFields();
+ }
+ }
+ },
+ },
methods: {
+ clearFields() {
+ this.localuser = "";
+ this.remoteusername = "";
+ this.remotepassword = "";
+ this.remotehostname = "";
+ this.remoteport = "";
+ this.security = "";
+ this.foldersynchronization = "all";
+ this.exclude = "";
+ this.delete_msg = "no_delete";
+ this.cron = "0";
+ this.cron_enabled = false;
+ },
validateConfigureModule() {
this.clearErrors(this);
let isValidationOk = true;
- if (!this.task.localuser) {
+ if (!this.localuser) {
this.error.localuser = "common.required";
if (isValidationOk) {
@@ -269,7 +316,7 @@ export default {
}
isValidationOk = false;
}
- if (!this.task.remoteusername) {
+ if (!this.remoteusername) {
this.error.remoteusername = "common.required";
if (isValidationOk) {
@@ -277,7 +324,7 @@ export default {
}
isValidationOk = false;
}
- if (!this.task.remotepassword && !this.isEdit) {
+ if (!this.remotepassword && !this.isEdit) {
this.error.remotepassword = "common.required";
if (isValidationOk) {
@@ -285,7 +332,7 @@ export default {
}
isValidationOk = false;
}
- if (!this.task.remotehostname) {
+ if (!this.remotehostname) {
this.error.remotehostname = "common.required";
if (isValidationOk) {
@@ -293,7 +340,7 @@ export default {
}
isValidationOk = false;
}
- if (!this.task.remoteport) {
+ if (!this.remoteport) {
this.error.remoteport = "common.required";
if (isValidationOk) {
@@ -302,8 +349,8 @@ export default {
isValidationOk = false;
}
if (
- this.task.foldersynchronization == "exclusion" &&
- !this.task.exclude
+ this.foldersynchronization == "exclusion" &&
+ !this.exclude
) {
this.error.exclude = "common.required";
@@ -352,32 +399,32 @@ export default {
this.setCreateTaskCompleted
);
// modify cron value to be compatible with previous format ('',5m, 10m, 15m, 30m, 45m, 1h)
- if (this.task.cron === "60" && this.task.cron_enabled) {
- this.task.cron = "1h";
- } else if (this.task.cron !== "0" && this.task.cron_enabled) {
- this.task.cron = this.task.cron + "m";
- } else if (!this.task.cron_enabled) {
- this.task.cron = "";
+ if (this.cron === "60" && this.cron_enabled) {
+ this.cron = "1h";
+ } else if (this.cron !== "0" && this.cron_enabled) {
+ this.cron = this.cron + "m";
+ } else if (!this.cron_enabled) {
+ this.cron = "";
}
const res = await to(
this.createModuleTaskForApp(this.instanceName, {
action: taskAction,
data: {
task_id: this.task.task_id,
- localuser: this.task.localuser,
- remotehostname: this.task.remotehostname,
- remotepassword: this.task.remotepassword,
- remoteport: Number(this.task.remoteport),
- remoteusername: this.task.remoteusername,
- security: this.task.security,
- delete_local: this.task.delete === "delete_local" ? true : false,
- delete_remote: this.task.delete === "delete_remote" ? true : false,
- exclude: this.task.exclude
+ localuser: this.localuser,
+ remotehostname: this.remotehostname,
+ remotepassword: this.remotepassword,
+ remoteport: Number(this.remoteport),
+ remoteusername: this.remoteusername,
+ security: this.security,
+ delete_local: this.delete_msg === "delete_local" ? true : false,
+ delete_remote: this.delete_msg === "delete_remote" ? true : false,
+ exclude: this.exclude
.split("\n")
.map((item) => item.trim())
.join(","),
- cron: this.task.cron,
- foldersynchronization: this.task.foldersynchronization,
+ cron: this.cron,
+ foldersynchronization: this.foldersynchronization,
},
extra: {
title: this.$t("action." + taskAction),