Skip to content

Commit

Permalink
Refactor variable names in Tasks.vue component to camelCase
Browse files Browse the repository at this point in the history
  • Loading branch information
stephdl committed Oct 14, 2024
1 parent 41338a2 commit 11ef76f
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 112 deletions.
162 changes: 81 additions & 81 deletions ui/src/components/CreateOrEditTask.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,57 +29,57 @@
</cv-row>
<NsComboBox
v-if="!isEdit"
:options="enabled_mailboxes"
v-model.trim="localuser"
:options="enabledMailboxes"
v-model.trim="localUser"
:autoFilter="true"
:autoHighlight="true"
:title="$t('tasks.local_user')"
:label="$t('tasks.choose_local_user')"
:userInputLabel="$t('tasks.choose_local_user')"
:acceptUserInput="true"
:showItemType="true"
:invalid-message="$t(error.localuser)"
:invalid-message="$t(error.localUser)"
tooltipAlignment="start"
tooltipDirection="top"
:disabled="loading.createTask"
ref="localuser"
ref="localUser"
>
<template slot="tooltip">
{{ $t("tasks.choose_the_user_to_sync") }}
</template>
</NsComboBox>
<NsTextInput
v-model.trim="remoteusername"
v-model.trim="remoteUsername"
:label="$t('tasks.remoteusername')"
ref="remoteusername"
:invalid-message="$t(error.remoteusername)"
ref="remoteUsername"
:invalid-message="$t(error.remoteUsername)"
:disabled="loading.createTask"
/>
<NsTextInput
v-model.trim="remotepassword"
v-model.trim="remotePassword"
type="password"
:label="$t('tasks.remotepassword')"
ref="remotepassword"
:invalid-message="$t(error.remotepassword)"
ref="remotePassword"
:invalid-message="$t(error.remotePassword)"
:placeholder="
isEdit ? $t('tasks.unchanged_password_placeholder') : ''
"
:disabled="loading.createTask"
/>
<NsTextInput
v-model.trim="remotehostname"
v-model.trim="remoteHostname"
:label="$t('tasks.remotehostname')"
placeholder="imap.domain.com"
ref="remotehostname"
:invalid-message="$t(error.remotehostname)"
ref="remoteHostname"
:invalid-message="$t(error.remoteHostname)"
:disabled="loading.createTask"
/>
<NsTextInput
v-model.trim="remoteport"
v-model.trim="remotePort"
type="number"
:label="$t('tasks.remoteport')"
ref="remoteport"
:invalid-message="$t(error.remoteport)"
ref="remotePort"
:invalid-message="$t(error.remotePort)"
:disabled="loading.createTask"
/>
<cv-dropdown
Expand Down Expand Up @@ -119,25 +119,25 @@
:name="'radio-group-foldersynchronization'"
:label="$t('tasks.syncronize_all')"
value="all"
v-model="foldersynchronization"
v-model="folderSynchronization"
:disabled="loading.createTask"
/>
<cv-radio-button
:name="'radio-group-foldersynchronization'"
:label="$t('tasks.synchronize_only_INBOX')"
value="inbox"
v-model="foldersynchronization"
v-model="folderSynchronization"
:disabled="loading.createTask"
/>
<cv-radio-button
:name="'radio-group-foldersynchronization'"
:label="$t('tasks.syncronize_with_exclusion')"
value="exclusion"
v-model="foldersynchronization"
v-model="folderSynchronization"
:disabled="loading.createTask"
/>
</cv-radio-group>
<template v-if="foldersynchronization == 'exclusion'">
<template v-if="folderSynchronization == 'exclusion'">
<cv-text-area
class="mg-left"
:label="$t('tasks.exclude_folder')"
Expand Down Expand Up @@ -166,15 +166,15 @@
:name="'radio-group-delete_local'"
:label="$t('tasks.no_deletion')"
value="no_delete"
v-model="delete_msg"
v-model="deleteMsg"
:disabled="loading.createTask"
/>

<cv-radio-button
:name="'radio-group-delete_local'"
:label="$t('tasks.delete_on_remote')"
value="delete_remote"
v-model="delete_msg"
v-model="deleteMsg"
:disabled="loading.createTask"
/>
<!-- <cv-radio-button
Expand All @@ -196,11 +196,11 @@
showUnlimited
:unlimitedLabel="$t('tasks.disabled')"
:limitedLabel="$t('tasks.enabled')"
:isUnlimited="!cron_enabled"
:isUnlimited="!cronEnabled"
:invalidMessage="$t(error.cron)"
:disabled="loading.createTask"
:unitLabel="$t('tasks.minutes')"
@unlimited="cron_enabled = !$event"
@unlimited="cronEnabled = !$event"
class="mg-bottom-xlg"
/>
</cv-form>
Expand Down Expand Up @@ -232,7 +232,7 @@ export default {
isShown: Boolean,
isEdit: Boolean,
task: { type: [Object, null] },
enabled_mailboxes: { type: Array },
enabledMailboxes: { type: Array },
},

data() {
Expand All @@ -241,26 +241,26 @@ export default {
loading: {
createTask: false,
},
localuser: "",
remoteusername: "",
remotepassword: "",
remotehostname: "",
remoteport: "",
localUser: "",
remoteUsername: "",
remotePassword: "",
remoteHostname: "",
remotePort: "",
security: "",
foldersynchronization: "all",
folderSynchronization: "all",
exclude: "",
delete_msg: "no_delete",
deleteMsg: "no_delete",
cron: "0",
cron_enabled: false,
cronEnabled: false,
error: {
enabled_mailboxe: "",
createTask: "",
exclude: "",
localuser: "",
remoteusername: "",
remotepassword: "",
remotehostname: "",
remoteport: "",
localUser: "",
remoteUsername: "",
remotePassword: "",
remoteHostname: "",
remotePort: "",
},
};
},
Expand All @@ -271,17 +271,17 @@ export default {
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.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.folderSynchronization = this.task.folderSynchronization;
this.exclude = this.task.exclude;
this.delete_msg = this.task.delete;
this.deleteMsg = this.task.delete;
this.cron = this.task.cron;
this.cron_enabled = this.task.cron_enabled;
this.cronEnabled = this.task.cronEnabled;
} else {
// hiding modal

Expand All @@ -293,64 +293,64 @@ export default {
},
methods: {
clearFields() {
this.localuser = "";
this.remoteusername = "";
this.remotepassword = "";
this.remotehostname = "";
this.remoteport = "";
this.localUser = "";
this.remoteUsername = "";
this.remotePassword = "";
this.remoteHostname = "";
this.remotePort = "";
this.security = "";
this.foldersynchronization = "all";
this.folderSynchronization = "all";
this.exclude = "";
this.delete_msg = "no_delete";
this.deleteMsg = "no_delete";
this.cron = "0";
this.cron_enabled = false;
this.cronEnabled = false;
},
validateConfigureModule() {
this.clearErrors(this);

let isValidationOk = true;
if (!this.localuser) {
this.error.localuser = "common.required";
if (!this.localUser) {
this.error.localUser = "common.required";

if (isValidationOk) {
this.focusElement("localuser");
this.focusElement("localUser");
}
isValidationOk = false;
}
if (!this.remoteusername) {
this.error.remoteusername = "common.required";
if (!this.remoteUsername) {
this.error.remoteUsername = "common.required";

if (isValidationOk) {
this.focusElement("remoteusername");
this.focusElement("remoteUsername");
}
isValidationOk = false;
}
if (!this.remotepassword && !this.isEdit) {
this.error.remotepassword = "common.required";
if (!this.remotePassword && !this.isEdit) {
this.error.remotePassword = "common.required";

if (isValidationOk) {
this.focusElement("remotepassword");
this.focusElement("remotePassword");
}
isValidationOk = false;
}
if (!this.remotehostname) {
this.error.remotehostname = "common.required";
if (!this.remoteHostname) {
this.error.remoteHostname = "common.required";

if (isValidationOk) {
this.focusElement("remotehostname");
this.focusElement("remoteHostname");
}
isValidationOk = false;
}
if (!this.remoteport) {
this.error.remoteport = "common.required";
if (!this.remotePort) {
this.error.remotePort = "common.required";

if (isValidationOk) {
this.focusElement("remoteport");
this.focusElement("remotePort");
}
isValidationOk = false;
}
if (
this.foldersynchronization == "exclusion" &&
this.folderSynchronization == "exclusion" &&
!this.exclude
) {
this.error.exclude = "common.required";
Expand Down Expand Up @@ -400,32 +400,32 @@ export default {
this.setCreateTaskCompleted
);
// modify cron value to be compatible with previous format ('',5m, 10m, 15m, 30m, 45m, 1h)
if (this.cron === "60" && this.cron_enabled) {
if (this.cron === "60" && this.cronEnabled) {
this.cron = "1h";
} else if (this.cron !== "0" && this.cron_enabled) {
} else if (this.cron !== "0" && this.cronEnabled) {
this.cron = this.cron + "m";
} else if (!this.cron_enabled) {
} else if (!this.cronEnabled) {
this.cron = "";
}
const res = await to(
this.createModuleTaskForApp(this.instanceName, {
action: taskAction,
data: {
task_id: this.task.task_id,
localuser: this.localuser,
remotehostname: this.remotehostname,
remotepassword: this.remotepassword,
remoteport: Number(this.remoteport),
remoteusername: this.remoteusername,
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,
delete_local: this.deleteMsg === "delete_local" ? true : false,
delete_remote: this.deleteMsg === "delete_remote" ? true : false,
exclude: this.exclude
.split("\n")
.map((item) => item.trim())
.join(","),
cron: this.cron,
foldersynchronization: this.foldersynchronization,
foldersynchronization: this.folderSynchronization,
},
extra: {
title: this.$t("action." + taskAction),
Expand Down
Loading

0 comments on commit 11ef76f

Please sign in to comment.