Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed May 5, 2016
1 parent b7c8aa3 commit 3a4dc09
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 74 deletions.
Expand Up @@ -25,9 +25,11 @@

/**
* @author Viliam Repan (lazyman)
* @author katkav
*/
public class MainPopupDialog extends ModalWindow {

private static final long serialVersionUID = 1L;

private static final String ID_MAIN_POPUP_BODY = "popupBody";

private boolean initialized;
Expand All @@ -44,16 +46,18 @@ public MainPopupDialog(String id) {
setWidthUnit("px");

setCloseButtonCallback(new ModalWindow.CloseButtonCallback() {
private static final long serialVersionUID = 1L;

@Override
@Override
public boolean onCloseButtonClicked(AjaxRequestTarget target) {
return true;
}
});

setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
private static final long serialVersionUID = 1L;

@Override
@Override
public void onClose(AjaxRequestTarget target) {
MainPopupDialog.this.close(target);
}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2015 Evolveum
* 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.
Expand Down Expand Up @@ -242,30 +242,11 @@ private void testConnectionPerformed(AjaxRequestTarget target) {
TestConnectionResultPanel testConnectionPanel = new TestConnectionResultPanel(page.getMainPopupBodyId(), new ListModel<OpResult>(resultDtoList));
testConnectionPanel.setOutputMarkupId(true);
page.showMainPopup(testConnectionPanel, new Model<String>("Test connection result"), target, 600, 400);
// page.setMainPopupContent(createConnectionResultTable(new ListModel<>(resultDtoList)));
// page.getMainPopup().setInitialHeight(400);
// page.getMainPopup().setInitialWidth(600);
// page.showMainPopup(target);

page.showResult(result, "Test connection failed", false);
target.add(page.getFeedbackPanel());
target.add(getForm());
}

// private TablePanel<TestConnectionResultDto> createConnectionResultTable(ListModel<TestConnectionResultDto> model) {
// ListDataProvider<TestConnectionResultDto> listprovider = new ListDataProvider<>(this,
// model);
// List<ColumnTypeDto> columns = Arrays.asList(new ColumnTypeDto<String>("Operation Name", "operationName", null),
// new ColumnTypeDto("Status", "status", null),
// new ColumnTypeDto<String>("Error Message", "errorMessage", null));
//
// TablePanel<TestConnectionResultDto> table =
// new TablePanel<>(getPageBase().getMainPopupBodyId(), listprovider, ColumnUtils.<TestConnectionResultDto>createColumns(columns));
// table.setOutputMarkupId(true);
// return table;
// }


@Override
public void applyState() {
saveChanges();
Expand Down
Expand Up @@ -96,14 +96,8 @@ public class PageResource extends PageAdminResources {

public static final String TABLE_TEST_CONNECTION_RESULT_ID = "testConņectionResults";

// private static final String FORM_DETAILS_OD = "details";

LoadableModel<PrismObject<ResourceType>> resourceModel;

private LoadableModel<CapabilitiesDto> capabilitiesModel;

// private ListModel testConnectionModel = new ListModel();

private String resourceOid;

public PageResource(PageParameters parameters) {
Expand Down Expand Up @@ -347,17 +341,15 @@ private void testConnectionPerformed(AjaxRequestTarget target) {
}

OperationResult result = new OperationResult(OPERATION_TEST_CONNECTION);
PrismObject<ResourceType> resource = null;
List<OpResult> resultsDto = new ArrayList<>();
// try {
try {
Task task = createSimpleTask(OPERATION_TEST_CONNECTION);

result = getModelService().testResource(dto.getOid(), task);

resultsDto = WebComponentUtil.getTestConnectionResults(result, this);

resource = getModelService().getObject(ResourceType.class, dto.getOid(), null, task, result);
getModelService().getObject(ResourceType.class, dto.getOid(), null, task, result);
} catch (ObjectNotFoundException | SchemaException | SecurityViolationException
| CommunicationException | ConfigurationException e) {
result.recordFatalError("Failed to test resource connection", e);
Expand All @@ -371,61 +363,30 @@ private void testConnectionPerformed(AjaxRequestTarget target) {
result.recomputeStatus();
}

// resourceModel.reset();
TestConnectionResultPanel testConnectionPanel = new TestConnectionResultPanel(getMainPopupBodyId(), new ListModel<OpResult>(resultsDto)) {

private static final long serialVersionUID = 1L;

@Override
protected void okPerformed(AjaxRequestTarget target) {
refreshStatus(target);
}
};
testConnectionPanel.setOutputMarkupId(true);
getMainPopup().setCloseButtonCallback(new ModalWindow.CloseButtonCallback() {
private static final long serialVersionUID = 1L;

@Override
@Override
public boolean onCloseButtonClicked(AjaxRequestTarget target) {
return false;
}
});

showMainPopup(testConnectionPanel, new Model<String>("Test connection result"), target, 800, 500);
// showMainPopup(createConnectionResultTable(resultsDto), new Model<String>("Test connection result"), target, 600, 400);
// ResourceSummaryPanel resourceSummaryPanel = (ResourceSummaryPanel) get(PANEL_RESOURCE_SUMMARY);
// resourceSummaryPanel.getModel().setObject(resource.asObjectable());
// target.add(resourceSummaryPanel);

// showResult(result, "Test connection failed");
// target.add(getFeedbackPanel());


}

private void refreshStatus(AjaxRequestTarget target) {
target.add(addOrReplace(createResourceSummaryPanel()));
target.add(addOrReplace(createTabsPanel()));
}

// private RepeatingView createConnectionResultTable(List<OpResult> testResults) {
//// ListDataProvider<TestConnectionResultDto> listprovider = new ListDataProvider<TestConnectionResultDto>(
//// this, model);
//// List<ColumnTypeDto> columns = Arrays.asList(
//// new ColumnTypeDto<String>("Operation Name", "operationName", null),
//// new ColumnTypeDto("Status", "status", null),
//// new ColumnTypeDto<String>("Error Message", "errorMessage", null));
////
//// TablePanel table = new TablePanel(getMainPopupBodyId(), listprovider,
//// ColumnUtils.createColumns(columns));
//// table.setOutputMarkupId(true);
//
// RepeatingView resultView = new RepeatingView(getMainPopupBodyId());
//
// for (OpResult result : testResults) {
// resultView.add(new OperationResultPanel(resultView.newChildId(), new Model<OpResult>(result)));
// }
//
// resultView.setOutputMarkupId(true);
//
// return resultView;
// }

}
Expand Up @@ -15,11 +15,6 @@
*/
package com.evolveum.midpoint.web.page.admin.resources;

import javax.xml.namespace.QName;

import com.evolveum.midpoint.web.component.AbstractSummaryPanel;
import org.apache.wicket.Component;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.IModel;

Expand Down
@@ -1,3 +1,18 @@
/*
* Copyright (c) 2010-2015 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 java.util.List;
Expand All @@ -12,15 +27,18 @@
import com.evolveum.midpoint.gui.api.component.result.OperationResultPanel;
import com.evolveum.midpoint.web.component.AjaxButton;

/**
*
* @author katkav
*
*/
public class TestConnectionResultPanel extends BasePanel<List<OpResult>> {

public TestConnectionResultPanel(String id, IModel<List<OpResult>> model) {
super(id, model);
initLayout();
}



private static final long serialVersionUID = 1L;

private static final String ID_RESULT = "result";
Expand Down

0 comments on commit 3a4dc09

Please sign in to comment.