fix: Remove agent keys from translation file (#1261)
This commit is contained in:
@@ -21,16 +21,11 @@
|
||||
<div class="medium-12 columns">
|
||||
<label :class="{ error: $v.agentType.$error }">
|
||||
{{ $t('AGENT_MGMT.ADD.FORM.AGENT_TYPE.LABEL') }}
|
||||
<multiselect
|
||||
v-model="agentType"
|
||||
:options="agentTypeList"
|
||||
:searchable="false"
|
||||
label="label"
|
||||
:placeholder="$t('AGENT_MGMT.ADD.FORM.AGENT_TYPE.PLACEHOLDER')"
|
||||
:allow-empty="true"
|
||||
:close-on-select="true"
|
||||
@select="setPageName"
|
||||
/>
|
||||
<select v-model="agentType">
|
||||
<option v-for="role in roles" :key="role.name" :value="role.name">
|
||||
{{ role.label }}
|
||||
</option>
|
||||
</select>
|
||||
<span v-if="$v.agentType.$error" class="message">
|
||||
{{ $t('AGENT_MGMT.ADD.FORM.AGENT_TYPE.ERROR') }}
|
||||
</span>
|
||||
@@ -69,8 +64,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/* global bus */
|
||||
/* eslint no-console: 0 */
|
||||
import { required, minLength, email } from 'vuelidate/lib/validators';
|
||||
import { mapGetters } from 'vuex';
|
||||
|
||||
@@ -85,10 +78,19 @@ export default {
|
||||
return {
|
||||
agentName: '',
|
||||
agentEmail: '',
|
||||
agentType: this.$t('AGENT_MGMT.AGENT_TYPES')[1],
|
||||
agentType: 'agent',
|
||||
vertical: 'bottom',
|
||||
horizontal: 'center',
|
||||
agentTypeList: this.$t('AGENT_MGMT.AGENT_TYPES'),
|
||||
roles: [
|
||||
{
|
||||
name: 'administrator',
|
||||
label: this.$t('AGENT_MGMT.AGENT_TYPES.ADMINISTRATOR'),
|
||||
},
|
||||
{
|
||||
name: 'agent',
|
||||
label: this.$t('AGENT_MGMT.AGENT_TYPES.AGENT'),
|
||||
},
|
||||
],
|
||||
show: true,
|
||||
};
|
||||
},
|
||||
@@ -112,10 +114,6 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
setPageName({ name }) {
|
||||
this.$v.agentType.$touch();
|
||||
this.agentType = name;
|
||||
},
|
||||
showAlert(message) {
|
||||
bus.$emit('newToastMessage', message);
|
||||
},
|
||||
@@ -124,7 +122,7 @@ export default {
|
||||
await this.$store.dispatch('agents/create', {
|
||||
name: this.agentName,
|
||||
email: this.agentEmail,
|
||||
role: this.agentType.name.toLowerCase(),
|
||||
role: this.agentType,
|
||||
});
|
||||
this.showAlert(this.$t('AGENT_MGMT.ADD.API.SUCCESS_MESSAGE'));
|
||||
this.onClose();
|
||||
|
||||
@@ -18,14 +18,11 @@
|
||||
<div class="medium-12 columns">
|
||||
<label :class="{ error: $v.agentType.$error }">
|
||||
{{ $t('AGENT_MGMT.EDIT.FORM.AGENT_TYPE.LABEL') }}
|
||||
<multiselect
|
||||
v-model.trim="agentType"
|
||||
:options="agentTypeList"
|
||||
:placeholder="$t('AGENT_MGMT.EDIT.FORM.AGENT_TYPE.PLACEHOLDER')"
|
||||
:searchable="false"
|
||||
label="label"
|
||||
@select="setPageName"
|
||||
/>
|
||||
<select v-model="agentType">
|
||||
<option v-for="role in roles" :key="role.name" :value="role.name">
|
||||
{{ role.label }}
|
||||
</option>
|
||||
</select>
|
||||
<span v-if="$v.agentType.$error" class="message">
|
||||
{{ $t('AGENT_MGMT.EDIT.FORM.AGENT_TYPE.ERROR') }}
|
||||
</span>
|
||||
@@ -59,8 +56,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/* global bus */
|
||||
/* eslint no-console: 0 */
|
||||
import { required, minLength } from 'vuelidate/lib/validators';
|
||||
import { mapGetters } from 'vuex';
|
||||
import WootSubmitButton from '../../../../components/buttons/FormSubmitButton';
|
||||
@@ -73,20 +68,41 @@ export default {
|
||||
Modal,
|
||||
},
|
||||
props: {
|
||||
id: Number,
|
||||
name: String,
|
||||
email: String,
|
||||
type: String,
|
||||
onClose: Function,
|
||||
id: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
email: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
onClose: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
agentTypeList: this.$t('AGENT_MGMT.AGENT_TYPES'),
|
||||
roles: [
|
||||
{
|
||||
name: 'administrator',
|
||||
label: this.$t('AGENT_MGMT.AGENT_TYPES.ADMINISTRATOR'),
|
||||
},
|
||||
{
|
||||
name: 'agent',
|
||||
label: this.$t('AGENT_MGMT.AGENT_TYPES.AGENT'),
|
||||
},
|
||||
],
|
||||
agentName: this.name,
|
||||
agentType: {
|
||||
name: this.type,
|
||||
label: this.type,
|
||||
},
|
||||
agentType: this.type,
|
||||
agentCredentials: {
|
||||
email: this.email,
|
||||
},
|
||||
@@ -111,10 +127,6 @@ export default {
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
setPageName({ name }) {
|
||||
this.$v.agentType.$touch();
|
||||
this.agentType = name;
|
||||
},
|
||||
showAlert(message) {
|
||||
bus.$emit('newToastMessage', message);
|
||||
},
|
||||
@@ -123,12 +135,11 @@ export default {
|
||||
await this.$store.dispatch('agents/update', {
|
||||
id: this.id,
|
||||
name: this.agentName,
|
||||
role: this.agentType.name.toLowerCase(),
|
||||
role: this.agentType,
|
||||
});
|
||||
this.showAlert(this.$t('AGENT_MGMT.EDIT.API.SUCCESS_MESSAGE'));
|
||||
this.onClose();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
this.showAlert(this.$t('AGENT_MGMT.EDIT.API.ERROR_MESSAGE'));
|
||||
}
|
||||
},
|
||||
|
||||
@@ -40,7 +40,11 @@
|
||||
</td>
|
||||
<!-- Agent Role + Verification Status -->
|
||||
<td>
|
||||
<span class="agent-name">{{ agent.role }}</span>
|
||||
<span class="agent-name">
|
||||
{{
|
||||
$t(`AGENT_MGMT.AGENT_TYPES.${agent.role.toUpperCase()}`)
|
||||
}}
|
||||
</span>
|
||||
<span v-if="agent.confirmed">
|
||||
{{ $t('AGENT_MGMT.LIST.VERIFIED') }}
|
||||
</span>
|
||||
@@ -112,8 +116,6 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
/* global bus */
|
||||
|
||||
import { mapGetters } from 'vuex';
|
||||
import globalConfigMixin from 'shared/mixins/globalConfigMixin';
|
||||
import Thumbnail from '../../../../components/widgets/Thumbnail';
|
||||
|
||||
@@ -52,18 +52,18 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/* global bus */
|
||||
/* eslint no-console: 0 */
|
||||
import { required, minLength } from 'vuelidate/lib/validators';
|
||||
|
||||
import WootSubmitButton from '../../../../components/buttons/FormSubmitButton';
|
||||
import Modal from '../../../../components/Modal';
|
||||
import alertMixin from 'shared/mixins/alertMixin';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
WootSubmitButton,
|
||||
Modal,
|
||||
},
|
||||
mixins: [alertMixin],
|
||||
props: {
|
||||
onClose: {
|
||||
type: Function,
|
||||
@@ -74,15 +74,13 @@ export default {
|
||||
return {
|
||||
shortCode: '',
|
||||
content: '',
|
||||
agentType: '',
|
||||
|
||||
vertical: 'bottom',
|
||||
horizontal: 'center',
|
||||
addCanned: {
|
||||
showAlert: false,
|
||||
showLoading: false,
|
||||
message: '',
|
||||
},
|
||||
agentTypeList: this.$t('CANNED_MGMT.AGENT_TYPES'),
|
||||
show: true,
|
||||
};
|
||||
},
|
||||
@@ -94,19 +92,8 @@ export default {
|
||||
content: {
|
||||
required,
|
||||
},
|
||||
agentType: {
|
||||
required,
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
setPageName({ name }) {
|
||||
this.$v.agentType.$touch();
|
||||
this.agentType = name;
|
||||
},
|
||||
showAlert() {
|
||||
bus.$emit('newToastMessage', this.addCanned.message);
|
||||
},
|
||||
resetForm() {
|
||||
this.shortCode = '';
|
||||
this.content = '';
|
||||
@@ -125,17 +112,13 @@ export default {
|
||||
.then(() => {
|
||||
// Reset Form, Show success message
|
||||
this.addCanned.showLoading = false;
|
||||
this.addCanned.message = this.$t(
|
||||
'CANNED_MGMT.ADD.API.SUCCESS_MESSAGE'
|
||||
);
|
||||
this.showAlert();
|
||||
this.showAlert(this.$t('CANNED_MGMT.ADD.API.SUCCESS_MESSAGE'));
|
||||
this.resetForm();
|
||||
this.onClose();
|
||||
})
|
||||
.catch(() => {
|
||||
this.addCanned.showLoading = false;
|
||||
this.addCanned.message = this.$t('CANNED_MGMT.ADD.API.ERROR_MESSAGE');
|
||||
this.showAlert();
|
||||
this.showAlert(this.$t('CANNED_MGMT.ADD.API.ERROR_MESSAGE'));
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user