ref 17169: Selection of users in the Sharing panel

https://support.d4science.org/issues/17169

Added support to workspace users discovery by VREs

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-sharing-widget@181359 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2019-07-30 14:57:34 +00:00
parent 87743b0277
commit 6d4b51a024
4 changed files with 33 additions and 12 deletions

View File

@ -37,6 +37,7 @@ import com.extjs.gxt.ui.client.widget.VerticalPanel;
import com.extjs.gxt.ui.client.widget.button.Button; 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.form.ComboBox;
import com.extjs.gxt.ui.client.widget.form.StoreFilterField; import com.extjs.gxt.ui.client.widget.form.StoreFilterField;
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig; import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnData; import com.extjs.gxt.ui.client.widget.grid.ColumnData;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel; import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
@ -58,6 +59,8 @@ import com.google.gwt.user.client.ui.FlexTable;
*/ */
public class PanelMultiDragContactAdmin extends ContentPanel { public class PanelMultiDragContactAdmin extends ContentPanel {
// //
private String workspaceItemId; private String workspaceItemId;
@ -71,13 +74,15 @@ public class PanelMultiDragContactAdmin extends ContentPanel {
private static final String ADMINISTRATORS = "Administrators"; private static final String ADMINISTRATORS = "Administrators";
// //
//private static final String LOADINGSTYLE = "x-mask-loading"; public static final String LOADING = "Loading";
public static final String LOADINGSTYLE = "x-mask-loading";
private static final int HEIGHT_VRE_PANEL = 40; private static final int HEIGHT_VRE_PANEL = 40;
private static final int WIDTH_VRE_PANEL = 597; private static final int WIDTH_VRE_PANEL = 597;
private static final int HEIGHT_CONTACTS_PANEL = 400; private static final int HEIGHT_CONTACTS_PANEL = 400;
private static final int WIDTH_CONTACTS_PANEL = 597; private static final int WIDTH_CONTACTS_PANEL = 597;
private static final int WIDTH_VRE_LIST_COMBO = 550;
private static final int HEIGHT_GRID = 310; private static final int HEIGHT_GRID = 310;
private static final int PADDING = 5; private static final int PADDING = 5;
@ -219,7 +224,7 @@ public class PanelMultiDragContactAdmin extends ContentPanel {
private void create() { private void create() {
GWT.log("PanelMultiDragContactAdmin Create Start"); GWT.log("PanelMultiDragContactAdmin Create Start");
// SORTING STORE
GWT.log("Create VREPanel"); GWT.log("Create VREPanel");
// VRE // VRE
final ContentPanel vrePanel = new ContentPanel(); final ContentPanel vrePanel = new ContentPanel();
@ -228,20 +233,24 @@ public class PanelMultiDragContactAdmin extends ContentPanel {
vrePanel.setHeaderVisible(false); vrePanel.setHeaderVisible(false);
vrePanel.setLayout(new RowLayout(Orientation.HORIZONTAL)); vrePanel.setLayout(new RowLayout(Orientation.HORIZONTAL));
// TODO
// VRE Select // VRE Select
vreListStore = new ListStore<UserVRE>(); vreListStore = new ListStore<UserVRE>();
vreListCombo = new ComboBox<UserVRE>(); vreListCombo = new ComboBox<UserVRE>();
vreListCombo.setStore(vreListStore); vreListCombo.setStore(vreListStore);
vreListCombo.setDisplayField(UserVRE.GROUP_NAME); vreListCombo.setDisplayField(UserVRE.GROUP_NAME);
vreListCombo.setWidth(554); vreListCombo.setWidth(WIDTH_VRE_LIST_COMBO);
vreListCombo.setEditable(true);
vreListCombo.setAllowBlank(false); vreListCombo.setAllowBlank(false);
vreListCombo.setForceSelection(true);
vreListCombo.setTypeAhead(true);
vreListCombo.setTriggerAction(TriggerAction.ALL);
vreListCombo.addSelectionChangedListener(new SelectionChangedListener<UserVRE>() { vreListCombo.addSelectionChangedListener(new SelectionChangedListener<UserVRE>() {
@Override @Override
public void selectionChanged(SelectionChangedEvent<UserVRE> selected) { public void selectionChanged(SelectionChangedEvent<UserVRE> selected) {
gridAllContacts.focus();
retrieveContactList(selected.getSelectedItem()); retrieveContactList(selected.getSelectedItem());
} }
}); });
@ -408,14 +417,14 @@ public class PanelMultiDragContactAdmin extends ContentPanel {
GWT.log("PanelMultiDragContactAdmin view Created"); GWT.log("PanelMultiDragContactAdmin view Created");
} }
// TODO
private void retrieveContactList(final UserVRE userVRE) { private void retrieveContactList(final UserVRE userVRE) {
if (!contactsMap.isEmpty() && contactsMap.containsKey(userVRE)) { if (!contactsMap.isEmpty() && contactsMap.containsKey(userVRE)) {
List<InfoContactModel> contacts = contactsMap.get(userVRE); List<InfoContactModel> contacts = contactsMap.get(userVRE);
updateStoreSource(contacts); updateStoreSource(contacts);
} else { } else {
gridAllContacts.mask("Loading...");//("", LOADINGSTYLE); gridAllContacts.mask(LOADING, LOADINGSTYLE);
GWT.log("PanelMultiDragContactAdmin retrieve contacts list"); GWT.log("PanelMultiDragContactAdmin retrieve contacts list");
WorkspaceSharingController.rpcWorkspaceSharingService.getAllContactsByVRE(userVRE, WorkspaceSharingController.rpcWorkspaceSharingService.getAllContactsByVRE(userVRE,
new AsyncCallback<List<InfoContactModel>>() { new AsyncCallback<List<InfoContactModel>>() {

View File

@ -8,6 +8,7 @@ import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.Con
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel; import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyCodes;
@ -287,6 +288,7 @@ public class MultiValuePanel extends Composite {
} else { } else {
displayItem.setStyleName("multivalue-panel-token-ws-notselectable"); displayItem.setStyleName("multivalue-panel-token-ws-notselectable");
p.setRemovable(false); p.setRemovable(false);
p.getElement().getStyle().setMargin(0, Unit.PX);
} }
GWT.log("Adding selected wp item '" + itemBox.getValue()); GWT.log("Adding selected wp item '" + itemBox.getValue());

View File

@ -35,6 +35,7 @@ import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.VerticalPanel; import com.extjs.gxt.ui.client.widget.VerticalPanel;
import com.extjs.gxt.ui.client.widget.button.Button; 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.form.ComboBox;
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
import com.extjs.gxt.ui.client.widget.form.StoreFilterField; import com.extjs.gxt.ui.client.widget.form.StoreFilterField;
import com.extjs.gxt.ui.client.widget.form.TextArea; import com.extjs.gxt.ui.client.widget.form.TextArea;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig; import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
@ -71,7 +72,9 @@ public class PanelMultiDragWorkspaceContact extends ContentPanel {
private static final String SHARE_WITH = "Share with..."; private static final String SHARE_WITH = "Share with...";
// //
//private static final String LOADINGSTYLE = "x-mask-loading"; public static final String LOADING = "Loading";
public static final String LOADINGSTYLE = "x-mask-loading";
private static final int HEIGHT_ALREADY_SHARED_PANEL = 80; private static final int HEIGHT_ALREADY_SHARED_PANEL = 80;
private static final int WIDTH_ALREADY_SHARED_PANEL = 597; private static final int WIDTH_ALREADY_SHARED_PANEL = 597;
private static final int HEIGHT_VRE_PANEL = 40; private static final int HEIGHT_VRE_PANEL = 40;
@ -208,6 +211,7 @@ public class PanelMultiDragWorkspaceContact extends ContentPanel {
private void create() { private void create() {
GWT.log("PanelMultiDragWorkspaceContact Create Start"); GWT.log("PanelMultiDragWorkspaceContact Create Start");
// Already Shared // Already Shared
GWT.log("PanelMultiDragWorkspaceContact Already Shared Panel"); GWT.log("PanelMultiDragWorkspaceContact Already Shared Panel");
alreadySharedPanel = new ContentPanel(); alreadySharedPanel = new ContentPanel();
@ -240,6 +244,7 @@ public class PanelMultiDragWorkspaceContact extends ContentPanel {
// //
GWT.log("PanelMultiDragWorkspaceContact Create VREPanel"); GWT.log("PanelMultiDragWorkspaceContact Create VREPanel");
// VRE // VRE
final ContentPanel vrePanel = new ContentPanel(); final ContentPanel vrePanel = new ContentPanel();
vrePanel.setId("vre-panel-share-admin" + Random.nextInt()); vrePanel.setId("vre-panel-share-admin" + Random.nextInt());
@ -247,7 +252,6 @@ public class PanelMultiDragWorkspaceContact extends ContentPanel {
vrePanel.setHeaderVisible(false); vrePanel.setHeaderVisible(false);
vrePanel.setLayout(new RowLayout(Orientation.HORIZONTAL)); vrePanel.setLayout(new RowLayout(Orientation.HORIZONTAL));
// TODO
// VRE Select // VRE Select
vreListStore = new ListStore<UserVRE>(); vreListStore = new ListStore<UserVRE>();
@ -255,12 +259,18 @@ public class PanelMultiDragWorkspaceContact extends ContentPanel {
vreListCombo.setStore(vreListStore); vreListCombo.setStore(vreListStore);
vreListCombo.setDisplayField(UserVRE.GROUP_NAME); vreListCombo.setDisplayField(UserVRE.GROUP_NAME);
vreListCombo.setWidth(552); vreListCombo.setWidth(552);
vreListCombo.setEditable(true);
vreListCombo.setAllowBlank(false); vreListCombo.setAllowBlank(false);
vreListCombo.setForceSelection(true);
vreListCombo.setTypeAhead(true);
vreListCombo.setTriggerAction(TriggerAction.ALL);
vreListCombo.addSelectionChangedListener(new SelectionChangedListener<UserVRE>() { vreListCombo.addSelectionChangedListener(new SelectionChangedListener<UserVRE>() {
@Override @Override
public void selectionChanged(SelectionChangedEvent<UserVRE> selected) { public void selectionChanged(SelectionChangedEvent<UserVRE> selected) {
gridAllContacts.focus();
retrieveContactList(selected.getSelectedItem()); retrieveContactList(selected.getSelectedItem());
} }
}); });
@ -427,7 +437,6 @@ public class PanelMultiDragWorkspaceContact extends ContentPanel {
GWT.log("PanelMultiDragWorkspaceContact view Created"); GWT.log("PanelMultiDragWorkspaceContact view Created");
} }
// TODO
private void retrieveContactList(final UserVRE userVRE) { private void retrieveContactList(final UserVRE userVRE) {
if (!contactsMap.isEmpty() && contactsMap.containsKey(userVRE)) { if (!contactsMap.isEmpty() && contactsMap.containsKey(userVRE)) {
@ -435,7 +444,7 @@ public class PanelMultiDragWorkspaceContact extends ContentPanel {
updateStoreSource(contacts); updateStoreSource(contacts);
} else { } else {
gridAllContacts.mask("Loading...");//"", LOADINGSTYLE); gridAllContacts.mask(LOADING, LOADINGSTYLE);
GWT.log("PanelMultiDragWorkspaceContact retrieve contacts list"); GWT.log("PanelMultiDragWorkspaceContact retrieve contacts list");
WorkspaceSharingController.rpcWorkspaceSharingService.getAllContactsByVRE(userVRE, WorkspaceSharingController.rpcWorkspaceSharingService.getAllContactsByVRE(userVRE,
new AsyncCallback<List<InfoContactModel>>() { new AsyncCallback<List<InfoContactModel>>() {

View File

@ -90,6 +90,7 @@ public class GWTWorkspaceSharingBuilder {
if (hashUserTest == null) { if (hashUserTest == null) {
vresListTest = new ArrayList<>(); vresListTest = new ArrayList<>();
vresListTest.add(new UserVRE(21660, 21657, "NextNext", "NextNext test VRE")); vresListTest.add(new UserVRE(21660, 21657, "NextNext", "NextNext test VRE"));
vresListTest.add(new UserVRE(21678, 21663, "devVRE", "devVRE test VRE"));
} }
return vresListTest; return vresListTest;
} }