modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java | 9 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionDataSource.java | 72 ++++++++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionsView.java | 35 +++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftSnapshotView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftPinTemplateWizard.java | 19 +-
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 2
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties | 2
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties | 2
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties | 2
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties | 2
10 files changed, 116 insertions(+), 31 deletions(-)
New commits:
commit ccbfb587d5a232840ca2ca368ea6b130375e6049
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Nov 22 16:31:21 2011 -0500
[Bug 756171 - The UI does not have a way to see the template from which a drift definition is derived]
Add template and attached info to the definitions view. This implements
#2 of the three proposed enhancements and should be enough for the
first release. It adds two new columns, "Attached?" and "Template",
which indicate whether the definition is attached or not,and to what
template. Note that detached definitions still have an associated template,
and may be re-attached.
Users with manage_settings can link to the template, for others the field
is not a link.
Given a lack of real-estate, the interval and drift handling columns have
been removed from the list row, and are now viewable only from the edit
view.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionDataSource.java
index 90440dd..b29e9a6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionDataSource.java
@@ -21,6 +21,8 @@ package org.rhq.enterprise.gui.coregui.client.drift;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
@@ -36,6 +38,7 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
+import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.common.EntityContext;
import org.rhq.core.domain.criteria.DriftDefinitionCriteria;
import org.rhq.core.domain.drift.DriftChangeSet;
@@ -49,6 +52,8 @@ import org.rhq.core.domain.util.PageList;
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.PermissionsLoadedListener;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
import org.rhq.enterprise.gui.coregui.client.gwt.DriftGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
@@ -76,12 +81,15 @@ public class DriftDefinitionDataSource extends RPCDataSource<DriftDefinitionComp
public static final String ATTR_CHANGE_SET_VERSION = "changesetVersion";
public static final String ATTR_COMPLIANCE = "compliance";
public static final String ATTR_COMPLIANCE_ICON = "complianceIcon";
+ public static final String ATTR_ATTACHED = "attached";
+ public static final String ATTR_TEMPLATE = "template";
public static final String DRIFT_HANDLING_MODE_NORMAL = MSG.view_drift_table_driftHandlingMode_normal();
public static final String DRIFT_HANDLING_MODE_PLANNED = MSG.view_drift_table_driftHandlingMode_plannedChanges();
private DriftGWTServiceAsync driftService = GWTServiceLookup.getDriftService();
private EntityContext entityContext;
+ private Set<Permission> globalPermissions;
public DriftDefinitionDataSource() {
this(EntityContext.forSubsystemView());
@@ -168,17 +176,42 @@ public class DriftDefinitionDataSource extends RPCDataSource<DriftDefinitionComp
});
fields.add(inComplianceField);
+ /*
ListGridField driftHandlingModeField = new ListGridField(ATTR_DRIFT_HANDLING_MODE, MSG
.view_drift_table_driftHandlingMode());
fields.add(driftHandlingModeField);
+ */
+ /*
ListGridField intervalField = new ListGridField(ATTR_INTERVAL, MSG.common_title_interval());
fields.add(intervalField);
+ */
ListGridField baseDirField = new ListGridField(ATTR_BASE_DIR_STRING, MSG.view_drift_table_baseDir());
changeSetTimeField.setCanSortClientOnly(true);
fields.add(baseDirField);
+ ListGridField attachedField = new ListGridField(ATTR_ATTACHED, MSG.view_drift_table_attached());
+ fields.add(attachedField);
+
+ ListGridField templateField = new ListGridField(ATTR_TEMPLATE, MSG.view_drift_table_template());
+ templateField.setCellFormatter(new CellFormatter() {
+ public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
+ DriftDefinition def = (DriftDefinition) listGridRecord.getAttributeAsObject(ATTR_ENTITY);
+ if (null != globalPermissions && globalPermissions.contains(Permission.MANAGE_SETTINGS)) {
+ int typeId = def.getResource().getResourceType().getId();
+ int templateId = def.getTemplate().getId();
+ String link = LinkManager.getDriftTemplateLink(typeId, templateId);
+ return SeleniumUtility.getLocatableHref(link, o.toString(), null);
+
+ } else {
+ return o.toString();
+ }
+ }
+ });
+ templateField.setCanSortClientOnly(true);
+ fields.add(templateField);
+
ListGridField editField = new ListGridField(ATTR_EDIT, MSG.common_title_edit());
editField.setType(ListGridFieldType.IMAGE);
editField.setAlign(Alignment.CENTER);
@@ -229,9 +262,11 @@ public class DriftDefinitionDataSource extends RPCDataSource<DriftDefinitionComp
nameField.setWidth("20%");
enabledField.setWidth(60);
inComplianceField.setWidth(100);
- driftHandlingModeField.setWidth("10%");
- intervalField.setWidth(100);
+ //driftHandlingModeField.setWidth("10%");
+ //intervalField.setWidth(100);
baseDirField.setWidth("*");
+ attachedField.setWidth(70);
+ templateField.setWidth("25%");
pinnedField.setWidth(70);
changeSetField.setWidth(70);
changeSetTimeField.setWidth(100);
@@ -244,9 +279,11 @@ public class DriftDefinitionDataSource extends RPCDataSource<DriftDefinitionComp
changeSetTimeField.setWidth(100);
enabledField.setWidth(60);
inComplianceField.setWidth(100);
- driftHandlingModeField.setWidth("15%");
- intervalField.setWidth(70);
+ //driftHandlingModeField.setWidth("15%");
+ //intervalField.setWidth(70);
baseDirField.setWidth("*");
+ attachedField.setWidth(70);
+ templateField.setWidth("25%");
pinnedField.setWidth(70);
editField.setWidth(70);
}
@@ -265,8 +302,21 @@ public class DriftDefinitionDataSource extends RPCDataSource<DriftDefinitionComp
processResponse(request.getRequestId(), response);
}
- public void onSuccess(PageList<DriftDefinitionComposite> result) {
- dataRetrieved(result, response, request);
+ public void onSuccess(final PageList<DriftDefinitionComposite> result) {
+
+ // if we don't have them grab the global perms to see later if we can link to to templates.
+ if (null == globalPermissions) {
+ new PermissionsLoader().loadExplicitGlobalPermissions(new PermissionsLoadedListener() {
+ @Override
+ public void onPermissionsLoaded(Set<Permission> permissions) {
+ globalPermissions = (permissions != null) ? permissions : new HashSet<Permission>();
+ dataRetrieved(result, response, request);
+ }
+ });
+
+ } else {
+ dataRetrieved(result, response, request);
+ }
}
});
}
@@ -326,12 +376,14 @@ public class DriftDefinitionDataSource extends RPCDataSource<DriftDefinitionComp
}
criteria.fetchConfiguration(true);
+ criteria.fetchTemplate(true);
// filter out unsortable fields (i.e. fields sorted client-side only)
PageControl pageControl = getPageControl(request);
pageControl.removeOrderingField(ATTR_BASE_DIR_STRING);
pageControl.removeOrderingField(ATTR_CHANGE_SET_CTIME);
pageControl.removeOrderingField(ATTR_CHANGE_SET_VERSION);
+ pageControl.removeOrderingField(ATTR_TEMPLATE);
criteria.setPageControl(pageControl);
return criteria;
@@ -353,7 +405,7 @@ public class DriftDefinitionDataSource extends RPCDataSource<DriftDefinitionComp
ListGridRecord record = new ListGridRecord();
// We need this for Detect Now support
- record.setAttribute(ATTR_ENTITY, from.getDriftDefinition());
+ record.setAttribute(ATTR_ENTITY, def);
record.setAttribute(ATTR_ID, def.getId());
record.setAttribute(ATTR_NAME, def.getName());
@@ -369,6 +421,8 @@ public class DriftDefinitionDataSource extends RPCDataSource<DriftDefinitionComp
record.setAttribute(ATTR_EDIT, ImageManager.getEditIcon());
record.setAttribute(ATTR_IS_PINNED, def.isPinned() ? ImageManager.getPinnedIcon() : ImageManager
.getUnpinnedIcon());
+ record.setAttribute(ATTR_ATTACHED, def.isAttached() ? MSG.common_val_yes() : MSG.common_val_no());
+ record.setAttribute(ATTR_TEMPLATE, def.getTemplate().getName());
record.setAttribute(ATTR_CHANGE_SET_VERSION, (null != changeSet) ? String.valueOf(changeSet.getVersion()) : MSG
.common_label_none());
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 b7edd70..e95da15 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
@@ -1203,6 +1203,7 @@ view_drift_success_deleteTemplate = Successfully deleted {0} drift templates
view_drift_success_detectNow = Successfully submitted drift detection run request
view_drift_success_pinToDef = Successfully pinned snapshot {0} to drift definition.
view_drift_success_templateUpdated = Drift template updated and changes pushed to attached definitions.
+view_drift_table_attached = Attached?
view_drift_table_baseDir = Base Directory
view_drift_table_driftHandlingMode = Drift Handling
view_drift_table_driftHandlingMode_normal = normal
@@ -1221,6 +1222,7 @@ view_drift_table_resourceDef = Resource Drift Detection Definition
view_drift_table_resourceHistory = Resource Drift History
view_drift_table_snapshot = Snapshot
view_drift_table_snapshotTime = Snapshot Time
+view_drift_table_template = Template
view_drift_table_title_initialSnapshot = Initial Snapshot for Definition [{0}] : Pinned = [{1}]
view_drift_table_title_snapshot = Snapshot [{0}] for Definition [{1}]
view_drift_table_title_templateSnapshot = Pinned Snapshot for Template [{0}]
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
index af27641..4c0e125 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
@@ -1053,6 +1053,7 @@ view_dashboards_title = Dashboard
##view_drift_success_detectNow = Successfully submitted drift detection run request
##view_drift_success_pinToDef = Successfully pinned snapshot {0} to drift definition.
##view_drift_success_templateUpdated = Drift template updated and changes pushed to attached definitions.
+##view_drift_table_attached = Attached?
##view_drift_table_baseDir = Base Directory
##view_drift_table_driftHandlingMode = Drift Handling
##view_drift_table_driftHandlingMode_normal = normal
@@ -1071,6 +1072,7 @@ view_dashboards_title = Dashboard
##view_drift_table_resourceHistory = Resource Drift History
##view_drift_table_snapshot = Snapshot
##view_drift_table_snapshotTime = Snapshot Time
+##view_drift_table_template = Template
##view_drift_table_title_initialSnapshot = Initial Snapshot for Definition [{0}] : Pinned = [{1}]
##view_drift_table_title_snapshot = Snapshot [{0}] for Definition [{1}]
##view_drift_table_title_templateSnapshot = Pinned Snapshot for Template [{0}]
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
index 2823d98..476e0eb 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
@@ -1193,6 +1193,7 @@ view_dashboards_title = ダッシュボード
##view_drift_success_detectNow = Successfully submitted drift detection run request
##view_drift_success_pinToDef = Successfully pinned snapshot {0} to drift definition.
##view_drift_success_templateUpdated = Drift template updated and changes pushed to attached definitions.
+##view_drift_table_attached = Attached?
##view_drift_table_baseDir = Base Directory
##view_drift_table_driftHandlingMode = Drift Handling
##view_drift_table_driftHandlingMode_normal = normal
@@ -1211,6 +1212,7 @@ view_dashboards_title = ダッシュボード
##view_drift_table_resourceHistory = Resource Drift History
##view_drift_table_snapshot = Snapshot
##view_drift_table_snapshotTime = Snapshot Time
+##view_drift_table_template = Template
##view_drift_table_title_initialSnapshot = Initial Snapshot for Definition [{0}] : Pinned = [{1}]
##view_drift_table_title_snapshot = Snapshot [{0}] for Definition [{1}]
##view_drift_table_title_templateSnapshot = Pinned Snapshot for Template [{0}]
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
index 5e84274..9bb4edb 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
@@ -1224,6 +1224,7 @@ view_drift_success_delete = Drifts {0} exclu�dos com sucesso!
view_drift_success_detectNow = Requisi��o de detec��o de drift submetida com sucesso.
##view_drift_success_pinToDef = Successfully pinned snapshot {0} to drift definition.
##view_drift_success_templateUpdated = Drift template updated and changes pushed to attached definitions.
+##view_drift_table_attached = Attached?
##view_drift_table_baseDir = Diret�rio Base
##view_drift_table_driftHandlingMode = Drift Handling
##view_drift_table_driftHandlingMode_normal = normal
@@ -1242,6 +1243,7 @@ view_drift_success_detectNow = Requisi��o de detec��o de drift submetida
##view_drift_table_resourceHistory = Hist�rico de Drift do Recurso
##view_drift_table_snapshot = Snapshot
##view_drift_table_snapshotTime = Snapshot Time
+##view_drift_table_template = Template
##view_drift_table_title_initialSnapshot = Initial Snapshot for Definition [{0}] : Pinned = [{1}]
##view_drift_table_title_snapshot = Snapshot [{0}] for Definition [{1}]
##view_drift_table_title_templateSnapshot = Pinned Snapshot for Template [{0}]
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
index a79d3ba..df871da 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
@@ -1202,6 +1202,7 @@ view_dashboards_title = \u7edf\u8ba1\u8868\u76d8
##view_drift_success_detectNow = Successfully submitted drift detection run request
##view_drift_success_pinToDef = Successfully pinned snapshot {0} to drift definition.
##view_drift_success_templateUpdated = Drift template updated and changes pushed to attached definitions.
+##view_drift_table_attached = Attached?
##view_drift_table_baseDir = Base Directory
##view_drift_table_driftHandlingMode = Drift Handling
##view_drift_table_driftHandlingMode_normal = normal
@@ -1220,6 +1221,7 @@ view_dashboards_title = \u7edf\u8ba1\u8868\u76d8
##view_drift_table_resourceHistory = Resource Drift History
##view_drift_table_snapshot = Snapshot
##view_drift_table_snapshotTime = Snapshot Time
+##view_drift_table_template = Template
##view_drift_table_title_initialSnapshot = Initial Snapshot for Definition [{0}] : Pinned = [{1}]
##view_drift_table_title_snapshot = Snapshot [{0}] for Definition [{1}]
##view_drift_table_title_templateSnapshot = Pinned Snapshot for Template [{0}]
commit 21e1403c8ec12b4c5a665231806b3267dc9f58b1
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Nov 22 13:40:42 2011 -0500
[Bug 753659 - Exception thrown when clicking Back to List after pinning snapshot to template]
A subtle issue having to do with the fact that pinning can remove
existing entities therefore invalidating previous views. A couple of
changes to address this and make things, hopefully, more intuitive:
- When navigating from the deifinitions list to the initial snapshot the
"Back to List" button now brings you directly back to the defs list. It
previously would bring you to the carousel, which was confusing because
that's not where you navigated from.
- When pinning a snapshot to a template the wizard will, if successful,
navigate you back to the definitions list view automatically. This
higher level view is guaranteed to be valid, and will reflect any new
pinning-related state changes. On cancel or failure the use will
remain on the snapshot view.
will
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
index d3ef464..ef99372 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
@@ -28,6 +28,7 @@ import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesView;
import org.rhq.enterprise.gui.coregui.client.admin.templates.DriftDefinitionTemplateTypeView;
import org.rhq.enterprise.gui.coregui.client.admin.users.UsersView;
import org.rhq.enterprise.gui.coregui.client.components.table.StringIDTableSection;
+import org.rhq.enterprise.gui.coregui.client.drift.DriftDefinitionsView;
/**
* @author Greg Hinkle
@@ -514,7 +515,13 @@ public class LinkManager {
}
public static String getDriftDefinitionEditLink(int resourceId, int driftDefId) {
- return "#Resource/" + resourceId + "/Drift/Definitions/" + driftDefId + "/Edit";
+ return "#Resource/" + resourceId + "/Drift/Definitions/" + driftDefId + "/"
+ + DriftDefinitionsView.DetailView.Edit.name();
+ }
+
+ public static String getDriftDefinitionInitialSnapshotLink(int resourceId, int driftDefId) {
+ return "#Resource/" + resourceId + "/Drift/Definitions/" + driftDefId + "/"
+ + DriftDefinitionsView.DetailView.InitialSnapshot.name();
}
public static String getDriftCarouselDriftLink(int resourceId, int driftDefId, String driftId) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionDataSource.java
index 0781f22..90440dd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionDataSource.java
@@ -112,8 +112,8 @@ public class DriftDefinitionDataSource extends RPCDataSource<DriftDefinitionComp
public void onRecordClick(RecordClickEvent event) {
switch (entityContext.getType()) {
case Resource:
- CoreGUI.goToView(LinkManager.getDriftCarouselSnapshotLink(entityContext.getResourceId(), event
- .getRecord().getAttributeAsInt(ATTR_ID), 0));
+ CoreGUI.goToView(LinkManager.getDriftDefinitionInitialSnapshotLink(entityContext.getResourceId(),
+ event.getRecord().getAttributeAsInt(ATTR_ID)));
break;
default:
throw new IllegalArgumentException("Entity Type not supported");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionsView.java
index 118e074..619fba3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionsView.java
@@ -65,10 +65,14 @@ public class DriftDefinitionsView extends TableSection<DriftDefinitionDataSource
private static final Criteria INITIAL_CRITERIA = new Criteria();
+ public enum DetailView {
+ Carousel, Edit, InitialSnapshot
+ };
+
private EntityContext context;
private boolean hasWriteAccess;
private DriftDefinitionDataSource dataSource;
- private boolean useEditDetailsView;
+ private DetailView detailsView = DetailView.Carousel;
static {
DriftCategory[] categoryValues = DriftCategory.values();
@@ -243,10 +247,17 @@ public class DriftDefinitionsView extends TableSection<DriftDefinitionDataSource
@Override
public void renderView(ViewPath viewPath) {
- // we have two detail views for drift defs, the config editor and the carousel. figure out which one we're
- // dealing with. The default is the carousel, anything further in the path we assume to be /Edit
- if (!viewPath.isEnd()) {
- this.useEditDetailsView = !viewPath.isNextEnd() && "Edit".equals(viewPath.getNext().getPath());
+ // we have three detail views for drift defs, the carousel, the the config editor, and the initial snapshot.
+ // Figure out which one we're dealing with. The default is the carousel.
+ this.detailsView = DetailView.Carousel;
+
+ if (!viewPath.isEnd() && !viewPath.isNextEnd()) {
+ if (DetailView.Edit.name().equals(viewPath.getNext().getPath())) {
+ this.detailsView = DetailView.Edit;
+
+ } else if (DetailView.InitialSnapshot.name().equals(viewPath.getNext().getPath())) {
+ this.detailsView = DetailView.InitialSnapshot;
+ }
}
super.renderView(viewPath);
@@ -254,11 +265,17 @@ public class DriftDefinitionsView extends TableSection<DriftDefinitionDataSource
@Override
public Canvas getDetailsView(Integer driftDefId) {
- if (this.useEditDetailsView) {
- return new DriftDefinitionEditView(extendLocatorId("DefinitionEdit"), context, driftDefId, hasWriteAccess);
- }
+ switch (detailsView) {
+ case Edit:
+ return new DriftDefinitionEditView(extendLocatorId("Edit"), context, driftDefId, hasWriteAccess);
+
+ case InitialSnapshot:
+ return new DriftSnapshotView(extendLocatorId("InitialSnapshot"), null, context.getResourceId(), driftDefId,
+ 0, hasWriteAccess);
- return new DriftCarouselView(extendLocatorId("Carousel"), context, driftDefId, hasWriteAccess);
+ default:
+ return new DriftCarouselView(extendLocatorId("Carousel"), context, driftDefId, hasWriteAccess);
+ }
}
public EntityContext getContext() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftSnapshotView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftSnapshotView.java
index 7d9a782..5ad8311 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftSnapshotView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftSnapshotView.java
@@ -239,7 +239,7 @@ public class DriftSnapshotView extends Table<DriftSnapshotDataSource> {
}
private void pinToTemplate() {
- DriftPinTemplateWizard.showWizard(driftDefId, version, DriftSnapshotView.this);
+ DriftPinTemplateWizard.showWizard(driftDefId, version);
// we can refresh the table buttons immediately since the wizard is a dialog, the
// user can't access enabled buttons anyway.
DriftSnapshotView.this.refreshTableInfo();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftPinTemplateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftPinTemplateWizard.java
index 7f6c683..46b69b6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftPinTemplateWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftPinTemplateWizard.java
@@ -30,7 +30,7 @@ import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -41,13 +41,9 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message;
*/
public class DriftPinTemplateWizard extends AbstractDriftPinTemplateWizard {
- private Table<?> table;
-
- public DriftPinTemplateWizard(ResourceType resourceType, DriftDefinition driftDef, int snapshotVersion,
- Table<?> table) {
+ public DriftPinTemplateWizard(ResourceType resourceType, DriftDefinition driftDef, int snapshotVersion) {
super(resourceType, driftDef, snapshotVersion);
- this.table = table;
final ArrayList<WizardStep> steps = new ArrayList<WizardStep>();
@@ -108,19 +104,20 @@ public class DriftPinTemplateWizard extends AbstractDriftPinTemplateWizard {
new Message(MSG.view_drift_wizard_pinTemplate_success(template.getName()),
Message.Severity.Info));
getView().closeDialog();
- DriftPinTemplateWizard.this.table.refresh();
+ CoreGUI.goToView(LinkManager.getDriftDefinitionsLink(getSnapshotDriftDef().getResource().getId()),
+ true);
}
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_drift_wizard_pinTemplate_failure(template.getName()),
- caught);
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_drift_wizard_pinTemplate_failure(template.getName()), caught);
getView().closeDialog();
}
});
}
- public static void showWizard(final int snapshpotDriftDefId, final int snapshotVersion, final Table<?> table) {
+ public static void showWizard(final int snapshpotDriftDefId, final int snapshotVersion) {
// get the relevant DriftDefinition
DriftDefinitionCriteria ddc = new DriftDefinitionCriteria();
@@ -153,7 +150,7 @@ public class DriftPinTemplateWizard extends AbstractDriftPinTemplateWizard {
public void onTypesLoaded(ResourceType type) {
DriftPinTemplateWizard wizard = new DriftPinTemplateWizard(type, driftDef,
- snapshotVersion, table);
+ snapshotVersion);
wizard.startWizard();
}
});