From d04a4b4260739a9c0fa115f880fb1d0bf2e59215 Mon Sep 17 00:00:00 2001 From: volodymyr Date: Wed, 15 Nov 2023 17:00:15 +0200 Subject: [PATCH 1/4] feature: save failed popup added to lib [WTEL-3894] --- .../__tests__/WtPopup.spec.js | 10 +++ .../wt-save-failed-popup.vue | 70 +++++++++++++++++++ src/locale/en/en.js | 5 ++ src/locale/kz/kz.js | 5 ++ src/locale/ru/ru.js | 5 ++ src/locale/ua/ua.js | 5 ++ src/utils/saveAsJSON.js | 7 ++ 7 files changed, 107 insertions(+) create mode 100644 src/components/wt-save-failed-popup/__tests__/WtPopup.spec.js create mode 100644 src/components/wt-save-failed-popup/wt-save-failed-popup.vue create mode 100644 src/utils/saveAsJSON.js diff --git a/src/components/wt-save-failed-popup/__tests__/WtPopup.spec.js b/src/components/wt-save-failed-popup/__tests__/WtPopup.spec.js new file mode 100644 index 000000000..3c0316c8e --- /dev/null +++ b/src/components/wt-save-failed-popup/__tests__/WtPopup.spec.js @@ -0,0 +1,10 @@ +import { shallowMount } from '@vue/test-utils'; +import WtSaveFailedPopup from '../wt-save-failed-popup.vue'; + +describe('WtSaveFailedPopup', () => { + it('renders a component', () => { + const wrapper = shallowMount(WtSaveFailedPopup); + expect(wrapper.classes('wt-save-failed-popup')).toBe(true); + }); +}); +`` diff --git a/src/components/wt-save-failed-popup/wt-save-failed-popup.vue b/src/components/wt-save-failed-popup/wt-save-failed-popup.vue new file mode 100644 index 000000000..0983a4a0b --- /dev/null +++ b/src/components/wt-save-failed-popup/wt-save-failed-popup.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/src/locale/en/en.js b/src/locale/en/en.js index add0f664f..fd7f6f584 100644 --- a/src/locale/en/en.js +++ b/src/locale/en/en.js @@ -359,5 +359,10 @@ export default { message: 'The limit for agents to take a pause has been exceeded. The pause is unavailable right now.', }, }, + saveFailedPopup: { + title: 'Save failed', + label: 'Something went wrong, please try again', + exportToJson: 'Export to JSON', + }, }, }; diff --git a/src/locale/kz/kz.js b/src/locale/kz/kz.js index d35dbed6c..8b9ffccc7 100644 --- a/src/locale/kz/kz.js +++ b/src/locale/kz/kz.js @@ -322,5 +322,10 @@ export default { unlimited: 'Шексіз', }, }, + saveFailedPopup: { + title: 'Қатені сақтау', + label: 'Бірдеңе дұрыс болмады.', + exportToJson: 'JSON файлына экспорттау', + }, }, }; diff --git a/src/locale/ru/ru.js b/src/locale/ru/ru.js index e22b5ed16..0d5986a9a 100644 --- a/src/locale/ru/ru.js +++ b/src/locale/ru/ru.js @@ -357,5 +357,10 @@ export default { message: 'Лимит операторов в паузе превышен. Перерыв сейчас недоступен.', }, }, + saveFailedPopup: { + title: 'Ошибка сохранения', + label: 'Что-то пошло не так. Пожалуйста, попробуйте еще раз', + exportToJson: 'Экспортировать в JSON', + }, }, }; diff --git a/src/locale/ua/ua.js b/src/locale/ua/ua.js index 922632d51..5c95a6e29 100644 --- a/src/locale/ua/ua.js +++ b/src/locale/ua/ua.js @@ -357,5 +357,10 @@ export default { message: 'Ліміт операторів в паузі перевищено. Перерва наразі недоступна.', }, }, + saveFailedPopup: { + title: 'Помилка збереження', + label: 'Щось пішло не так. Будь ласка, спробуйте ще раз', + exportToJson: 'Експортувати в JSON', + }, }, }; diff --git a/src/utils/saveAsJSON.js b/src/utils/saveAsJSON.js new file mode 100644 index 000000000..5237e5a2f --- /dev/null +++ b/src/utils/saveAsJSON.js @@ -0,0 +1,7 @@ +import { saveAs } from 'file-saver'; + +export const saveAsJSON = (name, content) => { + const fileName = name.replace(/[ ,]+/g, '-'); + const file = new Blob([JSON.stringify(content, null, 4)], { type: 'application/json' }); + saveAs(file, fileName); +}; From 5ab5c6466873c4896c11fee313b7282b45341f6e Mon Sep 17 00:00:00 2001 From: volodymyr Date: Thu, 16 Nov 2023 11:12:17 +0200 Subject: [PATCH 2/4] refactor: download method naming changed [WTEL-3894] --- .../wt-save-failed-popup/wt-save-failed-popup.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/wt-save-failed-popup/wt-save-failed-popup.vue b/src/components/wt-save-failed-popup/wt-save-failed-popup.vue index 0983a4a0b..1f15e5c79 100644 --- a/src/components/wt-save-failed-popup/wt-save-failed-popup.vue +++ b/src/components/wt-save-failed-popup/wt-save-failed-popup.vue @@ -24,7 +24,7 @@ {{ $t('webitelUI.saveFailedPopup.exportToJson') }} @@ -41,7 +41,7 @@ + + diff --git a/src/components/wt-save-failed-popup/__tests__/WtPopup.spec.js b/src/components/wt-save-failed-popup/__tests__/WtPopup.spec.js index 3c0316c8e..c1692b30d 100644 --- a/src/components/wt-save-failed-popup/__tests__/WtPopup.spec.js +++ b/src/components/wt-save-failed-popup/__tests__/WtPopup.spec.js @@ -7,4 +7,3 @@ describe('WtSaveFailedPopup', () => { expect(wrapper.classes('wt-save-failed-popup')).toBe(true); }); }); -`` diff --git a/src/utils/saveAsJSON.js b/src/scripts/saveAsJSON.js similarity index 100% rename from src/utils/saveAsJSON.js rename to src/scripts/saveAsJSON.js From 13c9832af2787759ca251049a775e9c046614582 Mon Sep 17 00:00:00 2001 From: volodymyr Date: Thu, 16 Nov 2023 17:08:59 +0200 Subject: [PATCH 4/4] refactor: no needed files deleted [WTEL-3894] --- .../__tests__/WtPopup.spec.js | 9 --- .../wt-save-failed-popup.vue | 70 ------------------- 2 files changed, 79 deletions(-) delete mode 100644 src/components/wt-save-failed-popup/__tests__/WtPopup.spec.js delete mode 100644 src/components/wt-save-failed-popup/wt-save-failed-popup.vue diff --git a/src/components/wt-save-failed-popup/__tests__/WtPopup.spec.js b/src/components/wt-save-failed-popup/__tests__/WtPopup.spec.js deleted file mode 100644 index c1692b30d..000000000 --- a/src/components/wt-save-failed-popup/__tests__/WtPopup.spec.js +++ /dev/null @@ -1,9 +0,0 @@ -import { shallowMount } from '@vue/test-utils'; -import WtSaveFailedPopup from '../wt-save-failed-popup.vue'; - -describe('WtSaveFailedPopup', () => { - it('renders a component', () => { - const wrapper = shallowMount(WtSaveFailedPopup); - expect(wrapper.classes('wt-save-failed-popup')).toBe(true); - }); -}); diff --git a/src/components/wt-save-failed-popup/wt-save-failed-popup.vue b/src/components/wt-save-failed-popup/wt-save-failed-popup.vue deleted file mode 100644 index 1f15e5c79..000000000 --- a/src/components/wt-save-failed-popup/wt-save-failed-popup.vue +++ /dev/null @@ -1,70 +0,0 @@ - - - - -