diff options
-rw-r--r-- | src/env/components/AppNavigation/sila.js | 5 | ||||
-rw-r--r-- | src/env/router/sila.js | 9 | ||||
-rw-r--r-- | src/locales/en-US.json | 31 | ||||
-rw-r--r-- | src/locales/ru-RU.json | 31 | ||||
-rw-r--r-- | src/store/index.js | 4 | ||||
-rw-r--r-- | src/store/modules/Settings/SmtpStore.js | 40 | ||||
-rw-r--r-- | src/store/modules/Settings/SnmpStore.js | 73 | ||||
-rw-r--r-- | src/utilities/_sila/regexConstants.js | 1 | ||||
-rw-r--r-- | src/views/_sila/Overview/Overview.vue | 10 | ||||
-rw-r--r-- | src/views/_sila/Settings/TransferInfo/ModalSnmp.vue | 136 | ||||
-rw-r--r-- | src/views/_sila/Settings/TransferInfo/Smtp.vue | 206 | ||||
-rw-r--r-- | src/views/_sila/Settings/TransferInfo/Snmp.vue | 140 | ||||
-rw-r--r-- | src/views/_sila/Settings/TransferInfo/Syslog.vue | 49 | ||||
-rw-r--r-- | src/views/_sila/Settings/TransferInfo/Transfer.vue | 51 | ||||
-rw-r--r-- | src/views/_sila/Settings/TransferInfo/WarningSmnp.vue | 57 | ||||
-rw-r--r-- | src/views/_sila/Settings/TransferInfo/index.js | 2 |
16 files changed, 845 insertions, 0 deletions
diff --git a/src/env/components/AppNavigation/sila.js b/src/env/components/AppNavigation/sila.js index 328c1b50..69c2d477 100644 --- a/src/env/components/AppNavigation/sila.js +++ b/src/env/components/AppNavigation/sila.js @@ -181,6 +181,11 @@ const AppNavigationMixin = { label: this.$t('appNavigation.powerRestorePolicy'), route: '/settings/power-restore-policy', }, + { + id: 'settings/transfer', + label: this.$t('appPageTitle.transfer'), + route: '/settings/transfer', + }, ], }, { diff --git a/src/env/router/sila.js b/src/env/router/sila.js index 9a3fbc1e..8ba9585f 100644 --- a/src/env/router/sila.js +++ b/src/env/router/sila.js @@ -36,6 +36,7 @@ import FansDynamic from '@/views/_sila/Fans/Dynamic'; import MotherboardDynamic from '@/views/_sila/Motherboard/Dynamic'; import PowerStatic from '@/views/_sila/Power/Static'; import PowerDynamic from '@/views/_sila/Power/Dynamic'; +import TransferInfo from '@/views/_sila/Settings/TransferInfo'; import i18n from '@/i18n'; @@ -280,6 +281,14 @@ const routes = [ }, }, { + path: '/settings/transfer', + name: 'transfer', + component: TransferInfo, + meta: { + title: i18n.t('appPageTitle.transfer'), + }, + }, + { path: '/resource-management/power', name: 'power', component: Power, diff --git a/src/locales/en-US.json b/src/locales/en-US.json index d8338e16..cf9f6df4 100644 --- a/src/locales/en-US.json +++ b/src/locales/en-US.json @@ -209,6 +209,7 @@ "virtualMedia": "Virtual media", "keyClear": "Key clear", "specification": "Specification", + "transfer": "Communication settings", "pciDevices": "PCI-devices" }, "pageChangePassword": { @@ -1143,6 +1144,36 @@ "deviceClass": "Device Class" } }, + "pageTransfer": { + "title": "Setting up information transfer", + "description": "Set up SMTP and SNMP", + "saveSmtpSuсcess": "Save SMTP successfully.", + "saveSmtpError": "Save SMTP error.", + "smtp": { + "smtpTitle": "Warning SMTP", + "username": "Username", + "password": "Password", + "host": "SMTP server", + "port": "SMTP port", + "authorization": "Authorization", + "sslEnabled": "SSL Support", + "testMessage": "Test message" + }, + "snmp": { + "snmpTitle": "SNMP settings", + "host": "SNMP server", + "port": "SNMP port", + "saveSubscriberSuсcess": "Subscriber added successfully", + "deleteSubscriberSuсcess": "Subscriber deleted successfully", + "saveSubscriberError": "Error adding subscriber", + "deleteSubscriberError": "Subscriber deletion error", + "delSubscriber": "Delete Subscriber" + }, + "table": { + "userName": "User name", + "value": "Value" + } + }, "countries": { "AF": "Afghanistan", "AL": "Albania", diff --git a/src/locales/ru-RU.json b/src/locales/ru-RU.json index eacd2a7a..90cb6c64 100644 --- a/src/locales/ru-RU.json +++ b/src/locales/ru-RU.json @@ -209,6 +209,7 @@ "virtualMedia": "Виртуальные носители", "keyClear": "Удаление ключей", "specification": "Характеристики", + "transfer": "Настройки передачи информации", "pciDevices": "PCI-устройства" }, "pageChangePassword": { @@ -1143,6 +1144,36 @@ "deviceClass": "Класс девайса" } }, + "pageTransfer": { + "title": "Настройка передачи информации", + "description": "Настройте SMTP и SNMP", + "saveSmtpSuсcess": "Настройки SMTP успешно сохранены.", + "saveSmtpError": "Ошибка сохранения настроек SMTP.", + "smtp": { + "smtpTitle": "Настройки SMTP", + "username": "Имя пользователя", + "password": "Пароль", + "host": "SMTP сервер", + "port": "SMTP порт", + "authorization": "Авторизация", + "sslEnabled": "Поддержка SSL", + "testMessage": "Тестовое сообщение" + }, + "snmp": { + "snmpTitle": "Настройки SNMP", + "host": "SNMP сервер", + "port": "SNMP порт", + "saveSubscriberSuсcess": "Подписчик успешно добавлен", + "deleteSubscriberSuсcess": "Подписчик успешно удален", + "saveSubscriberError": "Ошибка добавления подписчика", + "deleteSubscriberError": "Ошибка удаления подписчика", + "delSubscriber": "Удалить подписчика" + }, + "table": { + "userName": "Имя пользователя", + "value": "Значение" + } + }, "countries": { "AF": "Афганистан", "AL": "Албания", diff --git a/src/store/index.js b/src/store/index.js index a4dd16ed..a30f71e2 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -30,6 +30,8 @@ import PoliciesStore from './modules/SecurityAndAccess/PoliciesStore'; import FactoryResetStore from './modules/Operations/FactoryResetStore'; import KeyClearStore from './modules/Operations/KeyClearStore'; import PciStore from './modules/HardwareStatus/PciStore'; +import SmtpStore from './modules/Settings/SmtpStore'; +import SnmpStore from './modules/Settings/SnmpStore'; import WebSocketPlugin from './plugins/WebSocketPlugin'; import DateTimeStore from './modules/Settings/DateTimeStore'; @@ -73,6 +75,8 @@ export default new Vuex.Store({ factoryReset: FactoryResetStore, keyClear: KeyClearStore, pciStore: PciStore, + smtpStore: SmtpStore, + snmpStore: SnmpStore, }, plugins: [WebSocketPlugin], }); diff --git a/src/store/modules/Settings/SmtpStore.js b/src/store/modules/Settings/SmtpStore.js new file mode 100644 index 00000000..88fad25c --- /dev/null +++ b/src/store/modules/Settings/SmtpStore.js @@ -0,0 +1,40 @@ +import api from '@/store/api'; +import i18n from '@/i18n'; + +const SmtpStore = { + namespaced: true, + state: { smtp: {} }, + getters: { smtpSettings: (state) => state.smtp }, + mutations: { + saveSmtpSettings: (state, data) => (state.smtp = data), + }, + actions: { + async setSmtpSettings({ commit }, payload) { + let url = `/redfish/v1/Smtp/ChangeParameters`; + for (let key in payload) { + url += `&${key}=${payload[key]}`; + } + + return await api + .get(url) + .then(() => { + commit('saveSmtpSettings', payload); + return i18n.t('pageTransfer.saveSmtpSuсcess'); + }) + .catch((error) => { + console.log(error); + throw new Error(i18n.t('pageTransfer.saveSmtpError')); + }); + }, + async sendTestMessage(_, payload) { + let url = `/redfish/v1/Smtp/SendMail`; + for (let key in payload) { + url += `&${key}=${payload[key]}`; + } + + return await api.get(url); + }, + }, +}; + +export default SmtpStore; diff --git a/src/store/modules/Settings/SnmpStore.js b/src/store/modules/Settings/SnmpStore.js new file mode 100644 index 00000000..3fda494f --- /dev/null +++ b/src/store/modules/Settings/SnmpStore.js @@ -0,0 +1,73 @@ +import api from '@/store/api'; +import i18n from '@/i18n'; + +const SnmpStore = { + namespaced: true, + state: { subscribers: [] }, + getters: { subscribers: (state) => state.subscribers }, + mutations: { + setSubscribers: (state, data) => (state.subscribers = data), + }, + actions: { + async deleteSubscriber({ dispatch }, index) { + return await api + .delete(`/redfish/v1/EventService/Subscriptions/${index}`) + .then(async () => { + await dispatch('getSubscribers'); + return i18n.t('pageTransfer.snmp.deleteSubscriberSuсcess'); + }) + .catch((error) => { + console.log(error); + throw new Error(i18n.t('pageTransfer.snmp.deleteSubscriberError')); + }); + }, + async addSubscriber({ dispatch }, payload) { + return await api + .post('/redfish/v1/EventService/Subscriptions', payload) + .then(async () => { + await dispatch('getSubscribers'); + return i18n.t('pageTransfer.snmp.saveSubscriberSuсcess'); + }) + .catch((error) => { + console.log(error); + throw new Error(i18n.t('pageTransfer.snmp.saveSubscriberError')); + }); + }, + async getSubscribers({ commit }) { + return await api + .get('/redfish/v1/EventService/Subscriptions') + .then(({ data: { Members } }) => { + return Members.filter((member) => + member['@odata.id'].includes('snmp') + ); + }) + .then((members) => { + return api.all(members.map((member) => api.get(member['@odata.id']))); + }) + .then((subscribersRow) => { + return subscribersRow.map((subscriberRow) => { + return subscriberRow.data; + }); + }) + .then((data) => { + return data.map((subscriber) => { + const host = subscriber.Destination.split('/')[2].split(':')[0]; + const port = subscriber.Destination.split('/')[2].split(':')[1]; + return { + ...subscriber, + host, + port, + }; + }); + }) + .then((subscribers) => commit('setSubscribers', subscribers)) + .catch((error) => { + console.log(error); + const message = i18n.t('pageUserManagement.toast.errorLoadUsers'); + throw new Error(message); + }); + }, + }, +}; + +export default SnmpStore; diff --git a/src/utilities/_sila/regexConstants.js b/src/utilities/_sila/regexConstants.js index a377c695..e21ea109 100644 --- a/src/utilities/_sila/regexConstants.js +++ b/src/utilities/_sila/regexConstants.js @@ -1,3 +1,4 @@ export const isoDateRegex = /([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))/; export const isoTimeRegex = /^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/; export const isoNtpRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$|^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\.)+([A-Za-z]|[A-Za-z][A-Za-z0-9-]*[A-Za-z0-9])$/; +export const isoPortRegex = /^((6553[0-5])|(655[0-2][0-9])|(65[0-4][0-9]{2})|(6[0-4][0-9]{3})|([1-5][0-9]{4})|([0-5]{0,5})|([0-9]{1,4}))$/; diff --git a/src/views/_sila/Overview/Overview.vue b/src/views/_sila/Overview/Overview.vue index 9f97fb3e..c3928789 100644 --- a/src/views/_sila/Overview/Overview.vue +++ b/src/views/_sila/Overview/Overview.vue @@ -5,6 +5,16 @@ <page-section :section-title="$t('pageOverview.systemInformation')" class="mb-1" + @overviewEventsComplete=" + () => { + console.log('как подключить веб камеру к ноутбуку'); + } + " + @overview-firmware-complete=" + () => { + console.log('как подключить веб камеру к ноутбуку'); + } + " > <b-card-group deck> <overview-server /> diff --git a/src/views/_sila/Settings/TransferInfo/ModalSnmp.vue b/src/views/_sila/Settings/TransferInfo/ModalSnmp.vue new file mode 100644 index 00000000..af6c5d80 --- /dev/null +++ b/src/views/_sila/Settings/TransferInfo/ModalSnmp.vue @@ -0,0 +1,136 @@ +<template> + <b-modal + id="modal-snmp" + ref="modal" + :title="$t('global.action.add')" + @hidden="resetForm" + > + <b-form id="form-snmp" @submit.prevent="handleSubmit"> + <b-row> + <b-col sm="6"> + <b-form-group + :label="$t('pageTransfer.snmp.host')" + label-for="snmpHost" + > + <b-form-input + id="snmpHost" + v-model="host" + type="text" + :state="getValidationState($v.host)" + data-test-id="snmp-input-host" + @input="$v.host.$touch()" + /> + <b-form-invalid-feedback role="alert"> + <template v-if="!$v.host.required"> + {{ $t('global.form.fieldRequired') }} + </template> + <template v-if="!$v.host.ipAddress"> + {{ $t('global.form.invalidFormat') }} + </template> + </b-form-invalid-feedback> + </b-form-group> + </b-col> + <b-col sm="6"> + <b-form-group + :label="$t('pageTransfer.snmp.port')" + label-for="snmpPort" + > + <b-form-input + id="snmpPort" + v-model="port" + type="number" + :state="getValidationState($v.port)" + data-test-id="snmp-input-port" + @input="$v.port.$touch()" + /> + <b-form-invalid-feedback role="alert"> + <template v-if="!$v.port.required"> + {{ $t('global.form.fieldRequired') }} + </template> + <template v-if="!$v.port.ipAddress"> + {{ $t('global.form.invalidFormat') }} + </template> + </b-form-invalid-feedback> + </b-form-group> + </b-col> + </b-row> + </b-form> + <template #modal-footer="{ cancel }"> + <b-button variant="secondary" @click="cancel()"> + {{ $t('global.action.cancel') }} + </b-button> + <b-button form="form-snmp" type="submit" variant="primary" @click="onOk"> + {{ $t('global.action.add') }} + </b-button> + </template> + </b-modal> +</template> + +<script> +import VuelidateMixin from '@/components/_sila/Mixins/VuelidateMixin.js'; +import { helpers, ipAddress, required } from 'vuelidate/lib/validators'; +import { isoPortRegex } from '@/utilities/_sila/regexConstants'; + +export default { + mixins: [VuelidateMixin], + data() { + return { + form: { + Destination: null, + SubscriptionType: 'SNMPTrap', + Protocol: 'SNMPv2c', + Context: 'testContext', + }, + host: null, + port: null, + }; + }, + validations() { + return { + host: { + required, + ipAddress, + }, + port: { + required, + pattern: helpers.regex('pattern', isoPortRegex), + }, + }; + }, + methods: { + handleSubmit() { + this.$v.$touch(); + if (this.$v.$invalid) return; + + this.$emit('ok', { + ...this.form, + Destination: `snmp://${this.host}:${this.port}`, + }); + this.closeModal(); + }, + closeModal() { + this.$nextTick(() => { + this.$refs.modal.hide(); + }); + }, + resetForm() { + this.host = null; + this.port = null; + this.form.Destination = null; + this.$v.$reset(); + this.$emit('hidden'); + }, + onOk(bvModalEvt) { + // prevent modal close + bvModalEvt.preventDefault(); + this.handleSubmit(); + }, + }, +}; +</script> + +<style lang="scss" scoped> +.input-group-prepend + input { + padding-left: 70px !important; +} +</style> diff --git a/src/views/_sila/Settings/TransferInfo/Smtp.vue b/src/views/_sila/Settings/TransferInfo/Smtp.vue new file mode 100644 index 00000000..338eeda7 --- /dev/null +++ b/src/views/_sila/Settings/TransferInfo/Smtp.vue @@ -0,0 +1,206 @@ +<template> + <page-section :section-title="$t('pageTransfer.smtp.smtpTitle')"> + <b-row class="smtp-warning mb-5"> + <b-col xs="12" sm="12"> + <div class="switch-group"> + <label for="authenticationSwitch">{{ + $t('pageTransfer.smtp.authorization') + }}</label> + <b-form-checkbox + id="authenticationSwitch" + v-model="form.auth" + data-test-id="checkbox-authorization" + switch + :disabled="isNotAdmin" + > + <span v-if="form.auth"> + {{ $t('global.status.enabled') }} + </span> + <span v-else>{{ $t('global.status.disabled') }}</span> + </b-form-checkbox> + </div> + </b-col> + <b-col xs="12" sm="12"> + <b-form-group + :label="$t('pageTransfer.smtp.username')" + label-for="smtp-name" + > + <b-form-input + id="smtp-name" + v-model="form.user" + :disabled="isNotAdmin || !form.auth" + /> </b-form-group + ></b-col> + <b-col xs="12" sm="12"> + <b-form-group + :label="$t('pageTransfer.smtp.password')" + label-for="smtp-password" + > + <input-password-toggle> + <b-form-input + id="smtp-password" + v-model="form.password" + type="password" + :disabled="isNotAdmin || !form.auth" + /> + </input-password-toggle> + </b-form-group> + </b-col> + <b-col xs="12" sm="12"> + <b-form-group + :label="$t('pageTransfer.smtp.host')" + label-for="smtp-host" + > + <b-form-input + id="smtp-host" + v-model="form.host" + :disabled="isNotAdmin" + /> + </b-form-group> + </b-col> + <b-col xs="12" sm="12"> + <b-form-group + :label="$t('pageTransfer.smtp.port')" + label-for="smtp-port" + > + <b-form-input + id="smtp-port" + v-model="form.port" + type="number" + :disabled="isNotAdmin" + /> + </b-form-group> + </b-col> + <b-col xs="12" sm="12"> + <div class="switch-group"> + <label for="sslSwitch">{{ + $t('pageTransfer.smtp.sslEnabled') + }}</label> + <b-form-checkbox + id="sslSwitch" + v-model="form.ssl" + data-test-id="checkbox-ssl" + switch + :disabled="isNotAdmin" + > + <span v-if="form.ssl"> + {{ $t('global.status.enabled') }} + </span> + <span v-else>{{ $t('global.status.disabled') }}</span> + </b-form-checkbox> + </div> + </b-col> + <b-col xs="4" class="d-flex justify-content-between align-items-start"> + <b-button variant="secondary" :disabled="isNotAdmin" @click="sendMail"> + {{ $t('pageTransfer.smtp.testMessage') }} + </b-button> + + <b-button variant="primary" :disabled="isNotAdmin" @click="saveSmtp"> + {{ $t('global.action.save') }} + </b-button> + </b-col> + </b-row> + <b-row> + <b-col> + <b-table + hover + responsive="md" + show-empty + :fields="fields" + :empty-text="$t('global.table.emptyMessage')" + > + </b-table> + </b-col> + </b-row> + </page-section> +</template> + +<script> +import PageSection from '@/components/_sila/Global/PageSection'; +import BVToastMixin from '@/components/_sila/Mixins/BVToastMixin'; +import DataFormatterMixin from '@/components/_sila/Mixins/DataFormatterMixin'; +import InputPasswordToggle from '@/components/_sila/Global/InputPasswordToggle'; + +export default { + name: 'Smtp', + components: { + PageSection, + InputPasswordToggle, + }, + mixins: [BVToastMixin, DataFormatterMixin], + + data() { + return { + form: { + user: '', + password: '', + host: '', + port: '', + auth: false, + ssl: false, + }, + fields: [ + { + key: 'name', + label: this.$t('pageTransfer.table.userName'), + formatter: this.dataFormatter, + }, + { + key: 'value', + label: this.$t('pageTransfer.table.value'), + formatter: this.dataFormatter, + tdClass: 'text-nowrap', + }, + ], + }; + }, + computed: { + isNotAdmin() { + return ( + this.$store.getters['authentication/role'] === 'ReadOnly' || + this.$store.getters['authentication/role'] === 'Operator' + ); + }, + }, + methods: { + saveSmtp() { + if (!this.form.auth) { + // eslint-disable-next-line no-unused-vars + const { user, password, ...formWithoutCredits } = this.form; + this.form = formWithoutCredits; + } + + this.$store + .dispatch('smtpStore/setSmtpSettings', this.form) + .then((message) => this.successToast(message)) + .catch(({ message }) => this.errorToast(message)); + }, + sendMail() { + this.$store + .dispatch('smtpStore/sendTestMessage', { + from: 'ex@mail.ru', + to: 'v.lysak@dunice.net', + subject: 'qwerty', + text: 'lol', + }) + .then((message) => this.successToast(message)) + .catch(({ message }) => this.errorToast(message)); + }, + }, +}; +</script> + +<style lang="scss" scoped> +.switch-group { + margin-bottom: 1.5rem; +} +.smtp-warning { + width: 50%; + @media (max-width: 1200px) { + width: 75%; + } + @media (max-width: 576px) { + width: 100%; + } +} +</style> diff --git a/src/views/_sila/Settings/TransferInfo/Snmp.vue b/src/views/_sila/Settings/TransferInfo/Snmp.vue new file mode 100644 index 00000000..4a0e0abe --- /dev/null +++ b/src/views/_sila/Settings/TransferInfo/Snmp.vue @@ -0,0 +1,140 @@ +<template> + <page-section :section-title="$t('pageTransfer.snmp.snmpTitle')"> + <b-row> + <b-col> + <div class="text-right"> + <b-button + variant="primary" + :disabled="isNotAdmin" + @click="initAddModal()" + > + <icon-add /> + {{ $t('global.action.add') }} + </b-button> + </div> + <b-table + responsive="md" + hover + :busy="loading" + :fields="fields" + :items="subscribers" + :empty-text="$t('global.table.emptyMessage')" + show-empty + > + <!-- table actions column --> + <template #cell(actions)="{ item }"> + <table-row-action + v-for="(action, index) in item.actions" + :key="index" + :value="action.value" + :enabled="action.enabled" + :title="action.title" + @click-table-action="onTableAction($event, item)" + > + <template #icon> + <icon-trashcan + v-if="action.value === 'delete'" + :data-test-id="`snmp-tableRowAction-delete-${index}`" + /> + </template> + </table-row-action> + </template> + </b-table> + </b-col> + </b-row> + </page-section> +</template> + +<script> +import PageSection from '@/components/_sila/Global/PageSection'; +import BVToastMixin from '@/components/_sila/Mixins/BVToastMixin'; +import TableRowAction from '@/components/_sila/Global/TableRowAction'; +import LoadingBarMixin, { + loading, +} from '@/components/_sila/Mixins/LoadingBarMixin'; + +import IconAdd from '@carbon/icons-vue/es/add--alt/20'; +import IconTrashcan from '@carbon/icons-vue/es/trash-can/20'; + +export default { + name: 'Snmp', + components: { + IconAdd, + IconTrashcan, + PageSection, + TableRowAction, + }, + mixins: [BVToastMixin, LoadingBarMixin], + + data() { + return { + loading, + actions: [ + { + value: 'delete', + title: this.$t('global.action.delete'), + }, + ], + fields: [ + { + key: 'host', + label: this.$t('pageTransfer.snmp.host'), + }, + { + key: 'port', + label: this.$t('pageTransfer.snmp.port'), + }, + { key: 'actions', label: '', tdClass: 'text-right' }, + ], + }; + }, + computed: { + subscribers() { + return this.$store.getters['snmpStore/subscribers'].map((subscriber) => { + return { + ...subscriber, + actions: [ + { + value: 'delete', + title: this.$t('pageTransfer.snmp.delSubscriber'), + }, + ], + }; + }); + }, + isNotAdmin() { + return ( + this.$store.getters['authentication/role'] === 'ReadOnly' || + this.$store.getters['authentication/role'] === 'Operator' + ); + }, + }, + + created() { + this.startLoader(); + this.$store.dispatch('snmpStore/getSubscribers').finally(() => { + this.endLoader(); + this.isBusy = false; + }); + }, + + methods: { + onTableAction($event, { Id }) { + if ($event === 'delete') { + this.deleteSubscriber(Id); + } + }, + deleteSubscriber(index) { + this.startLoader(); + this.$store + .dispatch('snmpStore/deleteSubscriber', index) + .then((success) => this.successToast(success)) + .catch(({ message }) => this.errorToast(message)) + .finally(() => this.endLoader()); + }, + initAddModal() { + this.$bvModal.show('modal-snmp'); + }, + }, +}; +</script> diff --git a/src/views/_sila/Settings/TransferInfo/Syslog.vue b/src/views/_sila/Settings/TransferInfo/Syslog.vue new file mode 100644 index 00000000..1d2111c9 --- /dev/null +++ b/src/views/_sila/Settings/TransferInfo/Syslog.vue @@ -0,0 +1,49 @@ +<template> + <page-section :section-title="$t('pageLdap.settings')"> + <b-row class="mt-4 justify-content-end"> + <b-col xs="12" sm="6" lg="4"> + <b-form-group label="Расположение системы" label-for="system-location"> + <b-form-input + id="system-location" + placeholder="Ведите значение" + :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + /> </b-form-group + ></b-col> + <b-col xs="12" sm="6" lg="4"> + <b-form-group label="Контакты системы" label-for="system-contacts"> + <b-form-input + id="system-contacts" + placeholder="Ведите значение" + :disabled="$store.getters['authentication/role'] === 'ReadOnly'" + /> + </b-form-group> + </b-col> + <b-col xs="12" sm="6" lg="4"> + <b-form-group label="Статус" label-for="SMNP-status"> + <b-form-select id="SMNP-status"> </b-form-select> + </b-form-group> + </b-col> + <b-col xs="4" class="d-flex justify-content-end align-items-start"> + <b-button variant="primary"> + {{ $t('global.action.save') }} + </b-button> + </b-col> + </b-row> + </page-section> +</template> + +<script> +import PageSection from '@/components/_sila/Global/PageSection'; + +export default { + name: 'Syslog', + components: { + PageSection, + }, + + data() { + return {}; + }, + computed: {}, +}; +</script> diff --git a/src/views/_sila/Settings/TransferInfo/Transfer.vue b/src/views/_sila/Settings/TransferInfo/Transfer.vue new file mode 100644 index 00000000..5f6d5058 --- /dev/null +++ b/src/views/_sila/Settings/TransferInfo/Transfer.vue @@ -0,0 +1,51 @@ +<template> + <b-container fluid="xl"> + <page-title :description="$t('pageTransfer.description')" /> + <snmp /> + <hr /> + <smtp /> + <hr /> + <!-- <syslog />--> + <modal-snmp @ok="saveSnmp" /> + </b-container> +</template> + +<script> +import BVToastMixin from '@/components/_sila/Mixins/BVToastMixin'; +import LoadingBarMixin, { + loading, +} from '@/components/_sila/Mixins/LoadingBarMixin'; + +import PageTitle from '@/components/_sila/Global/PageTitle'; +import Snmp from './Snmp'; +import Smtp from './Smtp'; +import ModalSnmp from './ModalSnmp.vue'; +// import Syslog from './Syslog'; + +export default { + name: 'PowerRestorePolicy', + components: { + PageTitle, + Snmp, + ModalSnmp, + Smtp, + // Syslog + }, + mixins: [BVToastMixin, LoadingBarMixin], + data() { + return { + loading, + }; + }, + methods: { + saveSnmp(modalFormData) { + this.startLoader(); + this.$store + .dispatch('snmpStore/addSubscriber', modalFormData) + .then((message) => this.successToast(message)) + .catch(({ message }) => this.errorToast(message)) + .finally(() => this.endLoader()); + }, + }, +}; +</script> diff --git a/src/views/_sila/Settings/TransferInfo/WarningSmnp.vue b/src/views/_sila/Settings/TransferInfo/WarningSmnp.vue new file mode 100644 index 00000000..df97d1a1 --- /dev/null +++ b/src/views/_sila/Settings/TransferInfo/WarningSmnp.vue @@ -0,0 +1,57 @@ +<template> + <page-section section-title="Предупреждения SNmP"> + <b-row> + <b-col> + <b-table + hover + responsive="md" + show-empty + :items="items" + :fields="fields" + :empty-text="$t('global.table.emptyMessage')" + > + </b-table> + </b-col> + </b-row> + <b-row> + <b-col class="d-flex justify-content-end flex-wrap"> + <b-button variant="secondary" class="mr-3 mb-3"> + {{ 'Тестовое сообщение' }} + </b-button> + <b-button variant="primary" class="mb-3"> + {{ $t('global.action.save') }} + </b-button> + </b-col> + </b-row> + </page-section> +</template> + +<script> +import PageSection from '@/components/_sila/Global/PageSection'; + +export default { + name: 'WarningSmnp', + components: { + PageSection, + }, + + data() { + return { + fields: [ + { + key: 'id', + label: 'Тип предупреждения', + formatter: this.dataFormatter, + }, + { + key: 'health', + label: 'Значение', + formatter: this.dataFormatter, + tdClass: 'text-nowrap', + }, + ], + }; + }, + computed: {}, +}; +</script> diff --git a/src/views/_sila/Settings/TransferInfo/index.js b/src/views/_sila/Settings/TransferInfo/index.js new file mode 100644 index 00000000..50508f66 --- /dev/null +++ b/src/views/_sila/Settings/TransferInfo/index.js @@ -0,0 +1,2 @@ +import Transfer from './Transfer.vue'; +export default Transfer; |