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 Oct 6, 2020
2 parents ff4aca3 + da7f0cb commit d4b6df7
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 27 deletions.
Expand Up @@ -9,16 +9,22 @@
import com.evolveum.midpoint.gui.api.GuiStyleConstants;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.prism.PrismProperty;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.prism.xml.XmlTypeConverter;
import com.evolveum.midpoint.schema.util.ObjectTypeUtil;
import com.evolveum.midpoint.schema.util.TaskTypeUtil;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.ObjectSummaryPanel;
import com.evolveum.midpoint.web.component.refresh.AutoRefreshDto;
import com.evolveum.midpoint.web.component.refresh.Refreshable;
import com.evolveum.midpoint.web.component.util.SummaryTag;
import com.evolveum.midpoint.web.component.util.VisibleBehaviour;
import com.evolveum.midpoint.web.page.admin.server.dto.OperationResultStatusPresentationProperties;
import com.evolveum.midpoint.web.page.admin.server.dto.TaskDtoExecutionStatus;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultStatusType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SystemObjectsType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.TaskExecutionStatusType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType;
import org.apache.commons.lang3.time.DurationFormatUtils;
Expand Down Expand Up @@ -94,6 +100,23 @@ public String getLabel() {
}
};
summaryTagList.add(tagResult);

SummaryTag<TaskType> tagLiveSyncToken = new SummaryTag<TaskType>(ID_SUMMARY_TAG, getModel()) {
private static final long serialVersionUID = 1L;

@Override
protected void initialize(TaskType taskType) {
setIconCssClass(getLiveSyncTokenIcon());
setLabel(getLiveSyncToken(taskType));
// TODO setColor
}

};
tagLiveSyncToken.add(new VisibleBehaviour(() -> {
TaskType task = getModelObject();
return task != null && ObjectTypeUtil.hasArchetype(task, SystemObjectsType.ARCHETYPE_LIVE_SYNC_TASK.value());
}));
summaryTagList.add(tagLiveSyncToken);
return summaryTagList;
}

Expand Down Expand Up @@ -149,11 +172,6 @@ protected IModel<String> getTitleModel() {
return new IModel<String>() {
@Override
public String getObject() {
// TaskDto taskDto = getModelObject();
//TODO what to do with WF?
// if (taskDto.isWorkflow()) {
// return getString("TaskSummaryPanel.requestedBy", taskDto.getRequestedBy());
// } else {
TaskType taskType = getModelObject();

String rv;
Expand Down Expand Up @@ -181,7 +199,6 @@ public String getObject() {
rv += " " + getString("TaskSummaryPanel.progressIfStalled", WebComponentUtil.formatDate(new Date(stalledSince)));
}
return rv;
// }
}
};
}
Expand All @@ -191,10 +208,6 @@ protected IModel<String> getTitle2Model() {
return new IModel<String>() {
@Override
public String getObject() {
//TODO what to do with WF?
// if (parentPage.getTaskDto().isWorkflow()) {
// return getString("TaskSummaryPanel.requestedOn", getRequestedOn());
// } else {
TaskType taskType = getModelObject();
if (taskType.getOperationStats() != null && taskType.getOperationStats().getIterativeTaskInformation() != null &&
taskType.getOperationStats().getIterativeTaskInformation().getLastSuccessObjectName() != null) {
Expand All @@ -213,15 +226,6 @@ protected IModel<String> getTitle3Model() {
return new IModel<String>() {
@Override
public String getObject() {
//TODO what to do with WF?
// if (parentPage.getTaskDto().isWorkflow()) {
// String stageInfo = getStageInfo();
// if (stageInfo != null) {
// return getString("TaskSummaryPanel.stage", stageInfo);
// } else {
// return null;
// }
// }

TaskType taskType = getModelObject();
if (taskType == null) {
Expand Down Expand Up @@ -275,4 +279,24 @@ private String getTaskResultIcon(TaskType task) {
OperationResultStatusType resultStatus = task.getResultStatus();
return OperationResultStatusPresentationProperties.parseOperationalResultStatus(resultStatus).getIcon();
}

private String getLiveSyncTokenIcon() {
return "fa fa-hand-o-right";
}

private <T> String getLiveSyncToken(TaskType taskType) {
if (!ObjectTypeUtil.hasArchetype(taskType, SystemObjectsType.ARCHETYPE_LIVE_SYNC_TASK.value())) {
return null;
}
PrismProperty<T> tokenProperty = taskType.asPrismObject().findProperty(LivesyncTokenEditorPanel.PATH_TOKEN);
if (tokenProperty == null) {
return null;
}
T realValue = tokenProperty.getRealValue();
if (realValue == null) {
return null;
}

return realValue.toString();
}
}
Expand Up @@ -101,14 +101,6 @@
<c:path>extension/mext:updateLiveSyncTokenInDryRun</c:path>
</item>
</container>
<container>
<display>
<label>LiveSynchronizationTask.synchronizationState</label>
</display>
<item>
<c:path>extension/livesync:token</c:path>
</item>
</container>
</objectDetails>
</adminGuiConfiguration>
</archetypePolicy>
Expand Down

0 comments on commit d4b6df7

Please sign in to comment.