summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
index 5ac720f..ed1cf7b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
@@ -37,7 +37,9 @@ import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import org.rhq.core.domain.bundle.Bundle;
+import org.rhq.core.domain.bundle.BundleDeployment;
import org.rhq.core.domain.bundle.BundleDestination;
+import org.rhq.core.domain.criteria.BundleDeploymentCriteria;
import org.rhq.core.domain.criteria.BundleDestinationCriteria;
import org.rhq.core.domain.tagging.Tag;
import org.rhq.core.domain.util.PageList;
@@ -235,6 +237,7 @@ public class BundleDestinationView extends LocatableVLayout implements Bookmarka
});
}
});
+ checkIfDisabled(purgeButton);
actionLayout.addMember(purgeButton);
IButton deleteButton = new LocatableIButton(actionLayout.extendLocatorId("Delete"), MSG.common_button_delete());
@@ -277,6 +280,27 @@ public class BundleDestinationView extends LocatableVLayout implements Bookmarka
return actionLayout;
}
+ private void checkIfDisabled(final IButton purgeButton) {
+ BundleGWTServiceAsync bundleService = GWTServiceLookup.getBundleService();
+ BundleDeploymentCriteria criteria = new BundleDeploymentCriteria();
+ criteria.addFilterDestinationId(destination.getId());
+ bundleService.findBundleDeploymentsByCriteria(criteria, new AsyncCallback<PageList<BundleDeployment>>() {
+ public void onFailure(Throwable caught) {
+ purgeButton.setDisabled(false);
+ }
+
+ public void onSuccess(PageList<BundleDeployment> result) {
+ for (BundleDeployment deployment : result) {
+ if (deployment.isLive()) {
+ purgeButton.setDisabled(false);
+ return;
+ }
+ }
+ purgeButton.setDisabled(true);
+ }
+ });
+ }
+
private Table createDeploymentsTable() {
Criteria criteria = new Criteria();
criteria.addCriteria("bundleDestinationId", destination.getId());