modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
| 35 ++++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
| 18 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TimestampCellFormatter.java
| 49 +++++++++-
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
| 17 +--
5 files changed, 98 insertions(+), 25 deletions(-)
New commits:
commit eca868ae89eed3a67cc0ea5fee4a7d0974a233a3
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 30 12:45:20 2011 -0400
AlertHistoryView fixes
- fix bad link for create time field to alert detail
- consolidate timestamp formats for the createTime and status columns,
shortening value but adding verbose hover.
- replace "Ack" with "Acknowledge" where width is not an issue.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
index d9d1eda..9fde105 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
@@ -111,6 +111,8 @@ public class AlertDataSource extends RPCDataSource<Alert,
AlertCriteria> {
ListGridField ctimeField = new ListGridField(AlertCriteria.SORT_FIELD_CTIME, MSG
.view_alerts_field_created_time());
ctimeField.setCellFormatter(new TimestampCellFormatter());
+ ctimeField.setShowHover(true);
+
ctimeField.setHoverCustomizer(TimestampCellFormatter.getHoverCustomizer(AlertCriteria.SORT_FIELD_CTIME));
fields.add(ctimeField);
ListGridField nameField = new ListGridField("name",
MSG.view_alerts_field_name());
@@ -153,14 +155,25 @@ public class AlertDataSource extends RPCDataSource<Alert,
AlertCriteria> {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1)
{
String ackSubject =
listGridRecord.getAttribute("acknowledgingSubject");
if (ackSubject == null) {
- return MSG.view_alerts_field_ack_status_empty();
+ return MSG.view_alerts_field_ack_status_noAck();
} else {
- Date ackTime =
listGridRecord.getAttributeAsDate("acknowledgeTime");
- String formattedTime = TimestampCellFormatter.format(ackTime);
- return MSG.view_alerts_field_ack_status_filled(ackSubject,
formattedTime);
+ return MSG.view_alerts_field_ack_status_ack(ackSubject);
}
}
});
+ statusField.setShowHover(true);
+ statusField.setHoverCustomizer(new HoverCustomizer() {
+ public String hoverHTML(Object value, ListGridRecord record, int rowNum, int
colNum) {
+ String ackSubject =
record.getAttribute("acknowledgingSubject");
+ Date ackTime = record.getAttributeAsDate("acknowledgeTime");
+ String ackTimeString = TimestampCellFormatter.format(ackTime,
+ TimestampCellFormatter.DATE_TIME_FORMAT_FULL);
+ StringBuilder sb = new StringBuilder("<p
style='width:500px'>");
+ sb.append(MSG.view_alerts_field_ack_status_ackHover(ackSubject,
ackTimeString));
+ sb.append("</p>");
+ return sb.toString();
+ }
+ });
fields.add(statusField);
if (this.entityContext.type != EntityContext.Type.Resource) {
@@ -184,17 +197,17 @@ public class AlertDataSource extends RPCDataSource<Alert,
AlertCriteria> {
ListGridField ancestryField = AncestryUtil.setupAncestryListGridField();
fields.add(ancestryField);
- ctimeField.setWidth(125);
- nameField.setWidth("20%");
- conditionField.setWidth("30%");
+ ctimeField.setWidth(100);
+ nameField.setWidth("15%");
+ conditionField.setWidth("35%");
priorityField.setWidth(50);
- statusField.setWidth("80");
+ statusField.setWidth(100);
resourceNameField.setWidth("25%");
ancestryField.setWidth("25%");
} else {
- ctimeField.setWidth(125);
- nameField.setWidth("35%");
- conditionField.setWidth("40%");
+ ctimeField.setWidth(200);
+ nameField.setWidth("15%");
+ conditionField.setWidth("60%");
priorityField.setWidth(50);
statusField.setWidth("25%");
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java
index 49b2484..14cfc8a 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java
@@ -161,7 +161,7 @@ public class AlertDetailsView extends LocatableVLayout implements
BookmarkableVi
if (record.getAttribute("acknowledgingSubject") != null) {
ackByItem.setValue(record.getAttribute("acknowledgingSubject"));
} else {
- ackByItem.setValue(MSG.view_alerts_field_ack_status_empty());
+ ackByItem.setValue(MSG.view_alerts_field_ack_status_noAck());
}
items.add(ackByItem);
@@ -170,7 +170,7 @@ public class AlertDetailsView extends LocatableVLayout implements
BookmarkableVi
if (ack_time != null) {
ackTimeItem.setValue(TimestampCellFormatter.format(ack_time));
} else {
- ackTimeItem.setValue(MSG.view_alerts_field_ack_status_empty());
+ ackTimeItem.setValue(MSG.view_alerts_field_ack_status_noAck());
}
items.add(ackTimeItem);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
index f5fd917..e321819 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
@@ -29,6 +29,7 @@ import com.smartgwt.client.types.MultipleAppearance;
import com.smartgwt.client.types.SortDirection;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.fields.SelectItem;
+import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -38,13 +39,17 @@ import org.rhq.core.domain.common.EntityContext;
import org.rhq.core.domain.criteria.AlertCriteria;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
+import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.AncestryUtil;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
/**
* A view that displays a paginated table of fired {@link org.rhq.core.domain.alert.Alert
alert}s, along with the
@@ -131,6 +136,19 @@ public class AlertHistoryView extends
TableSection<AlertDataSource> {
return AlertCriteria.SORT_FIELD_CTIME;
}
+ @Override
+ protected CellFormatter getDetailsLinkColumnCellFormatter() {
+ return new CellFormatter() {
+ public String format(Object value, ListGridRecord record, int i, int i1) {
+ Integer resourceId = record.getAttributeAsInt(AncestryUtil.RESOURCE_ID);
+ Integer alertHistoryId = getId(record);
+ String url = LinkManager.getSubsystemAlertHistoryLink(resourceId,
alertHistoryId);
+ String formattedValue = TimestampCellFormatter.format(value);
+ return SeleniumUtility.getLocatableHref(url, formattedValue, null);
+ }
+ };
+ }
+
protected void setupTableInteractions(final boolean hasWriteAccess) {
TableActionEnablement singleTargetEnablement = hasWriteAccess ?
TableActionEnablement.ANY
: TableActionEnablement.NEVER;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TimestampCellFormatter.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TimestampCellFormatter.java
index b08c0ee..d8a86c7 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TimestampCellFormatter.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TimestampCellFormatter.java
@@ -4,6 +4,7 @@ import java.util.Date;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.HoverCustomizer;
import com.smartgwt.client.widgets.grid.ListGridRecord;
/**
@@ -12,10 +13,36 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
* @author Ian Springer
*/
public class TimestampCellFormatter implements CellFormatter {
- public static final DateTimeFormat DATE_TIME_FORMAT =
DateTimeFormat.getMediumDateTimeFormat();
+
+ public static final DateTimeFormat DATE_TIME_FORMAT_FULL =
DateTimeFormat.getFullDateTimeFormat();
+ public static final DateTimeFormat DATE_TIME_FORMAT_LONG =
DateTimeFormat.getLongDateTimeFormat();
+ public static final DateTimeFormat DATE_TIME_FORMAT_MEDIUM =
DateTimeFormat.getMediumDateTimeFormat();
+ public static final DateTimeFormat DATE_TIME_FORMAT_SHORT =
DateTimeFormat.getShortDateTimeFormat();
+
+ private DateTimeFormat dateTimeFormat;
+
+ /**
+ * Uses SHORT format.
+ */
+ public TimestampCellFormatter() {
+ this(DATE_TIME_FORMAT_MEDIUM);
+ }
+
+ public TimestampCellFormatter(DateTimeFormat dateTimeFormat) {
+ super();
+ this.dateTimeFormat = dateTimeFormat;
+ }
public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
- return format(value);
+ return format(value, dateTimeFormat);
+ }
+
+ /**
+ * @param value
+ * @return SHORT format for value
+ */
+ public static String format(Object value) {
+ return format(value, DATE_TIME_FORMAT_MEDIUM);
}
/**
@@ -24,10 +51,11 @@ public class TimestampCellFormatter implements CellFormatter {
* consistent across the app, whether the data is in a cell or not.
*
* @param value the date to format as a Date, Long, Integer or a String
+ * @param dateTimeFormat the format to use. If null defaults to SHORT format
*
* @return the formatted date string
*/
- public static String format(Object value) {
+ public static String format(Object value, DateTimeFormat dateTimeFormat) {
if (value == null) {
return "";
}
@@ -47,6 +75,19 @@ public class TimestampCellFormatter implements CellFormatter {
}
date = new Date(longValue);
}
- return DATE_TIME_FORMAT.format(date);
+
+ return (null == dateTimeFormat) ? DATE_TIME_FORMAT_MEDIUM.format(date) :
dateTimeFormat.format(date);
+ }
+
+ public static HoverCustomizer getHoverCustomizer(final String dateTimeAttributeName)
{
+ return new HoverCustomizer() {
+
+ public String hoverHTML(Object value, ListGridRecord record, int rowNum, int
colNum) {
+ StringBuilder sb = new StringBuilder("<p
style='width:300px'>");
+ sb.append(format(record.getAttributeAsDate(dateTimeAttributeName),
DATE_TIME_FORMAT_FULL));
+ sb.append("</p>");
+ return sb.toString();
+ }
+ };
}
}
diff --git
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index a965934..7bc3ea4 100644
---
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -13,8 +13,8 @@ common_buildInfo_gwtVersion = ${gwt.version}
# Button Labels
#--------------
-common_button_ack = Ack
-common_button_ack_all = Ack All
+common_button_ack = Acknowlege
+common_button_ack_all = Acknowledge All
common_button_add = Add
common_button_advanced = Advanced...
common_button_apply = Apply
@@ -877,11 +877,12 @@ view_alerts_table_filter_priority = Priority Filter
view_alerts_field_created_time = Creation Time
view_alerts_field_modified_time = Modified Time
view_alerts_field_enabled = Enabled
-view_alerts_field_ack_time = Ack Time
-view_alerts_field_ack_subject = Ack Subject
+view_alerts_field_ack_time = Acknowledge Time
+view_alerts_field_ack_subject = Acknowledge Subject
view_alerts_field_ack_status = Status
-view_alerts_field_ack_status_empty = Not Acknowledged
-view_alerts_field_ack_status_filled = {0} acknowledged on {1}
+view_alerts_field_ack_status_noAck = No Ack
+view_alerts_field_ack_status_ack = Ack ({0})
+view_alerts_field_ack_status_ackHover = Acknowledged by {0} at {1}
view_alerts_field_name = Name
view_alerts_field_condition_text = Condition Text
view_alerts_field_condition_text_none = No Conditions
@@ -897,8 +898,8 @@ view_alerts_delete_confirm_all = Delete all alerts from this source?
view_alerts_delete_success = Successfully deleted {0} alerts
view_alerts_delete_failure = Failed to delete alerts with id''s: {0}
view_alerts_delete_failure_all = Failed to delete all alerts from this source
-view_alerts_ack_confirm = Ack the selected alert(s)?
-view_alerts_ack_confirm_all = Ack all alerts from this source?
+view_alerts_ack_confirm = Acknowledge the selected alert(s)?
+view_alerts_ack_confirm_all = Acknowledge all alerts from this source?
view_alerts_ack_success = Successfully acknowledged {0} alerts
view_alerts_ack_failure = Failed to acknowledge alerts with id''s: {0}
view_alerts_ack_failure_all = Failed to acknowledge all alerts from this source