Skip to content

Commit

Permalink
MID-7662 new system configuration UI, logging, wip
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Feb 16, 2022
1 parent edec7e0 commit dea456a
Show file tree
Hide file tree
Showing 17 changed files with 338 additions and 149 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2010-2013 Evolveum
~ Copyright (c) 2022 Evolveum and contributors
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
-->

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
<body>
<wicket:extend>
<div class="row">
<div class="col-md-12">
<div wicket:id="container" />
</div>
</div>
<body>
<wicket:extend>
<div class="row">
<div class="col-md-12">
<div wicket:id="container"/>
</div>
</div>
</wicket:extend>
</body>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
/*
* Copyright (c) 2010-2022 Evolveum
* Copyright (c) 2022 Evolveum and contributors
*
* 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.
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.gui.impl.page.admin.systemconfiguration;
Expand All @@ -23,7 +14,8 @@
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.gui.impl.page.admin.systemconfiguration.page.PageAdminGui;
import com.evolveum.midpoint.gui.impl.page.admin.systemconfiguration.page.PageLogging;
import com.evolveum.midpoint.model.api.AssignmentObjectRelation;
import com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView;
import com.evolveum.midpoint.authentication.api.util.AuthConstants;
Expand Down Expand Up @@ -90,7 +82,7 @@ protected List<CompositedIconButtonDto> load() {
buttons.add(createCompositedButton("Notifications", "fa fa-envelope", PageNotificationConfiguration.class));
buttons.add(createCompositedButton("Logging", "fa fa-file-text", PageLogging.class));
buttons.add(createCompositedButton("Profiling", "fa fa-camera", PageProfiling.class));
buttons.add(createCompositedButton("Admin GUI configuration", "fa fa-camera", PageAdminGuiConfiguration.class));
buttons.add(createCompositedButton("Admin GUI configuration", "fa fa-camera", PageAdminGui.class));
buttons.add(createCompositedButton("Workflow configuration", "fa fa-camera", PageWorkflowConfiguration.class));
buttons.add(createCompositedButton("Role management", "fa fa-camera", PageRoleManagement.class));
buttons.add(createCompositedButton("Internals", "fa fa-camera", PageInternals.class));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
/*
* Copyright (c) 2010-2022 Evolveum
* Copyright (c) 2022 Evolveum and contributors
*
* 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.
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.gui.impl.page.admin.systemconfiguration.component;
Expand Down Expand Up @@ -52,7 +43,7 @@
display = @PanelDisplay(
label = "AdditionalMenuLinkContentPanel.label",
icon = GuiStyleConstants.CLASS_CIRCLE_FULL,
order = 10
order = 20
)
)
@Counter(provider = AdditionalMenuLinkCounter.class)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
/*
* Copyright (c) 2010-2022 Evolveum
* Copyright (c) 2022 Evolveum and contributors
*
* 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.
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.gui.impl.page.admin.systemconfiguration.component;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright (c) 2022 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

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.ClassLoggerConfigurationType;
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 ClassLoggerDetailsPanel extends MultivalueContainerDetailsPanel<ClassLoggerConfigurationType> {

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

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

@Override
protected DisplayNamePanel<ClassLoggerConfigurationType> 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("ClassLoggerConfigurationType.label");
}

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

@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,112 @@
/*
* Copyright (c) 2022 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

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

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

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 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;

/**
* Created by Viliam Repan (lazyman).
*/
@PanelType(name = "classLoggersContent")
@PanelInstance(
identifier = "classLoggersContent",
applicableForType = SystemConfigurationType.class,
display = @PanelDisplay(
label = "ClassLoggersContentPanel.label",
icon = GuiStyleConstants.CLASS_CIRCLE_FULL,
order = 30
)
)
@Counter(provider = ClassLoggersMenuLinkCounter.class)
public class ClassLoggersContentPanel extends MultivalueContainerListPanelWithDetailsPanel<ClassLoggerConfigurationType> {

private IModel<PrismContainerWrapper<ClassLoggerConfigurationType>> model;

public ClassLoggersContentPanel(String id, AssignmentHolderDetailsModel model, ContainerPanelConfigurationType configurationType) {
super(id, ClassLoggerConfigurationType.class, configurationType);

this.model = PrismContainerWrapperModel.fromContainerWrapper(model.getObjectWrapperModel(), ItemPath.create(
SystemConfigurationType.F_LOGGING,
LoggingConfigurationType.F_CLASS_LOGGER
));
}

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

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

@Override
protected void onClick(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ClassLoggerConfigurationType>> model) {
ClassLoggersContentPanel.this.itemDetailsPerformed(target, model);
}
},
new PrismPropertyWrapperColumn<>(getContainerModel(), ClassLoggerConfigurationType.F_LEVEL,
AbstractItemWrapperColumn.ColumnType.VALUE, getPageBase()) {

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

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

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

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

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

@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,33 @@
/*
* Copyright (c) 2022 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

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.LoggingConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType;

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

public ClassLoggersMenuLinkCounter() {
super();
}

@Override
public int count(AssignmentHolderDetailsModel<SystemConfigurationType> model, PageBase pageBase) {
SystemConfigurationType object = model.getObjectType();
LoggingConfigurationType lg = object.getLogging();

return lg != null ? lg.getClassLogger().size() : 0;
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!--
~ Copyright (c) 2022 Evolveum and contributors
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
-->
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:wicket="http://wicket.apache.org">
<body>
<wicket:panel>
<div class="row">
<div class="col-md-12">
<div wicket:id="mainPanel" />
</div>
</div>
</wicket:panel>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2022 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

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

import com.evolveum.midpoint.gui.api.GuiStyleConstants;
import com.evolveum.midpoint.gui.impl.page.admin.AbstractObjectMainPanel;
import com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.AssignmentHolderDetailsModel;
import com.evolveum.midpoint.gui.impl.prism.panel.SingleContainerPanel;
import com.evolveum.midpoint.prism.path.ItemPath;
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.model.PrismContainerWrapperModel;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

@PanelType(name = "loggingPanel")
@PanelInstance(
identifier = "loggingPanel",
applicableForType = SystemConfigurationType.class,
display = @PanelDisplay(
label = "LoggingPanelContent.label",
icon = GuiStyleConstants.CLASS_CIRCLE_FULL,
order = 20
)
)
public class LoggingContentPanel extends AbstractObjectMainPanel<SystemConfigurationType, AssignmentHolderDetailsModel<SystemConfigurationType>> {

private static final String ID_MAIN_PANEL = "mainPanel";

public LoggingContentPanel(String id, AssignmentHolderDetailsModel<SystemConfigurationType> model, ContainerPanelConfigurationType config) {
super(id, model, config);
}

@Override
protected void initLayout() {
SingleContainerPanel panel = new SingleContainerPanel(ID_MAIN_PANEL,
PrismContainerWrapperModel.fromContainerWrapper(getObjectWrapperModel(), ItemPath.create(SystemConfigurationType.F_LOGGING)),
LoggingConfigurationType.COMPLEX_TYPE);
add(panel);
}
}

0 comments on commit dea456a

Please sign in to comment.