Skip to content

Commit

Permalink
MID-7662 new system configuration UI started
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Feb 16, 2022
1 parent 9fd03fd commit 44dbc48
Show file tree
Hide file tree
Showing 29 changed files with 978 additions and 668 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ protected LookupTableType getPredefinedValues(PrismProperty<T> item, WrapperCont
String name = appender.getName();
row.setKey(name);
row.setValue(name);
row.setLabel(new PolyStringType(name));
if (name != null) {
row.setLabel(new PolyStringType(name));
}
list.add(row);
}
return lookupTable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
/*
* Copyright (c) 2018 Evolveum and contributors
* Copyright (c) 2010-2022 Evolveum
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.evolveum.midpoint.web.page.admin.configuration;
package com.evolveum.midpoint.gui.impl.page.admin.systemconfiguration;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -14,12 +23,14 @@
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder;
import com.evolveum.midpoint.gui.impl.component.icon.IconCssStyle;
import com.evolveum.midpoint.gui.impl.page.admin.systemconfiguration.page.PageAdminGuiConfiguration;
import com.evolveum.midpoint.model.api.AssignmentObjectRelation;
import com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView;
import com.evolveum.midpoint.authentication.api.util.AuthConstants;
import com.evolveum.midpoint.web.component.CompositedIconButtonDto;
import com.evolveum.midpoint.web.component.MultiCompositedButtonPanel;

import com.evolveum.midpoint.web.page.admin.configuration.PageInternals;
import com.evolveum.midpoint.web.page.admin.configuration.system.*;
import com.evolveum.prism.xml.ns._public.types_3.PolyStringType;

Expand All @@ -42,7 +53,7 @@
*/
@PageDescriptor(
urls = {
@Url(mountUrl = "/admin/config/system2", matchUrlForSecurity = "/admin/config/system2"),
@Url(mountUrl = "/admin/config/system2"),
},
action = {
@AuthorizationAction(actionUri = AuthConstants.AUTH_CONFIGURATION_ALL,
Expand All @@ -52,18 +63,17 @@
label = "PageSystemConfiguration.auth.configSystemConfiguration.label",
description = "PageSystemConfiguration.auth.configSystemConfiguration.description")
})
public class PageSystemConfigurationNew extends PageBase {
public class PageSystemConfiguration extends PageBase {

private static final long serialVersionUID = 1L;

private static final String DOT_CLASS = PageSystemConfigurationNew.class.getName() + ".";
private static final String DOT_CLASS = PageSystemConfiguration.class.getName() + ".";

private static final Trace LOGGER = TraceManager.getTrace(PageSystemConfigurationNew.class);
private static final Trace LOGGER = TraceManager.getTrace(PageSystemConfiguration.class);

private static final String ID_CONTAINER = "container";


public PageSystemConfigurationNew() {
public PageSystemConfiguration() {
initLayout();
}

Expand Down Expand Up @@ -94,6 +104,7 @@ protected List<CompositedIconButtonDto> load() {
}
};
MultiCompositedButtonPanel panel = new MultiCompositedButtonPanel(ID_CONTAINER, model) {

@Override
protected void buttonClickPerformed(AjaxRequestTarget target, AssignmentObjectRelation relationSpec, CompiledObjectCollectionView collectionViews, Class<? extends WebPage> page) {
navigateToNext(page);
Expand All @@ -114,6 +125,7 @@ private CompositedIconButtonDto createCompositedButton(String type, String icon,
displayType.setLabel(new PolyStringType(type));
button.setAdditionalButtonDisplayType(displayType);
button.setPage(page);

return button;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Copyright (c) 2010-2022 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.evolveum.midpoint.gui.impl.page.admin.systemconfiguration.component;

import com.evolveum.midpoint.gui.api.GuiStyleConstants;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper;
import com.evolveum.midpoint.gui.impl.component.MultivalueContainerDetailsPanel;
import com.evolveum.midpoint.gui.impl.component.MultivalueContainerListPanelWithDetailsPanel;
import com.evolveum.midpoint.gui.impl.component.data.column.AbstractItemWrapperColumn;
import com.evolveum.midpoint.gui.impl.component.data.column.PrismPropertyWrapperColumn;
import com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.AssignmentHolderDetailsModel;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.web.application.Counter;
import com.evolveum.midpoint.web.application.PanelDisplay;
import com.evolveum.midpoint.web.application.PanelInstance;
import com.evolveum.midpoint.web.application.PanelType;
import com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn;
import com.evolveum.midpoint.web.model.PrismContainerWrapperModel;
import com.evolveum.midpoint.web.session.UserProfileStorage;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.model.IModel;

import java.util.Arrays;
import java.util.List;

/**
* Created by Viliam Repan (lazyman).
*/
@PanelType(name = "additionalMenuLinkContent")
@PanelInstance(
identifier = "additionalMenuLinkContent",
applicableForType = SystemConfigurationType.class,
display = @PanelDisplay(
label = "AdditionalMenuLinkContentPanel.label",
icon = GuiStyleConstants.CLASS_CIRCLE_FULL,
order = 10
)
)
@Counter(provider = AdditionalMenuLinkCounter.class)
public class AdditionalMenuLinkContentPanel extends RichHyperlinkListContentPanel {

public AdditionalMenuLinkContentPanel(String id, AssignmentHolderDetailsModel model, ContainerPanelConfigurationType configurationType) {
super(id, model, configurationType, ItemPath.create(
SystemConfigurationType.F_ADMIN_GUI_CONFIGURATION,
AdminGuiConfigurationType.F_ADDITIONAL_MENU_LINK));
}

@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.PAGE_MESSAGE_TEMPLATE_LOCALIZED_CONTENT_PANEL; // todo fix
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (c) 2010-2022 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.evolveum.midpoint.gui.impl.page.admin.systemconfiguration.component;

import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.AssignmentHolderDetailsModel;
import com.evolveum.midpoint.web.application.SimpleCounter;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AdminGuiConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType;

/**
* Created by Viliam Repan (lazyman).
*/
public class AdditionalMenuLinkCounter extends SimpleCounter<AssignmentHolderDetailsModel<SystemConfigurationType>, SystemConfigurationType> {

public AdditionalMenuLinkCounter() {
super();
}

@Override
public int count(AssignmentHolderDetailsModel<SystemConfigurationType> model, PageBase pageBase) {
SystemConfigurationType object = model.getObjectType();
AdminGuiConfigurationType agc = object.getAdminGuiConfiguration();

return agc != null ? agc.getAdditionalMenuLink().size() : 0;
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright (c) 2010-2022 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.evolveum.midpoint.gui.impl.page.admin.systemconfiguration.component;

import com.evolveum.midpoint.gui.api.component.DisplayNamePanel;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper;
import com.evolveum.midpoint.gui.impl.component.MultivalueContainerDetailsPanel;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ContainerPanelConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.RichHyperlinkType;

import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

/**
* Created by Viliam Repan (lazyman).
*/
public class RichHyperlinkDetailsPanel extends MultivalueContainerDetailsPanel<RichHyperlinkType> {

public RichHyperlinkDetailsPanel(String id, IModel<PrismContainerValueWrapper<RichHyperlinkType>> model, boolean addDefaultPanel) {
super(id, model, addDefaultPanel);
}

public RichHyperlinkDetailsPanel(String id, IModel<PrismContainerValueWrapper<RichHyperlinkType>> model, boolean addDefaultPanel, ContainerPanelConfigurationType config) {
super(id, model, addDefaultPanel, config);
}

@Override
protected DisplayNamePanel<RichHyperlinkType> createDisplayNamePanel(String displayNamePanelId) {
// so far no display name panel needed
DisplayNamePanel d = new DisplayNamePanel<>(displayNamePanelId, Model.of(getModelObject().getRealValue())) {

@Override
protected IModel<String> createHeaderModel() {
return createStringResource("RichHyperlinkType.label");
}

@Override
protected IModel<String> getDescriptionLabelModel() {
return () -> getModelObject().getLabel();
}

@Override
protected WebMarkupContainer createTypeImagePanel(String idTypeImage) {
WebMarkupContainer c = new WebMarkupContainer(idTypeImage);
c.setVisible(false);
return c;
}
};

return d;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* Copyright (c) 2010-2022 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.evolveum.midpoint.gui.impl.page.admin.systemconfiguration.component;

import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper;
import com.evolveum.midpoint.gui.impl.component.MultivalueContainerDetailsPanel;
import com.evolveum.midpoint.gui.impl.component.MultivalueContainerListPanelWithDetailsPanel;
import com.evolveum.midpoint.gui.impl.component.data.column.AbstractItemWrapperColumn;
import com.evolveum.midpoint.gui.impl.component.data.column.PrismPropertyWrapperColumn;
import com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.AssignmentHolderDetailsModel;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn;
import com.evolveum.midpoint.web.model.PrismContainerWrapperModel;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ContainerPanelConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.RichHyperlinkType;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.model.IModel;

import java.util.Arrays;
import java.util.List;

/**
* Created by Viliam Repan (lazyman).
*/
public abstract class RichHyperlinkListContentPanel extends MultivalueContainerListPanelWithDetailsPanel<RichHyperlinkType> {

private IModel<PrismContainerWrapper<RichHyperlinkType>> model;

public RichHyperlinkListContentPanel(String id, AssignmentHolderDetailsModel model, ContainerPanelConfigurationType configurationType, ItemPath containerRealPath) {
super(id, RichHyperlinkType.class, configurationType);

this.model = PrismContainerWrapperModel.fromContainerWrapper(model.getObjectWrapperModel(), containerRealPath);
}

@Override
protected IColumn<PrismContainerValueWrapper<RichHyperlinkType>, String> createCheckboxColumn() {
return new CheckBoxHeaderColumn<>();
}

@Override
protected List<IColumn<PrismContainerValueWrapper<RichHyperlinkType>, String>> createDefaultColumns() {
return Arrays.asList(
new PrismPropertyWrapperColumn<>(getContainerModel(), RichHyperlinkType.F_LABEL,
AbstractItemWrapperColumn.ColumnType.LINK, getPageBase()) {

@Override
protected void onClick(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<RichHyperlinkType>> model) {
RichHyperlinkListContentPanel.this.itemDetailsPerformed(target, model);
}
}
);
}

@Override
protected boolean isCreateNewObjectVisible() {
return true;
}

@Override
protected IModel<PrismContainerWrapper<RichHyperlinkType>> getContainerModel() {
return model;
}

@Override
protected MultivalueContainerDetailsPanel<RichHyperlinkType> getMultivalueContainerDetailsPanel(
ListItem<PrismContainerValueWrapper<RichHyperlinkType>> item) {

return new RichHyperlinkDetailsPanel(MultivalueContainerListPanelWithDetailsPanel.ID_ITEM_DETAILS, item.getModel(), true);
}
}

0 comments on commit 44dbc48

Please sign in to comment.