From c23333110d846b4bf4a76422853820875b74e93a Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 26 Nov 2017 16:41:59 +0900 Subject: [PATCH] confirm before setting migration --- .eslintrc | 1 + src/settings/components/index.jsx | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/.eslintrc b/.eslintrc index ab61dc7..0f230c7 100644 --- a/.eslintrc +++ b/.eslintrc @@ -36,6 +36,7 @@ "newline-after-var": "off", "newline-before-return": "off", "newline-per-chained-call": "off", + "no-alert": "off", "no-bitwise": "off", "no-console": ["error", { "allow": ["warn", "error"] }], "no-empty-function": "off", diff --git a/src/settings/components/index.jsx b/src/settings/components/index.jsx index b7de259..3961982 100644 --- a/src/settings/components/index.jsx +++ b/src/settings/components/index.jsx @@ -8,6 +8,10 @@ import * as settingActions from 'settings/actions/setting'; import * as validator from 'shared/validators/setting'; import * as settingsValues from 'shared/settings/values'; +const DO_YOU_WANT_TO_CONTINUE = + 'Some settings in JSON can be lose on migrating. ' + + 'Do you want to continue ?'; + class SettingsComponent extends Component { constructor(props, context) { super(props, context); @@ -154,6 +158,11 @@ class SettingsComponent extends Component { next.settings.json = settingsValues.jsonFromForm(this.state.settings.form); } else if (from === 'json' && to === 'form') { + let b = window.confirm(DO_YOU_WANT_TO_CONTINUE); + if (!b) { + this.setState(this.state); + return; + } next.settings.form = settingsValues.formFromJson(this.state.settings.json); }