Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Mar 25, 2020
2 parents 1ff58a4 + 7d13d2f commit 8acc8a6
Show file tree
Hide file tree
Showing 10 changed files with 143 additions and 43 deletions.
Expand Up @@ -218,6 +218,8 @@ public class GuiStyleConstants {
public static final String CLASS_ICON_TEXT = "fa fa-text-width";

public static final String CLASS_ICON_TRASH = "fa fa-trash-o";
public static final String CLASS_ICON_PERFORMANCE = "fa fa-area-chart";
public static final String CLASS_ICON_TASK_RESULTS = "fa fa-list-alt";


}
@@ -0,0 +1,56 @@
/*
* Copyright (c) 2010-2019 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.web.boot;

import org.apache.commons.lang3.StringUtils;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
* @author skublik
*/

@Component
@Order(Ordered.HIGHEST_PRECEDENCE)
public class TrailingSlashRedirectingFilter extends OncePerRequestFilter {

@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
String pathWithoutContextPath;
String uri = request.getRequestURI();
if (StringUtils.isNotBlank(request.getContextPath()) && uri.startsWith(request.getContextPath())) {
if (uri.length() == request.getContextPath().length()) {
pathWithoutContextPath = "";
} else {
pathWithoutContextPath = uri.substring(request.getContextPath().length());
}
} else {
pathWithoutContextPath = uri;
}
if (StringUtils.isNotBlank(pathWithoutContextPath) && !pathWithoutContextPath.equals("/") && pathWithoutContextPath.endsWith("/")) {
ServletUriComponentsBuilder builder =
ServletUriComponentsBuilder.fromRequest(request);
builder.replacePath(builder.build().getPath().replaceFirst(".$",""));
response.setStatus(HttpStatus.MOVED_PERMANENTLY.value());
response.setHeader(HttpHeaders.LOCATION,
builder.toUriString());
} else {
filterChain.doFilter(request, response);
}
}
}
Expand Up @@ -4,6 +4,11 @@
import java.util.Collection;
import java.util.Collections;

import com.evolveum.midpoint.gui.impl.component.AjaxCompositedIconButton;
import com.evolveum.midpoint.gui.impl.component.data.column.CompositedIconPanel;
import com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon;
import com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder;
import com.evolveum.midpoint.gui.impl.component.icon.IconCssStyle;
import com.evolveum.midpoint.gui.impl.prism.PrismPropertyValueWrapper;
import com.evolveum.midpoint.gui.impl.prism.PrismReferenceValueWrapperImpl;
import com.evolveum.midpoint.gui.impl.prism.PrismReferenceWrapper;
Expand Down Expand Up @@ -137,8 +142,6 @@ protected Collection<SelectorOptions<GetOperationOptions>> buildGetOptions() {
}

protected void initOperationalButtons(RepeatingView repeatingView) {
super.initOperationalButtons(repeatingView);

createSuspendButton(repeatingView);
createResumeButton(repeatingView);
createRunNowButton(repeatingView);
Expand Down Expand Up @@ -346,7 +349,7 @@ public void onClick(AjaxRequestTarget target) {
}

private void createCleanupPerformanceButton(RepeatingView repeatingView) {
AjaxIconButton cleanupPerformance = new AjaxIconButton(repeatingView.newChildId(), new Model<>(GuiStyleConstants.CLASS_ICON_TRASH),
AjaxCompositedIconButton cleanupPerformance = new AjaxCompositedIconButton(repeatingView.newChildId(), getTaskCleanupCompositedIcon(GuiStyleConstants.CLASS_ICON_PERFORMANCE),
createStringResource("operationalButtonsPanel.cleanupEnvironmentalPerformance")) {

@Override
Expand All @@ -366,7 +369,7 @@ public void onClick(AjaxRequestTarget target) {
}

private void createCleanupResultsButton(RepeatingView repeatingView) {
AjaxIconButton cleanupResults = new AjaxIconButton(repeatingView.newChildId(), new Model<>(GuiStyleConstants.CLASS_ICON_TRASH),
AjaxCompositedIconButton cleanupResults = new AjaxCompositedIconButton(repeatingView.newChildId(), getTaskCleanupCompositedIcon(GuiStyleConstants.CLASS_ICON_TASK_RESULTS),
createStringResource("operationalButtonsPanel.cleanupResults")) {

@Override
Expand Down Expand Up @@ -418,6 +421,15 @@ private void saveTaskChanges(AjaxRequestTarget target, ObjectDelta<TaskType> tas
afterOperation(target, result);
}

private CompositedIcon getTaskCleanupCompositedIcon(String basicIconClass){
CompositedIconBuilder iconBuilder = new CompositedIconBuilder();
CompositedIcon icon = iconBuilder
.setBasicIcon(basicIconClass, IconCssStyle.IN_ROW_STYLE)
.appendLayerIcon(WebComponentUtil.createIconType(GuiStyleConstants.CLASS_ICON_TRASH), IconCssStyle.BOTTOM_RIGHT_STYLE)
.build();
return icon;
}

private void afterOperation(AjaxRequestTarget target, OperationResult result) {
showResult(result);
getObjectModel().reset();
Expand Down
Expand Up @@ -131,7 +131,7 @@ public WebMarkupContainer createPanel(String panelId) {

@Override
public boolean isVisible(){
return super.isVisible() && parentTaskPage.getTaskTabVisibilty().isWorkManagementVisible();
return super.isVisible() && parentTaskPage.getTaskTabVisibilty().isWorkManagementVisible(getTask());
}
};
tabs.add(new PanelTab(parentPage.createStringResource("pageTask.workManagement.title"), workManagementTabVisibility) {
Expand Down Expand Up @@ -174,7 +174,7 @@ public WebMarkupContainer createPanel(String panelId) {

@Override
public boolean isVisible(){
return super.isVisible() && parentTaskPage.getTaskTabVisibilty().isSubtasksAndThreadsVisible();
return super.isVisible() && parentTaskPage.getTaskTabVisibilty().isSubtasksAndThreadsVisible(getTask());
}
};
tabs.add(new PanelTab(parentPage.createStringResource("pageTask.subtasks.title"), subtasksTabVisibility) {
Expand Down
Expand Up @@ -28,6 +28,7 @@
import org.apache.commons.lang.StringUtils;

import java.io.Serializable;
import java.util.List;

/**
* Used to determine whether tabs have to be refreshed - by comparing instances of this class before and after task update.
Expand Down Expand Up @@ -78,25 +79,21 @@ public boolean computeCleanupPolicyVisible(){
return cleanupPolicyVisible;
}

public boolean computeSubtasksAndThreadsVisible(PageTask parentPage, PrismObjectWrapper<TaskType> taskWrapper) {
public boolean computeSubtasksAndThreadsVisible(TaskType task) {

PrismReference subtasks = taskWrapper.getObject().findReference(TaskType.F_SUBTASK_REF);
if (subtasks == null) {
return subtasksAndThreadsVisible = false;
}
if (CollectionUtils.isEmpty(subtasks.getValues())) {
List<ObjectReferenceType> subtasks = task.getSubtaskRef();
if (CollectionUtils.isEmpty(subtasks)) {
return subtasksAndThreadsVisible = false;
}

boolean allEmpty = true;
for (PrismReferenceValue val : subtasks.getValues()) {
if (!val.isEmpty()) {
for (ObjectReferenceType subtask : subtasks) {
if (!subtask.asReferenceValue().isEmpty()){
allEmpty = false;
break;
}
}

return subtasksAndThreadsVisible = allEmpty;
return subtasksAndThreadsVisible = !allEmpty;



Expand Down Expand Up @@ -164,7 +161,7 @@ public void computeAll(PageTask parentPage, PrismObjectWrapper<TaskType> taskWra
computeSchedulingVisible(parentPage, taskType);
computeWorkManagementVisible(taskType);
computeCleanupPolicyVisible();
computeSubtasksAndThreadsVisible(parentPage, taskWrapper);
computeSubtasksAndThreadsVisible(taskType);
computeProgressVisible(parentPage);
computeEnvironmentalPerformanceVisible(parentPage, taskWrapper);
computeInternalPerformanceVisible(parentPage, taskWrapper);
Expand Down Expand Up @@ -214,15 +211,17 @@ public boolean isSchedulingVisible() {
return schedulingVisible;
}

public boolean isWorkManagementVisible() {
public boolean isWorkManagementVisible(TaskType task) {
workManagementVisible = computeWorkManagementVisible(task);
return workManagementVisible;
}

public boolean isCleanupPolicyVisible() {
return cleanupPolicyVisible;
}

public boolean isSubtasksAndThreadsVisible() {
public boolean isSubtasksAndThreadsVisible(TaskType task) {
subtasksAndThreadsVisible = computeSubtasksAndThreadsVisible(task);
return subtasksAndThreadsVisible;
}

Expand Down
Expand Up @@ -16,8 +16,6 @@
import org.apache.wicket.request.mapper.parameter.IPageParametersEncoder;
import org.apache.wicket.request.mapper.parameter.PageParametersEncoder;

import java.util.List;

/**
* Created by lazyman on 09/03/2017.
*/
Expand All @@ -43,10 +41,6 @@ protected boolean urlStartsWithMountedSegments(Url url) {
if (url == null) {
return false;
}
int segmentsSize = url.getSegments().size();
if (segmentsSize != 0 && StringUtils.isBlank(url.getSegments().get(segmentsSize-1))) {
url.getSegments().remove(segmentsSize-1);
}

if (!(pageParametersEncoder instanceof PageParametersEncoder)) {
LOG.trace("Matching using standard mounted mapper for '{}'", url);
Expand Down
Expand Up @@ -287,6 +287,10 @@ public String toString() {

@Override
public String toHumanReadableDescription() {
return toHumanReadableDescription(true);
}

public String toHumanReadableDescription(boolean writeOid) {
StringBuilder sb = new StringBuilder("RSD(");
sb.append(kind==null?"null":kind.value());
sb.append(" (").append(intent);
Expand All @@ -297,8 +301,10 @@ public String toHumanReadableDescription() {
if (objectClass != null) {
sb.append(": ").append(PrettyPrinter.prettyPrint(objectClass));
}
sb.append(" @");
sb.append(resourceOid);
if (writeOid) {
sb.append(" @");
sb.append(resourceOid);
}
if (order != 0) {
sb.append(" order=");
sb.append(order);
Expand Down
Expand Up @@ -2592,12 +2592,13 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="ownerRef" type="tns:ObjectReferenceType">
<xsd:element name="ownerRef" type="tns:ObjectReferenceType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
The user that owns this task. It usually means the user that started the task
or a system user that is used to execute the task. The owner will be used to
determine access rights of the task, will be used for auditing, etc.
determine access rights of the task, will be used for auditing, etc. If owner
isn't set, currently logged in user is used.
</xsd:documentation>
<xsd:appinfo>
<a:objectReferenceTargetType>tns:UserType</a:objectReferenceTargetType>
Expand Down Expand Up @@ -2647,7 +2648,7 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="executionStatus" type="tns:TaskExecutionStatusType">
<xsd:element name="executionStatus" type="tns:TaskExecutionStatusType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Execution status provides information about the task overall high-level execution state.
Expand Down Expand Up @@ -2888,11 +2889,12 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="recurrence" type="tns:TaskRecurrenceType">
<xsd:element name="recurrence" type="tns:TaskRecurrenceType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Whether the task activity is to be executed only once (single-run tasks)
or periodically (recurring tasks).
or periodically (recurring tasks). If nothing set explicitly, single-run
task is created.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
Expand Down
Expand Up @@ -26,6 +26,9 @@
<xsd:import namespace="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
schemaLocation="http://midpoint.evolveum.com/xml/ns/public/common/common-3"/>

<xsd:import namespace="http://midpoint.evolveum.com/xml/ns/public/model/scripting/extension-3"
schemaLocation="http://midpoint.evolveum.com/xml/ns/public/model/scripting/extension-3"/>

<xsd:import namespace="http://prism.evolveum.com/xml/ns/public/query-3"
schemaLocation="http://prism.evolveum.com/xml/ns/public/query-3">
<xsd:annotation>
Expand All @@ -35,9 +38,6 @@
</xsd:annotation>
</xsd:import>

<xsd:import namespace="http://midpoint.evolveum.com/xml/ns/public/model/scripting/extension-3"
schemaLocation="http://midpoint.evolveum.com/xml/ns/public/model/scripting/extension-3"/>

<xsd:import namespace="http://prism.evolveum.com/xml/ns/public/types-3"
schemaLocation="http://prism.evolveum.com/xml/ns/public/types-3">
<xsd:annotation>
Expand Down Expand Up @@ -94,7 +94,7 @@
<xsd:element name="freshnessInterval" type="xsd:long">
<xsd:annotation>
<xsd:documentation>
Interval in which the shadow will be considered fresh. It is conted from the last synchronization
Interval in which the shadow will be considered fresh. It is counted from the last synchronization
of the shadow (any kind of synchronization). It is in milliseconds.
If no value is specified then a default value will be used.
If a negative value is specified then the shadow will never be considered fresh and it will be
Expand Down

0 comments on commit 8acc8a6

Please sign in to comment.