From c2d0cfa676eb57602d3bb3c44c6b7965f84b82da Mon Sep 17 00:00:00 2001 From: Maksim Zakharov Date: Fri, 9 Sep 2022 14:10:03 +0300 Subject: smnp-layout --- src/store/index.js | 2 ++ src/store/modules/Settings/SmtpStore.js | 43 +++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 src/store/modules/Settings/SmtpStore.js (limited to 'src/store') diff --git a/src/store/index.js b/src/store/index.js index a4dd16ed..ba7cdf99 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -30,6 +30,7 @@ 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 WebSocketPlugin from './plugins/WebSocketPlugin'; import DateTimeStore from './modules/Settings/DateTimeStore'; @@ -73,6 +74,7 @@ export default new Vuex.Store({ factoryReset: FactoryResetStore, keyClear: KeyClearStore, pciStore: PciStore, + smtpStore: SmtpStore, }, plugins: [WebSocketPlugin], }); diff --git a/src/store/modules/Settings/SmtpStore.js b/src/store/modules/Settings/SmtpStore.js new file mode 100644 index 00000000..ccb0eb48 --- /dev/null +++ b/src/store/modules/Settings/SmtpStore.js @@ -0,0 +1,43 @@ +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) { + return await api + .get( + `/redfish/v1/Smtp/ChangeParameters/ + &user=${payload.user} + &password=${payload.password} + &host=smtp.${payload.host} + &port=${payload.port}` + ) + .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) { + return await api.get( + `redfish/v1/Smtp/SendMail + &from=${payload.from} + &to=${payload.subscribers} + &subject=theme + &text=text + ` + ); + }, + }, +}; + +export default SmtpStore; -- cgit v1.2.3 From 84fcbdf88d85bdd879b6139942916c1af8daf176 Mon Sep 17 00:00:00 2001 From: Vitalii Lysak Date: Mon, 12 Sep 2022 10:59:55 +0300 Subject: fx errors --- src/store/modules/Settings/SmtpStore.js | 2 +- src/views/_sila/Settings/TransferInfo/Transfer.vue | 6 +++--- src/views/_sila/Settings/TransferInfo/WarningSmtp.vue | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/store') diff --git a/src/store/modules/Settings/SmtpStore.js b/src/store/modules/Settings/SmtpStore.js index ccb0eb48..c6c37273 100644 --- a/src/store/modules/Settings/SmtpStore.js +++ b/src/store/modules/Settings/SmtpStore.js @@ -12,7 +12,7 @@ const SmtpStore = { async setSmtpSettings({ commit }, payload) { return await api .get( - `/redfish/v1/Smtp/ChangeParameters/ + `/redfish/v1/Smtp/ChangeParameters &user=${payload.user} &password=${payload.password} &host=smtp.${payload.host} diff --git a/src/views/_sila/Settings/TransferInfo/Transfer.vue b/src/views/_sila/Settings/TransferInfo/Transfer.vue index 921087e5..d95d8ff9 100644 --- a/src/views/_sila/Settings/TransferInfo/Transfer.vue +++ b/src/views/_sila/Settings/TransferInfo/Transfer.vue @@ -1,10 +1,10 @@ diff --git a/src/views/_sila/Settings/TransferInfo/WarningSmtp.vue b/src/views/_sila/Settings/TransferInfo/WarningSmtp.vue index 8372acca..1aa932cd 100644 --- a/src/views/_sila/Settings/TransferInfo/WarningSmtp.vue +++ b/src/views/_sila/Settings/TransferInfo/WarningSmtp.vue @@ -8,7 +8,7 @@ > @@ -90,7 +90,7 @@ export default { data() { return { form: { - name: '', + user: '', password: '', host: '', port: '', -- cgit v1.2.3 From 4c61406a3fac9c0233e840da73866a2f3d4c9ed6 Mon Sep 17 00:00:00 2001 From: Vitalii Lysak Date: Mon, 12 Sep 2022 14:56:04 +0300 Subject: add fields for req, warning smtp --- src/store/modules/Settings/SmtpStore.js | 6 +----- src/views/_sila/Settings/TransferInfo/WarningSmtp.vue | 6 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'src/store') diff --git a/src/store/modules/Settings/SmtpStore.js b/src/store/modules/Settings/SmtpStore.js index c6c37273..38f60cf1 100644 --- a/src/store/modules/Settings/SmtpStore.js +++ b/src/store/modules/Settings/SmtpStore.js @@ -12,11 +12,7 @@ const SmtpStore = { async setSmtpSettings({ commit }, payload) { return await api .get( - `/redfish/v1/Smtp/ChangeParameters - &user=${payload.user} - &password=${payload.password} - &host=smtp.${payload.host} - &port=${payload.port}` + `/redfish/v1/Smtp/ChangeParameters&user=${payload.user}&password=${payload.password}&host=smtp.${payload.host}&port=${payload.port}&auth=${payload.auth}&ssl=${payload.ssl}` ) .then(() => { commit('saveSmtpSettings', payload); diff --git a/src/views/_sila/Settings/TransferInfo/WarningSmtp.vue b/src/views/_sila/Settings/TransferInfo/WarningSmtp.vue index 3b4994c6..9d7c8961 100644 --- a/src/views/_sila/Settings/TransferInfo/WarningSmtp.vue +++ b/src/views/_sila/Settings/TransferInfo/WarningSmtp.vue @@ -8,12 +8,12 @@ }} - + {{ $t('global.status.enabled') }} {{ $t('global.status.disabled') }} @@ -132,7 +132,7 @@ export default { password: '', host: '', port: '', - authorization: null, + auth: null, ssl: null, }, fields: [ -- cgit v1.2.3 From 6236064bf4c21c350026fafb875551fda8699a15 Mon Sep 17 00:00:00 2001 From: Vitalii Lysak Date: Mon, 12 Sep 2022 17:09:07 +0300 Subject: add test msg req --- src/locales/ru-RU.json | 3 +- src/store/modules/Settings/SmtpStore.js | 9 ++---- .../_sila/Settings/TransferInfo/WarningSmtp.vue | 37 ++++++++++++++++------ 3 files changed, 31 insertions(+), 18 deletions(-) (limited to 'src/store') diff --git a/src/locales/ru-RU.json b/src/locales/ru-RU.json index 4c562e9f..2ff30ace 100644 --- a/src/locales/ru-RU.json +++ b/src/locales/ru-RU.json @@ -1155,7 +1155,8 @@ "host": "SMTP-сервер", "port": "SMTP-порт", "authorization": "Авторизация", - "sslEnabled": "Поддержка SSL" + "sslEnabled": "Поддержка SSL", + "testMessage": "Тестовое сообщение" }, "table": { "userName": "Имя пользователя", diff --git a/src/store/modules/Settings/SmtpStore.js b/src/store/modules/Settings/SmtpStore.js index 38f60cf1..b89b99b6 100644 --- a/src/store/modules/Settings/SmtpStore.js +++ b/src/store/modules/Settings/SmtpStore.js @@ -23,14 +23,9 @@ const SmtpStore = { throw new Error(i18n.t('pageTransfer.saveSmtpError')); }); }, - async sendTestMessage(payload) { + async sendTestMessage(_, payload) { return await api.get( - `redfish/v1/Smtp/SendMail - &from=${payload.from} - &to=${payload.subscribers} - &subject=theme - &text=text - ` + `redfish/v1/Smtp/SendMail&from=${payload.from}&to=${payload.to}&subject=${payload.subject}&text=${payload.text}` ); }, }, diff --git a/src/views/_sila/Settings/TransferInfo/WarningSmtp.vue b/src/views/_sila/Settings/TransferInfo/WarningSmtp.vue index 2e59c3a9..63d3a75a 100644 --- a/src/views/_sila/Settings/TransferInfo/WarningSmtp.vue +++ b/src/views/_sila/Settings/TransferInfo/WarningSmtp.vue @@ -1,6 +1,6 @@