You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@livy.apache.org by js...@apache.org on 2017/07/05 03:06:43 UTC

[14/33] incubator-livy git commit: LIVY-375. Change Livy code package name to org.apache.livy

http://git-wip-us.apache.org/repos/asf/incubator-livy/blob/412ccc8f/server/src/main/resources/org/apache/livy/server/ui/static/all-sessions.js
----------------------------------------------------------------------
diff --git a/server/src/main/resources/org/apache/livy/server/ui/static/all-sessions.js b/server/src/main/resources/org/apache/livy/server/ui/static/all-sessions.js
new file mode 100644
index 0000000..4fe3f8f
--- /dev/null
+++ b/server/src/main/resources/org/apache/livy/server/ui/static/all-sessions.js
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function appIdLink(session) {
+  var appUiUrl = session.appInfo.sparkUiUrl;
+  if (appUiUrl != null) {
+    return '<a href="' + appUiUrl + '">' + session.appId + "</a>";
+  } else {
+    return session.appId;
+  }
+}
+
+function tdWrap(str) {
+  return "<td>" + str + "</td>";
+}
+
+function loadSessionsTable(sessions) {
+  $.each(sessions, function(index, session) {
+    $("#interactive-sessions .sessions-table-body").append(
+      "<tr>" +
+        tdWrap(session.id) +
+        tdWrap(appIdLink(session)) +
+        tdWrap(session.owner) +
+        tdWrap(session.proxyUser) +
+        tdWrap(session.kind) +
+        tdWrap(session.state) +
+       "</tr>"
+    );
+  });
+}
+
+function loadBatchesTable(sessions) {
+  $.each(sessions, function(index, session) {
+    $("#batches .sessions-table-body").append(
+      "<tr>" +
+        tdWrap(session.id) +
+        tdWrap(appIdLink(session)) +
+        tdWrap(session.state) +
+       "</tr>"
+    );
+  });
+}
+
+var numSessions = 0;
+var numBatches = 0;
+
+$(document).ready(function () {
+  $.extend( $.fn.dataTable.defaults, {
+    stateSave: true,
+  });
+
+  var sessionsReq = $.getJSON(location.origin + "/sessions", function(response) {
+    if (response && response.total > 0) {
+      $("#interactive-sessions").load("/static/sessions-table.html .sessions-template", function() {
+        loadSessionsTable(response.sessions);
+        $("#interactive-sessions-table").DataTable();
+        $('#interactive-sessions [data-toggle="tooltip"]').tooltip();
+      });
+    }
+    numSessions = response.total;
+  });
+
+  var batchesReq = $.getJSON(location.origin + "/batches", function(response) {
+    if (response && response.total > 0) {
+      $("#batches").load("/static/batches-table.html .sessions-template", function() {
+        loadBatchesTable(response.sessions);
+        $("#batches-table").DataTable();
+        $('#batches [data-toggle="tooltip"]').tooltip();
+      });
+    }
+    numBatches = response.total;
+  });
+
+  $.when(sessionsReq, batchesReq).done(function () {
+    if (numSessions + numBatches == 0) {
+      $("#all-sessions").append('<h4>No Sessions or Batches have been created yet.</h4>');
+    }
+  });
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-livy/blob/412ccc8f/server/src/main/resources/org/apache/livy/server/ui/static/batches-table.html
----------------------------------------------------------------------
diff --git a/server/src/main/resources/org/apache/livy/server/ui/static/batches-table.html b/server/src/main/resources/org/apache/livy/server/ui/static/batches-table.html
new file mode 100644
index 0000000..e0b3213
--- /dev/null
+++ b/server/src/main/resources/org/apache/livy/server/ui/static/batches-table.html
@@ -0,0 +1,42 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<h4 id="batches-header" class="sessions-template">Batch Sessions</h4>
+
+<table id="batches-table" class="table table-striped sessions-table sessions-template">
+  <thead class="sessions-table-head">
+  <tr>
+    <th>Batch Id</th>
+    <th>
+      <span data-toggle="tooltip"
+            title="Spark Application Id for this session.
+            If available, links to Spark Application Web UI">
+        Application Id
+      </span>
+    </th>
+    <th>
+      <span data-toggle="tooltip"
+            title="Session State (not_started, starting, idle, busy,
+            shutting_down, error, dead, success)">
+        State
+      </span>
+    </th>
+  </tr>
+  </thead>
+  <tbody class="sessions-table-body">
+  </tbody>
+</table>
\ No newline at end of file