Skip to content

Commit

Permalink
Admin GUI configuration tab is implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Feb 18, 2016
1 parent 4812d48 commit 691c82e
Show file tree
Hide file tree
Showing 11 changed files with 473 additions and 38 deletions.
Expand Up @@ -1209,7 +1209,24 @@ public boolean isMenuActive(WebPage page) {
};
submenu.add(menu);


params = new PageParameters();
params.add(PageSystemConfiguration.SELECTED_TAB_INDEX, PageSystemConfiguration.CONFIGURATION_TAB_ADMIN_GUI);
menu = new MenuItem(createStringResource("PageAdmin.menu.top.configuration.adminGui"),
PageSystemConfiguration.class, params, null) {

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

int index = getSelectedTabForConfiguration(page);
return PageSystemConfiguration.CONFIGURATION_TAB_ADMIN_GUI == index ? true : false;
}
};
submenu.add(menu);




menu = new MenuItem(createStringResource("PageAdmin.menu.top.configuration.shadowsDetails"),
Expand Down
@@ -1,3 +1,19 @@
/*
* Copyright (c) 2010-2016 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.web.component.assignment;

import com.evolveum.midpoint.gui.api.component.BasePanel;
Expand Down Expand Up @@ -40,6 +56,11 @@

/**
* Created by Honchar
* Creates a panel with the list of focus type items
* with the possibility to filter by user (show only
* assigned to the specified user items), to search
* through the list and to reset the list to the
* initial state
*/
public class MultipleAssignmentSelector<F extends FocusType> extends BasePanel<List<AssignmentEditorDto>> {
private static final long serialVersionUID = 1L;
Expand Down
@@ -1,3 +1,19 @@
/*
* Copyright (c) 2010-2016 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.web.component.assignment;

import com.evolveum.midpoint.gui.api.component.BasePanel;
Expand Down Expand Up @@ -45,6 +61,9 @@

/**
* Created by Honchar.
* Panel contains available list of focus type items and
* the list of assigned items of the same type with the
* possibility of editing the list of assignments.
*/
public class MultipleAssignmentSelectorPanel<F extends FocusType> extends BasePanel<List<AssignmentEditorDto>> {
private LoadableModel<List<AssignmentEditorDto>> assignmentsModel;
Expand Down
Expand Up @@ -20,6 +20,9 @@
import java.util.Collection;
import java.util.List;

import com.evolveum.midpoint.web.page.admin.configuration.component.*;
import com.evolveum.midpoint.web.page.admin.configuration.dto.*;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.apache.commons.lang.StringUtils;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
Expand Down Expand Up @@ -49,21 +52,7 @@
import com.evolveum.midpoint.web.component.AjaxSubmitButton;
import com.evolveum.midpoint.web.component.TabbedPanel;
import com.evolveum.midpoint.web.component.form.Form;
import com.evolveum.midpoint.web.page.admin.configuration.component.LoggingConfigPanel;
import com.evolveum.midpoint.web.page.admin.configuration.component.NotificationConfigPanel;
import com.evolveum.midpoint.web.page.admin.configuration.component.ProfilingConfigPanel;
import com.evolveum.midpoint.web.page.admin.configuration.component.SystemConfigPanel;
import com.evolveum.midpoint.web.page.admin.configuration.dto.LoggingDto;
import com.evolveum.midpoint.web.page.admin.configuration.dto.NotificationConfigurationDto;
import com.evolveum.midpoint.web.page.admin.configuration.dto.ObjectPolicyConfigurationTypeDto;
import com.evolveum.midpoint.web.page.admin.configuration.dto.ProfilingDto;
import com.evolveum.midpoint.web.page.admin.configuration.dto.PropertyConstraintTypeDto;
import com.evolveum.midpoint.web.page.admin.configuration.dto.SystemConfigurationDto;
import com.evolveum.midpoint.web.page.error.PageError;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectPolicyConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.PropertyConstraintType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SystemObjectsType;
import com.evolveum.prism.xml.ns._public.types_3.ItemPathType;

/**
Expand All @@ -80,6 +69,7 @@ public class PageSystemConfiguration extends PageAdminConfiguration {
public static final int CONFIGURATION_TAB_NOTIFICATION = 1;
public static final int CONFIGURATION_TAB_LOGGING = 2;
public static final int CONFIGURATION_TAB_PROFILING = 3;
public static final int CONFIGURATION_TAB_ADMIN_GUI = 4;

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

Expand All @@ -97,6 +87,7 @@ public class PageSystemConfiguration extends PageAdminConfiguration {
private LoggingConfigPanel loggingConfigPanel;
private ProfilingConfigPanel profilingConfigPanel;
private SystemConfigPanel systemConfigPanel;
private AdminGuiConfigPanel adminGuiConfigPanel;
private NotificationConfigPanel notificationConfigPanel;

private LoadableModel<SystemConfigurationDto> model;
Expand Down Expand Up @@ -195,6 +186,16 @@ public WebMarkupContainer getPanel(String panelId) {
}
});

tabs.add(new AbstractTab(createStringResource("pageSystemConfiguration.adminGui.title")) {

@Override
public WebMarkupContainer getPanel(String panelId) {
adminGuiConfigPanel = new AdminGuiConfigPanel(panelId,
new PropertyModel<List<RichHyperlinkType>>(model, "userDashboardLink"));
return adminGuiConfigPanel;
}
});

TabbedPanel tabPanel = new TabbedPanel(ID_TAB_PANEL, tabs) {

@Override
Expand Down Expand Up @@ -270,6 +271,7 @@ private void savePerformed(AjaxRequestTarget target) {
SystemConfigurationType newObject = model.getObject().getNewObject();

saveObjectPolicies(newObject);
saveAdminGui(newObject);


ObjectDelta<SystemConfigurationType> delta = DiffUtil.diff(model.getObject().getOldObject(), newObject);
Expand Down Expand Up @@ -344,6 +346,15 @@ private void saveObjectPolicies(SystemConfigurationType systemConfig) {
systemConfig.getDefaultObjectPolicyConfiguration().addAll(confList);
}

private void saveAdminGui(SystemConfigurationType systemConfig) {
if (adminGuiConfigPanel == null) {
return;
}
List<RichHyperlinkType> linksList = adminGuiConfigPanel.getModel().getObject();
systemConfig.getAdminGuiConfiguration().getUserDashboardLink().clear();
systemConfig.getAdminGuiConfiguration().getUserDashboardLink().addAll(linksList);
}


private void resetPerformed(AjaxRequestTarget target) {
int index = getTabPanel().getSelectedTab();
Expand Down
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<!--
~ Copyright (c) 2010-2016 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.
-->
<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">
<h3>
<wicket:message key="AdminGuiConfigPanel.title"/>
</h3>
<div class="form-group" wicket:id="dashboardLinkEditor"></div>
</div>
</div>
</wicket:panel>
</body>
</html>

@@ -0,0 +1,95 @@
/*
* Copyright (c) 2010-2016 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.web.page.admin.configuration.component;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.web.component.ObjectPolicyConfigurationEditor;
import com.evolveum.midpoint.web.component.form.multivalue.GenericMultiValueLabelEditPanel;
import com.evolveum.midpoint.web.page.admin.configuration.dto.AdminGuiConfigurationDto;
import com.evolveum.midpoint.web.page.admin.configuration.dto.ObjectPolicyConfigurationTypeDto;
import com.evolveum.midpoint.web.page.admin.configuration.dto.SystemConfigurationDto;
import com.evolveum.midpoint.web.page.admin.roles.component.MultiplicityPolicyDialog;
import com.evolveum.midpoint.xml.ns._public.common.common_3.MultiplicityPolicyConstraintType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.RichHyperlinkType;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;

import java.util.List;

/**
* Created by Honchar.
*/
public class AdminGuiConfigPanel extends BasePanel<List<RichHyperlinkType>> {

private static final String ID_DASHBOARD_LINK_EDITOR = "dashboardLinkEditor";
private static final String LABEL_SIZE = "col-md-4";
private static final String INPUT_SIZE = "col-md-6";

public AdminGuiConfigPanel(String id, IModel<List<RichHyperlinkType>> model) {
super(id, model);
initLayout();
}

private void initLayout(){
GenericMultiValueLabelEditPanel dashboardLinkEditor = new GenericMultiValueLabelEditPanel<RichHyperlinkType>(ID_DASHBOARD_LINK_EDITOR,
getModel(), createStringResource("AdminGuiConfigPanel.dashboardLinksConfig"), LABEL_SIZE, INPUT_SIZE){

@Override
protected void initDialog() {
ModalWindow dialog = new DashboardLinkDialog(ID_MODAL_EDITOR, null){

@Override
protected void savePerformed(AjaxRequestTarget target) {
closeModalWindow(target);
target.add(getDashboardLinkEditorContainer());
}
};
add(dialog);
}

@Override
protected IModel<String> createTextModel(final IModel<RichHyperlinkType> model) {
return new PropertyModel<String>(model, "label");
}

@Override
protected void editValuePerformed(AjaxRequestTarget target, IModel<RichHyperlinkType> rowModel) {
DashboardLinkDialog window = (DashboardLinkDialog) get(ID_MODAL_EDITOR);
window.updateModel(target, rowModel.getObject());
window.show(target);
}

@Override
protected RichHyperlinkType createNewEmptyItem() {
RichHyperlinkType link = new RichHyperlinkType();
link.getAuthorization().add("");
return link;
}
};
dashboardLinkEditor.setOutputMarkupId(true);
add(dashboardLinkEditor);

}

private WebMarkupContainer getDashboardLinkEditorContainer(){
return (WebMarkupContainer) get(ID_DASHBOARD_LINK_EDITOR);
}
}
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<!--
~ Copyright (c) 2010-2016 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.
-->

<wicket:panel xmlns:wicket="http://wicket.apache.org">
<div wicket:id="content">
<form wicket:id="mainForm" class="form-horizontal" style="margin: 15px">
<div class="form-group" wicket:id="label" />
<div class="form-group" wicket:id="description" />
<div class="form-group" wicket:id="targetUrl" />
<div class="form-group" wicket:id="color" />
<div class="form-group" wicket:id="authorization" />
<div class="form-group" wicket:id="icon" />

<p align="right">
<a class="btn btn-primary btn-sm" wicket:id="saveButton"/>
<a class="btn btn-default btn-sm" wicket:id="cancelButton"/>
</p>
</form>
</div>
</wicket:panel>

0 comments on commit 691c82e

Please sign in to comment.