Skip to content
Browse files

Fixed the various UI issues that were suggested by Gary.

  • Loading branch information...
1 parent f8c983e commit ef1a696924ccf1f044bc72f6dd71ffb6afd177c9 @jeffyu jeffyu committed Nov 24, 2012
View
2 gadget-web/src/main/java/org/overlord/gadgets/web/client/widgets/PortalLayout.java
@@ -40,7 +40,7 @@
private List<FlowPanel> columnPanel;
public static final int THREE_COLUMN_WIDTH = 325;
- public static final int TWO_COLUMN_WIDTH = 480;
+ public static final int TWO_COLUMN_WIDTH = 500;
public static final int ONE_COLUMN_WIDTH = 980;
private int columnWidth = TWO_COLUMN_WIDTH;
View
17 gadget-web/src/main/java/org/overlord/gadgets/web/client/widgets/Portlet.java
@@ -36,6 +36,7 @@
import com.google.gwt.http.client.Response;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
@@ -126,7 +127,7 @@ public void onClick(ClickEvent event) {
hideRestoreButton(id);
gadgetSpec.setWidth("100%");
gadgetSpec.setHeight("250px");
- gadgetSpec.getElement().setAttribute("scrolling", "no");
+ gadgetSpec.getElement().setAttribute("scrolling", "auto");
gadgetSpec.setUrl("http://localhost:8080/gadget-server/gadgets/ifr?url=" + wmodel.getSpecUrl() + "&" + getHomeView());
}
});
@@ -147,7 +148,7 @@ public Portlet(WidgetModel model, int width, String portalId) {
generateUserPref(model);
- gadgetSpec.getElement().setAttribute("scrolling", "no");
+ gadgetSpec.getElement().setAttribute("scrolling", "auto");
gadgetSpec.getElement().setAttribute("frameborder", "0");
gadgetSpec.setWidth(width - 20 + "px");
gadgetSpec.setHeight("250px");
@@ -249,6 +250,7 @@ public void onClick(ClickEvent event) {
public void onResponseReceived(Request request, Response response) {
hideUserPref(id);
gadgetSpec.setUrl("http://localhost:8080/gadget-server/gadgets/ifr?url=" + wmodel.getSpecUrl() + "&" + getHomeView());
+ reloadIFrame(gadgetSpec.getElement());
}
});
@@ -342,6 +344,15 @@ private static native void hideUserPref(String id) /*-{
private static native void showUserPref(String id) /*-{
$wnd.$('#' + id).find(".portlet-preference").show();
- }-*/;
+ }-*/;
+
+ private static native void reloadIFrame(Element iframeEl) /*-{
+ iframeEl.contentWindow.location.reload(true);
+ }-*/;
+
+ private static native void setPreference(String name, String value) /*-{
+ var prefs = new gadgets.Prefs();
+ prefs.set(name, value);
+}-*/;
}
View
2 gadget-web/src/main/webapp/Application.css
@@ -93,7 +93,7 @@ a {
.portlet-header .portlet-setting {float:right;}
.portlet-header .portlet-close {float:right;}
.portlet-header .portlet-restore {float:right;}
-.portlet-content { padding: 0.4em; height:95%}
+.portlet-content { padding: 0.4em; height:100%;}
.ui-sortable-placeholder { border: 1px dashed black; visibility: visible !important; }
.ui-sortable-placeholder * { visibility: hidden; }
View
2 gadget-web/src/main/webapp/WEB-INF/classes/import.sql
@@ -5,7 +5,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('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/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('Call Trace Gadget','Red Hat','jeffyu@overlord.com','Call Trace 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
73 gadgets/src/main/webapp/calltrace-gadget/gadget.xml
@@ -3,9 +3,11 @@
<ModulePrefs title="Call Trace" description="Call Trace gadget"
author="Jeff Yu" author_email="jeff.yuchang@gmail.com">
<Require feature="tabs"/>
+ <Require feature="setprefs"/>
+ <Require feature="dynamic-height" />
</ModulePrefs>
- <UserPref name="serviceUrl" display_name="Service URL:"
- default_value="http://localhost:8080/overlord-bam-services/call/trace/instance?correlation=test" />
+ <UserPref name="host" display_name="Host:" default_value="http://localhost:8080" />
+ <UserPref name="identifier" display_name="Identifier:" default_value="test" />
<UserPref name="refreshCycle" display_name="Refresh Interval(sec):"
default_value="30" datatype="enum">
<EnumValue value="30" />
@@ -17,6 +19,7 @@
<Content type="html"><![CDATA[
<style type="text/css">
+ #promptDiv {width:90%;font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif; font-size: 9pt;margin:10px;}
#tree {width:90%;}
#detail {width:90%; border:1px solid #69C; border-collapse: collapse;font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif; font-size: 9pt;margin:10px;}
#detail thead th {font-weight: normal;font-size: 9pt; color:#039;border-bottom: 1px dashed #69C; text-align: left;}
@@ -38,7 +41,18 @@
function makeJSONRequest(){
var prefs = new gadgets.Prefs();
- var restUrl = prefs.getString("serviceUrl");
+ var host = prefs.getString("host");
+ var ident = prefs.getString("identifier");
+
+ if (ident == "") {
+ $("#promptDiv").show();
+ return;
+ } else {
+ $("#promptDiv").hide();
+ }
+
+ var restUrl = host + "/overlord-bam/call/trace/instance?identifier=" + ident;
+
var params = {};
params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON;
params[gadgets.io.RequestParameters.REFRESH_INTERVAL] = prefs.getInt("refreshCycle");
@@ -48,25 +62,25 @@
}
function updateResponse(response) {
+ var treeData;
var data = response.data;
- if (response.data == undefined) {
- return ;
+ if (data == undefined) {
+ treeData={};
+ } else {
+ treeData = new Array(data.tasks.length);
+ for(var i = 0; i < treeData.length; i++) {
+ var task = data.tasks[i];
+ treeData[i] = convertJsonToTreeData(task);
+ }
}
- 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) {
var treeObject = {};
var isCall = (task.type == "Call");
if (isCall) {
- treeObject["title"] = getTruncatedTitle(task.component + " " + task.operation) + " [" + task.duration + " ms] (" + task.percentage + "%)";
+ treeObject["title"] = getCallTypeTitle(task);
treeObject["isFolder"] = true;
treeObject["request"] = escapeHTML(task.request);
treeObject["response"] = escapeHTML(task.response);
@@ -76,10 +90,12 @@
treeObject['duration'] = task.duration;
treeObject['percentage'] = task.percentage;
treeObject['type'] = task.type;
- if (task.fault == undefined) {
- treeObject['addClass'] = 'success';
- } else {
+ if (task.status == "Warning") {
+ treeObject['addClass'] = 'warning';
+ } else if (task.status == "Fail") {
treeObject['addClass'] = 'error';
+ } else {
+ treeObject['addClass'] = 'success';
}
} else {
@@ -89,7 +105,7 @@
treeObject['duration'] = task.duration;
treeObject['percentage'] = task.percentage;
treeObject['type'] = task.type;
- treeObject['addClass'] = '';
+ treeObject['addClass'] = 'task';
}
if (task.properties != undefined) {
@@ -107,6 +123,17 @@
return treeObject;
}
+
+ function getCallTypeTitle(task) {
+ var title = getTruncatedTitle(task.component + " " + task.operation);
+ if (task.duration != undefined) {
+ title = title + "[" + task.duration + "ms]";
+ }
+ if (task.percentage != undefined) {
+ title = title + "(" + task.percentage + "%)";
+ }
+ return title;
+ }
function initialiseTree(data) {
// Attach the dynatree widget to an existing <div id="tree"> element
@@ -118,7 +145,6 @@
}
function showTheDetail(node) {
- //$("#detail").show();
tabset.setSelectedTab(1);
var properties = ['type', 'component', 'operation', 'request', 'response', 'fault', 'requestLatency', 'responseLatency', 'duration', 'percentage'];
var thedata = node.data;
@@ -139,6 +165,8 @@
}
}
+ //gadgets.window.adjustHeight();
+
}
function deleteRows() {
@@ -197,20 +225,15 @@
tabset = new gadgets.TabSet();
tabset.alignTabs('left');
tabset.addTab("Call Trace Tree", {contentContainer:document.getElementById("tree")});
- tabset.addTab("Summary", {contentContainer:document.getElementById("detail")});
-
+ tabset.addTab("Details", {contentContainer:document.getElementById("detail")});
makeJSONRequest();
setInterval(makeJSONRequest, refreshInterval * 1000);
}
-
- function getViewName() {
- return gadgets.views.getCurrentView().getName();
- }
gadgets.util.registerOnLoadHandler(loadData);
</script>
-
+ <div id="promptDiv">Please set the Identifier field in the Preference setting by clicking the setting button!</div>
<div id="tree"></div>
<div id="detail">
<table style="width:95%" summary="Summary">
View
9 gadgets/src/main/webapp/calltrace-gadget/skin/ui.dynatree.css
@@ -453,5 +453,12 @@ span.warning span.dynatree-icon
span.task span.dynatree-icon
{
- background-position: 0px 0px;
+ width: 16px;
+ height: 16px;
+ display: inline-block; /* Required to make a span sizeable */
+ vertical-align: top;
+ background-repeat: no-repeat;
+ background-position: left;
+ background-image: url("icons.gif");
+ background-position: 0 0;
}

0 comments on commit ef1a696

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