Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

Commit

Permalink
Sense: Do not override the last server used with th url host if runni…
Browse files Browse the repository at this point in the history
…ng as a plugin (but use it as a default)

Closes elastic#120
  • Loading branch information
bleskes committed Feb 19, 2014
1 parent 23cd52c commit 97131a8
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions sense/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand All @@ -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() {
Expand Down

0 comments on commit 97131a8

Please sign in to comment.