Commit 83aa03b2 authored by Gianluca Filippone's avatar Gianluca Filippone
Browse files

[CRV-225] Hiding action buttons if choreography is in PENDING DELETE status

parent e5ec03c8
......@@ -180,7 +180,7 @@ public class ChoreographyDirectoryPanel extends GroupDirectoryPanel {
}, ChoreographyActionsPanel.ChoreographyActionType.START);
}
if (model.getObject().getPlainAttrMap().get("status").getValues().iterator().next().equals("FREEZED")) {
if (model.getObject().getPlainAttrMap().get("status").getValues().iterator().next().equals("FROZEN")) {
choreographyActionsPanel.addAction(new IndicatingAjaxLink<Void>("link") {
private static final long serialVersionUID = 3104631231085231035L;
......@@ -193,7 +193,7 @@ public class ChoreographyDirectoryPanel extends GroupDirectoryPanel {
SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
target.add(container);
} catch (SyncopeClientException e) {
LOG.error("While unfreexing choreography {}", model.getObject().getKey(), e);
LOG.error("While unfreezing choreography {}", model.getObject().getKey(), e);
SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage())
? e.getClass().getName() : e.getMessage());
}
......@@ -202,38 +202,41 @@ public class ChoreographyDirectoryPanel extends GroupDirectoryPanel {
}, ChoreographyActionsPanel.ChoreographyActionType.UNFREEZE);
}
choreographyActionsPanel.addAction(new IndicatingAjaxLink<Void>("link") {
if (!model.getObject().getPlainAttrMap().get("status").getValues().iterator().next()
.equals("PENDING DELETE")) {
choreographyActionsPanel.addAction(new IndicatingAjaxLink<Void>("link") {
private static final long serialVersionUID = -7978723352517770644L;
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target) {
try {
choreographyRestClient.deleteChoreography(
model.getObject().getPlainAttrMap().get("id").getValues().iterator().next());
SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
target.add(container);
} catch (SyncopeClientException e) {
LOG.error("While deleting object {}", model.getObject().getKey(), e);
SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage())
? e.getClass().getName() : e.getMessage());
@Override
public void onClick(final AjaxRequestTarget target) {
try {
choreographyRestClient.deleteChoreography(
model.getObject().getPlainAttrMap().get("id").getValues().iterator().next());
SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
target.add(container);
} catch (SyncopeClientException e) {
LOG.error("While deleting object {}", model.getObject().getKey(), e);
SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage())
? e.getClass().getName() : e.getMessage());
}
((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}, ChoreographyActionsPanel.ChoreographyActionType.DELETE);
choreographyActionsPanel.addAction(new IndicatingAjaxLink<Void>("link") {
}, ChoreographyActionsPanel.ChoreographyActionType.DELETE);
choreographyActionsPanel.addAction(new IndicatingAjaxLink<Void>("link") {
private static final long serialVersionUID = 3104631231085231035L;
private static final long serialVersionUID = 3104631231085231035L;
@Override
public void onClick(final AjaxRequestTarget target) {
utilityModal.header(Model.of("Resize Choreography"));
utilityModal.setContent(new ResizeChoreographyModalPanel(
utilityModal, model.getObject(), choreographyRestClient, pageRef));
utilityModal.show(true);
target.add(utilityModal);
}
}, ChoreographyActionsPanel.ChoreographyActionType.RESIZE);
@Override
public void onClick(final AjaxRequestTarget target) {
utilityModal.header(Model.of("Resize Choreography"));
utilityModal.setContent(new ResizeChoreographyModalPanel(
utilityModal, model.getObject(), choreographyRestClient, pageRef));
utilityModal.show(true);
target.add(utilityModal);
}
}, ChoreographyActionsPanel.ChoreographyActionType.RESIZE);
}
item.add(choreographyActionsPanel);
}
});
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment