From 306dc2e4d8c71c9cb22789dd0512e0cd4154ad23 Mon Sep 17 00:00:00 2001 From: Dan Sosedoff Date: Sat, 1 Nov 2014 20:06:15 -0500 Subject: [PATCH] Add button to edit connection settings --- static/css/app.css | 10 ++++++++++ static/index.html | 5 ++++- static/js/app.js | 23 ++++++++++++++++++++++- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/static/css/app.css b/static/css/app.css index 0684cdb..f6e2152 100644 --- a/static/css/app.css +++ b/static/css/app.css @@ -349,6 +349,16 @@ display: none; } +#edit_connection { + position: fixed; + right: 8px; + top: 10px; +} + +#close_connection_window { + display: none; +} + #connection_error { display: none; } diff --git a/static/index.html b/static/index.html index 841fc71..c1da508 100644 --- a/static/index.html +++ b/static/index.html @@ -23,6 +23,8 @@
  • History
  • Connection
  • + + Edit Connection diff --git a/static/js/app.js b/static/js/app.js index aa7ccee..fa13aa2 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -1,4 +1,5 @@ var editor; +var connected = false; function apiCall(method, path, params, cb) { $.ajax({ @@ -307,6 +308,10 @@ function addShortcutTooltips() { } } +function showConnectionSettings() { + $("#connection_window").show(); +} + $(document).ready(function() { $("#table_content").on("click", function() { showTableContent(); }); $("#table_structure").on("click", function() { showTableStructure(); }); @@ -339,6 +344,18 @@ $(document).ready(function() { showTableInfo(); }); + $("#edit_connection").on("click", function() { + if (connected) { + $("#close_connection_window").show(); + } + + showConnectionSettings(); + }); + + $("#close_connection_window").on("click", function() { + $("#connection_window").hide(); + }) + $("#connection_form").on("submit", function(e) { e.preventDefault(); @@ -361,9 +378,11 @@ $(document).ready(function() { button.prop("disabled", false).text("Connect"); if (resp.error) { + connected = false; $("#connection_error").text(resp.error).show(); } else { + connected = true; $("#connection_window").hide(); loadTables(); $("#main").show(); @@ -376,9 +395,11 @@ $(document).ready(function() { apiCall("get", "/info", {}, function(resp) { if (resp.error) { - $("#connection_window").show(); + connected = false; + showConnectionSettings(); } else { + connected = true; loadTables(); $("#main").show(); }