Skip to content

Commit

Permalink
MID-7777 fix assignments panel loading, improved error messages
Browse files Browse the repository at this point in the history
(cherry picked from commit 6d476ff)
  • Loading branch information
1azyman committed Apr 1, 2022
1 parent f1c866c commit 082eab1
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -382,14 +382,14 @@ private boolean isApplicableForOperation(ContainerPanelConfigurationType configu

private void initMainPanel(ContainerPanelConfigurationType panelConfig, MidpointForm form) {
if (panelConfig == null) {
addErrorPanel(form, MessagePanel.MessagePanelType.WARN,"AbstractPageObjectDetails.noPanels");
addErrorPanel(false, form, MessagePanel.MessagePanelType.WARN,"AbstractPageObjectDetails.noPanels");
return;
}

getSessionStorage().setObjectDetailsStorage("details" + getType().getSimpleName(), panelConfig);
String panelType = panelConfig.getPanelType();
if (panelType == null) {
addErrorPanel(form, MessagePanel.MessagePanelType.ERROR,"AbstractPageObjectDetails.panelTypeUndefined", panelConfig.getIdentifier());
addErrorPanel(false, form, MessagePanel.MessagePanelType.ERROR,"AbstractPageObjectDetails.panelTypeUndefined", panelConfig.getIdentifier());
return;
}

Expand All @@ -400,10 +400,14 @@ private void initMainPanel(ContainerPanelConfigurationType panelConfig, Midpoint
return;
}

addErrorPanel(form, MessagePanel.MessagePanelType.ERROR, "AbstractPageObjectDetails.panelErrorInitialization", panelConfig.getIdentifier(), panelType);
addErrorPanel(true, form, MessagePanel.MessagePanelType.ERROR, "AbstractPageObjectDetails.panelErrorInitialization", panelConfig.getIdentifier(), panelType);
}

private void addErrorPanel(MidpointForm form, MessagePanel.MessagePanelType type, String message, Object... params) {
private void addErrorPanel(boolean force, MidpointForm form, MessagePanel.MessagePanelType type, String message, Object... params) {
if (!force && form.get(ID_MAIN_PANEL) != null) {
return;
}

WebMarkupContainer panel = new MessagePanel(ID_MAIN_PANEL, type,
createStringResource(message, params), false);
panel.add(AttributeAppender.append("style", "margin-top: 20px;"));
Expand Down

0 comments on commit 082eab1

Please sign in to comment.