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/master'
- Loading branch information
Showing
33 changed files
with
1,503 additions
and
1,354 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
28 changes: 28 additions & 0 deletions
28
...com/evolveum/midpoint/web/page/admin/resources/component/TestConnectionMessagesPanel.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,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="box-body"> | ||
<diiv wicket:id="messagesPanel"> | ||
<div wicket:id="messages"/> | ||
|
||
</diiv> | ||
|
||
</div> | ||
</wicket:panel> | ||
</html> |
102 changes: 102 additions & 0 deletions
102
...com/evolveum/midpoint/web/page/admin/resources/component/TestConnectionMessagesPanel.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,102 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package com.evolveum.midpoint.web.page.admin.resources.component; | ||
|
||
import com.evolveum.midpoint.gui.api.component.BasePanel; | ||
import com.evolveum.midpoint.gui.api.component.result.OpResult; | ||
import com.evolveum.midpoint.gui.api.component.result.OperationResultPanel; | ||
import com.evolveum.midpoint.gui.api.page.PageBase; | ||
import com.evolveum.midpoint.gui.api.util.WebComponentUtil; | ||
import com.evolveum.midpoint.schema.result.OperationResult; | ||
import com.evolveum.midpoint.task.api.Task; | ||
import com.evolveum.midpoint.util.exception.*; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.apache.wicket.Page; | ||
import org.apache.wicket.markup.html.WebMarkupContainer; | ||
import org.apache.wicket.markup.repeater.RepeatingView; | ||
import org.apache.wicket.model.IModel; | ||
import org.apache.wicket.model.Model; | ||
import org.apache.wicket.model.util.ListModel; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Created by honchar. | ||
*/ | ||
public class TestConnectionMessagesPanel extends BasePanel { | ||
private static final String DOT_CLASS = TestConnectionMessagesPanel.class.getName() + "."; | ||
|
||
private static final String OPERATION_TEST_CONNECTION = DOT_CLASS + "testConnection"; | ||
|
||
private static final String ID_MESSAGES_PANEL = "messagesPanel"; | ||
private static final String ID_MESSAGES = "messages"; | ||
private PageBase parentPage; | ||
private ListModel<OpResult> model; | ||
|
||
public TestConnectionMessagesPanel(String id, String resourceOid, PageBase parentPage) { | ||
super(id); | ||
this.parentPage = parentPage; | ||
initResultsModel(resourceOid); | ||
initLayout(); | ||
} | ||
|
||
private void initResultsModel(String resourceOid) { | ||
OperationResult result = new OperationResult(OPERATION_TEST_CONNECTION); | ||
List<OpResult> resultsDto = new ArrayList<>(); | ||
if (StringUtils.isNotEmpty(resourceOid)) { | ||
try { | ||
Task task = parentPage.createSimpleTask(OPERATION_TEST_CONNECTION); | ||
result = parentPage.getModelService().testResource(resourceOid, task); | ||
resultsDto = WebComponentUtil.getTestConnectionResults(result, parentPage); | ||
} catch (ObjectNotFoundException e) { | ||
result.recordFatalError("Failed to test resource connection", e); | ||
} | ||
|
||
if (result.isSuccess()) { | ||
result.recomputeStatus(); | ||
} | ||
} | ||
model = new ListModel<OpResult>(resultsDto); | ||
} | ||
|
||
private void initLayout() { | ||
setOutputMarkupId(true); | ||
|
||
WebMarkupContainer messagesPanel = new WebMarkupContainer(ID_MESSAGES_PANEL); | ||
messagesPanel.setOutputMarkupId(true); | ||
add(messagesPanel); | ||
|
||
RepeatingView resultView = new RepeatingView(ID_MESSAGES); | ||
if (model.getObject() != null && model.getObject().size() > 0) { | ||
initResultsPanel(resultView, parentPage); | ||
} | ||
resultView.setOutputMarkupId(true); | ||
messagesPanel.add(resultView); | ||
} | ||
|
||
public void initResultsPanel(RepeatingView resultView, Page parentPage) { | ||
for (OpResult result : model.getObject()) { | ||
OperationResultPanel resultPanel = new OperationResultPanel(resultView.newChildId(), new Model<>(result), parentPage); | ||
resultPanel.setOutputMarkupId(true); | ||
resultView.add(resultPanel); | ||
} | ||
} | ||
|
||
|
||
} |
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.