Skip to content

Commit 1505429

Browse files
committed
#311 centralize confirmation dialog message
1 parent eee3c01 commit 1505429

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

webapp/components/topbar/Topbar.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import ImportExportHLSDialog from './dialogs/ImportExportHLS';
2020
import ImportCellParamsDialog from './dialogs/ImportCellParams';
2121
import UploadDownloadFilesDialog from './dialogs/UploadDownloadFiles';
2222

23-
import { TOPBAR_CONSTANTS, MODEL_STATE } from '../../constants';
23+
import { TOPBAR_CONSTANTS, MODEL_STATE, DEFAULT_CONFIRMATION_DIALOG_MESSAGE } from '../../constants';
2424
import { LOAD_TUTORIAL } from '../../redux/actions/general';
2525

2626
const styles = () => ({
@@ -91,8 +91,7 @@ class Topbar extends Component {
9191
if (this.props.modelState === MODEL_STATE.INSTANTIATED || this.props.modelState === MODEL_STATE.SIMULATED) {
9292
this.props.openConfirmationDialog({
9393
title: 'Warning',
94-
message: 'A NetPyNE model has already been instantiated or simulated.'
95-
+ ' Continuing with this action will use the old value of netParams and simConfig for the new model. Do you want to continue?',
94+
message: DEFAULT_CONFIRMATION_DIALOG_MESSAGE,
9695
onConfirm: {
9796
type: LOAD_TUTORIAL,
9897
action,

webapp/components/topbar/dialogs/ImportExportHLS.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Box from '@material-ui/core/Box';
77
import { withStyles } from '@material-ui/core/styles';
88

99
import { ActionDialog, Tooltip } from 'netpyne/components';
10-
import { NETPYNE_COMMANDS, MODEL_STATE } from '../../../constants';
10+
import { NETPYNE_COMMANDS, MODEL_STATE, DEFAULT_CONFIRMATION_DIALOG_MESSAGE } from '../../../constants';
1111
import { PYTHON_CALL } from '../../../redux/actions/general';
1212
import FileBrowser from '../../general/FileBrowser';
1313
import Checkbox from '../../general/Checkbox';
@@ -183,8 +183,7 @@ class ImportExportHLS extends React.Component {
183183
handleConfirmation (command, args) {
184184
this.props.openConfirmationDialog({
185185
title: 'Warning',
186-
message: 'A NetPyNE model has already been instantiated or simulated.'
187-
+ ' Continuing with this import action will use the old value of netParams and simConfig for the new model. Do you want to continue?',
186+
message: DEFAULT_CONFIRMATION_DIALOG_MESSAGE,
188187
onConfirm: {
189188
type: PYTHON_CALL,
190189
cmd: command,

webapp/constants.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ export const MINIMIZED_PANEL = 'border_bottom';
44
export { WidgetStatus };
55
export const TOP_PANEL = 'hlsPanel';
66
export const TOOLS_LIST = 'tools';
7+
8+
export const DEFAULT_CONFIRMATION_DIALOG_MESSAGE = 'A NetPyNE model has already been instantiated or simulated.'
9+
+ ' Continuing with this action will use the old value of netParams and simConfig for the new model. Do you want to continue?';
10+
711
export const THEMES = {
812
DARK: 'gui',
913
BLACK: 'guiBlack',

0 commit comments

Comments
 (0)