Commit c677314d authored by Vivek's avatar Vivek

gadget_interface_validator: implemented panel and router interface.

parent 5ddeeee4
...@@ -107,41 +107,6 @@ ...@@ -107,41 +107,6 @@
"use strict";\n "use strict";\n
\n \n
var INTERFACE_GADGET_SCOPE = "interface_gadget";\n var INTERFACE_GADGET_SCOPE = "interface_gadget";\n
\n
function renderInitialReport(gadget, gadget_list) {\n
var gadget_info_list = [],\n
row_list = [],\n
column_list = [\'Gadget Name\', \'Declared Interfaces\', \'Validation Status\'],\n
cell_list,\n
default_status = "In Progress",\n
content = \'\',\n
item;\n
for(item in gadget_list) {\n
cell_list = [];\n
cell_list.push({\n
default_class: "gadget_name",\n
value: gadget_list[item]\n
});\n
cell_list.push({\n
default_class: "interface_list",\n
value: default_status\n
});\n
cell_list.push({\n
default_class: "validation_status",\n
value: default_status\n
});\n
row_list.push({\n
"cell_list": cell_list,\n
"default_id": gadget_list[item].substr(0, gadget_list[item].indexOf(\'.\'))\n
});\n
}\n
content += report_widget_table({\n
column_list: column_list,\n
row_list: row_list\n
});\n
gadget.props.content_element.innerHTML = content;\n
$(gadget.props.element).trigger("create");\n
}\n
\n \n
function validateAppGadgetList(gadget, gadget_list){\n function validateAppGadgetList(gadget, gadget_list){\n
var item;\n var item;\n
...@@ -171,7 +136,7 @@ ...@@ -171,7 +136,7 @@
function verifyGadgetImplementation(gadget, verify_gadget_url) {\n function verifyGadgetImplementation(gadget, verify_gadget_url) {\n
var interface_gadget,\n var interface_gadget,\n
interface_list = [],\n interface_list = [],\n
default_validation_status = {result:"N/A"};\n default_validation_status = {result:"N/A", result_message: "N/A"};\n
return new RSVP.Queue()\n return new RSVP.Queue()\n
.push(function() {\n .push(function() {\n
return gadget.getDeclaredGadget(INTERFACE_GADGET_SCOPE);\n return gadget.getDeclaredGadget(INTERFACE_GADGET_SCOPE);\n
...@@ -218,11 +183,14 @@ ...@@ -218,11 +183,14 @@
if(report_data.validation_status === true) {\n if(report_data.validation_status === true) {\n
validation_status = "Success";\n validation_status = "Success";\n
update_element.setAttribute(\'style\', \'color: green\');\n update_element.setAttribute(\'style\', \'color: green\');\n
}\n } else {\n
if(report_data.validation_status === false) {\n //if(report_data.validation_status === false) {\n
validation_status = (validation_message !== undefined? validation_message : "Failure");\n validation_status = (validation_message !== undefined? validation_message : "Failure");\n
update_element.setAttribute(\'style\', \'cursor: pointer; color: red\');\n update_element.setAttribute(\'style\', \'color: red\');\n
update_element.className += "error expand";\n if(report_data.validation_status === false) {\n
update_element.className += "error expand";\n
update_element.setAttribute(\'style\', \'cursor: pointer; color: red\');\n
}\n
}\n }\n
gadget.props.error_data[report_data.id] = report_data.error_detail;\n gadget.props.error_data[report_data.id] = report_data.error_detail;\n
update_element.querySelector(".validation_status").innerHTML = validation_status;\n update_element.querySelector(".validation_status").innerHTML = validation_status;\n
...@@ -282,21 +250,17 @@ ...@@ -282,21 +250,17 @@
\n \n
.declareMethod("render", function (options) {\n .declareMethod("render", function (options) {\n
var gadget = this,\n var gadget = this,\n
appcache_url = options.appcache_url,\n report_data;\n
gadget_list;\n
return new RSVP.Queue()\n return new RSVP.Queue()\n
.push(function() {\n .push(function() {\n
return gadget.getDeclaredGadget(INTERFACE_GADGET_SCOPE);\n return gadget.generateInitialReportData(options);\n
})\n
.push(function(interface_gadget) {\n
return interface_gadget.getGadgetListFromAppcache(appcache_url);\n
})\n })\n
.push(function(filtered_gadget_list) {\n .push(function(gadget_list) {\n
gadget_list = filtered_gadget_list;\n report_data = {\'gadget_list\': gadget_list};\n
return renderInitialReport(gadget, gadget_list);\n return gadget.renderInitialReport(report_data);\n
})\n })\n
.push(function() {\n .push(function() {\n
return validateAppGadgetList(gadget, gadget_list);\n return gadget.renderFinalReport(report_data);\n
}, function(error) {\n }, function(error) {\n
return gadget.redirect({\n return gadget.redirect({\n
found: false\n found: false\n
...@@ -304,10 +268,69 @@ ...@@ -304,10 +268,69 @@
});\n });\n
})\n })\n
\n \n
.declareMethod("reportPageDummyMethod1", function(param1) {\n .declareMethod("generateInitialReportData", function(options) {\n
// A dummy method to fulfil the interface implementation requirement.\n var gadget = this,\n
return;\n appcache_url = options.appcache_url;\n
return new RSVP.Queue()\n
.push(function() {\n
return gadget.getDeclaredGadget(INTERFACE_GADGET_SCOPE);\n
})\n
.push(function(interface_gadget) {\n
return interface_gadget.getGadgetListFromAppcache(appcache_url);\n
})\n
.push(function(filtered_gadget_list) {\n
gadget.props.gadget_list = filtered_gadget_list;\n
return filtered_gadget_list;\n
});\n
})\n
\n
.declareMethod("renderInitialReport", function(options) {\n
var gadget = this,\n
gadget_list = options.gadget_list, \n
gadget_info_list = [],\n
row_list = [],\n
column_list = [\'Gadget Name\', \'Declared Interfaces\', \'Validation Status\'],\n
cell_list,\n
default_status = "In Progress",\n
content = \'\',\n
item;\n
for(item in gadget_list) {\n
cell_list = [];\n
cell_list.push({\n
default_class: "gadget_name",\n
value: gadget_list[item]\n
});\n
cell_list.push({\n
default_class: "interface_list",\n
value: default_status\n
});\n
cell_list.push({\n
default_class: "validation_status",\n
value: default_status\n
});\n
row_list.push({\n
"cell_list": cell_list,\n
"default_id": gadget_list[item].substr(0, gadget_list[item].indexOf(\'.\'))\n
});\n
}\n
content += report_widget_table({\n
column_list: column_list,\n
row_list: row_list\n
});\n
gadget.props.content_element.innerHTML = content;\n
$(gadget.props.element).trigger("create");\n
})\n })\n
\n
.declareMethod("renderFinalReport", function(options) {\n
var gadget = this,\n
gadget_list = options.gadget_list;\n
return new RSVP.Queue()\n
.push(function() {\n
return validateAppGadgetList(gadget, gadget_list);\n
});\n
\n
})\n
\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
// Acquired methods\n // Acquired methods\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
...@@ -472,7 +495,7 @@ ...@@ -472,7 +495,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>946.54878.32293.23654</string> </value> <value> <string>947.13944.52291.15803</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -490,8 +513,8 @@ ...@@ -490,8 +513,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1446717974.43</float> <float>1447953184.15</float>
<string>UTC</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
...@@ -109,6 +109,8 @@ ...@@ -109,6 +109,8 @@
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />\n <meta http-equiv="Content-type" content="text/html; charset=utf-8" />\n
<meta name="viewport" content="width=device-width, user-scalable=no" />\n <meta name="viewport" content="width=device-width, user-scalable=no" />\n
<title>Gadget Interface Validator Panel</title>\n <title>Gadget Interface Validator Panel</title>\n
\n
<link rel="http://www.renderjs.org/rel/interface" href="gadget_interface_validator_interface_panel.html" />\n
\n \n
<!-- renderjs -->\n <!-- renderjs -->\n
<script src="rsvp.js" type="text/javascript"></script>\n <script src="rsvp.js" type="text/javascript"></script>\n
...@@ -289,7 +291,7 @@ ...@@ -289,7 +291,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>946.54879.52570.13994</string> </value> <value> <string>947.9498.60930.44168</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -307,8 +309,8 @@ ...@@ -307,8 +309,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1446805712.99</float> <float>1447996310.51</float>
<string>UTC</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
...@@ -111,6 +111,8 @@ ...@@ -111,6 +111,8 @@
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />\n <meta http-equiv="Content-type" content="text/html; charset=utf-8" />\n
<meta name="viewport" content="width=device-width, user-scalable=no" />\n <meta name="viewport" content="width=device-width, user-scalable=no" />\n
<title>Gadget Interface Validator Router</title>\n <title>Gadget Interface Validator Router</title>\n
\n
<link rel="http://www.renderjs.org/rel/interface" href="gadget_interface_validator_interface_router.html" />\n
\n \n
<!-- renderjs -->\n <!-- renderjs -->\n
<script src="rsvp.js" type="text/javascript"></script>\n <script src="rsvp.js" type="text/javascript"></script>\n
...@@ -260,7 +262,7 @@ ...@@ -260,7 +262,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>946.44766.54929.30600</string> </value> <value> <string>947.9498.60930.44168</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -278,8 +280,8 @@ ...@@ -278,8 +280,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1446476270.36</float> <float>1447996304.28</float>
<string>UTC</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
...@@ -345,7 +345,7 @@ ...@@ -345,7 +345,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>946.58912.52724.48776</string> </value> <value> <string>947.14517.45318.16230</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -363,8 +363,8 @@ ...@@ -363,8 +363,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1446805302.57</float> <float>1447986581.85</float>
<string>UTC</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment