Skip to content

Commit

Permalink
MID-4877 and removing of old system configuration page and its compon…
Browse files Browse the repository at this point in the history
…ents
  • Loading branch information
skublik committed Sep 7, 2018
1 parent df41fa2 commit 9a983c6
Show file tree
Hide file tree
Showing 62 changed files with 483 additions and 6,091 deletions.
Expand Up @@ -30,7 +30,6 @@
import com.evolveum.midpoint.gui.api.util.ModelServiceLocator;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils;
import com.evolveum.midpoint.gui.impl.page.admin.configuration.component.SystemConfigPanelNew;
import com.evolveum.midpoint.model.api.*;
import com.evolveum.midpoint.model.api.expr.MidpointFunctions;
import com.evolveum.midpoint.model.api.validator.ResourceValidator;
Expand Down Expand Up @@ -1534,18 +1533,6 @@ protected List<SideBarMenuItem> createMenuItems() {
return menus;
}

// private MainMenuItem createSystemConfigurationItems() {
// MainMenuItem item = new MainMenuItem(GuiStyleConstants.CLASS_SYSTEM_CONFIGURATION_ICON_COLORED,
// createStringResource("PageAdmin.menu.top.configuration.basic.new"), PageSystemConfigurationNew.class);
//
// addMenuItem(item, "PageAdmin.menu.top.configuration.basic", SystemConfigPanelNew.class);
// addMenuItem(item, "PageAdmin.menu.top.configuration.objectPolicy", PageUsers.class);
// addMenuItem(item, "PageAdmin.menu.top.users.list", PageUsers.class);
//
// addUsersViewMenuItems(item.getItems());
//
// return item;
// }

private void createConfigurationMenu(SideBarMenuItem item) {
addMainMenuItem(item, "fa fa-bullseye", "PageAdmin.menu.top.configuration.bulkActions", PageBulkAction.class);
Expand All @@ -1559,53 +1546,40 @@ private void createConfigurationMenu(SideBarMenuItem item) {
PageDebugView.class, null, createVisibleDisabledBehaviorForEditMenu(PageDebugView.class));
debugs.getItems().add(menu);

MainMenuItem systemItemNew = addMainMenuItem(item, "fa fa-cog", "PageAdmin.menu.top.configuration.basic.new", null);
MainMenuItem systemItemNew = addMainMenuItem(item, "fa fa-cog", "PageAdmin.menu.top.configuration.basic", null);

addSystemMenuItemNew(systemItemNew, "PageAdmin.menu.top.configuration.basic",
PageSystemConfigurationNew.CONFIGURATION_TAB_BASIC);
addSystemMenuItemNew(systemItemNew, "PageAdmin.menu.top.configuration.objectPolicy",
PageSystemConfigurationNew.CONFIGURATION_TAB_OBJECT_POLICY);
addSystemMenuItemNew(systemItemNew, "PageAdmin.menu.top.configuration.globalPolicyRule",
PageSystemConfigurationNew.CONFIGURATION_TAB_GLOBAL_POLICY_RULE);
addSystemMenuItemNew(systemItemNew, "PageAdmin.menu.top.configuration.globalAccountSynchronization",
PageSystemConfigurationNew.CONFIGURATION_TAB_GLOBAL_ACCOUNT_SYNCHRONIZATION);
addSystemMenuItemNew(systemItemNew, "PageAdmin.menu.top.configuration.cleanupPolicy",
PageSystemConfigurationNew.CONFIGURATION_TAB_CLEANUP_POLICY);
addSystemMenuItemNew(systemItemNew, "PageAdmin.menu.top.configuration.notifications",
PageSystemConfigurationNew.CONFIGURATION_TAB_NOTIFICATION);
addSystemMenuItemNew(systemItemNew, "PageAdmin.menu.top.configuration.logging",
PageSystemConfigurationNew.CONFIGURATION_TAB_LOGGING);
addSystemMenuItemNew(systemItemNew, "PageAdmin.menu.top.configuration.profiling",
PageSystemConfigurationNew.CONFIGURATION_TAB_PROFILING);
addSystemMenuItemNew(systemItemNew, "PageAdmin.menu.top.configuration.adminGui",
PageSystemConfigurationNew.CONFIGURATION_TAB_ADMIN_GUI);
addSystemMenuItemNew(systemItemNew, "PageAdmin.menu.top.configuration.workflow",
PageSystemConfigurationNew.CONFIGURATION_TAB_WORKFLOW);
addSystemMenuItemNew(systemItemNew, "PageAdmin.menu.top.configuration.roleManagement",
PageSystemConfigurationNew.CONFIGURATION_TAB_ROLE_MANAGEMENT);
addSystemMenuItemNew(systemItemNew, "PageAdmin.menu.top.configuration.internals",
PageSystemConfigurationNew.CONFIGURATION_TAB_INTERNALS);
addSystemMenuItemNew(systemItemNew, "PageAdmin.menu.top.configuration.deploymentInformation",
PageSystemConfigurationNew.CONFIGURATION_TAB_DEPLOYMENT_INFORMATION);
addSystemMenuItemNew(systemItemNew, "PageAdmin.menu.top.configuration.accessCertification",
PageSystemConfigurationNew.CONFIGURATION_TAB_ACCESS_CERTIFICATION);
addSystemMenuItemNew(systemItemNew, "PageAdmin.menu.top.configuration.infrastructure",
PageSystemConfigurationNew.CONFIGURATION_TAB_INFRASTRUCTURE);
addSystemMenuItemNew(systemItemNew, "PageAdmin.menu.top.configuration.fullTextSearch",
PageSystemConfigurationNew.CONFIGURATION_TAB_FULL_TEXT_SEARCH);

MainMenuItem systemItem = addMainMenuItem(item, "fa fa-cog", "PageAdmin.menu.top.configuration.basic", null);

addSystemMenuItem(systemItem, "PageAdmin.menu.top.configuration.basic",
addSystemMenuItem(systemItemNew, "PageAdmin.menu.top.configuration.basic",
PageSystemConfiguration.CONFIGURATION_TAB_BASIC);
addSystemMenuItem(systemItem, "PageAdmin.menu.top.configuration.notifications",
addSystemMenuItem(systemItemNew, "PageAdmin.menu.top.configuration.objectPolicy",
PageSystemConfiguration.CONFIGURATION_TAB_OBJECT_POLICY);
addSystemMenuItem(systemItemNew, "PageAdmin.menu.top.configuration.globalPolicyRule",
PageSystemConfiguration.CONFIGURATION_TAB_GLOBAL_POLICY_RULE);
addSystemMenuItem(systemItemNew, "PageAdmin.menu.top.configuration.globalAccountSynchronization",
PageSystemConfiguration.CONFIGURATION_TAB_GLOBAL_ACCOUNT_SYNCHRONIZATION);
addSystemMenuItem(systemItemNew, "PageAdmin.menu.top.configuration.cleanupPolicy",
PageSystemConfiguration.CONFIGURATION_TAB_CLEANUP_POLICY);
addSystemMenuItem(systemItemNew, "PageAdmin.menu.top.configuration.notifications",
PageSystemConfiguration.CONFIGURATION_TAB_NOTIFICATION);
addSystemMenuItem(systemItem, "PageAdmin.menu.top.configuration.logging",
addSystemMenuItem(systemItemNew, "PageAdmin.menu.top.configuration.logging",
PageSystemConfiguration.CONFIGURATION_TAB_LOGGING);
addSystemMenuItem(systemItem, "PageAdmin.menu.top.configuration.profiling",
addSystemMenuItem(systemItemNew, "PageAdmin.menu.top.configuration.profiling",
PageSystemConfiguration.CONFIGURATION_TAB_PROFILING);
addSystemMenuItem(systemItem, "PageAdmin.menu.top.configuration.adminGui",
addSystemMenuItem(systemItemNew, "PageAdmin.menu.top.configuration.adminGui",
PageSystemConfiguration.CONFIGURATION_TAB_ADMIN_GUI);
addSystemMenuItem(systemItemNew, "PageAdmin.menu.top.configuration.workflow",
PageSystemConfiguration.CONFIGURATION_TAB_WORKFLOW);
addSystemMenuItem(systemItemNew, "PageAdmin.menu.top.configuration.roleManagement",
PageSystemConfiguration.CONFIGURATION_TAB_ROLE_MANAGEMENT);
addSystemMenuItem(systemItemNew, "PageAdmin.menu.top.configuration.internals",
PageSystemConfiguration.CONFIGURATION_TAB_INTERNALS);
addSystemMenuItem(systemItemNew, "PageAdmin.menu.top.configuration.deploymentInformation",
PageSystemConfiguration.CONFIGURATION_TAB_DEPLOYMENT_INFORMATION);
addSystemMenuItem(systemItemNew, "PageAdmin.menu.top.configuration.accessCertification",
PageSystemConfiguration.CONFIGURATION_TAB_ACCESS_CERTIFICATION);
addSystemMenuItem(systemItemNew, "PageAdmin.menu.top.configuration.infrastructure",
PageSystemConfiguration.CONFIGURATION_TAB_INFRASTRUCTURE);
addSystemMenuItem(systemItemNew, "PageAdmin.menu.top.configuration.fullTextSearch",
PageSystemConfiguration.CONFIGURATION_TAB_FULL_TEXT_SEARCH);

addMainMenuItem(item, "fa fa-archive", "PageAdmin.menu.top.configuration.internals", PageInternals.class);
addMainMenuItem(item, "fa fa-search", "PageAdmin.menu.top.configuration.repoQuery", PageRepositoryQuery.class);
Expand All @@ -1620,8 +1594,6 @@ private void addSystemMenuItem(MainMenuItem mainItem, String key, int tabIndex)
params.add(PageSystemConfiguration.SELECTED_TAB_INDEX, tabIndex);
MenuItem menu = new MenuItem(createStringResource(key), PageSystemConfiguration.class, params, null) {

private static final long serialVersionUID = 1L;

@Override
public boolean isMenuActive(WebPage page) {
if (!PageSystemConfiguration.class.equals(page.getClass())) {
Expand All @@ -1634,24 +1606,6 @@ public boolean isMenuActive(WebPage page) {
};
mainItem.getItems().add(menu);
}

private void addSystemMenuItemNew(MainMenuItem mainItem, String key, int tabIndex) {
PageParameters params = new PageParameters();
params.add(PageSystemConfigurationNew.SELECTED_TAB_INDEX, tabIndex);
MenuItem menu = new MenuItem(createStringResource(key), PageSystemConfigurationNew.class, params, null) {

@Override
public boolean isMenuActive(WebPage page) {
if (!PageSystemConfigurationNew.class.equals(page.getClass())) {
return false;
}

int index = getSelectedTabForNewConfiguration(page);
return tabIndex == index ? true : false;
}
};
mainItem.getItems().add(menu);
}

private MainMenuItem addMainMenuItem(SideBarMenuItem item, String icon, String key, Class<? extends PageBase> page) {
MainMenuItem mainItem = new MainMenuItem(icon, createStringResource(key), page);
Expand Down Expand Up @@ -1803,17 +1757,6 @@ private int getSelectedTabForConfiguration(WebPage page) {

return StringUtils.isNumeric(value) ? Integer.parseInt(value) : PageSystemConfiguration.CONFIGURATION_TAB_BASIC;
}

private int getSelectedTabForNewConfiguration(WebPage page) {
PageParameters params = page.getPageParameters();
StringValue val = params.get(PageSystemConfigurationNew.SELECTED_TAB_INDEX);
String value = null;
if (val != null && !val.isNull()) {
value = val.toString();
}

return StringUtils.isNumeric(value) ? Integer.parseInt(value) : PageSystemConfigurationNew.CONFIGURATION_TAB_BASIC;
}

private void createSelfServiceMenu(SideBarMenuItem menu) {
addMainMenuItem(menu, GuiStyleConstants.CLASS_ICON_DASHBOARD, "PageAdmin.menu.selfDashboard",
Expand Down
Expand Up @@ -17,15 +17,15 @@

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div class="col-xs-2 prism-property-label" wicket:id="labelContainer">
<div wicket:id="labelContainer">
<span wicket:id="label"/>
<span wicket:id="required" style="color: #f00; font-weight: bold;"
wicket:message="title:prismPropertyPanel.required">*</span>
<i wicket:id="tooltip"/>
</div>

<div class="col-md-10 prism-property-value">
<div class="row">
<div wicket:id="propertyLabel">
<div wicket:id="row">
<div wicket:id="valueWrapper">
<div wicket:id="value"/>
<span class="text-danger" wicket:id="feedback"/>
Expand Down
Expand Up @@ -47,26 +47,43 @@ public class TriStateFormGroup extends BasePanel<Boolean> {
private static final String ID_TOOLTIP = "tooltip";
private static final String ID_REQUIRED = "required";
private static final String ID_FEEDBACK = "feedback";
private static final String ID_PROPERTY_LABEL = "propertyLabel";
private static final String ID_ROW = "row";

public TriStateFormGroup(String id, IModel<Boolean> value, IModel<String> label, String labelCssClass, String textCssClass, boolean required, boolean isSimilarAsPropertyPanel) {
this(id, value, label, null, false, labelCssClass, textCssClass, required, isSimilarAsPropertyPanel);
}

public TriStateFormGroup(String id, IModel<Boolean> value, IModel<String> label, String labelCssClass, String textCssClass, boolean required) {
this(id, value, label, null, false, labelCssClass, textCssClass, required);
this(id, value, label, null, false, labelCssClass, textCssClass, required, false);
}

public TriStateFormGroup(String id, IModel<Boolean> value, IModel<String> label, String tooltipKey,
boolean isTooltipInModal, String labelCssClass, String textCssClass, boolean required) {
this(id, value, label, null, false, labelCssClass, textCssClass, required, false);
}

public TriStateFormGroup(String id, IModel<Boolean> value, IModel<String> label, String tooltipKey,
boolean isTooltipInModal, String labelCssClass, String textCssClass, boolean required) {
boolean isTooltipInModal, String labelCssClass, String textCssClass, boolean required, boolean isSimilarAsPropertyPanel) {
super(id, value);

initLayout(label, tooltipKey, isTooltipInModal, labelCssClass, textCssClass, required);
initLayout(label, tooltipKey, isTooltipInModal, labelCssClass, textCssClass, required, isSimilarAsPropertyPanel);
}

private void initLayout(IModel<String> label, final String tooltipKey, boolean isTooltipInModal, String labelCssClass, String textCssClass, boolean required) {
private void initLayout(IModel<String> label, final String tooltipKey, boolean isTooltipInModal, String labelCssClass, String textCssClass,
boolean required, boolean isSimilarAsPropertyPanel) {
WebMarkupContainer labelContainer = new WebMarkupContainer(ID_LABEL_CONTAINER);
add(labelContainer);
Label l = new Label(ID_LABEL, label);

if (StringUtils.isNotEmpty(labelCssClass)) {
labelContainer.add(AttributeAppender.prepend("class", labelCssClass));
}
if(isSimilarAsPropertyPanel) {
labelContainer.add(AttributeAppender.prepend("class", " col-xs-2 prism-property-label "));
} else {
labelContainer.add(AttributeAppender.prepend("class", " control-label "));
}
labelContainer.add(l);

Label tooltipLabel = new Label(ID_TOOLTIP, new Model<>());
Expand Down Expand Up @@ -98,11 +115,19 @@ public boolean isVisible() {
});
labelContainer.add(requiredContainer);

WebMarkupContainer propertyLabel = new WebMarkupContainer(ID_PROPERTY_LABEL);
WebMarkupContainer rowLabel = new WebMarkupContainer(ID_ROW);
WebMarkupContainer valueWrapper = new WebMarkupContainer(ID_VALUE_WRAPPER);
if (StringUtils.isNotEmpty(textCssClass)) {
valueWrapper.add(AttributeAppender.prepend("class", textCssClass));
}
add(valueWrapper);
if(isSimilarAsPropertyPanel) {
propertyLabel.add(AttributeAppender.prepend("class", " col-md-10 prism-property-value "));
rowLabel.add(AttributeAppender.prepend("class", " row "));
}
propertyLabel.add(rowLabel);
rowLabel.add(valueWrapper);
add(propertyLabel);

TriStateComboPanel triStateCombo = new TriStateComboPanel(ID_VALUE, getModel());;
valueWrapper.add(triStateCombo);
Expand Down
Expand Up @@ -56,7 +56,7 @@
</div>
<div class="prism-properties" wicket:id="fileConfiguration">
<div class="row prism-property">
<div class="col-md-10 prism-property-value" wicket:id="values">
<div class="col-md-12 prism-property-value" wicket:id="values">
<div class="container-fluid">
<div class="prism-header" style="height: 29px;">
<div wicket:id="valueHeader"/>
Expand Down
Expand Up @@ -148,13 +148,13 @@ protected void initLayout() {

mailConfigType = (MailConfigurationType)mailConfig.getValues().get(0).getValue().getRealValue();

add(new TextFormGroup(ID_DEFAULT_FROM, new PropertyModel<String>(mailConfigType, "defaultFrom"), createStringResource(mailConfig.getItemDefinition().getTypeName().getLocalPart() + ".defaultFrom"), "", getInputCssClass(), false));
add(new TextFormGroup(ID_DEFAULT_FROM, new PropertyModel<String>(mailConfigType, "defaultFrom"), createStringResource(mailConfig.getItemDefinition().getTypeName().getLocalPart() + ".defaultFrom"), "", getInputCssClass(), false, true));

add(new TextFormGroup(ID_REDIRECT_TO_FILE, new PropertyModel<String>(mailConfigType, "redirectToFile"), createStringResource(mailConfig.getItemDefinition().getTypeName().getLocalPart() + ".redirectToFile"), "", getInputCssClass(), false));
add(new TextFormGroup(ID_REDIRECT_TO_FILE, new PropertyModel<String>(mailConfigType, "redirectToFile"), createStringResource(mailConfig.getItemDefinition().getTypeName().getLocalPart() + ".redirectToFile"), "", getInputCssClass(), false, true));

add(new TextFormGroup(ID_LOG_TO_FILE, new PropertyModel<String>(mailConfigType, "logToFile"), createStringResource(mailConfig.getItemDefinition().getTypeName().getLocalPart() + ".logToFile"), "", getInputCssClass(), false));
add(new TextFormGroup(ID_LOG_TO_FILE, new PropertyModel<String>(mailConfigType, "logToFile"), createStringResource(mailConfig.getItemDefinition().getTypeName().getLocalPart() + ".logToFile"), "", getInputCssClass(), false, true));

add(new TriStateFormGroup(ID_DEBUG, new PropertyModel<Boolean>(mailConfigType, "debug"), createStringResource(mailConfig.getItemDefinition().getTypeName().getLocalPart() + ".debug"), "", getInputCssClass(), false));
add(new TriStateFormGroup(ID_DEBUG, new PropertyModel<Boolean>(mailConfigType, "debug"), createStringResource(mailConfig.getItemDefinition().getTypeName().getLocalPart() + ".debug"), "", getInputCssClass(), false, true));

add(createHeader(ID_MAIL_SERVER_CONFIG_HEADER, MailServerConfigurationType.COMPLEX_TYPE.getLocalPart() + ".details"));

Expand Down Expand Up @@ -191,7 +191,7 @@ public void onClick(AjaxRequestTarget target) {
};
item.add(removeButton);

TextFormGroup name = new TextFormGroup(ID_FILE_NAME, fileConfigType != null ? new PropertyModel<String>(fileConfigType, "name") : Model.of(""), createStringResource(fileConfigType == null ? "" : (fileConfigType.COMPLEX_TYPE.getLocalPart() + ".name")), "", getInputCssClass(), false);
TextFormGroup name = new TextFormGroup(ID_FILE_NAME, fileConfigType != null ? new PropertyModel<String>(fileConfigType, "name") : Model.of(""), createStringResource(fileConfigType == null ? "" : (fileConfigType.COMPLEX_TYPE.getLocalPart() + ".name")), "", getInputCssClass(), false, true);
name.getField().add(new OnChangeAjaxBehavior() {

private static final long serialVersionUID = 1L;
Expand All @@ -203,7 +203,7 @@ protected void onUpdate(AjaxRequestTarget target) {
});
item.add(name);

TextFormGroup file = new TextFormGroup(ID_FILE_PATH, fileConfigType != null ? new PropertyModel<String>(fileConfigType, "file") : Model.of(""), createStringResource(fileConfigType == null ? "" : (fileConfigType.COMPLEX_TYPE.getLocalPart() + ".file")), "", getInputCssClass(), false);
TextFormGroup file = new TextFormGroup(ID_FILE_PATH, fileConfigType != null ? new PropertyModel<String>(fileConfigType, "file") : Model.of(""), createStringResource(fileConfigType == null ? "" : (fileConfigType.COMPLEX_TYPE.getLocalPart() + ".file")), "", getInputCssClass(), false, true);
file.getField().add(new OnChangeAjaxBehavior() {

private static final long serialVersionUID = 1L;
Expand Down

0 comments on commit 9a983c6

Please sign in to comment.