Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
matusmacik committed Sep 7, 2017
2 parents 66f23b9 + b620bde commit a9ce84f
Show file tree
Hide file tree
Showing 82 changed files with 6,542 additions and 1,584 deletions.
Expand Up @@ -91,6 +91,12 @@ public class GuiStyleConstants {
public static final String CLASS_SHADOW_ICON_GENERIC = "fa fa-circle-o";
public static final String CLASS_SHADOW_ICON_PROTECTED = "fa fa-shield";
public static final String CLASS_SHADOW_ICON_UNKNOWN = "fa fa-eye";

public static final String CLASS_ICON_DASHBOARD = "fa fa-dashboard";
public static final String CLASS_ICON_PROFILE = "fa fa-user";
public static final String CLASS_ICON_CREDENTIALS = "fa fa-shield";
public static final String CLASS_ICON_REQUEST = "fa fa-pencil-square-o";
public static final String CLASS_ICON_CONSENT = "fa fa-check-square-o";

public static final String CLASS_APPROVAL_OUTCOME_ICON_UNKNOWN_COLORED = "fa fa-check text-warning";
public static final String CLASS_APPROVAL_OUTCOME_ICON_APPROVED_COLORED = "fa fa-check text-success";
Expand Down
@@ -1,3 +1,18 @@
/*
* Copyright (c) 2010-2017 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.api.component;

import org.apache.wicket.AttributeModifier;
Expand Down Expand Up @@ -58,6 +73,7 @@ private IModel<String> getAdditionalNameLabelStyleClass() {
}

private IModel<String> createHeaderModel() {
// TODO: align with DisplayNameModel
if (ObjectType.class.isAssignableFrom(getModelObject().getClass())) {
return Model.of(WebComponentUtil.getEffectiveName((ObjectType) getModelObject(), AbstractRoleType.F_DISPLAY_NAME));
}
Expand Down
Expand Up @@ -5,6 +5,7 @@
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.extensions.markup.html.captcha.CaptchaImageResource;
import org.apache.wicket.feedback.ComponentFeedbackMessageFilter;
import org.apache.wicket.feedback.ContainerFeedbackMessageFilter;
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.html.form.RequiredTextField;
Expand All @@ -13,6 +14,7 @@
import org.apache.wicket.model.PropertyModel;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.web.component.message.FeedbackAlerts;

public class CaptchaPanel extends BasePanel<Void> {

Expand All @@ -34,10 +36,10 @@ public class CaptchaPanel extends BasePanel<Void> {
public CaptchaPanel(String id) {
super(id);

FeedbackPanel feedback = new FeedbackPanel("feedback",
new ContainerFeedbackMessageFilter(CaptchaPanel.this));
FeedbackAlerts feedback = new FeedbackAlerts("feedback");
feedback.setFilter(new ContainerFeedbackMessageFilter(CaptchaPanel.this));
add(feedback);

captchaImageResource = createCaptchImageResource();
final Image captchaImage = new Image("image", captchaImageResource);
captchaImage.setOutputMarkupId(true);
Expand Down
@@ -0,0 +1,61 @@
/**
* Copyright (c) 2017 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.api.model;

import org.apache.wicket.model.IModel;

import com.evolveum.midpoint.xml.ns._public.common.common_3.AbstractRoleType;
import com.evolveum.prism.xml.ns._public.types_3.PolyStringType;

/**
*
* TODO: refactor for lazy loading
*
* @author semancik
*/
public class DisplayNameModel implements IModel<String> {
private static final long serialVersionUID = 1L;

private String name;

public DisplayNameModel(AbstractRoleType role) {
PolyStringType displayName = role.getDisplayName();
if (displayName == null) {
displayName = role.getName();
}
if (displayName == null) {
name = "";
} else {
name = displayName.getOrig();
}
}

@Override
public void detach() {
// TODO Auto-generated method stub
}

@Override
public String getObject() {
return name;
}

@Override
public void setObject(String object) {
this.name = object;
}

}
Expand Up @@ -35,7 +35,6 @@
<link href="wro/admin-lte.css" type="text/css" rel="stylesheet"/>

<wicket:link>
<link href="../../../../../../webjars/adminlte/2.3.11/dist/css/skins/skin-blue-light.min.css" rel="stylesheet" type="text/css" />

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
Expand All @@ -55,7 +54,8 @@
<!-- OBSOLETE END -->
<link type="text/css" rel="stylesheet" href="wro/midpoint-theme.css"/>
</head>
<body class="custom-hold-transition hold-transition skin-blue-light">

<body wicket:id="body" class="">
<div wicket:id="mainPopup"/>
<div class="wrapper">
<header wicket:id="mainHeader" class="main-header">
Expand Down
Expand Up @@ -51,9 +51,11 @@
import org.apache.wicket.feedback.FeedbackMessage;
import org.apache.wicket.feedback.FeedbackMessages;
import org.apache.wicket.injection.Injector;
import org.apache.wicket.markup.head.CssHeaderItem;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.JavaScriptHeaderItem;
import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
import org.apache.wicket.markup.html.TransparentWebMarkupContainer;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
Expand All @@ -65,6 +67,7 @@
import org.apache.wicket.model.StringResourceModel;
import org.apache.wicket.protocol.http.WebSession;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.request.resource.CssResourceReference;
import org.apache.wicket.resource.CoreLibrariesContributor;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.apache.wicket.util.string.StringValue;
Expand Down Expand Up @@ -199,6 +202,9 @@ public abstract class PageBase extends WebPage implements ModelServiceLocator {
private static final String ID_CUSTOM_LOGO_IMG_CSS = "customLogoImgCss";
private static final String ID_NAVIGATION = "navigation";
private static final String ID_DEPLOYMENT_NAME = "deploymentName";
private static final String ID_BODY = "body";

private static final String CLASS_DEFAULT_SKIN = "skin-blue-light";

private static final String OPERATION_GET_SYSTEM_CONFIG = DOT_CLASS + "getSystemConfiguration";
private static final String OPERATION_GET_DEPLOYMENT_INFORMATION = DOT_CLASS + "getDeploymentInformation";
Expand Down Expand Up @@ -560,8 +566,20 @@ public MidpointConfiguration getMidpointConfiguration() {

@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
super.renderHead(response);

String skinCssString = CLASS_DEFAULT_SKIN;
if (deploymentInfoModel != null && deploymentInfoModel.getObject() != null &&
StringUtils.isNotEmpty(deploymentInfoModel.getObject().getSkin())) {
skinCssString = deploymentInfoModel.getObject().getSkin();
}

String skinCssPath = String.format("../../../../../../webjars/adminlte/2.3.11/dist/css/skins/%s.min.css", skinCssString);
response.render(CssHeaderItem.forReference(
new CssResourceReference(
PageBase.class, skinCssPath)
)
);
// this attaches jquery.js as first header item, which is used in our
// scripts.
CoreLibrariesContributor.contribute(getApplication(), response);
Expand Down Expand Up @@ -682,6 +700,19 @@ public boolean isVisible() {
}

private void initLayout() {
TransparentWebMarkupContainer body = new TransparentWebMarkupContainer(ID_BODY);
body.add(new AttributeAppender("class", "hold-transition ", " "));
body.add(new AttributeAppender("class", "custom-hold-transition ", " "));

if (deploymentInfoModel != null && deploymentInfoModel.getObject() != null &&
StringUtils.isNotEmpty(deploymentInfoModel.getObject().getSkin())) {

body.add(new AttributeAppender("class", deploymentInfoModel.getObject().getSkin(), " "));
} else {
body.add(new AttributeAppender("class", CLASS_DEFAULT_SKIN, " "));
}
add(body);

WebMarkupContainer mainHeader = new WebMarkupContainer(ID_MAIN_HEADER);
mainHeader.setOutputMarkupId(true);
add(mainHeader);
Expand Down Expand Up @@ -724,7 +755,10 @@ public boolean isVisible(){
WebMarkupContainer navigation = new WebMarkupContainer(ID_NAVIGATION);
mainHeader.add(navigation);

WebMarkupContainer customLogoImgSrc = new WebMarkupContainer(ID_CUSTOM_LOGO_IMG_SRC);



WebMarkupContainer customLogoImgSrc = new WebMarkupContainer(ID_CUSTOM_LOGO_IMG_SRC);
WebMarkupContainer customLogoImgCss = new WebMarkupContainer(ID_CUSTOM_LOGO_IMG_CSS);
if (deploymentInfoModel != null && deploymentInfoModel.getObject() != null &&
deploymentInfoModel.getObject().getLogo() != null){
Expand Down Expand Up @@ -1537,23 +1571,23 @@ private int getSelectedTabForConfiguration(WebPage page) {
}

private void createSelfServiceMenu(SideBarMenuItem menu) {
MainMenuItem item = new MainMenuItem("fa fa-dashboard", createStringResource("PageAdmin.menu.selfDashboard"),
MainMenuItem item = new MainMenuItem(GuiStyleConstants.CLASS_ICON_DASHBOARD, createStringResource("PageAdmin.menu.selfDashboard"),
PageSelfDashboard.class);
menu.getItems().add(item);
item = new MainMenuItem("fa fa-user", createStringResource("PageAdmin.menu.profile"), PageSelfProfile.class);
item = new MainMenuItem(GuiStyleConstants.CLASS_ICON_PROFILE, createStringResource("PageAdmin.menu.profile"), PageSelfProfile.class);
menu.getItems().add(item);
// PageSelfAssignments is not implemented yet
// item = new MainMenuItem("fa fa-star",
// createStringResource("PageAdmin.menu.assignments"),
// PageSelfAssignments.class);
// menu.getItems().add(item);
item = new MainMenuItem("fa fa-shield", createStringResource("PageAdmin.menu.credentials"),
item = new MainMenuItem(GuiStyleConstants.CLASS_ICON_CREDENTIALS, createStringResource("PageAdmin.menu.credentials"),
PageSelfCredentials.class);
menu.getItems().add(item);
item = new MainMenuItem("fa fa-pencil-square-o", createStringResource("PageAdmin.menu.request"),
item = new MainMenuItem(GuiStyleConstants.CLASS_ICON_REQUEST, createStringResource("PageAdmin.menu.request"),
PageAssignmentShoppingKart.class);
menu.getItems().add(item);
item = new MainMenuItem("fa fa-eur", createStringResource("PageAdmin.menu.consent"),
item = new MainMenuItem(GuiStyleConstants.CLASS_ICON_CONSENT, createStringResource("PageAdmin.menu.consent"),
PageSelfConsents.class);
menu.getItems().add(item);
}
Expand Down
Expand Up @@ -71,8 +71,8 @@ public class AbstractRoleAssignmentPanel extends AssignmentPanel {
private static final String ID_SHOW_ALL_ASSIGNMENTS_BUTTON = "showAllAssignmentsButton";


public AbstractRoleAssignmentPanel(String id, IModel<List<AssignmentDto>> assignmentsModel, PageBase pageBase){
super(id, assignmentsModel, pageBase);
public AbstractRoleAssignmentPanel(String id, IModel<List<AssignmentDto>> assignmentsModel){
super(id, assignmentsModel);
}

protected void initCustomLayout(WebMarkupContainer assignmentsContainer){
Expand Down
@@ -1,3 +1,18 @@
/*
* Copyright (c) 2010-2017 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 java.util.ArrayList;
Expand All @@ -18,6 +33,7 @@
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.util.tester.WicketTester;

import com.evolveum.midpoint.gui.api.GuiStyleConstants;
import com.evolveum.midpoint.gui.api.component.BasePanel;
Expand Down Expand Up @@ -66,18 +82,25 @@ public abstract class AssignmentPanel extends BasePanel<List<AssignmentDto>> {

protected boolean assignmentDetailsVisible;

private PageBase pageBase;
// private PageBase pageBase;

public AssignmentPanel(String id, IModel<List<AssignmentDto>> assignmentsModel, PageBase pageBase) {
public AssignmentPanel(String id, IModel<List<AssignmentDto>> assignmentsModel) {
super(id, assignmentsModel);
this.pageBase = pageBase;
initPaging();
initLayout();

// this.pageBase = pageBase;
// initPaging();
// initLayout();
}

protected abstract void initPaging();

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

private void initLayout() {

initListPanel();
Expand Down Expand Up @@ -150,7 +173,7 @@ public ObjectQuery getQuery() {

List<IColumn<AssignmentDto, String>> columns = initBasicColumns();
if (WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_ADMIN_UNASSIGN_ACTION_URI)) {
columns.add(new InlineMenuButtonColumn<AssignmentDto>(getAssignmentMenuActions(), 2, getParentPage()));
columns.add(new InlineMenuButtonColumn<AssignmentDto>(getAssignmentMenuActions(), 2, getPageBase()));
}

BoxedTablePanel<AssignmentDto> assignmentTable = new BoxedTablePanel<AssignmentDto>(ID_ASSIGNMENTS_TABLE,
Expand All @@ -159,7 +182,7 @@ assignmentsProvider, columns, getTableId(), getItemsPerPage()) {

@Override
public int getItemsPerPage() {
return pageBase.getSessionStorage().getUserProfile().getTables()
return getPageBase().getSessionStorage().getUserProfile().getTables()
.get(UserProfileStorage.TableId.ASSIGNMENTS_TAB_TABLE);
}

Expand All @@ -177,7 +200,7 @@ protected Item<AssignmentDto> customizeNewRowItem(Item<AssignmentDto> item, IMod
}

protected AssignmentsTabStorage getAssignmentsStorage() {
return pageBase.getSessionStorage().getAssignmentsTabStorage();
return getPageBase().getSessionStorage().getAssignmentsTabStorage();
}

protected abstract ObjectQuery createObjectQuery();
Expand Down Expand Up @@ -436,11 +459,11 @@ protected void assignmentDetailsPerformed(AjaxRequestTarget target, List<Assignm

protected void updateAssignmnetActivation(AjaxRequestTarget target, IModel<AssignmentDto> rowModel) {
AssignmentActivationPopupablePanel activationPanel = new AssignmentActivationPopupablePanel(
getParentPage().getMainPopupBodyId(),
getPageBase().getMainPopupBodyId(),
new PropertyModel<>(rowModel, AssignmentDto.F_VALUE + "." + AssignmentType.F_ACTIVATION.getLocalPart()));
activationPanel.setOutputMarkupId(true);

getParentPage().showMainPopup(activationPanel, target);
getPageBase().showMainPopup(activationPanel, target);
}

protected abstract TableId getTableId();
Expand All @@ -460,7 +483,8 @@ protected WebMarkupContainer getAssignmentContainer() {
return (WebMarkupContainer) get(ID_ASSIGNMENTS);
}

public PageBase getParentPage() {
return pageBase;
protected PageBase getParentPage() {
return getPageBase();
}

}

0 comments on commit a9ce84f

Please sign in to comment.