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
---
 webapp/components/admin_console/rate_settings.jsx | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

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

diff --git a/webapp/components/admin_console/rate_settings.jsx b/webapp/components/admin_console/rate_settings.jsx
index b65ba0ac3..92eb8613a 100644
--- a/webapp/components/admin_console/rate_settings.jsx
+++ b/webapp/components/admin_console/rate_settings.jsx
@@ -18,14 +18,6 @@ export default class RateSettings extends AdminSettings {
         this.getConfigFromState = this.getConfigFromState.bind(this);
 
         this.renderSettings = this.renderSettings.bind(this);
-
-        this.state = Object.assign(this.state, {
-            enableRateLimiter: props.config.RateLimitSettings.EnableRateLimiter,
-            perSec: props.config.RateLimitSettings.PerSec,
-            memoryStoreSize: props.config.RateLimitSettings.MemoryStoreSize,
-            varyByRemoteAddr: props.config.RateLimitSettings.VaryByRemoteAddr,
-            varyByHeader: props.config.RateLimitSettings.VaryByHeader
-        });
     }
 
     getConfigFromState(config) {
@@ -38,6 +30,16 @@ export default class RateSettings extends AdminSettings {
         return config;
     }
 
+    getStateFromConfig(config) {
+        return {
+            enableRateLimiter: config.RateLimitSettings.EnableRateLimiter,
+            perSec: config.RateLimitSettings.PerSec,
+            memoryStoreSize: config.RateLimitSettings.MemoryStoreSize,
+            varyByRemoteAddr: config.RateLimitSettings.VaryByRemoteAddr,
+            varyByHeader: config.RateLimitSettings.VaryByHeader
+        };
+    }
+
     renderTitle() {
         return (
             <h3>
-- 
cgit v1.2.3-1-g7c22

