From 97131a8754ea02e9eb36f68851577e3d33674088 Mon Sep 17 00:00:00 2001 From: Boaz Leskes Date: Wed, 19 Feb 2014 16:15:55 +0100 Subject: [PATCH] Sense: Do not override the last server used with th url host if running as a plugin (but use it as a default) Closes #120 --- sense/app/app.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/sense/app/app.js b/sense/app/app.js index 9f28d899d770b..1fc4e3a547192 100644 --- a/sense/app/app.js +++ b/sense/app/app.js @@ -95,12 +95,18 @@ define([ var sourceLocation = utils.getUrlParam('load_from') || "stored"; var previousSaveState = history.getSavedEditorState(); + var defaultHost = "localhost:9200"; + if (document.location.pathname && document.location.pathname.indexOf("_plugin") == 1) { + // running as an ES plugin. Always assume we are using that elasticsearch + defaultHost = document.location.host; + } + if (sourceLocation == "stored") { if (previousSaveState) { resetToValues(previousSaveState.server, previousSaveState.content); } else { - resetToValues("localhost:9200"); + resetToValues(defaultHost); input.autoIndent(); } } @@ -114,14 +120,9 @@ define([ else if (previousSaveState) { resetToValues(previousSaveState.server); } else { - resetToValues("localhost:9200") + resetToValues(defaultHost) } - - if (document.location.pathname && document.location.pathname.indexOf("_plugin") == 1) { - // running as an ES plugin. Always assume we are using that elasticsearch - resetToValues(document.location.host); - } }()); (function setupAutosave() {