Skip to content

Commit

Permalink
MID-7484 initial UI for message template, wip
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Feb 11, 2022
1 parent 9a837b0 commit fde0fe5
Show file tree
Hide file tree
Showing 11 changed files with 312 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ public class GuiStyleConstants {
public static final String EVO_CASE_OBJECT_ICON = "fe fe-case";
public static final String EVO_CASE_THICK_ICON = "fe fe-case_thick";
public static final String EVO_ARCHETYPE_TYPE_ICON = "fe fe-archetype_smooth";
public static final String EVO_MESSAGE_TEMPLATE_TYPE_ICON = "fa fa-book";

public static final String GREEN_COLOR = "color-green";
public static final String YELLOW_COLOR = "color-yellow";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import javax.xml.namespace.QName;

import com.evolveum.midpoint.authentication.api.authorization.AuthorizationAction;
import com.evolveum.midpoint.gui.impl.page.admin.messagetemplate.PageMessageTemplate;
import com.evolveum.midpoint.gui.impl.page.admin.messagetemplate.PageMessageTemplates;
import com.evolveum.midpoint.prism.delta.DeltaFactory;
import com.evolveum.midpoint.schema.util.task.work.ObjectSetUtil;
import com.evolveum.midpoint.security.api.AuthorizationConstants;
Expand Down Expand Up @@ -264,6 +266,7 @@ public final class WebComponentUtil {
OBJECT_DETAILS_PAGE_MAP_NEW.put(ShadowType.class, PageShadow.class);
OBJECT_DETAILS_PAGE_MAP_NEW.put(ObjectCollectionType.class, com.evolveum.midpoint.gui.impl.page.admin.objectcollection.PageObjectCollection.class);
OBJECT_DETAILS_PAGE_MAP_NEW.put(ObjectTemplateType.class, com.evolveum.midpoint.gui.impl.page.admin.objecttemplate.PageObjectTemplate.class);
OBJECT_DETAILS_PAGE_MAP_NEW.put(MessageTemplateType.class, PageMessageTemplate.class);
}

static {
Expand All @@ -281,6 +284,7 @@ public final class WebComponentUtil {
OBJECT_LIST_PAGE_MAP.put(ServiceType.class, PageServices.class);
OBJECT_LIST_PAGE_MAP.put(ResourceType.class, PageResources.class);
OBJECT_LIST_PAGE_MAP.put(TaskType.class, PageTasks.class);
OBJECT_LIST_PAGE_MAP.put(PageMessageTemplate.class, PageMessageTemplates.class);
}

private static final Map<TableId, String> STORAGE_TABLE_ID_MAP;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ private MainMenuItem createReportsItems() {
private SideBarMenuItem createConfigurationMenu(boolean experimentalFeaturesEnabled) {
SideBarMenuItem item = new SideBarMenuItem("PageAdmin.menu.top.configuration", experimentalFeaturesEnabled);
item.addMainMenuItem(createArchetypesItems());
item.addMainMenuItem(createMessageTemplatesItems());
item.addMainMenuItem(createObjectsCollectionItems());
item.addMainMenuItem(createObjectTemplatesItems());
item.addMainMenuItem(createMainMenuItem("PageAdmin.menu.top.configuration.bulkActions", "fa fa-bullseye", PageBulkAction.class));
Expand Down Expand Up @@ -519,7 +520,11 @@ private void createFocusPageViewMenu(MainMenuItem mainMenuItem, String viewKey,
}
}


private MainMenuItem createMessageTemplatesItems() {
MainMenuItem item = new MainMenuItem("PageAdmin.menu.top.messageTemplates", GuiStyleConstants.EVO_MESSAGE_TEMPLATE_TYPE_ICON);
createBasicAssignmentHolderMenuItems(item, PageTypes.MESSAGE_TEMPLATES);
return item;
}

private MainMenuItem createArchetypesItems() {
MainMenuItem item = new MainMenuItem("PageAdmin.menu.top.archetypes", GuiStyleConstants.EVO_ARCHETYPE_TYPE_ICON);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.impl.page.admin.AbstractPageObjectDetails;
import com.evolveum.midpoint.gui.impl.page.admin.archetype.PageArchetype;
import com.evolveum.midpoint.gui.impl.page.admin.messagetemplate.PageMessageTemplate;
import com.evolveum.midpoint.gui.impl.page.admin.messagetemplate.PageMessageTemplates;
import com.evolveum.midpoint.gui.impl.page.admin.objectcollection.PageObjectCollection;
import com.evolveum.midpoint.gui.impl.page.admin.objecttemplate.PageObjectTemplate;
import com.evolveum.midpoint.gui.impl.page.admin.org.PageOrg;
Expand Down Expand Up @@ -48,6 +50,7 @@ public enum PageTypes {
RESOURCE("resources", GuiStyleConstants.CLASS_OBJECT_RESOURCE_ICON, PageResources.class, PageResource.class, PageResourceWizard.class, ResourceType.COMPLEX_TYPE),
CASE("cases", GuiStyleConstants.EVO_CASE_OBJECT_ICON, PageCases.class, null, null, CaseType.COMPLEX_TYPE),
ARCHETYPE("archetypes", GuiStyleConstants.EVO_ARCHETYPE_TYPE_ICON, PageArchetypes.class, PageArchetype.class, com.evolveum.midpoint.web.page.admin.archetype.PageArchetype.class, ArchetypeType.COMPLEX_TYPE),
MESSAGE_TEMPLATES("messageTemplates", GuiStyleConstants.EVO_MESSAGE_TEMPLATE_TYPE_ICON, PageMessageTemplates.class, PageMessageTemplate.class, null, MessageTemplateType.COMPLEX_TYPE),
OBJECT_COLLECTION("objectCollections", GuiStyleConstants.CLASS_OBJECT_COLLECTION_ICON, PageObjectCollections.class, PageObjectCollection.class, com.evolveum.midpoint.web.page.admin.objectCollection.PageObjectCollection.class, ObjectCollectionType.COMPLEX_TYPE),
OBJECT_TEMPLATE("objectTemplates", GuiStyleConstants.CLASS_OBJECT_TEMPLATE_ICON, PageObjectTemplates.class, PageObjectTemplate.class, com.evolveum.midpoint.web.page.admin.objectTemplate.PageObjectTemplate.class, ObjectTemplateType.COMPLEX_TYPE),
REPORT("reports", GuiStyleConstants.CLASS_REPORT_ICON, PageReports.class, PageReport.class, com.evolveum.midpoint.web.page.admin.reports.PageReport.class, ReportType.COMPLEX_TYPE);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* 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.messagetemplate;

import com.evolveum.midpoint.gui.api.util.ModelServiceLocator;
import com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.AssignmentHolderDetailsModel;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.xml.ns._public.common.common_3.MessageTemplateType;

import org.apache.wicket.model.LoadableDetachableModel;

/**
* Created by Viliam Repan (lazyman).
*/
public class MessageTemplateModel extends AssignmentHolderDetailsModel<MessageTemplateType> {

public MessageTemplateModel(LoadableDetachableModel<PrismObject<MessageTemplateType>> prismObjectModel, ModelServiceLocator serviceLocator) {
super(prismObjectModel, serviceLocator);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* 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.messagetemplate;

import com.evolveum.midpoint.gui.api.GuiStyleConstants;
import com.evolveum.midpoint.web.component.ObjectSummaryPanel;
import com.evolveum.midpoint.xml.ns._public.common.common_3.MessageTemplateType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SummaryPanelSpecificationType;

import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

/**
* Created by Viliam Repan (lazyman).
*/
public class MessageTemplateSummaryPanel extends ObjectSummaryPanel<MessageTemplateType> {

public MessageTemplateSummaryPanel(String id, IModel<MessageTemplateType> model, SummaryPanelSpecificationType specification) {
super(id, MessageTemplateType.class, model, specification);
}

@Override
protected String getDefaultIconCssClass() {
return GuiStyleConstants.CLASS_VALUE_POLICY_ICON;
}

@Override
protected String getIconBoxAdditionalCssClass() {
return null;
}

@Override
protected String getBoxAdditionalCssClass() {
return null;
}

@Override
protected boolean isIdentifierVisible() {
return false;
}

@Override
protected IModel<String> getTitleModel() {
return Model.of("title");
}

@Override
protected IModel<String> getTitle2Model() {
return super.getTitle2Model();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* 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.messagetemplate;

import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;

import com.evolveum.midpoint.authentication.api.authorization.AuthorizationAction;
import com.evolveum.midpoint.authentication.api.authorization.PageDescriptor;
import com.evolveum.midpoint.authentication.api.authorization.Url;
import com.evolveum.midpoint.authentication.api.util.AuthConstants;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.PageAssignmentHolderDetails;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.security.api.AuthorizationConstants;
import com.evolveum.midpoint.web.util.OnePageParameterEncoder;
import com.evolveum.midpoint.xml.ns._public.common.common_3.MessageTemplateType;

@PageDescriptor(
urls = {
@Url(mountUrl = "/admin/messageTemplate")
},
encoder = OnePageParameterEncoder.class,
action = {
@AuthorizationAction(actionUri = AuthConstants.AUTH_CONFIGURATION_ALL,
label = AuthConstants.AUTH_CONFIGURATION_ALL_LABEL,
description = AuthConstants.AUTH_CONFIGURATION_ALL_DESCRIPTION),
@AuthorizationAction(actionUri = AuthorizationConstants.AUTZ_UI_MESSAGE_TEMPLATES_ALL_URL,
label = "PageMessageTemplates.auth.messageTemplatesAll.label",
description = "PageMessageTemplates.auth.messageTemplatesAll.description"),
@AuthorizationAction(actionUri = AuthorizationConstants.AUTZ_UI_MESSAGE_TEMPLATE_URL,
label = "PageMessageTemplate.auth.messageTemplate.label",
description = "PageMessageTemplate.auth.messageTemplate.description")
})
public class PageMessageTemplate extends PageAssignmentHolderDetails<MessageTemplateType, MessageTemplateModel> {

private static final long serialVersionUID = 1L;

public PageMessageTemplate() {
super();
}

public PageMessageTemplate(PageParameters parameters) {
super(parameters);
}

public PageMessageTemplate(final PrismObject<MessageTemplateType> object) {
super(object);
}

@Override
public Class<MessageTemplateType> getType() {
return MessageTemplateType.class;
}

@Override
protected Panel createSummaryPanel(String id, IModel<MessageTemplateType> model) {
return new MessageTemplateSummaryPanel(id, model, getSummaryPanelSpecification());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2010-2018 Evolveum
~
~ 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>
<form wicket:id="mainForm" class="clearfix form-horizontal">
<wicket:child/>
<div wicket:id="table"/>
</form>
</wicket:extend>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*
* 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.messagetemplate;

import com.evolveum.midpoint.authentication.api.authorization.AuthorizationAction;
import com.evolveum.midpoint.authentication.api.authorization.PageDescriptor;
import com.evolveum.midpoint.authentication.api.authorization.Url;
import com.evolveum.midpoint.authentication.api.util.AuthConstants;
import com.evolveum.midpoint.gui.api.GuiStyleConstants;
import com.evolveum.midpoint.gui.api.component.MainObjectListPanel;
import com.evolveum.midpoint.security.api.AuthorizationConstants;
import com.evolveum.midpoint.web.application.CollectionInstance;
import com.evolveum.midpoint.web.application.PanelDisplay;
import com.evolveum.midpoint.web.component.form.MidpointForm;
import com.evolveum.midpoint.web.component.util.SelectableBean;
import com.evolveum.midpoint.web.page.admin.PageAdmin;
import com.evolveum.midpoint.web.session.UserProfileStorage.TableId;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ArchetypeType;

import com.evolveum.midpoint.xml.ns._public.common.common_3.MessageTemplateType;

import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.markup.html.form.Form;

@PageDescriptor(
urls = {
@Url(mountUrl = "/admin/messageTemplates")
},
action = {
@AuthorizationAction(actionUri = AuthConstants.AUTH_CONFIGURATION_ALL,
label = AuthConstants.AUTH_CONFIGURATION_ALL_LABEL,
description = AuthConstants.AUTH_CONFIGURATION_ALL_DESCRIPTION),
@AuthorizationAction(actionUri = AuthorizationConstants.AUTZ_UI_MESSAGE_TEMPLATES_ALL_URL,
label = "PageMessageTemplates.auth.archetypesAll.label",
description = "PageMessageTemplates.auth.archetypesAll.description"),
@AuthorizationAction(actionUri = AuthorizationConstants.AUTZ_UI_MESSAGE_TEMPLATES_URL,
label = "PageMessageTemplates.auth.messageTemplates.label",
description = "PageMessageTemplates.auth.messageTemplates.description"),
@AuthorizationAction(actionUri = AuthorizationConstants.AUTZ_UI_MESSAGE_TEMPLATES_VIEW_URL,
label = "PageMessageTemplates.auth.messageTemplates.view.label",
description = "PageMessageTemplates.auth.messageTemplates.view.description")
})
@CollectionInstance(identifier = "allMessageTemplates", applicableForType = MessageTemplateType.class,
display = @PanelDisplay(label = "PageAdmin.menu.top.messageTemplates.list", singularLabel = "ObjectType.messageTemplate", icon = GuiStyleConstants.EVO_MESSAGE_TEMPLATE_TYPE_ICON))
public class PageMessageTemplates extends PageAdmin {

private static final long serialVersionUID = 1L;

private static final String ID_MAIN_FORM = "mainForm";
private static final String ID_TABLE = "table";

public PageMessageTemplates() {
super();
}

@Override
protected void onInitialize() {
super.onInitialize();
initLayout();
}

private void initLayout() {
Form mainForm = new MidpointForm(ID_MAIN_FORM);
add(mainForm);

MainObjectListPanel<MessageTemplateType> table = new MainObjectListPanel<>(ID_TABLE, MessageTemplateType.class) {

@Override
protected TableId getTableId() {
return TableId.TABLE_MESSAGE_TEMPLATES;
}

@Override
protected IColumn<SelectableBean<MessageTemplateType>, String> createCheckboxColumn() {
return null;
}
};
table.setOutputMarkupId(true);
mainForm.add(table);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public enum TableId {
TABLE_ORGS,
TABLE_SERVICES,
TABLE_ARCHETYPES,
TABLE_MESSAGE_TEMPLATES,
TABLE_RESOURCES,
TABLE_VALUE_POLICIES,
TABLE_TASKS,
Expand Down

0 comments on commit fde0fe5

Please sign in to comment.