Skip to content

Commit

Permalink
♻️ refactor: Fix some eslint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jolzee committed Nov 2, 2020
1 parent 4d76931 commit 0e169d3
Show file tree
Hide file tree
Showing 16 changed files with 106 additions and 109 deletions.
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@
<OverlayAlert />
<router-view
:drawer="drawer"
@closeMenu="drawer = false"
@close-menu="drawer = false"
v-if="['config'].indexOf($route.name) === -1"
/>
<teneo-modal></teneo-modal>
Expand Down
22 changes: 5 additions & 17 deletions src/components/AgentAssistCannedResponseForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,7 @@ export default {
filters: {
tagify(value) {
if (!value) return "";
value = value
.toString()
.toLowerCase()
.replace(/\s/g, "");
value = value.toString().toLowerCase().replace(/\s/g, "");
return value;
}
},
Expand Down Expand Up @@ -221,16 +218,13 @@ export default {
});
},
hideDialog() {
this.$emit("hideDialog");
this.$emit("hide-dialog");
},
edit(index, item) {
if (!this.editing) {
if (item && item.text) {
logger.debug(`Item Text: ${item.text}`);
item.text = item.text
.toString()
.toLowerCase()
.replace(/\s/g, "");
item.text = item.text.toString().toLowerCase().replace(/\s/g, "");
}
this.editing = item;
Expand All @@ -247,14 +241,8 @@ export default {
let text = hasValue(itemText);
let query = hasValue(queryText);
query = query
.toString()
.toLowerCase()
.replace(/\s/g, "");
text = text
.toString()
.toLowerCase()
.replace(/\s/g, "");
query = query.toString().toLowerCase().replace(/\s/g, "");
text = text.toString().toLowerCase().replace(/\s/g, "");
return text.indexOf(query) > -1;
}
Expand Down
40 changes: 20 additions & 20 deletions src/components/ChatInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
v-show="textFieldShowCondition"
:disabled="textFieldDisabledCondition"
v-shortkey="{
toggle1: ['ctrl', 'alt', '/'],
toggle2: ['ctrl', 'alt', 'arrowdown']
}"
toggle1: ['ctrl', 'alt', '/'],
toggle2: ['ctrl', 'alt', 'arrowdown']
}"
@shortkey.native="swapInputButton"
@keyup.esc="handleEscapeKey"
:prepend-inner-icon="innerIconCondition"
Expand Down Expand Up @@ -108,10 +108,10 @@
ripple
v-if="showAudioInput"
v-shortkey="{
recordAudioOne: ['ctrl', 'alt', '.'],
recordAudioTwo: ['ctrl', 'alt', '`'],
recordAudioThree: ['ctrl', 'alt', 'arrowup']
}"
recordAudioOne: ['ctrl', 'alt', '.'],
recordAudioTwo: ['ctrl', 'alt', '`'],
recordAudioThree: ['ctrl', 'alt', 'arrowup']
}"
@shortkey.native="captureAudio"
:color="audioButtonColor"
:class="!$vuetify.theme.dark ? 'white--text' : 'black--text'"
Expand Down Expand Up @@ -199,39 +199,39 @@ export default {
valid: false
}),
watch: {
storeUserInput: function(storeInput) {
storeUserInput: function (storeInput) {
if (this.userInput !== storeInput) {
this.userInput = storeInput;
}
},
drawer: function(newDrawer) {
drawer: function (newDrawer) {
if (!newDrawer) {
this.handleFocus();
}
},
dialogs: function() {
dialogs: function () {
this.handleFocus();
},
mustSend: function(mustSend) {
mustSend: function (mustSend) {
if (mustSend) {
this.valid = true;
this.sendUserInput();
}
},
handleInputFocus: function(shouldFocus) {
handleInputFocus: function (shouldFocus) {
if (shouldFocus) {
this.handleFocus();
}
},
toggleButton: function() {
toggleButton: function () {
this.swapInputButton();
},
passUserInput: function(newInput) {
passUserInput: function (newInput) {
if (newInput) {
this.userInput = newInput;
}
},
userInputReadyForSending: function(readyForSend) {
userInputReadyForSending: function (readyForSend) {
if (readyForSend) {
this.valid = true;
this.sendUserInput();
Expand Down Expand Up @@ -332,7 +332,7 @@ export default {
if (parentEl.classList.contains("v-input__icon--clear")) {
clearElement.tabIndex = 0;
clearElement.setAttribute("aria-label", "Clear Chat");
clearElement.addEventListener("keyup", function(event) {
clearElement.addEventListener("keyup", function (event) {
event.preventDefault();
if (event.keyCode === 13) {
clearElement.click();
Expand Down Expand Up @@ -363,7 +363,7 @@ export default {
if (this.showAudioInput) {
this.$emit("asr");
}
// this.$emit("changeKey");
// this.$emit("change-key");
})
.catch(err => {
logger.error("Error Sending User Input", err);
Expand Down Expand Up @@ -419,11 +419,11 @@ export default {
if (isChrome) {
navigator.mediaDevices
.getUserMedia({ audio: true })
.then(function() {
.then(function () {
that.showAudioInput = !that.showAudioInput;
that.$store.commit("TTS_ENABLE", that.showAudioInput);
})
.catch(function(err) {
.catch(function (err) {
logger.debug("ASR input is not allowed", err);
that.$store.commit(
"SHOW_MESSAGE_IN_CHAT",
Expand Down Expand Up @@ -491,7 +491,7 @@ export default {
: postResultQueryParam
);
})
.catch(function(response) {
.catch(function (response) {
uploadProgress = 100;
successfullUpload = false;
//handle error
Expand Down
20 changes: 10 additions & 10 deletions src/components/ChatTeneoResponse.vue
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,10 @@
<Form
v-if="mustShowForm()"
:form-config="getFormConfig()"
@showForm="showForm()"
@hideForm="hideForm()"
@show-form="showForm()"
@hide-form="hideForm()"
@completed="completed()"
@handleFocus="handleFocus()"
@handle-focus="handleFocus()"
/>

<v-btn
Expand Down Expand Up @@ -422,7 +422,7 @@
<AgentAssistCannedResponseForm
v-if="agentAssist.cannedResponseForm"
:text="agentAssist.cannedResponseText"
@hideDialog="agentAssist.cannedResponseForm = false"
@hide-dialog="agentAssist.cannedResponseForm = false"
@saved="handleAgentAssistCannedResponseSave"
/>
</div>
Expand Down Expand Up @@ -994,7 +994,7 @@ export default {
return this.itemIndexInDialog === this.dialog.length - 1;
},
handleFocus() {
this.$emit("handleFocus");
this.$emit("handle-focus");
},
mustShowForm() {
if (this.displayForm) {
Expand Down Expand Up @@ -1078,16 +1078,16 @@ export default {
this.$store.commit("SHOW_CHAT_MODAL", this.item);
},
displayFeedbackForm() {
this.$emit("showFeedback");
this.$emit("show-feedback");
},
toggleDate() {
this.$emit("toggleDate");
this.$emit("toggle-date");
},
toggleTime() {
this.$emit("toggleTime");
this.$emit("toggle-time");
},
swapInputButton() {
this.$emit("swapInputButton");
this.$emit("swap-input-button");
},
optionClicked(option) {
this.$store.commit("SHOW_PROGRESS_BAR");
Expand All @@ -1099,7 +1099,7 @@ export default {
option.params ? `&${option.params}${optionClickParam}` : optionClickParam
)
.then(() => {
this.$emit("handleFocus");
this.$emit("handle-focus");
});
}
}
Expand Down
24 changes: 9 additions & 15 deletions src/components/ChatUserQuestion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@
"
>
<p
:class="
`${
!$vuetify.theme.dark && questionLookAndFeel.blockTextColor === 'light'
? 'white--text'
: ''
}`
"
:class="`${
!$vuetify.theme.dark && questionLookAndFeel.blockTextColor === 'light'
? 'white--text'
: ''
}`"
>
<span class="sr-only">I said.</span>
{{ item.text }}
Expand Down Expand Up @@ -104,13 +102,9 @@
<v-icon large>{{ userIcon }}</v-icon>
</v-btn>
</template>
<v-snackbar
v-model="snackbar"
absolute
color="primary"
:timeout="snackBarTimeout"
top
>{{ snackBarText }}</v-snackbar>
<v-snackbar v-model="snackbar" absolute color="primary" :timeout="snackBarTimeout" top>{{
snackBarText
}}</v-snackbar>
<AgentAssistTrainBotForm
v-if="agentAssist.trainForm"
:question="agentAssist.trainFormQuestion"
Expand Down Expand Up @@ -244,7 +238,7 @@ export default {
this.$emit("clicked", userInput);
},
swapInputButton() {
this.$emit("swapInputButton");
this.$emit("swap-input-button");
}
}
};
Expand Down
3 changes: 3 additions & 0 deletions src/components/ConfigAddEditSolution.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1594,17 +1594,20 @@ export default {
logger.debug("About to save an edit to an existing solution");
for (let index = 0; index < this.config.solutions.length; index += 1) {
if (this.config.solutions[index].id === this.solution.id) {
/* eslint-disable-next-line */
this.config.solutions.splice(index, 1, cloneObject(this.solution));
break;
}
}
// adding a new solution config
} else {
logger.debug("About to add a new solution");
/* eslint-disable-next-line */
this.config.solutions.push(cloneObject(this.solution));
// this.selectedSolution = cloneObject(this.solution);
if (this.config.solutions.length === 1) {
// first one added. Make it active
/* eslint-disable-next-line */
this.config.activeSolution = this.solution.id;
}
}
Expand Down
30 changes: 21 additions & 9 deletions src/components/Dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
leave-active-class="fadeOutRightBig"
>
<v-dialog
v-show="show"
v-show="isVisible"
id="leopard-dialog"
v-model="show"
v-model="isVisible"
:transition="undefined"
persistent
scrollable
Expand All @@ -26,7 +26,8 @@
type="info"
elevation="2"
@click="overlay = false"
>"Welcome to my dialog!!"</v-alert>
>"Welcome to my dialog!!"</v-alert
>
</v-overlay>
</v-fade-transition>
<v-system-bar
Expand All @@ -39,17 +40,20 @@
}"
dark
>
<v-spacer style="height:30px" class="teneo-systembar-spacer"></v-spacer>
<v-spacer style="height: 30px" class="teneo-systembar-spacer"></v-spacer>

<v-icon
v-if="!embed && !$vuetify.breakpoint.mdAndDown"
tabindex="0"
tag="button"
:aria-label="fullscreen ? 'Restore dialog size' : 'Maximize dialog'"
@click="toggleFullscreen"
>{{ fullscreen ? "mdi-window-restore" : "mdi-window-maximize" }}</v-icon>
>{{ fullscreen ? "mdi-window-restore" : "mdi-window-maximize" }}</v-icon
>

<v-icon tag="button" aria-label="Close dialog" tabindex="0" @click="close">mdi-close</v-icon>
<v-icon tag="button" aria-label="Close dialog" tabindex="0" @click="close"
>mdi-close</v-icon
>
</v-system-bar>

<v-app-bar :color="`primary ${textColor('primary')}`" dense>
Expand All @@ -58,7 +62,7 @@
</v-app-bar>

<v-card-text
style="height: 90%;"
style="height: 90%"
class="px-3 py-0"
:class="{ 'dark-scroll': dark, 'light-scroll': !dark }"
>
Expand All @@ -74,7 +78,9 @@
<v-card-actions>
<v-spacer></v-spacer>
<slot name="buttons">
<v-btn small color="secondary white--text" @click="close">{{ $t('forms.close') }}</v-btn>
<v-btn small color="secondary white--text" @click="close">{{
$t("forms.close")
}}</v-btn>
</slot>
</v-card-actions>
</v-card>
Expand Down Expand Up @@ -103,9 +109,15 @@ export default {
data() {
return {
fullscreen: false,
overlay: false
overlay: false,
isVisible: false
};
},
watch: {
show() {
this.isVisible = this.$props.show;
}
},
computed: {
...mapGetters(["uuid", "dark", "embed", "fullscreenEmbed", "textColor"])
},
Expand Down
Loading

0 comments on commit 0e169d3

Please sign in to comment.