From 74d87aed6c5f179239c159962f76666c0498e411 Mon Sep 17 00:00:00 2001 From: Andrew Watkins Date: Wed, 22 Mar 2017 12:29:48 -0700 Subject: [PATCH] Update delete code requirements --- ui/src/admin/components/DatabaseTable.js | 2 +- ui/src/admin/containers/DatabaseManagerPage.js | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ui/src/admin/components/DatabaseTable.js b/ui/src/admin/components/DatabaseTable.js index 759486e621..ddebd33a2f 100644 --- a/ui/src/admin/components/DatabaseTable.js +++ b/ui/src/admin/components/DatabaseTable.js @@ -156,7 +156,7 @@ const Header = ({ name="name" type="text" value={database.deleteCode || ''} - placeholder="type DELETE to confirm" + placeholder={`DELETE ${database.name}`} onChange={(e) => onDatabaseDeleteConfirm(database, e)} onKeyDown={(e) => onDatabaseDeleteConfirm(database, e)} autoFocus={true} diff --git a/ui/src/admin/containers/DatabaseManagerPage.js b/ui/src/admin/containers/DatabaseManagerPage.js index 68db3aeb68..f49a56a666 100644 --- a/ui/src/admin/containers/DatabaseManagerPage.js +++ b/ui/src/admin/containers/DatabaseManagerPage.js @@ -71,13 +71,17 @@ class DatabaseManagerPage extends Component { handleDatabaseDeleteConfirm(database, e) { const {key, target: {value}} = e - const {actions, source} = this.props + const {actions, source, notify} = this.props if (key === 'Escape') { return actions.removeDatabaseDeleteCode(database) } - if (key === 'Enter' && database.deleteCode === 'DELETE') { + if (key === 'Enter') { + if (database.deleteCode !== `DELETE ${database.name}`) { + return notify('error', `Please type DELETE ${database.name} to confirm`) + } + return actions.deleteDatabaseAsync(source, database) }