Skip to content

Commit

Permalink
KAA-1155: Bug with server-side profile schema version fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
vchizhevsky committed Jun 22, 2016
1 parent bc3a535 commit 52d674f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 59 deletions.
Expand Up @@ -19,6 +19,7 @@
import java.util.ArrayList;
import java.util.List;

import com.google.gwt.activity.shared.AbstractActivity;
import org.kaaproject.avro.ui.gwt.client.util.BusyAsyncCallback;
import org.kaaproject.avro.ui.gwt.client.widget.grid.event.RowActionEvent;
import org.kaaproject.avro.ui.gwt.client.widget.grid.event.RowActionEventHandler;
Expand All @@ -32,7 +33,6 @@
import org.kaaproject.kaa.server.admin.client.mvp.view.EndpointProfilesView;
import org.kaaproject.kaa.server.admin.client.util.Utils;

import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
Expand All @@ -49,22 +49,18 @@ public class EndpointProfilesActivity extends AbstractActivity implements BaseLi
private EndpointProfilesView listView;
private EndpointProfilesPlace place;
private String applicationId;
private boolean gridLoaded;
private EndpointProfileDataProvider dataProvider;
private EndpointGroupDto groupAll;

private List<HandlerRegistration> registrations = new ArrayList<>();

public EndpointProfilesActivity(EndpointProfilesPlace place, ClientFactory clientFactory) {
this.place = place;
this.clientFactory = clientFactory;
this.applicationId = place.getApplicationId();
this.gridLoaded = place.isGridLoaded();
}

@Override
public void start(AcceptsOneWidget containerWidget, EventBus eventBus) {
gridLoaded = false;
listView = clientFactory.getEndpointProfilesView();
dataProvider = new EndpointProfileDataProvider(listView.getListWidget(), listView, this.applicationId);
listView.setPresenter(this);
Expand All @@ -88,7 +84,7 @@ public void onClick(ClickEvent clickEvent) {
public void onRowAction(RowActionEvent<String> event) {
String id = event.getClickedId();
if (event.getAction()==RowActionEvent.CLICK) {
goTo(new EndpointProfilePlace(applicationId, id, gridLoaded));
goTo(new EndpointProfilePlace(applicationId, id));
} else if (event.getAction()==RowActionEvent.DELETE) {
deleteEntity(id, new BusyAsyncCallback<Void>() {
@Override
Expand Down Expand Up @@ -162,32 +158,24 @@ private void findByEndpointKeyHash() {

private void reset() {
listView.getEndpointKeyHashTextBox().setValue("");
if (!gridLoaded) {
listView.getEndpointGroupButton().setValue(true);
listView.getEndpointKeyHashButton().setValue(false);
getGroupsList();
} else {
listView.getEndpointGroupsInfo().setValue(groupAll);
listView.getEndpointGroupButton().setValue(true);
listView.getEndpointKeyHashButton().setValue(false);
findByEndpointGroup();
}
listView.getEndpointKeyHashButton().setValue(false);
listView.getEndpointGroupButton().setValue(true);
listView.getEndpointGroupsInfo().reset();
getGroupsList();
}

private void getGroupsList() {
if (!gridLoaded) {
KaaAdmin.getDataSource().loadEndpointGroups(applicationId, new AsyncCallback<List<EndpointGroupDto>>() {
@Override
public void onFailure(Throwable caught) {
Utils.handleException(caught, listView);
}
KaaAdmin.getDataSource().loadEndpointGroups(applicationId, new AsyncCallback<List<EndpointGroupDto>>() {
@Override
public void onFailure(Throwable caught) {
Utils.handleException(caught, listView);
}

@Override
public void onSuccess(List<EndpointGroupDto> result) {
populateListBoxAndGrid(result);
}
});
}
@Override
public void onSuccess(List<EndpointGroupDto> result) {
populateListBoxAndGrid(result);
}
});
}

private void populateListBoxAndGrid(List<EndpointGroupDto> result) {
Expand All @@ -198,7 +186,6 @@ private void populateListBoxAndGrid(List<EndpointGroupDto> result) {
}
}
listView.getEndpointGroupsInfo().setAcceptableValues(result);
gridLoaded = true;
}

@Override
Expand Down
Expand Up @@ -23,19 +23,12 @@
public class EndpointProfilePlace extends EndpointProfilesPlace {

private String endpointKeyHash;
private boolean gridLoaded;

public EndpointProfilePlace(String applicationId, String endpointKeyHash) {
super(applicationId);
this.endpointKeyHash = endpointKeyHash;
}

public EndpointProfilePlace(String applicationId, String endpointKeyHash, boolean gridLoaded) {
super(applicationId);
this.endpointKeyHash = endpointKeyHash;
this.gridLoaded = gridLoaded;
}

@Override
public String getName() {
return Utils.constants.profile();
Expand All @@ -45,11 +38,6 @@ public String getEndpointKeyHash() {
return endpointKeyHash;
}

@Override
public boolean isGridLoaded() {
return gridLoaded;
}

@Prefix(value = "endProfKeyHash")
public static class Tokenizer implements PlaceTokenizer<EndpointProfilePlace>, PlaceConstants {

Expand Down Expand Up @@ -98,7 +86,7 @@ public boolean isLeaf() {

@Override
public TreePlace createDefaultPreviousPlace() {
return new EndpointProfilesPlace(applicationId, gridLoaded);
return new EndpointProfilesPlace(applicationId);
}


Expand Down
Expand Up @@ -24,26 +24,15 @@
public class EndpointProfilesPlace extends TreePlace {

protected String applicationId;
private boolean gridLoaded;

public EndpointProfilesPlace(String applicationId) {
this.applicationId = applicationId;
this.gridLoaded = false;
}

public EndpointProfilesPlace(String applicationId, boolean gridLoaded) {
this.applicationId = applicationId;
this.gridLoaded = gridLoaded;
}

public String getApplicationId() {
return applicationId;
}

public boolean isGridLoaded() {
return gridLoaded;
}

@Override
public String getName() {
return Utils.constants.endpointProfiles();
Expand Down
Expand Up @@ -19,13 +19,12 @@
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.ValueListBox;
import org.kaaproject.kaa.common.dto.EndpointGroupDto;
import org.kaaproject.kaa.common.dto.EndpointProfileDto;
import org.kaaproject.kaa.server.admin.client.mvp.view.widget.EndpointGroupsInfoListBox;

public interface EndpointProfilesView extends BaseListView<EndpointProfileDto>{

ValueListBox<EndpointGroupDto> getEndpointGroupsInfo();
EndpointGroupsInfoListBox getEndpointGroupsInfo();

Button getResetButton();
Button getFindEndpointButton();
Expand Down
Expand Up @@ -17,7 +17,6 @@
package org.kaaproject.kaa.server.admin.client.mvp.view.endpoint;

import org.kaaproject.avro.ui.gwt.client.widget.grid.AbstractGrid;
import org.kaaproject.kaa.common.dto.EndpointGroupDto;
import org.kaaproject.kaa.common.dto.EndpointProfileDto;
import org.kaaproject.kaa.server.admin.client.mvp.view.EndpointProfilesView;
import org.kaaproject.kaa.server.admin.client.mvp.view.base.BaseListViewImpl;
Expand All @@ -34,7 +33,6 @@
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.RadioButton;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.ValueListBox;
import com.google.gwt.user.client.ui.Widget;

public class EndpointProfilesViewImpl extends BaseListViewImpl<EndpointProfileDto> implements EndpointProfilesView {
Expand Down Expand Up @@ -99,7 +97,7 @@ protected Widget createAndBindUi() {
}

@Override
public ValueListBox<EndpointGroupDto> getEndpointGroupsInfo() {
public EndpointGroupsInfoListBox getEndpointGroupsInfo() {
return listBox;
}

Expand Down

0 comments on commit 52d674f

Please sign in to comment.