azkaban-aplcache
Changes
src/web/js/azkaban/model/log-data.js 16(+16 -0)
src/web/js/azkaban/model/svg-graph.js 79(+79 -0)
src/web/js/azkaban/util/flow-loader.js 67(+16 -51)
src/web/js/azkaban/view/exflow.js 4(+1 -3)
src/web/js/azkaban/view/flow.js 7(+2 -5)
src/web/js/azkaban/view/svg-graph.js 1(+0 -1)
Details
diff --git a/src/java/azkaban/webapp/servlet/velocity/svgflowincludes.vm b/src/java/azkaban/webapp/servlet/velocity/svgflowincludes.vm
index 220ebcb..2b1765f 100644
--- a/src/java/azkaban/webapp/servlet/velocity/svgflowincludes.vm
+++ b/src/java/azkaban/webapp/servlet/velocity/svgflowincludes.vm
@@ -29,6 +29,7 @@
<script type="text/javascript" src="${context}/js/azkaban/util/date.js"></script>
<script type="text/javascript" src="${context}/js/azkaban/view/job-list.js"></script>
+ <script type="text/javascript" src="${context}/js/azkaban/model/svg-graph.js"></script>
<script type="text/javascript" src="${context}/js/azkaban/view/svg-graph.js"></script>
<script type="text/javascript" src="${context}/js/azkaban/util/svg-navigate.js"></script>
src/web/js/azkaban/model/log-data.js 16(+16 -0)
diff --git a/src/web/js/azkaban/model/log-data.js b/src/web/js/azkaban/model/log-data.js
index 90a958f..958ee5d 100644
--- a/src/web/js/azkaban/model/log-data.js
+++ b/src/web/js/azkaban/model/log-data.js
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2014 LinkedIn Corp.
+ *
+ * Licensed 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.
+ */
+
$.namespace('azkaban');
azkaban.LogDataModel = Backbone.Model.extend({
src/web/js/azkaban/model/svg-graph.js 79(+79 -0)
diff --git a/src/web/js/azkaban/model/svg-graph.js b/src/web/js/azkaban/model/svg-graph.js
new file mode 100644
index 0000000..c683997
--- /dev/null
+++ b/src/web/js/azkaban/model/svg-graph.js
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2014 LinkedIn Corp.
+ *
+ * Licensed 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.
+ */
+
+$.namespace('azkaban');
+
+azkaban.GraphModel = Backbone.Model.extend({
+ initialize: function() {
+
+ },
+
+ /*
+ * Process and add data from JSON.
+ */
+ addFlow: function(data) {
+ this.processFlowData(data);
+ this.set({'data': data});
+ },
+
+ processFlowData: function(data) {
+ var nodes = {};
+ var edges = new Array();
+
+ // Create a node map
+ for (var i = 0; i < data.nodes.length; ++i) {
+ var node = data.nodes[i];
+ nodes[node.id] = node;
+ if (!node.status) {
+ node.status = "READY";
+ }
+ }
+
+ // Create each node in and out nodes. Create an edge list.
+ for (var i = 0; i < data.nodes.length; ++i) {
+ var node = data.nodes[i];
+ if (node.in) {
+ for (var j = 0; j < node.in.length; ++j) {
+ var fromNode = nodes[node.in[j]];
+ if (!fromNode.outNodes) {
+ fromNode.outNodes = {};
+ }
+ if (!node.inNodes) {
+ node.inNodes = {};
+ }
+
+ fromNode.outNodes[node.id] = node;
+ node.inNodes[fromNode.id] = fromNode;
+ edges.push({to: node.id, from: fromNode.id});
+ }
+ }
+ }
+
+ // Iterate over the nodes again. Parse the data if they're embedded flow data.
+ // Assign each nodes to the parent flow data.
+ for (var key in nodes) {
+ var node = nodes[key];
+ node.parent = data;
+ if (node.type == "flow") {
+ this.processFlowData(node);
+ }
+ }
+
+ // Assign the node map and the edge list
+ data.nodeMap = nodes;
+ data.edges = edges;
+ }
+});
src/web/js/azkaban/util/flow-loader.js 67(+16 -51)
diff --git a/src/web/js/azkaban/util/flow-loader.js b/src/web/js/azkaban/util/flow-loader.js
index 97e447c..73beef2 100644
--- a/src/web/js/azkaban/util/flow-loader.js
+++ b/src/web/js/azkaban/util/flow-loader.js
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2014 LinkedIn Corp.
+ *
+ * Licensed 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.
+ */
+
var statusStringMap = {
"FAILED": "Failed",
"SUCCEEDED": "Success",
@@ -57,57 +73,6 @@ var createNewPanel = function(node, model, evt) {
backboneView.showExtendedView(evt);
}
-/**
- * Processes the flow data from Javascript
- */
-var processFlowData = function(data) {
- var nodes = {};
- var edges = new Array();
-
- //Create a node map
- for (var i=0; i < data.nodes.length; ++i) {
- var node = data.nodes[i];
- nodes[node.id] = node;
- if (!node.status) {
- node.status = "READY";
- }
- }
-
- // Create each node in and out nodes. Create an edge list.
- for (var i=0; i < data.nodes.length; ++i) {
- var node = data.nodes[i];
- if (node.in) {
- for (var j=0; j < node.in.length; ++j) {
- var fromNode = nodes[node.in[j]];
- if (!fromNode.outNodes) {
- fromNode.outNodes = {};
- }
- if (!node.inNodes) {
- node.inNodes = {};
- }
-
- fromNode.outNodes[node.id] = node;
- node.inNodes[fromNode.id] = fromNode;
- edges.push({to: node.id, from: fromNode.id});
- }
- }
- }
-
- // Iterate over the nodes again. Parse the data if they're embedded flow data.
- // Assign each nodes to the parent flow data.
- for (var key in nodes) {
- var node = nodes[key];
- node.parent = data;
- if (node.type == "flow") {
- processFlowData(node);
- }
- }
-
- // Assign the node map and the edge list
- data.nodeMap = nodes;
- data.edges = edges;
-}
-
var closeAllSubDisplays = function() {
$(".flowExtendedView").hide();
}
src/web/js/azkaban/view/exflow.js 4(+1 -3)
diff --git a/src/web/js/azkaban/view/exflow.js b/src/web/js/azkaban/view/exflow.js
index eee5a1a..c495584 100644
--- a/src/web/js/azkaban/view/exflow.js
+++ b/src/web/js/azkaban/view/exflow.js
@@ -377,7 +377,6 @@ azkaban.StatsView = Backbone.View.extend({
});
var graphModel;
-azkaban.GraphModel = Backbone.Model.extend({});
var logModel;
azkaban.LogModel = Backbone.Model.extend({});
@@ -582,8 +581,7 @@ $(function() {
var requestData = {"execid": execId, "ajax":"fetchexecflow"};
var successHandler = function(data) {
console.log("data fetched");
- processFlowData(data);
- graphModel.set({data:data});
+ graphModel.addFlow(data);
graphModel.trigger("change:graph");
updateTime = Math.max(updateTime, data.submitTime);
src/web/js/azkaban/view/flow.js 7(+2 -5)
diff --git a/src/web/js/azkaban/view/flow.js b/src/web/js/azkaban/view/flow.js
index 14ee620..32ae40a 100644
--- a/src/web/js/azkaban/view/flow.js
+++ b/src/web/js/azkaban/view/flow.js
@@ -366,7 +366,7 @@ azkaban.SummaryView = Backbone.View.extend({
});
var graphModel;
-azkaban.GraphModel = Backbone.Model.extend({});
+var mainSvgGraphView;
var executionModel;
azkaban.ExecutionModel = Backbone.Model.extend({});
@@ -379,8 +379,6 @@ var flowStatsModel;
var executionsTimeGraphView;
-var mainSvgGraphView;
-
$(function() {
var selected;
// Execution model has to be created before the window switches the tabs.
@@ -452,8 +450,7 @@ $(function() {
};
var successHandler = function(data) {
console.log("data fetched");
- processFlowData(data);
- graphModel.set({data:data});
+ graphModel.addFlow(data);
graphModel.trigger("change:graph");
// Handle the hash changes here so the graph finishes rendering first.
diff --git a/src/web/js/azkaban/view/flow-execute-dialog.js b/src/web/js/azkaban/view/flow-execute-dialog.js
index e6d9cb1..e8db80c 100644
--- a/src/web/js/azkaban/view/flow-execute-dialog.js
+++ b/src/web/js/azkaban/view/flow-execute-dialog.js
@@ -259,8 +259,7 @@ azkaban.FlowExecuteDialogView = Backbone.View.extend({
var self = this;
var successHandler = function(data) {
console.log("data fetched");
- processFlowData(data);
- graphModel.set({data:data});
+ graphModel.addFlow(data);
if (exgraph) {
self.assignInitialStatus(data, exgraph);
@@ -481,7 +480,6 @@ var handleJobMenuClick = function(action, el, pos) {
}
var executableGraphModel;
-azkaban.GraphModel = Backbone.Model.extend({});
/**
* Disable jobs that need to be disabled
src/web/js/azkaban/view/svg-graph.js 1(+0 -1)
diff --git a/src/web/js/azkaban/view/svg-graph.js b/src/web/js/azkaban/view/svg-graph.js
index ff1fa2d..7e0d179 100644
--- a/src/web/js/azkaban/view/svg-graph.js
+++ b/src/web/js/azkaban/view/svg-graph.js
@@ -430,7 +430,6 @@ azkaban.SvgGraphView = Backbone.View.extend({
bounds.maxX = bounds.maxX ? bounds.maxX + margin : margin;
bounds.maxY = bounds.maxY ? bounds.maxY + margin : margin;
this.graphBounds = bounds;
-
},
relayoutFlow: function(node) {