modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java | 27 + modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java | 147 +++---- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 207 ++++------ 3 files changed, 189 insertions(+), 192 deletions(-)
New commits: commit 96b39f22488b796562f3b050e7b6717f3435a1f7 Author: Joseph Marques joseph@redhat.com Date: Sun Nov 28 21:37:54 2010 -0500
ensure global permissions are loaded prior to rendering the view
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java index f07f7dc..d091618 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java @@ -18,13 +18,18 @@ */ package org.rhq.enterprise.gui.coregui.client.inventory.common.detail;
+import java.util.EnumSet; +import java.util.HashSet; import java.util.List; +import java.util.Set;
import com.google.gwt.user.client.History; +import com.google.gwt.user.client.rpc.AsyncCallback; import com.smartgwt.client.types.Side; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.layout.Layout;
+import org.rhq.core.domain.authz.Permission; import org.rhq.enterprise.gui.coregui.client.BookmarkableView; import org.rhq.enterprise.gui.coregui.client.CoreGUI; import org.rhq.enterprise.gui.coregui.client.RefreshableView; @@ -34,6 +39,8 @@ import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab; import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedEvent; import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedHandler; import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSet; +import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; +import org.rhq.enterprise.gui.coregui.client.util.message.Message; import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/** @@ -48,6 +55,7 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo private String tabName; private String subTabName; private U titleBar; + protected Set<Permission> globalPermissions;
public AbstractTwoLevelTabSetView(String locatorId, String baseViewPath) { super(locatorId); @@ -142,6 +150,25 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo }
public void renderView(final ViewPath viewPath) { + GWTServiceLookup.getAuthorizationService().getExplicitGlobalPermissions(new AsyncCallback<Set<Permission>>() { + @Override + public void onSuccess(Set<Permission> result) { + globalPermissions = result; + renderTabs(viewPath); + } + + @Override + public void onFailure(Throwable caught) { + CoreGUI.getMessageCenter().notify( + new Message(MSG.util_userPerm_loadFailGlobal(), caught, Message.Severity.Error, EnumSet + .of(Message.Option.BackgroundJobResult))); + globalPermissions = new HashSet<Permission>(); + renderTabs(viewPath); + } + }); + } + + private void renderTabs(final ViewPath viewPath) { // e.g. #Resource/10010/Summary/Overview // ^ current path final int id = Integer.parseInt(viewPath.getCurrent().getPath()); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java index 0d7d3ca..978e927 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java @@ -20,7 +20,6 @@ package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail;
import java.util.ArrayList; import java.util.EnumSet; -import java.util.HashSet; import java.util.List; import java.util.Set;
@@ -59,7 +58,6 @@ import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.monitoring. import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.summary.OverviewView; import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView; import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository; -import org.rhq.enterprise.gui.coregui.client.util.message.Message;
/** * Be able to view members as a resource list, or edit members via selector. @@ -144,100 +142,83 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource protected List<TwoLevelTab> createTabs() { List<TwoLevelTab> tabs = new ArrayList<TwoLevelTab>();
- summaryTab = new TwoLevelTab(getTabSet().extendLocatorId("Summary"), new ViewName("Summary", MSG - .view_tabs_common_summary()), "/images/icons/Service_up_16.png"); - summaryOverview = new SubTab(summaryTab.extendLocatorId("Overview"), new ViewName("Overview", MSG - .view_tabs_common_overview()), null); - summaryTimeline = new SubTab(summaryTab.extendLocatorId("Timeline"), new ViewName("Timeline", MSG - .view_tabs_common_timeline()), null); + summaryTab = new TwoLevelTab(getTabSet().extendLocatorId("Summary"), new ViewName("Summary", + MSG.view_tabs_common_summary()), "/images/icons/Service_up_16.png"); + summaryOverview = new SubTab(summaryTab.extendLocatorId("Overview"), new ViewName("Overview", + MSG.view_tabs_common_overview()), null); + summaryTimeline = new SubTab(summaryTab.extendLocatorId("Timeline"), new ViewName("Timeline", + MSG.view_tabs_common_timeline()), null); summaryTab.registerSubTabs(summaryOverview, summaryTimeline); tabs.add(summaryTab);
- monitoringTab = new TwoLevelTab(getTabSet().extendLocatorId("Monitoring"), new ViewName("Monitoring", MSG - .view_tabs_common_monitoring()), "/images/icons/Monitor_grey_16.png"); - monitorGraphs = new SubTab(monitoringTab.extendLocatorId("Graphs"), new ViewName("Graphs", MSG - .view_tabs_common_graphs()), null); - monitorTables = new SubTab(monitoringTab.extendLocatorId("Tables"), new ViewName("Tables", MSG - .view_tabs_common_tables()), null); - monitorTraits = new SubTab(monitoringTab.extendLocatorId("Traits"), new ViewName("Traits", MSG - .view_tabs_common_traits()), null); - - monitorSched = new SubTab(monitoringTab.extendLocatorId("Schedules"), new ViewName("Schedules", MSG - .view_tabs_common_schedules()), null); - monitorCallTime = new SubTab(monitoringTab.extendLocatorId("CallTime"), new ViewName("CallTime", MSG - .view_tabs_common_calltime()), null); + monitoringTab = new TwoLevelTab(getTabSet().extendLocatorId("Monitoring"), new ViewName("Monitoring", + MSG.view_tabs_common_monitoring()), "/images/icons/Monitor_grey_16.png"); + monitorGraphs = new SubTab(monitoringTab.extendLocatorId("Graphs"), new ViewName("Graphs", + MSG.view_tabs_common_graphs()), null); + monitorTables = new SubTab(monitoringTab.extendLocatorId("Tables"), new ViewName("Tables", + MSG.view_tabs_common_tables()), null); + monitorTraits = new SubTab(monitoringTab.extendLocatorId("Traits"), new ViewName("Traits", + MSG.view_tabs_common_traits()), null); + + monitorSched = new SubTab(monitoringTab.extendLocatorId("Schedules"), new ViewName("Schedules", + MSG.view_tabs_common_schedules()), null); + monitorCallTime = new SubTab(monitoringTab.extendLocatorId("CallTime"), new ViewName("CallTime", + MSG.view_tabs_common_calltime()), null); monitoringTab.registerSubTabs(monitorGraphs, monitorTables, monitorTraits, monitorSched, monitorCallTime); tabs.add(monitoringTab);
- inventoryTab = new TwoLevelTab(getTabSet().extendLocatorId("Inventory"), new ViewName("Inventory", MSG - .view_tabs_common_inventory()), "/images/icons/Inventory_grey_16.png"); - inventoryMembers = new SubTab(inventoryTab.extendLocatorId("Members"), new ViewName("Members", MSG - .view_tabs_common_members()), null); + inventoryTab = new TwoLevelTab(getTabSet().extendLocatorId("Inventory"), new ViewName("Inventory", + MSG.view_tabs_common_inventory()), "/images/icons/Inventory_grey_16.png"); + inventoryMembers = new SubTab(inventoryTab.extendLocatorId("Members"), new ViewName("Members", + MSG.view_tabs_common_members()), null); inventoryConn = new SubTab(inventoryTab.extendLocatorId("ConnectionSettings"), new ViewName( "ConnectionSettings", MSG.view_tabs_common_connectionSettings()), null); inventoryConnHistory = new SubTab(inventoryTab.extendLocatorId("ConnectionSettingsHistory"), new ViewName( "ConnectionSettingsHistory", MSG.view_tabs_common_connectionSettingsHistory()), null); - inventoryMembership = new SubTab(inventoryTab.extendLocatorId("Membership"), new ViewName("Membership", MSG - .view_tabs_common_membership()), null); // TODO this will merge with Members + inventoryMembership = new SubTab(inventoryTab.extendLocatorId("Membership"), new ViewName("Membership", + MSG.view_tabs_common_membership()), null); // TODO this will merge with Members inventoryTab.registerSubTabs(this.inventoryMembers, this.inventoryConn, this.inventoryConnHistory, this.inventoryMembership); tabs.add(inventoryTab);
- operationsTab = new TwoLevelTab(getTabSet().extendLocatorId("Operations"), new ViewName("Operations", MSG - .view_tabs_common_operations()), "/images/icons/Operation_grey_16.png"); - this.opHistory = new SubTab(operationsTab.extendLocatorId("History"), new ViewName("History", MSG - .view_tabs_common_history()), null); - this.opSched = new SubTab(operationsTab.extendLocatorId("Scheduled"), new ViewName("Scheduled", MSG - .view_tabs_common_scheduled()), null); + operationsTab = new TwoLevelTab(getTabSet().extendLocatorId("Operations"), new ViewName("Operations", + MSG.view_tabs_common_operations()), "/images/icons/Operation_grey_16.png"); + this.opHistory = new SubTab(operationsTab.extendLocatorId("History"), new ViewName("History", + MSG.view_tabs_common_history()), null); + this.opSched = new SubTab(operationsTab.extendLocatorId("Scheduled"), new ViewName("Scheduled", + MSG.view_tabs_common_scheduled()), null); operationsTab.registerSubTabs(this.opHistory, this.opSched); tabs.add(operationsTab);
- alertsTab = new TwoLevelTab(getTabSet().extendLocatorId("Alerts"), new ViewName("Alerts", MSG - .view_tabs_common_alerts()), "/images/icons/Alert_grey_16.png"); - this.alertHistory = new SubTab(alertsTab.extendLocatorId("History"), new ViewName("History", MSG - .view_tabs_common_history()), null); - this.alertDef = new SubTab(alertsTab.extendLocatorId("Definitions"), new ViewName("Definitions", MSG - .view_tabs_common_definitions()), null); + alertsTab = new TwoLevelTab(getTabSet().extendLocatorId("Alerts"), new ViewName("Alerts", + MSG.view_tabs_common_alerts()), "/images/icons/Alert_grey_16.png"); + this.alertHistory = new SubTab(alertsTab.extendLocatorId("History"), new ViewName("History", + MSG.view_tabs_common_history()), null); + this.alertDef = new SubTab(alertsTab.extendLocatorId("Definitions"), new ViewName("Definitions", + MSG.view_tabs_common_definitions()), null); alertsTab.registerSubTabs(alertHistory, alertDef); tabs.add(alertsTab);
configurationTab = new TwoLevelTab(getTabSet().extendLocatorId("Configuration"), new ViewName("Configuration", MSG.view_tabs_common_configuration()), "/images/icons/Configure_grey_16.png"); - this.configCurrent = new SubTab(configurationTab.extendLocatorId("Current"), new ViewName("Current", MSG - .view_tabs_common_current()), null); - this.configHistory = new SubTab(configurationTab.extendLocatorId("History"), new ViewName("History", MSG - .view_tabs_common_history()), null); + this.configCurrent = new SubTab(configurationTab.extendLocatorId("Current"), new ViewName("Current", + MSG.view_tabs_common_current()), null); + this.configHistory = new SubTab(configurationTab.extendLocatorId("History"), new ViewName("History", + MSG.view_tabs_common_history()), null); configurationTab.registerSubTabs(this.configCurrent, this.configHistory); tabs.add(configurationTab);
- eventsTab = new TwoLevelTab(getTabSet().extendLocatorId("Events"), new ViewName("Events", MSG - .view_tabs_common_events()), "/images/icons/Events_grey_16.png"); - this.eventHistory = new SubTab(eventsTab.extendLocatorId("History"), new ViewName("History", MSG - .view_tabs_common_history()), null); + eventsTab = new TwoLevelTab(getTabSet().extendLocatorId("Events"), new ViewName("Events", + MSG.view_tabs_common_events()), "/images/icons/Events_grey_16.png"); + this.eventHistory = new SubTab(eventsTab.extendLocatorId("History"), new ViewName("History", + MSG.view_tabs_common_history()), null); eventsTab.registerSubTabs(eventHistory); tabs.add(eventsTab);
return tabs; }
- protected void updateTabContent(final ResourceGroupComposite groupComposite) { - GWTServiceLookup.getAuthorizationService().getExplicitGlobalPermissions(new AsyncCallback<Set<Permission>>() { - @Override - public void onSuccess(Set<Permission> result) { - updateTabContent(groupComposite, result); - } - - @Override - public void onFailure(Throwable caught) { - CoreGUI.getMessageCenter().notify( - new Message(MSG.util_userPerm_loadFailGlobal(), caught, Message.Severity.Error, EnumSet - .of(Message.Option.BackgroundJobResult))); - updateTabContent(groupComposite, new HashSet<Permission>()); - } - }); - } - - protected void updateTabContent(ResourceGroupComposite groupComposite, Set<Permission> globalPermissions) { + protected void updateTabContent(ResourceGroupComposite groupComposite) { boolean enabled; boolean visible; Canvas canvas; @@ -258,8 +239,8 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource // summaryTab.updateSubTab("Overview", new DashboardView(resource)); // summaryTab.updateSubTab("Timeline", timelinePane); // Summary tab is always visible and enabled. - updateSubTab(this.summaryTab, this.summaryOverview, new OverviewView(this.summaryOverview - .extendLocatorId("View"), this.groupComposite), true, true); + updateSubTab(this.summaryTab, this.summaryOverview, + new OverviewView(this.summaryOverview.extendLocatorId("View"), this.groupComposite), true, true);
if (updateTab(this.monitoringTab, groupCategory == GroupCategory.COMPATIBLE, true)) { visible = hasMetricsOfType(this.groupComposite, DataType.MEASUREMENT); @@ -288,22 +269,22 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource }
// Inventory tab is always visible and enabled. - updateSubTab(this.inventoryTab, this.inventoryMembers, ResourceSearchView.getMembersOf(this.inventoryMembers - .extendLocatorId("View"), groupId), true, true); - updateSubTab(this.inventoryTab, this.inventoryConn, new CurrentGroupPluginConfigurationView(this.inventoryConn - .extendLocatorId("View"), this.groupComposite), facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION), - true); + updateSubTab(this.inventoryTab, this.inventoryMembers, + ResourceSearchView.getMembersOf(this.inventoryMembers.extendLocatorId("View"), groupId), true, true); + updateSubTab(this.inventoryTab, this.inventoryConn, + new CurrentGroupPluginConfigurationView(this.inventoryConn.extendLocatorId("View"), this.groupComposite), + facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION), true); updateSubTab(this.inventoryTab, this.inventoryConnHistory, new HistoryGroupPluginConfigurationView( - this.inventoryConnHistory.extendLocatorId("View"), this.groupComposite), facets - .contains(ResourceTypeFacet.PLUGIN_CONFIGURATION), true); + this.inventoryConnHistory.extendLocatorId("View"), this.groupComposite), + facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION), true); visible = !isAutoGroup(); enabled = visible && globalPermissions.contains(Permission.MANAGE_INVENTORY); canvas = (enabled) ? new ResourceGroupMembershipView(this.inventoryMembership.extendLocatorId("View"), groupId) : null; updateSubTab(this.inventoryTab, this.inventoryMembership, canvas, visible, enabled);
- if (updateTab(this.operationsTab, groupCategory == GroupCategory.COMPATIBLE - && facets.contains(ResourceTypeFacet.OPERATION), true)) { + if (updateTab(this.operationsTab, + groupCategory == GroupCategory.COMPATIBLE && facets.contains(ResourceTypeFacet.OPERATION), true)) { updateSubTab(this.operationsTab, this.opHistory, new FullHTMLPane(this.opHistory.extendLocatorId("View"), "/rhq/group/operation/groupOperationHistory-plain.xhtml?groupId=" + groupId), true, true); updateSubTab(this.operationsTab, this.opSched, new FullHTMLPane(this.opSched.extendLocatorId("View"), @@ -313,8 +294,8 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource // alerts tab is always visible, even for mixed groups if (updateTab(this.alertsTab, true, true)) { // alert history is always available - updateSubTab(this.alertsTab, this.alertHistory, GroupAlertHistoryView.get(this.alertHistory - .extendLocatorId("View"), groupComposite), true, true); + updateSubTab(this.alertsTab, this.alertHistory, + GroupAlertHistoryView.get(this.alertHistory.extendLocatorId("View"), groupComposite), true, true); // but alert definitions can only be created on compatible groups visible = (groupCategory == GroupCategory.COMPATIBLE); canvas = (visible) ? new GroupAlertDefinitionsView(alertDef.extendLocatorId("View"), this.groupComposite) @@ -329,16 +310,16 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource // "/rhq/group/configuration/viewCurrent-plain.xhtml?groupId=" + groupId), true, true); updateSubTab(this.configurationTab, this.configCurrent, new GroupResourceConfigurationEditView( this.configCurrent.extendLocatorId("View"), this.groupComposite), true, true); - updateSubTab(this.configurationTab, this.configHistory, new FullHTMLPane(this.configHistory - .extendLocatorId("View"), "/rhq/group/configuration/history-plain.xhtml?groupId=" + groupId), true, - true); + updateSubTab(this.configurationTab, this.configHistory, + new FullHTMLPane(this.configHistory.extendLocatorId("View"), + "/rhq/group/configuration/history-plain.xhtml?groupId=" + groupId), true, true); } // allow mixed groups to show events from supporting resources visible = groupCategory == GroupCategory.MIXED || (groupCategory == GroupCategory.COMPATIBLE && facets.contains(ResourceTypeFacet.EVENT)); if (updateTab(this.eventsTab, visible, true)) { - updateSubTab(this.eventsTab, this.eventHistory, EventCompositeHistoryView.get(this.eventHistory - .extendLocatorId("View"), groupComposite), true, true); + updateSubTab(this.eventsTab, this.eventHistory, + EventCompositeHistoryView.get(this.eventHistory.extendLocatorId("View"), groupComposite), true, true); }
this.show(); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java index c914b9d..0191f51 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java @@ -20,7 +20,6 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
import java.util.ArrayList; import java.util.EnumSet; -import java.util.HashSet; import java.util.List; import java.util.Set;
@@ -121,97 +120,97 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo protected List<TwoLevelTab> createTabs() { List<TwoLevelTab> tabs = new ArrayList<TwoLevelTab>();
- summaryTab = new TwoLevelTab(getTabSet().extendLocatorId("Summary"), new ViewName("Summary", MSG - .view_tabs_common_summary()), "/images/icons/Service_up_16.png"); - summaryOverview = new SubTab(summaryTab.extendLocatorId("Overview"), new ViewName("Overview", MSG - .view_tabs_common_overview()), null); - summaryDashboard = new SubTab(summaryTab.extendLocatorId("Dashboard"), new ViewName("Dashboard", MSG - .view_tabs_common_dashboard()), null); - summaryTimeline = new SubTab(summaryTab.extendLocatorId("Timeline"), new ViewName("Timeline", MSG - .view_tabs_common_timeline()), null); + summaryTab = new TwoLevelTab(getTabSet().extendLocatorId("Summary"), new ViewName("Summary", + MSG.view_tabs_common_summary()), "/images/icons/Service_up_16.png"); + summaryOverview = new SubTab(summaryTab.extendLocatorId("Overview"), new ViewName("Overview", + MSG.view_tabs_common_overview()), null); + summaryDashboard = new SubTab(summaryTab.extendLocatorId("Dashboard"), new ViewName("Dashboard", + MSG.view_tabs_common_dashboard()), null); + summaryTimeline = new SubTab(summaryTab.extendLocatorId("Timeline"), new ViewName("Timeline", + MSG.view_tabs_common_timeline()), null); summaryTab.registerSubTabs(summaryOverview, summaryDashboard, summaryTimeline); tabs.add(summaryTab);
- monitoringTab = new TwoLevelTab(getTabSet().extendLocatorId("Monitoring"), new ViewName("Monitoring", MSG - .view_tabs_common_monitoring()), "/images/icons/Monitor_grey_16.png"); - monitorGraphs = new SubTab(monitoringTab.extendLocatorId("Graphs"), new ViewName("Graphs", MSG - .view_tabs_common_graphs()), null); - monitorTables = new SubTab(monitoringTab.extendLocatorId("Tables"), new ViewName("Tables", MSG - .view_tabs_common_tables()), null); - monitorTraits = new SubTab(monitoringTab.extendLocatorId("Traits"), new ViewName("Traits", MSG - .view_tabs_common_traits()), null); - monitorAvail = new SubTab(monitoringTab.extendLocatorId("Availability"), new ViewName("Availability", MSG - .view_tabs_common_availability()), null); - monitorSched = new SubTab(monitoringTab.extendLocatorId("Schedules"), new ViewName("Schedules", MSG - .view_tabs_common_schedules()), null); - monitorCallTime = new SubTab(monitoringTab.extendLocatorId("CallTime"), new ViewName("CallTime", MSG - .view_tabs_common_calltime()), null); + monitoringTab = new TwoLevelTab(getTabSet().extendLocatorId("Monitoring"), new ViewName("Monitoring", + MSG.view_tabs_common_monitoring()), "/images/icons/Monitor_grey_16.png"); + monitorGraphs = new SubTab(monitoringTab.extendLocatorId("Graphs"), new ViewName("Graphs", + MSG.view_tabs_common_graphs()), null); + monitorTables = new SubTab(monitoringTab.extendLocatorId("Tables"), new ViewName("Tables", + MSG.view_tabs_common_tables()), null); + monitorTraits = new SubTab(monitoringTab.extendLocatorId("Traits"), new ViewName("Traits", + MSG.view_tabs_common_traits()), null); + monitorAvail = new SubTab(monitoringTab.extendLocatorId("Availability"), new ViewName("Availability", + MSG.view_tabs_common_availability()), null); + monitorSched = new SubTab(monitoringTab.extendLocatorId("Schedules"), new ViewName("Schedules", + MSG.view_tabs_common_schedules()), null); + monitorCallTime = new SubTab(monitoringTab.extendLocatorId("CallTime"), new ViewName("CallTime", + MSG.view_tabs_common_calltime()), null); monitoringTab.registerSubTabs(monitorGraphs, monitorTables, monitorTraits, monitorAvail, monitorSched, monitorCallTime); tabs.add(monitoringTab);
- inventoryTab = new TwoLevelTab(getTabSet().extendLocatorId("Inventory"), new ViewName("Inventory", MSG - .view_tabs_common_inventory()), "/images/icons/Inventory_grey_16.png"); - inventoryChildren = new SubTab(inventoryTab.extendLocatorId("Children"), new ViewName("Children", MSG - .view_tabs_common_child_resources()), null); - inventoryChildHistory = new SubTab(inventoryTab.extendLocatorId("ChildHist"), new ViewName("ChildHistory", MSG - .view_tabs_common_child_history()), null); + inventoryTab = new TwoLevelTab(getTabSet().extendLocatorId("Inventory"), new ViewName("Inventory", + MSG.view_tabs_common_inventory()), "/images/icons/Inventory_grey_16.png"); + inventoryChildren = new SubTab(inventoryTab.extendLocatorId("Children"), new ViewName("Children", + MSG.view_tabs_common_child_resources()), null); + inventoryChildHistory = new SubTab(inventoryTab.extendLocatorId("ChildHist"), new ViewName("ChildHistory", + MSG.view_tabs_common_child_history()), null); inventoryConn = new SubTab(inventoryTab.extendLocatorId("ConnectionSettings"), new ViewName( "ConnectionSettings", MSG.view_tabs_common_connectionSettings()), null); inventoryConnHistory = new SubTab(inventoryTab.extendLocatorId("ConnSetHist"), new ViewName( "ConnectionSettingsHistory", MSG.view_tabs_common_connectionSettingsHistory()), null); - inventoryGroups = new SubTab(inventoryTab.extendLocatorId("Groups"), new ViewName("Groups", MSG - .view_tabs_common_groups()), null); + inventoryGroups = new SubTab(inventoryTab.extendLocatorId("Groups"), new ViewName("Groups", + MSG.view_tabs_common_groups()), null); inventoryGroupMembership = new SubTab(inventoryTab.extendLocatorId("GroupMembership"), new ViewName( "GroupMembership", MSG.view_tabs_common_group_membership()), null); inventoryTab.registerSubTabs(this.inventoryChildren, this.inventoryChildHistory, this.inventoryConn, this.inventoryConnHistory, this.inventoryGroups, this.inventoryGroupMembership); tabs.add(inventoryTab);
- operationsTab = new TwoLevelTab(getTabSet().extendLocatorId("Operations"), new ViewName("Operations", MSG - .view_tabs_common_operations()), "/images/icons/Operation_grey_16.png"); - this.opHistory = new SubTab(operationsTab.extendLocatorId("History"), new ViewName("History", MSG - .view_tabs_common_history()), null); - this.opSched = new SubTab(operationsTab.extendLocatorId("Scheduled"), new ViewName("Scheduled", MSG - .view_tabs_common_scheduled()), null); + operationsTab = new TwoLevelTab(getTabSet().extendLocatorId("Operations"), new ViewName("Operations", + MSG.view_tabs_common_operations()), "/images/icons/Operation_grey_16.png"); + this.opHistory = new SubTab(operationsTab.extendLocatorId("History"), new ViewName("History", + MSG.view_tabs_common_history()), null); + this.opSched = new SubTab(operationsTab.extendLocatorId("Scheduled"), new ViewName("Scheduled", + MSG.view_tabs_common_scheduled()), null); operationsTab.registerSubTabs(this.opHistory, this.opSched); tabs.add(operationsTab);
- alertsTab = new TwoLevelTab(getTabSet().extendLocatorId("Alerts"), new ViewName("Alerts", MSG - .view_tabs_common_alerts()), "/images/icons/Alert_grey_16.png"); - this.alertHistory = new SubTab(alertsTab.extendLocatorId("History"), new ViewName("History", MSG - .view_tabs_common_history()), null); - this.alertDef = new SubTab(alertsTab.extendLocatorId("Definitions"), new ViewName("Definitions", MSG - .view_tabs_common_definitions()), null); + alertsTab = new TwoLevelTab(getTabSet().extendLocatorId("Alerts"), new ViewName("Alerts", + MSG.view_tabs_common_alerts()), "/images/icons/Alert_grey_16.png"); + this.alertHistory = new SubTab(alertsTab.extendLocatorId("History"), new ViewName("History", + MSG.view_tabs_common_history()), null); + this.alertDef = new SubTab(alertsTab.extendLocatorId("Definitions"), new ViewName("Definitions", + MSG.view_tabs_common_definitions()), null); alertsTab.registerSubTabs(alertHistory, alertDef); tabs.add(alertsTab);
configurationTab = new TwoLevelTab(getTabSet().extendLocatorId("Configuration"), new ViewName("Configuration", MSG.view_tabs_common_configuration()), "/images/icons/Configure_grey_16.png"); - this.configCurrent = new SubTab(configurationTab.extendLocatorId("Current"), new ViewName("Current", MSG - .view_tabs_common_current()), null); - this.configHistory = new SubTab(configurationTab.extendLocatorId("History"), new ViewName("History", MSG - .view_tabs_common_history()), null); + this.configCurrent = new SubTab(configurationTab.extendLocatorId("Current"), new ViewName("Current", + MSG.view_tabs_common_current()), null); + this.configHistory = new SubTab(configurationTab.extendLocatorId("History"), new ViewName("History", + MSG.view_tabs_common_history()), null); configurationTab.registerSubTabs(this.configCurrent, this.configHistory); tabs.add(configurationTab);
- eventsTab = new TwoLevelTab(getTabSet().extendLocatorId("Events"), new ViewName("Events", MSG - .view_tabs_common_events()), "/images/icons/Events_grey_16.png"); - this.eventHistory = new SubTab(eventsTab.extendLocatorId("History"), new ViewName("History", MSG - .view_tabs_common_history()), null); + eventsTab = new TwoLevelTab(getTabSet().extendLocatorId("Events"), new ViewName("Events", + MSG.view_tabs_common_events()), "/images/icons/Events_grey_16.png"); + this.eventHistory = new SubTab(eventsTab.extendLocatorId("History"), new ViewName("History", + MSG.view_tabs_common_history()), null); eventsTab.registerSubTabs(eventHistory); tabs.add(eventsTab);
- contentTab = new TwoLevelTab(getTabSet().extendLocatorId("Content"), new ViewName("Content", MSG - .view_tabs_common_content()), "/images/icons/Content_grey_16.png"); - this.contentDeployed = new SubTab(contentTab.extendLocatorId("Deployed"), new ViewName("Deployed", MSG - .view_tabs_common_deployed()), null); + contentTab = new TwoLevelTab(getTabSet().extendLocatorId("Content"), new ViewName("Content", + MSG.view_tabs_common_content()), "/images/icons/Content_grey_16.png"); + this.contentDeployed = new SubTab(contentTab.extendLocatorId("Deployed"), new ViewName("Deployed", + MSG.view_tabs_common_deployed()), null); this.contentNew = new SubTab(contentTab.extendLocatorId("New"), new ViewName("New", MSG.view_tabs_common_new()), null); this.contentSubscrip = new SubTab(contentTab.extendLocatorId("Subscriptions"), new ViewName("Subscriptions", MSG.view_tabs_common_subscriptions()), null); - this.contentHistory = new SubTab(contentTab.extendLocatorId("History"), new ViewName("History", MSG - .view_tabs_common_history()), null); + this.contentHistory = new SubTab(contentTab.extendLocatorId("History"), new ViewName("History", + MSG.view_tabs_common_history()), null); contentTab.registerSubTabs(contentDeployed, contentNew, contentSubscrip, contentHistory); tabs.add(contentTab);
@@ -222,24 +221,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo return new ResourceTitleBar(extendLocatorId("TitleBar")); }
- protected void updateTabContent(final ResourceComposite resourceComposite) { - GWTServiceLookup.getAuthorizationService().getExplicitGlobalPermissions(new AsyncCallback<Set<Permission>>() { - @Override - public void onSuccess(Set<Permission> result) { - updateTabContent(resourceComposite, result); - } - - @Override - public void onFailure(Throwable caught) { - CoreGUI.getMessageCenter().notify( - new Message(MSG.util_userPerm_loadFailGlobal(), caught, Message.Severity.Error, EnumSet - .of(Message.Option.BackgroundJobResult))); - updateTabContent(resourceComposite, new HashSet<Permission>()); - } - }); - } - - protected void updateTabContent(ResourceComposite resourceComposite, Set<Permission> globalPermissions) { + protected void updateTabContent(ResourceComposite resourceComposite) { boolean enabled; boolean visible; Canvas canvas; @@ -256,14 +238,15 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo Set<ResourceTypeFacet> facets = this.resourceComposite.getResourceFacets().getFacets();
// Summary Tab - updateSubTab(this.summaryTab, this.summaryOverview, new OverviewView(this.summaryTab - .extendLocatorId("OverviewView"), this.resourceComposite), true, true); + updateSubTab(this.summaryTab, this.summaryOverview, + new OverviewView(this.summaryTab.extendLocatorId("OverviewView"), this.resourceComposite), true, true);
- updateSubTab(this.summaryTab, this.summaryDashboard, new DashboardView(this.summaryDashboard - .extendLocatorId("View"), this.resourceComposite), true, true); + updateSubTab(this.summaryTab, this.summaryDashboard, + new DashboardView(this.summaryDashboard.extendLocatorId("View"), this.resourceComposite), true, true);
- updateSubTab(this.summaryTab, this.summaryTimeline, new FullHTMLPane(this.summaryTimeline - .extendLocatorId("View"), "/rhq/resource/summary/timeline-plain.xhtml?id=" + resource.getId()), true, true); + updateSubTab(this.summaryTab, this.summaryTimeline, + new FullHTMLPane(this.summaryTimeline.extendLocatorId("View"), + "/rhq/resource/summary/timeline-plain.xhtml?id=" + resource.getId()), true, true);
// Monitoring Tab visible = hasMetricsOfType(this.resourceComposite, DataType.MEASUREMENT); @@ -284,8 +267,9 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo updateSubTab(this.monitoringTab, this.monitorAvail, new FullHTMLPane(this.monitorAvail.extendLocatorId("View"), "/rhq/resource/monitor/availabilityHistory-plain.xhtml?id=" + resource.getId()), true, true);
- updateSubTab(this.monitoringTab, this.monitorSched, new SchedulesView(monitoringTab - .extendLocatorId("SchedulesView"), resource.getId()), hasMetricsOfType(this.resourceComposite, null), true); + updateSubTab(this.monitoringTab, this.monitorSched, + new SchedulesView(monitoringTab.extendLocatorId("SchedulesView"), resource.getId()), + hasMetricsOfType(this.resourceComposite, null), true);
visible = facets.contains(ResourceTypeFacet.CALL_TIME); canvas = (visible) ? new FullHTMLPane(this.monitorCallTime.extendLocatorId("View"), @@ -295,8 +279,8 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo // Inventory Tab ResourceType type = this.resourceComposite.getResource().getResourceType(); visible = !type.getChildResourceTypes().isEmpty(); - canvas = (visible) ? ResourceCompositeSearchView.getChildrenOf(this.inventoryTab - .extendLocatorId("ChildrenView"), resourceComposite) : null; + canvas = (visible) ? ResourceCompositeSearchView.getChildrenOf( + this.inventoryTab.extendLocatorId("ChildrenView"), resourceComposite) : null; updateSubTab(this.inventoryTab, this.inventoryChildren, canvas, visible, true);
updateSubTab(this.inventoryTab, this.inventoryChildHistory, new Canvas(), visible, true); @@ -310,8 +294,9 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo canvas = (visible) ? new Canvas() : null; // TODO: Add real canvas when visible updateSubTab(this.inventoryTab, this.inventoryConnHistory, canvas, visible, true);
- updateSubTab(this.inventoryTab, this.inventoryGroups, ResourceGroupListView.getGroupsOf(this.inventoryTab - .extendLocatorId("GroupsView"), resource.getId()), true, true); + updateSubTab(this.inventoryTab, this.inventoryGroups, + ResourceGroupListView.getGroupsOf(this.inventoryTab.extendLocatorId("GroupsView"), resource.getId()), true, + true);
enabled = globalPermissions.contains(Permission.MANAGE_INVENTORY); canvas = (enabled) ? new ResourceResourceGroupsView(this.inventoryTab.extendLocatorId("GroupMembershipView"), @@ -326,54 +311,58 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo // 3) operation arguments/results become read-only configuration data in the history details pop-up // 4) user can navigate to the group operation that spawned this resource operation history, if appropriate // note: enabled operation execution/schedules from left-nav, if it doesn't already exist - updateSubTab(this.operationsTab, this.opHistory, OperationHistoryView.getResourceHistoryView(operationsTab - .extendLocatorId("HistoryView"), this.resourceComposite), true, true); + updateSubTab(this.operationsTab, this.opHistory, OperationHistoryView.getResourceHistoryView( + operationsTab.extendLocatorId("HistoryView"), this.resourceComposite), true, true);
updateSubTab(this.operationsTab, this.opSched, new FullHTMLPane(this.opSched.extendLocatorId("View"), "/rhq/resource/operation/resourceOperationSchedules-plain.xhtml?id=" + resource.getId()), true, true); }
// Alerts Tab - updateSubTab(this.alertsTab, this.alertHistory, ResourceAlertHistoryView.get(this.alertHistory - .extendLocatorId("View"), resourceComposite), true, true); + updateSubTab(this.alertsTab, this.alertHistory, + ResourceAlertHistoryView.get(this.alertHistory.extendLocatorId("View"), resourceComposite), true, true);
- updateSubTab(this.alertsTab, this.alertDef, new ResourceAlertDefinitionsView(alertsTab - .extendLocatorId("AlertDefView"), this.resourceComposite), true, true); + updateSubTab(this.alertsTab, this.alertDef, + new ResourceAlertDefinitionsView(alertsTab.extendLocatorId("AlertDefView"), this.resourceComposite), true, + true);
// Configuration Tab - if (updateTab(this.configurationTab, facets.contains(ResourceTypeFacet.CONFIGURATION), resourcePermissions - .isConfigureRead())) { + if (updateTab(this.configurationTab, facets.contains(ResourceTypeFacet.CONFIGURATION), + resourcePermissions.isConfigureRead())) {
- updateSubTab(this.configurationTab, this.configCurrent, new ResourceConfigurationEditView(this - .extendLocatorId("ResourceConfigView"), resourceComposite), true, true); + updateSubTab(this.configurationTab, this.configCurrent, + new ResourceConfigurationEditView(this.extendLocatorId("ResourceConfigView"), resourceComposite), true, + true);
- updateSubTab(this.configurationTab, this.configHistory, ConfigurationHistoryView.getHistoryOf(this - .extendLocatorId("ConfigHistView"), resource.getId()), true, true); + updateSubTab(this.configurationTab, this.configHistory, + ConfigurationHistoryView.getHistoryOf(this.extendLocatorId("ConfigHistView"), resource.getId()), true, + true); }
// Events Tab if (updateTab(this.eventsTab, facets.contains(ResourceTypeFacet.EVENT), true)) {
- updateSubTab(this.eventsTab, this.eventHistory, EventCompositeHistoryView.get(this.eventsTab - .extendLocatorId("CompositeHistoryView"), resourceComposite), true, true); + updateSubTab(this.eventsTab, this.eventHistory, EventCompositeHistoryView.get( + this.eventsTab.extendLocatorId("CompositeHistoryView"), resourceComposite), true, true); }
// Content Tab if (updateTab(this.contentTab, facets.contains(ResourceTypeFacet.CONTENT), true)) {
- updateSubTab(this.contentTab, this.contentDeployed, new FullHTMLPane(this.contentDeployed - .extendLocatorId("View"), "/rhq/resource/content/view-plain.xhtml?id=" + resource.getId()), true, true); + updateSubTab(this.contentTab, this.contentDeployed, + new FullHTMLPane(this.contentDeployed.extendLocatorId("View"), + "/rhq/resource/content/view-plain.xhtml?id=" + resource.getId()), true, true);
updateSubTab(this.contentTab, this.contentNew, new FullHTMLPane(this.contentNew.extendLocatorId("View"), "/rhq/resource/content/deploy-plain.xhtml?id=" + resource.getId()), true, true);
- updateSubTab(this.contentTab, this.contentSubscrip, new FullHTMLPane(this.contentSubscrip - .extendLocatorId("View"), "/rhq/resource/content/subscription-plain.xhtml?id=" + resource.getId()), - true, true); + updateSubTab(this.contentTab, this.contentSubscrip, + new FullHTMLPane(this.contentSubscrip.extendLocatorId("View"), + "/rhq/resource/content/subscription-plain.xhtml?id=" + resource.getId()), true, true);
- updateSubTab(this.contentTab, this.contentHistory, new FullHTMLPane(this.configHistory - .extendLocatorId("View"), "/rhq/resource/content/history-plain.xhtml?id=" + resource.getId()), true, - true); + updateSubTab(this.contentTab, this.contentHistory, + new FullHTMLPane(this.configHistory.extendLocatorId("View"), + "/rhq/resource/content/history-plain.xhtml?id=" + resource.getId()), true, true); }
this.show();
rhq-commits@lists.fedorahosted.org