ZBase.registerView((function() {

  var renderOverview = function() {
    var viewport = document.getElementById("zbase_viewport");
    var page = ZBase.getTemplate(
      "sql_editor", "zbase_sql_editor_overview_main_tpl");
    ZBase.util.install_link_handlers(page);

    viewport.innerHTML = "";
    viewport.appendChild(page);
  };

  var render = function(path) {
    var path_parts = path.split("/");
    // render view
    if (path_parts.length == 4 && path_parts[3].length > 0) {
      renderSqlEditor();
    } else {
      renderOverview();
    }
  };

  return {
    name: "sql_editor",

    loadView: function(params) {
      render(params.path);
    },
    unloadView: function() {
    },
    handleNavigationChange: function(url){
    }
  };

})());

@@ -27,16 +27,64 @@
 on() %7B%0A%0A
+  var renderSqlEditor = function() %7B%0A    %0A  %7D;%0A%0A
   var re
@@ -371,16 +371,877 @@
 d(page);
+%0A%0A    loadOverviewTable();%0A  %7D;%0A%0A  var renderOverviewTable = function(documents) %7B%0A    var tbody = document.querySelector(%22.zbase_sql_editor_overview tbody%22);%0A    documents.forEach(function(doc) %7B%0A      var url = %22/a/sql/%22 + doc.uuid;%0A      var tr = document.createElement(%22tr%22);%0A      tr.innerHTML = %22%3Ctd%3E%3Ca href='%22 + url + %22'%3E%22 + doc.name + %22%3C/td%3E%3Ctd%3E%22 +%0A        doc.type + %22%3C/td%3E%3Ctd%3E&mdash;%3C/td%3E%22;%0A      tbody.appendChild(tr);%0A%0A      tr.addEventListener(%22click%22, function() %7B%0A        window.location.href = url;%0A      %7D);%0A    %7D);%0A  %7D;%0A%0A  var loadOverviewTable = function() %7B%0A    ZBase.util.httpGet(%22/analytics/api/v1/documents%22, function(r) %7B%0A      console.log(r);%0A      if (r.status == 200) %7B%0A        var documents = JSON.parse(r.response).documents;%0A        renderOverviewTable(documents);%0A      %7D else %7B%0A        //TODO render error message%0A      %7D%0A    %7D);
 %0A  %7D;%0A%0A 

load and render sql overview