From b114062c1b8128fe650fce72454ba4f1fcbe5733 Mon Sep 17 00:00:00 2001
From: Harrison Healey <harrisonmhealey@gmail.com>
Date: Wed, 6 Jul 2016 16:07:56 -0400
Subject: PLT-3237 Update displayed config values in admin console after saving
 (#3506)

* Reloaded admin console data when settings are saved

* Fixed attempting to save an invalid config setting overwriting the stored config
---
 .../components/admin_console/database_settings.jsx   | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

(limited to 'webapp/components/admin_console/database_settings.jsx')

diff --git a/webapp/components/admin_console/database_settings.jsx b/webapp/components/admin_console/database_settings.jsx
index 79c464a03..2cd4929ec 100644
--- a/webapp/components/admin_console/database_settings.jsx
+++ b/webapp/components/admin_console/database_settings.jsx
@@ -20,15 +20,6 @@ export default class DatabaseSettings extends AdminSettings {
         this.getConfigFromState = this.getConfigFromState.bind(this);
 
         this.renderSettings = this.renderSettings.bind(this);
-
-        this.state = Object.assign(this.state, {
-            driverName: this.props.config.SqlSettings.DriverName,
-            dataSource: this.props.config.SqlSettings.DataSource,
-            maxIdleConns: props.config.SqlSettings.MaxIdleConns,
-            maxOpenConns: props.config.SqlSettings.MaxOpenConns,
-            atRestEncryptKey: props.config.SqlSettings.AtRestEncryptKey,
-            trace: props.config.SqlSettings.Trace
-        });
     }
 
     getConfigFromState(config) {
@@ -42,6 +33,17 @@ export default class DatabaseSettings extends AdminSettings {
         return config;
     }
 
+    getStateFromConfig(config) {
+        return {
+            driverName: config.SqlSettings.DriverName,
+            dataSource: config.SqlSettings.DataSource,
+            maxIdleConns: config.SqlSettings.MaxIdleConns,
+            maxOpenConns: config.SqlSettings.MaxOpenConns,
+            atRestEncryptKey: config.SqlSettings.AtRestEncryptKey,
+            trace: config.SqlSettings.Trace
+        };
+    }
+
     renderTitle() {
         return (
             <h3>
-- 
cgit v1.2.3-1-g7c22

