|
|
|
@ -20,6 +20,7 @@ import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import org.gcube.portlets.admin.resourcemanagement.client.ContexClientModel;
|
|
|
|
|
import org.gcube.portlets.admin.resourcemanagement.client.views.profile.ResourceProfilePanel;
|
|
|
|
|
import org.gcube.portlets.admin.resourcemanagement.client.views.resourcedetails.ResourceDetailsPanel;
|
|
|
|
|
import org.gcube.portlets.admin.resourcemanagement.client.views.resourcedetails.ResourceGridFactory;
|
|
|
|
@ -38,15 +39,13 @@ import org.gcube.resourcemanagement.support.shared.types.Tuple;
|
|
|
|
|
import org.gcube.resourcemanagement.support.shared.types.datamodel.CompleteResourceProfile;
|
|
|
|
|
|
|
|
|
|
import com.extjs.gxt.ui.client.data.ModelData;
|
|
|
|
|
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
|
|
|
|
import com.extjs.gxt.ui.client.store.ListStore;
|
|
|
|
|
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
|
|
|
|
import com.extjs.gxt.ui.client.widget.Dialog;
|
|
|
|
|
import com.extjs.gxt.ui.client.widget.MessageBox;
|
|
|
|
|
import com.extjs.gxt.ui.client.widget.button.Button;
|
|
|
|
|
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
|
|
|
|
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
|
|
|
|
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
|
|
|
|
import com.extjs.gxt.ui.client.widget.menu.Menu;
|
|
|
|
|
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
|
|
|
|
|
import com.google.gwt.core.client.GWT;
|
|
|
|
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
|
|
|
|
|
|
|
@ -69,27 +68,25 @@ public class Callbacks {
|
|
|
|
|
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Button btnScopes = (Button) WidgetsRegistry.getWidget(UIIdentifiers.BUTTON_AVAILABLE_SCOPES_ID);
|
|
|
|
|
|
|
|
|
|
Menu scrollMenu = new Menu();
|
|
|
|
|
scrollMenu.setMaxHeight(200);
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
|
ComboBox<ContexClientModel> select = (ComboBox<ContexClientModel>) WidgetsRegistry.getWidget(UIIdentifiers.BUTTON_AVAILABLE_SCOPES_ID);
|
|
|
|
|
|
|
|
|
|
LocalStatus.getInstance().getAvailableScopes().clear();
|
|
|
|
|
|
|
|
|
|
final ListStore<ContexClientModel> yourStore = select.getStore();
|
|
|
|
|
for (String scope : result) {
|
|
|
|
|
final String currScope = scope;
|
|
|
|
|
LocalStatus.getInstance().getAvailableScopes().add(currScope);
|
|
|
|
|
scrollMenu.add(new MenuItem(currScope) {
|
|
|
|
|
@Override
|
|
|
|
|
protected void onClick(final ComponentEvent be) {
|
|
|
|
|
super.onClick(be);
|
|
|
|
|
Commands.doLoadResourceTree(this, currScope);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
String splits[] = currScope.split("/");
|
|
|
|
|
String context = splits[splits.length-1];
|
|
|
|
|
if (splits.length > 3) { //VRE
|
|
|
|
|
context += " ("+splits[2]+")";
|
|
|
|
|
} else if (splits.length == 3) { //VO
|
|
|
|
|
context += " ("+splits[1]+")";
|
|
|
|
|
}
|
|
|
|
|
yourStore.add(new ContexClientModel(scope, context));
|
|
|
|
|
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
btnScopes.setMenu(scrollMenu);
|
|
|
|
|
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
|
|
|
|
}
|
|
|
|
|
public void onFailure(final Throwable caught) {
|
|
|
|
|
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
|
|
|
@ -148,7 +145,7 @@ public class Callbacks {
|
|
|
|
|
* Here implemented the logics for that.
|
|
|
|
|
*/
|
|
|
|
|
public static final AsyncCallback<HashMap<String, ArrayList<String>>> handleLoadResourceTree =
|
|
|
|
|
new AsyncCallback<HashMap<String, ArrayList<String>>>() {
|
|
|
|
|
new AsyncCallback<HashMap<String, ArrayList<String>>>() {
|
|
|
|
|
public void onSuccess(final HashMap<String, ArrayList<String>> result) {
|
|
|
|
|
builtResourceTree(result, true);
|
|
|
|
|
}
|
|
|
|
@ -169,7 +166,7 @@ public class Callbacks {
|
|
|
|
|
* Here implemented the logics for that.
|
|
|
|
|
*/
|
|
|
|
|
public static final AsyncCallback<HashMap<String, ArrayList<String>>> handleReloadResourceTree =
|
|
|
|
|
new AsyncCallback<HashMap<String, ArrayList<String>>>() {
|
|
|
|
|
new AsyncCallback<HashMap<String, ArrayList<String>>>() {
|
|
|
|
|
public void onSuccess(final HashMap<String, ArrayList<String>> result) {
|
|
|
|
|
builtResourceTree(result, false);
|
|
|
|
|
}
|
|
|
|
@ -190,13 +187,13 @@ public class Callbacks {
|
|
|
|
|
* they will be shown inside a grid that is created here.
|
|
|
|
|
*/
|
|
|
|
|
public static final AsyncCallback<List<String>> handleLoadResourceDetailsGrid =
|
|
|
|
|
new AsyncCallback<List<String>>() {
|
|
|
|
|
new AsyncCallback<List<String>>() {
|
|
|
|
|
public void onSuccess(final List<String> result) {
|
|
|
|
|
|
|
|
|
|
Commands.mask(
|
|
|
|
|
"Rendering grid",
|
|
|
|
|
WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL).getContainer()
|
|
|
|
|
);
|
|
|
|
|
);
|
|
|
|
|
try {
|
|
|
|
|
ResourceDetailsPanel resGrid = Commands.getResourceDetailPanel();
|
|
|
|
|
Grid<ModelData> grid = ResourceGridFactory.createGrid(StatusHandler.getStatus().getCurrentResourceType(),
|
|
|
|
@ -226,7 +223,7 @@ public class Callbacks {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static final AsyncCallback<List<String>> handleFilterResourceDetailsGrid =
|
|
|
|
|
new AsyncCallback<List<String>>() {
|
|
|
|
|
new AsyncCallback<List<String>>() {
|
|
|
|
|
public void onSuccess(final List<String> result) {
|
|
|
|
|
try {
|
|
|
|
|
ResourceDetailsPanel resGrid = Commands.getResourceDetailPanel();
|
|
|
|
@ -258,7 +255,7 @@ public class Callbacks {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static final AsyncCallback<CompleteResourceProfile> handleGetResourceProfile =
|
|
|
|
|
new AsyncCallback<CompleteResourceProfile>() {
|
|
|
|
|
new AsyncCallback<CompleteResourceProfile>() {
|
|
|
|
|
|
|
|
|
|
public void onSuccess(final CompleteResourceProfile result) {
|
|
|
|
|
Dialog dlg = new Dialog();
|
|
|
|
@ -285,7 +282,7 @@ public class Callbacks {
|
|
|
|
|
//result.getType() + ": " + result.getTitle(),
|
|
|
|
|
result.getTitle(),
|
|
|
|
|
"resource-profile-taskbar-item",
|
|
|
|
|
"profile-big-icon");
|
|
|
|
|
"profile-big-icon");
|
|
|
|
|
tkItem.getRelatedWindow().setMainWidget(
|
|
|
|
|
new ResourceProfilePanel(
|
|
|
|
|
result.getType(),
|
|
|
|
@ -308,7 +305,7 @@ public class Callbacks {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static final AsyncCallback<Tuple<String>> handleGetDeploymentReport =
|
|
|
|
|
new AsyncCallback<Tuple<String>>() {
|
|
|
|
|
new AsyncCallback<Tuple<String>>() {
|
|
|
|
|
|
|
|
|
|
public void onSuccess(final Tuple<String> result) {
|
|
|
|
|
|
|
|
|
|