Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin'
- Loading branch information
Showing
86 changed files
with
1,972 additions
and
1,306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...dmin-gui/src/main/java/com/evolveum/midpoint/gui/api/component/PendingOperationPanel.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!-- | ||
~ Copyright (c) 2010-2018 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="operation"> | ||
<span class="label" wicket:id="label"><span wicket:id="text"/></span> | ||
</div> | ||
</wicket:panel> |
177 changes: 177 additions & 0 deletions
177
...dmin-gui/src/main/java/com/evolveum/midpoint/gui/api/component/PendingOperationPanel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
/* | ||
* Copyright (c) 2010-2018 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 com.evolveum.midpoint.gui.api.util.WebComponentUtil; | ||
import com.evolveum.midpoint.web.util.InfoTooltipBehavior; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultStatusType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.PendingOperationExecutionStatusType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.PendingOperationType; | ||
import org.apache.wicket.AttributeModifier; | ||
import org.apache.wicket.behavior.AttributeAppender; | ||
import org.apache.wicket.markup.html.WebMarkupContainer; | ||
import org.apache.wicket.markup.html.basic.Label; | ||
import org.apache.wicket.markup.html.list.ListItem; | ||
import org.apache.wicket.markup.html.list.ListView; | ||
import org.apache.wicket.model.AbstractReadOnlyModel; | ||
import org.apache.wicket.model.IModel; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Created by Viliam Repan (lazyman). | ||
*/ | ||
public class PendingOperationPanel extends BasePanel<List<PendingOperationType>> { | ||
|
||
private static final String ID_LABEL = "label"; | ||
private static final String ID_OPERATION = "operation"; | ||
private static final String ID_TEXT = "text"; | ||
|
||
public PendingOperationPanel(String id, IModel<List<PendingOperationType>> model) { | ||
super(id, model); | ||
} | ||
|
||
@Override | ||
protected void onInitialize() { | ||
super.onInitialize(); | ||
|
||
initLayout(); | ||
} | ||
|
||
private void initLayout() { | ||
ListView<PendingOperationType> operation = new ListView<PendingOperationType>(ID_OPERATION, getModel()) { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
@Override | ||
protected void populateItem(ListItem<PendingOperationType> item) { | ||
item.setRenderBodyOnly(true); | ||
|
||
WebMarkupContainer label = new WebMarkupContainer(ID_LABEL); | ||
item.add(label); | ||
|
||
Label text = new Label(ID_TEXT, createLabelText(item.getModel())); | ||
text.setRenderBodyOnly(true); | ||
label.add(text); | ||
|
||
label.add(AttributeAppender.append("class", createTextClass(item.getModel()))); | ||
|
||
label.add(AttributeModifier.replace("title", createTextTooltipModel(item.getModel()))); | ||
label.add(new InfoTooltipBehavior() { | ||
|
||
@Override | ||
public String getCssClass() { | ||
return null; | ||
} | ||
}); | ||
} | ||
}; | ||
add(operation); | ||
} | ||
|
||
private IModel<String> createTextClass(IModel<PendingOperationType> model) { | ||
return new AbstractReadOnlyModel<String>() { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
@Override | ||
public String getObject() { | ||
PendingOperationType op = model.getObject(); | ||
OperationResultStatusType rStatus = op.getResultStatus(); | ||
PendingOperationExecutionStatusType eStatus = op.getExecutionStatus(); | ||
|
||
if (rStatus != null && | ||
(rStatus == OperationResultStatusType.FATAL_ERROR || rStatus == OperationResultStatusType.PARTIAL_ERROR)) { | ||
return "label-danger"; | ||
} | ||
|
||
if (rStatus != null && | ||
(rStatus == OperationResultStatusType.UNKNOWN || rStatus == OperationResultStatusType.WARNING)) { | ||
return "label-warning"; | ||
} | ||
|
||
if ((rStatus != null && rStatus == OperationResultStatusType.SUCCESS) | ||
|| (eStatus != null && eStatus == PendingOperationExecutionStatusType.COMPLETED)) { | ||
return "label-success"; | ||
} | ||
|
||
if ((rStatus != null && | ||
(rStatus == OperationResultStatusType.IN_PROGRESS || rStatus == OperationResultStatusType.NOT_APPLICABLE || rStatus == OperationResultStatusType.HANDLED_ERROR))) { | ||
return "label-info"; | ||
} | ||
|
||
return "label-default"; | ||
} | ||
}; | ||
} | ||
|
||
private IModel<String> createTextTooltipModel(IModel<PendingOperationType> model) { | ||
return new AbstractReadOnlyModel<String>() { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
@Override | ||
public String getObject() { | ||
StringBuilder sb = new StringBuilder(); | ||
|
||
PendingOperationType op = model.getObject(); | ||
|
||
buildStringItem(sb, "PendingOperationPanel.resultStatus", op.getResultStatus()); | ||
buildStringItem(sb, "PendingOperationPanel.executionStatus", op.getExecutionStatus()); | ||
buildStringItem(sb, "PendingOperationPanel.attempt", op.getAttemptNumber()); | ||
buildStringItem(sb, "PendingOperationPanel.pendingOperationType", op.getType()); | ||
buildStringItem(sb, "PendingOperationPanel.lastAttemptTimestamp", WebComponentUtil.formatDate(op.getLastAttemptTimestamp())); | ||
buildStringItem(sb, "PendingOperationPanel.completionTimestamp", WebComponentUtil.formatDate(op.getCompletionTimestamp())); | ||
|
||
return sb.toString(); | ||
} | ||
}; | ||
} | ||
|
||
private void buildStringItem(StringBuilder sb, String key, Object obj) { | ||
if (obj == null) { | ||
return; | ||
} | ||
|
||
sb.append(getString(key)).append(" "); | ||
|
||
String value = obj instanceof Enum ? getString((Enum) obj) : obj.toString(); | ||
|
||
sb.append(value); | ||
sb.append('\n'); | ||
} | ||
|
||
private IModel<String> createLabelText(IModel<PendingOperationType> model) { | ||
return new AbstractReadOnlyModel<String>() { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
@Override | ||
public String getObject() { | ||
PendingOperationType op = model.getObject(); | ||
OperationResultStatusType rStatus = op.getResultStatus(); | ||
PendingOperationExecutionStatusType eStatus = op.getExecutionStatus(); | ||
|
||
if (rStatus == null) { | ||
return getString(eStatus); | ||
} | ||
|
||
return getString(rStatus); | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.