Skip to content
Browse files

Added the calltrace gadget thumbnail.

  • Loading branch information...
1 parent 2ce46c5 commit b47b41bec6e4c8994b56b75a8b91805f7b3a40ca @jeffyu jeffyu committed Nov 16, 2012
View
2 gadget-web/src/main/webapp/WEB-INF/classes/import.sql
@@ -6,7 +6,7 @@ INSERT INTO GS_USER_GROUP(`USER_ID`, `GROUP_ID`) VALUES(1, 1);
INSERT INTO GS_GADGET(`GADGET_TITLE`,`GADGET_AUTHOR`,`GADGET_AUTHOR_EMAIL`,`GADGET_DESCRIPTION`,`GADGET_THUMBNAIL_URL`,`GADGET_URL`) VALUES('Response Time','Red Hat','jeffyu@overlord.com','Response Time Gadget','http://localhost:8080/gadgets/rt-gadget/thumbnail.png','http://localhost:8080/gadgets/rt-gadget/gadget.xml');
INSERT INTO GS_GADGET(`GADGET_TITLE`,`GADGET_AUTHOR`,`GADGET_AUTHOR_EMAIL`,`GADGET_DESCRIPTION`,`GADGET_THUMBNAIL_URL`,`GADGET_URL`) VALUES('Currency Converter','Google','info@tofollow.com','currency converter widget','http://www.gstatic.com/ig/modules/currency_converter/currency_converter_content/en_us-thm.cache.png','http://www.gstatic.com/ig/modules/currency_converter/currency_converter_v2.xml');
INSERT INTO GS_GADGET(`GADGET_TITLE`,`GADGET_AUTHOR`,`GADGET_AUTHOR_EMAIL`,`GADGET_DESCRIPTION`,`GADGET_THUMBNAIL_URL`,`GADGET_URL`) VALUES('Situation Gadget','Red Hat','jeffyu@overlord.com','Situation Gadget','http://localhost:8080/gadgets/situation-gadget/thumbnail.png','http://localhost:8080/gadgets/situation-gadget/gadget.xml');
-INSERT INTO GS_GADGET(`GADGET_TITLE`,`GADGET_AUTHOR`,`GADGET_AUTHOR_EMAIL`,`GADGET_DESCRIPTION`,`GADGET_THUMBNAIL_URL`,`GADGET_URL`) VALUES('Service Call Gadget','Red Hat','jeffyu@overlord.com','Service Call Gadget','http://localhost:8080/gadgets/situation-gadget/thumbnail.png','http://localhost:8080/gadgets/calltrace-gadget/gadget.xml');
+INSERT INTO GS_GADGET(`GADGET_TITLE`,`GADGET_AUTHOR`,`GADGET_AUTHOR_EMAIL`,`GADGET_DESCRIPTION`,`GADGET_THUMBNAIL_URL`,`GADGET_URL`) VALUES('Service Call Gadget','Red Hat','jeffyu@overlord.com','Service Call Gadget','http://localhost:8080/gadgets/calltrace-gadget/thumbnail.png','http://localhost:8080/gadgets/calltrace-gadget/gadget.xml');
INSERT INTO GS_GADGET(`GADGET_TITLE`,`GADGET_AUTHOR`,`GADGET_AUTHOR_EMAIL`,`GADGET_DESCRIPTION`,`GADGET_THUMBNAIL_URL`,`GADGET_URL`) VALUES('Service Overview Gadget','Red Hat','jeffyu@overlord.com','Service Overview Gadget','http://localhost:8080/gadgets/so-gadget/thumbnail.png','http://localhost:8080/gadgets/so-gadget/gadget.xml');
INSERT INTO GS_GADGET(`GADGET_TITLE`,`GADGET_AUTHOR`,`GADGET_AUTHOR_EMAIL`,`GADGET_DESCRIPTION`,`GADGET_THUMBNAIL_URL`,`GADGET_URL`) VALUES('Date & Time','Google','admin@google.com','Add a clock to your page. Click edit to change it to the color of your choice','http://gadgets.adwebmaster.net/images/gadgets/datetimemulti/thumbnail_en.jpg','http://www.gstatic.com/ig/modules/datetime_v3/datetime_v3.xml');
INSERT INTO GS_GADGET(`GADGET_TITLE`,`GADGET_AUTHOR`,`GADGET_AUTHOR_EMAIL`,`GADGET_DESCRIPTION`,`GADGET_THUMBNAIL_URL`,`GADGET_URL`) VALUES('Economic Data - ALFRED Graph','Research Department','webmaster@research.stlouisfed.org','Vintage Economic Data from the Federal Reserve Bank of St. Louis','http://research.stlouisfed.org/gadgets/images/alfredgraphgadgetthumbnail.png','http://research.stlouisfed.org/gadgets/code/alfredgraph.xml');
View
40 gadgets/src/main/webapp/calltrace-gadget/gadget.xml
@@ -31,16 +31,26 @@
<script type="text/javascript">
function makeJSONRequest(){
- $.getJSON("calltrace.json", function(data){
- var treeData = new Array(data.tasks.length);
- for(var i = 0; i < treeData.length; i++) {
- var task = data.tasks[i];
- treeData[i] = convertJsonToTreeData(task);
- }
-
- initialiseTree(treeData);
- $("#detail").hide();
- });
+ var restUrl = "http://localhost:8080/gadgets/calltrace-gadget/calltrace.json";
+ var params = {};
+ var prefs = new gadgets.Prefs();
+ params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON;
+ params[gadgets.io.RequestParameters.REFRESH_INTERVAL] = prefs.getInt("refreshCycle");
+ params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.GET;
+
+ gadgets.io.makeRequest(restUrl, updateResponse, params);
+ }
+
+ function updateResponse(response) {
+ var data = response.data;
+ var treeData = new Array(data.tasks.length);
+ for(var i = 0; i < treeData.length; i++) {
+ var task = data.tasks[i];
+ treeData[i] = convertJsonToTreeData(task);
+ }
+
+ initialiseTree(treeData);
+ $("#detail").hide();
}
function convertJsonToTreeData(task) {
@@ -135,9 +145,13 @@
</script>
-
-
-
+ <div id="tree"></div>
+ <div id="detail">
+ <table style="width:100%" border="0" cellspacing="3" cellpadding="5">
+ <tbody id="detail-body">
+ </tbody>
+ </table>
+ </div>
]]>
</Content>
</Module>
View
BIN gadgets/src/main/webapp/calltrace-gadget/thumbnail.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b47b41b

Please sign in to comment.
Something went wrong with that request. Please try again.