Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	gui/admin-gui/src/main/resources/localization/Midpoint.properties
  • Loading branch information
mederly committed Apr 14, 2016
2 parents 33936bf + d9e92ff commit d41a4ab
Show file tree
Hide file tree
Showing 17 changed files with 862 additions and 152 deletions.
Expand Up @@ -56,6 +56,7 @@ public class GuiStyleConstants {

public static final String CLASS_ICON_STYLE_NORMAL = "icon-style-normal";
public static final String CLASS_ICON_STYLE_DISABLED = "icon-style-disabled";
public static final String CLASS_ICON_STYLE_ARCHIVED = "icon-style-archived";
public static final String CLASS_ICON_STYLE_PRIVILEGED = "icon-style-privileged";
public static final String CLASS_ICON_STYLE_WARNING = "icon-style-warning";
public static final String CLASS_ICON_STYLE_UP = "icon-style-up";
Expand Down
Expand Up @@ -17,12 +17,14 @@
<wicket:panel xmlns:wicket="http://wicket.apache.org">

<div class="form-inline search-form">
<div class="row">
<div class="form-group col-md-12">
<label><wicket:message key="roleMemberPanel.type" /></label>
<select class="form-control input-sm" wicket:id="type" />
</div>
</div>
<div class="row">
<div class="form-group col-md-12">
<label>
<wicket:message key="roleMemberPanel.type"/>
</label>
<select class="form-control input-sm" wicket:id="type"/>
</div>
</div>
<div wicket:id="countContainer">
<div class="form-group col-md-3">
<label><wicket:message key="typedAssignablePanel.selectedResources" /></label>
Expand Down
Expand Up @@ -768,8 +768,12 @@ public static String createServiceIcon(PrismObject<ServiceType> object) {

private static <F extends FocusType> String getIconEnabledDisabled(PrismObject<F> object, String baseIcon) {
ActivationType activation = object.asObjectable().getActivation();
if (activation != null && ActivationStatusType.DISABLED.equals(activation.getEffectiveStatus())) {
return baseIcon + " " + GuiStyleConstants.CLASS_ICON_STYLE_DISABLED;
if (activation != null) {
if (ActivationStatusType.DISABLED.equals(activation.getEffectiveStatus())) {
return baseIcon + " " + GuiStyleConstants.CLASS_ICON_STYLE_DISABLED;
} else if (ActivationStatusType.ARCHIVED.equals(activation.getEffectiveStatus())) {
return baseIcon + " " + GuiStyleConstants.CLASS_ICON_STYLE_ARCHIVED;
}
}

return baseIcon + " " + GuiStyleConstants.CLASS_ICON_STYLE_NORMAL;
Expand Down
@@ -0,0 +1,28 @@
<!--
~ 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.
-->
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div class="row">
<div class="col-md-12">
<div wicket:id="container">
<div class="col-md-11" wicket:id="label"></div>
<div class="col-md-1 btn btn-primary btn-xs" wicket:id="button"></div>
</div>
</div>
</div>
</wicket:panel>
</html>
@@ -0,0 +1,117 @@
package com.evolveum.midpoint.web.component;

import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.xml.ns._public.common.common_3.LockoutStatusType;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;

/**
* Created by Kate on 12.04.2016.
*/
public class LockoutStatusPanel extends Panel {
private static final String ID_CONTAINER = "container";
private static final String ID_LABEL = "label";
private static final String ID_BUTTON = "button";
private static final String BUTTON_UNDO_LABEL = "Undo";
private static final String BUTTON_UNLOCK_LABEL = "Unlock";
private boolean isInitialState = true;
private boolean isUndo = false;

public LockoutStatusPanel(String id){
this(id, null);
}

public LockoutStatusPanel(String id, IModel<LockoutStatusType> model){
super(id);
LockoutStatusType l = model.getObject();
isUndo = l != null && model.getObject().value() != null &&
model.getObject().equals(LockoutStatusType.LOCKED);
initLayout(model);
}

private void initLayout(final IModel<LockoutStatusType> model){
WebMarkupContainer container = new WebMarkupContainer(ID_CONTAINER);
add(container);

Label label = new Label(ID_LABEL, new IModel<String>() {
@Override
public String getObject() {
LockoutStatusType object = model != null ? model.getObject() : null;

return object == null ?
((PageBase)getPage()).createStringResource("LockoutStatusType.UNDEFINED").getString()
: WebComponentUtil.createLocalizedModelForEnum(object, getLabel()).getObject();
}

@Override
public void setObject(String s) {
}

@Override
public void detach() {

}
});
label.setOutputMarkupId(true);
container.add(label);

AjaxButton button = new AjaxButton(ID_BUTTON, getButtonModel()) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
if (!isInitialState){
model.setObject(LockoutStatusType.LOCKED);
} else {
model.setObject(LockoutStatusType.NORMAL);
}
isInitialState = !isInitialState;
ajaxRequestTarget.add(getButton());
ajaxRequestTarget.add(getLabel());
}
};
button.add(new VisibleEnableBehaviour(){
@Override
public boolean isVisible(){
return isUndo;
}
});
button.setOutputMarkupId(true);
container.add(button);
}

private IModel<String> getButtonModel(){
return new IModel<String>() {
@Override
public String getObject() {
if (isInitialState){
return BUTTON_UNLOCK_LABEL;
} else {
return BUTTON_UNDO_LABEL;
}
}

@Override
public void setObject(String s) {

}

@Override
public void detach() {

}
};
}

private Component getButton(){
return get(ID_CONTAINER).get(ID_BUTTON);
}

private Component getLabel(){
return get(ID_CONTAINER).get(ID_LABEL);
}
}
Expand Up @@ -20,6 +20,7 @@
import java.util.ArrayList;
import java.util.List;

import com.evolveum.midpoint.web.page.self.PageSelfProfile;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.Validate;
import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
Expand Down Expand Up @@ -184,13 +185,15 @@ public WebMarkupContainer getPanel(String panelId) {
return createFocusAssignmentsTabPanel(panelId, parentPage);
}
});
tabs.add(
new AbstractTab(parentPage.createStringResource("pageAdminFocus.request")){
@Override
public WebMarkupContainer getPanel(String panelId) {
return createRequestAssignmentTabPanel(panelId, parentPage);
}
});
if (!(parentPage instanceof PageSelfProfile)) {
tabs.add(
new AbstractTab(parentPage.createStringResource("pageAdminFocus.request")) {
@Override
public WebMarkupContainer getPanel(String panelId) {
return createRequestAssignmentTabPanel(panelId, parentPage);
}
});
}
}

private IModel<String> getProjectionsTabTitleModel(final PageAdminObjectDetails<F> parentPage){
Expand Down
Expand Up @@ -43,6 +43,7 @@
import com.evolveum.midpoint.util.logging.LoggingUtils;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.LockoutStatusPanel;
import com.evolveum.midpoint.web.component.form.ValueChoosePanel;
import com.evolveum.midpoint.web.component.input.*;
import com.evolveum.midpoint.web.component.model.delta.DeltaDto;
Expand Down Expand Up @@ -434,7 +435,7 @@ private Panel createTypedInputComponent(String id) {
if (ActivationType.F_ADMINISTRATIVE_STATUS.equals(definition.getName())) {
return WebComponentUtil.createEnumPanel(ActivationStatusType.class, id, new PropertyModel<ActivationStatusType>(model, baseExpression), this);
} else if(ActivationType.F_LOCKOUT_STATUS.equals(definition.getName())){
return WebComponentUtil.createEnumPanel(LockoutStatusType.class, id, new PropertyModel<LockoutStatusType>(model, baseExpression), this);
return new LockoutStatusPanel(id, new PropertyModel<LockoutStatusType>(model, baseExpression));
} else {
// nothing to do
}
Expand Down
Expand Up @@ -233,21 +233,30 @@ private void initInfoBoxes() {

private <F extends FocusType> InfoBoxPanel createFocusInfoBoxPanel(String id, Class<F> type, String bgColor, String icon, String keyPrefix, OperationResult result, Task task) {
InfoBoxType infoBoxType = new InfoBoxType(bgColor, icon, getString(keyPrefix + ".label"));
Integer totalCount;
Integer allCount;
try {
totalCount = getModelService().countObjects(type, null, null, task, result);
if (totalCount == null) {
totalCount = 0;
allCount = getModelService().countObjects(type, null, null, task, result);
if (allCount == null) {
allCount = 0;
}

EqualFilter<ActivationStatusType> filter = EqualFilter.createEqual(SchemaConstants.PATH_ACTIVATION_EFFECTIVE_STATUS,
type, getPrismContext(), ActivationStatusType.ENABLED);
ObjectQuery query = ObjectQuery.createObjectQuery(filter);
Integer activeCount = getModelService().countObjects(type, query, null, task, result);
if (activeCount == null) {
activeCount = 0;
EqualFilter<ActivationStatusType> filterDisabled = EqualFilter.createEqual(SchemaConstants.PATH_ACTIVATION_EFFECTIVE_STATUS,
type, getPrismContext(), ActivationStatusType.DISABLED);
Integer disabledCount = getModelService().countObjects(type, ObjectQuery.createObjectQuery(filterDisabled), null, task, result);
if (disabledCount == null) {
disabledCount = 0;
}

EqualFilter<ActivationStatusType> filterArchived = EqualFilter.createEqual(SchemaConstants.PATH_ACTIVATION_EFFECTIVE_STATUS,
type, getPrismContext(), ActivationStatusType.ARCHIVED);
Integer archivedCount = getModelService().countObjects(type, ObjectQuery.createObjectQuery(filterArchived), null, task, result);
if (archivedCount == null) {
archivedCount = 0;
}

int activeCount = allCount - disabledCount - archivedCount;
int totalCount = allCount - archivedCount;

infoBoxType.setNumber(activeCount + " " + getString(keyPrefix + ".number"));

int progress = 0;
Expand All @@ -256,7 +265,12 @@ private <F extends FocusType> InfoBoxPanel createFocusInfoBoxPanel(String id, Cl
}
infoBoxType.setProgress(progress);

infoBoxType.setDescription(totalCount + " " + getString(keyPrefix + ".total"));
StringBuilder descSb = new StringBuilder();
descSb.append(totalCount).append(" ").append(getString(keyPrefix + ".total"));
if (archivedCount != 0) {
descSb.append(" ( + ").append(archivedCount).append(" ").append(getString(keyPrefix + ".archived")).append(")");
}
infoBoxType.setDescription(descSb.toString());

} catch (Exception e) {
infoBoxType.setNumber("ERROR: "+e.getMessage());
Expand Down
Expand Up @@ -470,6 +470,7 @@ LimitationsEditorDialog.label.read=Read
LimitationsEditorDialog.label.schema=Schema
LockoutStatusType.LOCKED=Locked
LockoutStatusType.NORMAL=Normal
LockoutStatusType.UNDEFINED=Undefined
logger.duplicate=Logger with name '{0}' is already defined
logger.emptyLogger=Logger must not be empty
LoggingComponentType.ALL=All
Expand Down Expand Up @@ -1520,17 +1521,21 @@ PageDashboard.title=Dashboard
PageDashboard.usedRam=Used RAM
PageDashboard.workItems=My work items
PageDashboard.infobox.users.label=Users
PageDashboard.infobox.users.number=active
PageDashboard.infobox.users.number=enabled
PageDashboard.infobox.users.total=total
PageDashboard.infobox.users.archived=archived
PageDashboard.infobox.orgs.label=Organizational units
PageDashboard.infobox.orgs.number=active
PageDashboard.infobox.orgs.number=enabled
PageDashboard.infobox.orgs.total=total
PageDashboard.infobox.orgs.archived=archived
PageDashboard.infobox.roles.label=Roles
PageDashboard.infobox.roles.number=active
PageDashboard.infobox.roles.number=enabled
PageDashboard.infobox.roles.total=total
PageDashboard.infobox.roles.archived=archived
PageDashboard.infobox.services.label=Services
PageDashboard.infobox.services.number=active
PageDashboard.infobox.services.number=enabled
PageDashboard.infobox.services.total=total
PageDashboard.infobox.services.archived=archived
PageDashboard.infobox.resources.label=Resources
PageDashboard.infobox.resources.number=up
PageDashboard.infobox.resources.total=total
Expand Down
Expand Up @@ -471,6 +471,7 @@ LimitationsEditorDialog.label.read=Read
LimitationsEditorDialog.label.schema=Schema
LockoutStatusType.LOCKED=Locked
LockoutStatusType.NORMAL=Normal
LockoutStatusType.UNDEFINED=Undefined
logger.duplicate=Logger with name '{0}' is already defined
logger.emptyLogger=Logger must not be empty
LoggingComponentType.ALL=All
Expand Down
4 changes: 4 additions & 0 deletions gui/admin-gui/src/main/webapp/less/midpoint-theme.less
Expand Up @@ -149,6 +149,10 @@ th.cog, td.cog {
color: #909090;
}

.icon-style-archived {
color: #c0c0c0;
}

.icon-style-privileged {
color: #a94442;
}
Expand Down
Expand Up @@ -1212,6 +1212,9 @@ public String debugDump(int indent, boolean showTriples) {

sb.append("\n");
DebugUtil.debugDumpWithLabel(sb, getDebugDumpTitle("squeezed associations"), squeezedAssociations, indent + 1);

sb.append("\n");
DebugUtil.debugDumpWithLabel(sb, getDebugDumpTitle("squeezed auxiliary object classes"), squeezedAuxiliaryObjectClasses, indent + 1);

// This is just a debug thing
// sb.append("\n");
Expand Down

0 comments on commit d41a4ab

Please sign in to comment.