in progress

This commit is contained in:
Francesco Mangiacrapa 2021-06-24 15:02:49 +02:00
parent 814a0c6661
commit 34277dafb0
10 changed files with 141 additions and 59 deletions

View File

@ -45,7 +45,7 @@
<dependency> <dependency>
<groupId>org.gcube.distribution</groupId> <groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId> <artifactId>maven-portal-bom</artifactId>
<version>3.6.2-SNAPSHOT</version> <version>3.6.3-SNAPSHOT</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
<exclusions> <exclusions>

View File

@ -9,7 +9,7 @@ import org.gcube.portlets.widgets.ckancontentmoderator.shared.SearchedData;
import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
// TODO: Auto-generated Javadoc
/** /**
* The client side stub for the RPC service. * The client side stub for the RPC service.
* *
@ -27,36 +27,40 @@ public interface CkanContentModeratorService extends RemoteService {
*/ */
public boolean isContentModeratorEnabled(); public boolean isContentModeratorEnabled();
/** /**
* Sets the status. * Sets the status.
* *
* @param itemId the item id
* @param theStatus the the status * @param theStatus the the status
* @param itemNames the item names
*/ */
public void setStatus(String itemId, ItemStatus theStatus); public void setStatus(ItemStatus theStatus, List<String> itemNames);
/** /**
* Approve item. * Approve item.
* *
* @param itemId the item id * @param itemNames the item names
*/ */
public void approveItem(String itemId); public void approveItem(List<String> itemNames);
/** /**
* Reject item. * Reject item.
* *
* @param itemId the item id * @param itemName the item name
* @param permanentlyDelete the permanently delete * @param permanentlyDelete the permanently delete
* @param reasonMsg the reason msg * @param reasonMsg the reason msg
*/ */
public void rejectItem(String itemId, boolean permanentlyDelete, String reasonMsg); public void rejectItem(String itemName, boolean permanentlyDelete, String reasonMsg);
/** /**
* Permanently delete. * Permanently delete.
* *
* @param itemId the item id * @param itemNames the item names
*/ */
public void permanentlyDelete(String itemId); public void permanentlyDelete(List<String> itemNames);
/** /**
* Gets the list items for status. * Gets the list items for status.
@ -77,7 +81,7 @@ public interface CkanContentModeratorService extends RemoteService {
* @param lenght the lenght * @param lenght the lenght
* @param serverIndex the server index * @param serverIndex the server index
* @return the data for status * @return the data for status
* @throws Exception * @throws Exception the exception
*/ */
SearchedData getDataForStatus(ItemStatus status, int startIndex, int lenght, int serverIndex) throws Exception; SearchedData getDataForStatus(ItemStatus status, int startIndex, int lenght, int serverIndex) throws Exception;

View File

@ -8,12 +8,13 @@ import org.gcube.portlets.widgets.ckancontentmoderator.shared.SearchedData;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
/** /**
* The Interface CkanContentModeratorServiceAsync. * The Interface CkanContentModeratorServiceAsync.
* *
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
* *
* Jun 14, 2021 * Jun 23, 2021
*/ */
public interface CkanContentModeratorServiceAsync { public interface CkanContentModeratorServiceAsync {
@ -24,55 +25,65 @@ public interface CkanContentModeratorServiceAsync {
*/ */
void isContentModeratorEnabled(AsyncCallback<Boolean> callback); void isContentModeratorEnabled(AsyncCallback<Boolean> callback);
/**
* Approve item.
*
* @param itemId the item id
* @param callback the callback
*/
void approveItem(String itemId, AsyncCallback<Void> callback);
/**
* Permanently delete.
*
* @param itemId the item id
* @param callback the callback
*/
void permanentlyDelete(String itemId, AsyncCallback<Void> callback);
/** /**
* Reject item. * Reject item.
* *
* @param itemId the item id * @param itemName the item name
* @param permanentlyDelete the permanently delete * @param permanentlyDelete the permanently delete
* @param reasonMsg the reason msg * @param reasonMsg the reason msg
* @param callback the callback * @param callback the callback
*/ */
void rejectItem(String itemId, boolean permanentlyDelete, String reasonMsg, AsyncCallback<Void> callback); void rejectItem(String itemName, boolean permanentlyDelete, String reasonMsg, AsyncCallback<Void> callback);
/**
* Sets the status.
*
* @param itemId the item id
* @param theStatus the the status
* @param callback the callback
*/
void setStatus(String itemId, ItemStatus theStatus, AsyncCallback<Void> callback);
/** /**
* Gets the list items for status. * Gets the list items for status.
* *
* @param theStatus the the status * @param theStatus the the status
* @param limit the limit * @param limit the limit
* @param offset the offset * @param offset the offset
* @param callback the callback * @param callback the callback
* @return the list items for status * @return the list items for status
*/ */
void getListItemsForStatus(ItemStatus theStatus, int limit, int offset, void getListItemsForStatus(ItemStatus theStatus, int limit, int offset,
AsyncCallback<List<CatalogueDataset>> callback); AsyncCallback<List<CatalogueDataset>> callback);
/**
* Gets the data for status.
*
* @param status the status
* @param startIndex the start index
* @param lenght the lenght
* @param serverIndex the server index
* @param asyncCallback the async callback
* @return the data for status
*/
void getDataForStatus(ItemStatus status, int startIndex, int lenght, int serverIndex, void getDataForStatus(ItemStatus status, int startIndex, int lenght, int serverIndex,
AsyncCallback<SearchedData> asyncCallback); AsyncCallback<SearchedData> asyncCallback);
/**
* Approve item.
*
* @param itemNames the item names
* @param callback the callback
*/
void approveItem(List<String> itemNames, AsyncCallback<Void> callback);
/**
* Permanently delete.
*
* @param itemNames the item names
* @param callback the callback
*/
void permanentlyDelete(List<String> itemNames, AsyncCallback<Void> callback);
/**
* Sets the status.
*
* @param theStatus the the status
* @param itemNames the item names
* @param callback the callback
*/
void setStatus(ItemStatus theStatus, List<String> itemNames, AsyncCallback<Void> callback);
} }

View File

@ -14,7 +14,6 @@ import org.gcube.portlets.widgets.ckancontentmoderator.client.events.ShowItemEve
import org.gcube.portlets.widgets.ckancontentmoderator.client.events.TableRangeViewChangedEvent; import org.gcube.portlets.widgets.ckancontentmoderator.client.events.TableRangeViewChangedEvent;
import org.gcube.portlets.widgets.ckancontentmoderator.client.events.TableRangeViewChangedEventHandler; import org.gcube.portlets.widgets.ckancontentmoderator.client.events.TableRangeViewChangedEventHandler;
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.CkanFramePanel; import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.CkanFramePanel;
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.ContentModeratorPaginatedView;
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.ContentModeratorToolbar; import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.ContentModeratorToolbar;
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.HomeView; import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.HomeView;
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.MainTabPanel; import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.MainTabPanel;

View File

@ -19,12 +19,12 @@ import com.google.gwt.user.client.ui.Frame;
import com.google.gwt.user.client.ui.Image; import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.NamedFrame; import com.google.gwt.user.client.ui.NamedFrame;
// TODO: Auto-generated Javadoc
/** /**
* The Class CkanFramePanel. * The Class CkanFramePanel.
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
* Jun 9, 2016 *
* Jun 23, 2021
*/ */
public class CkanFramePanel extends FlowPanel{ public class CkanFramePanel extends FlowPanel{
@ -96,7 +96,7 @@ public class CkanFramePanel extends FlowPanel{
frame.getElement().setId(iFrameRandomName); frame.getElement().setId(iFrameRandomName);
frame.setWidth("100%"); frame.setWidth("100%");
frame.setHeight("500px"); frame.setHeight("580px");
// frame.setHeight("100%"); // frame.setHeight("100%");
// frame.getElement().getStyle().setOverflow(Overflow.HIDDEN); // frame.getElement().getStyle().setOverflow(Overflow.HIDDEN);
// frame.getElement().setAttribute("scrolling", "no"); // frame.getElement().setAttribute("scrolling", "no");

View File

@ -8,11 +8,15 @@ import org.gcube.portlets.widgets.ckancontentmoderator.client.events.CheckBoxSel
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.table.ItemsTable.DISPLAY_FIELD; import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.table.ItemsTable.DISPLAY_FIELD;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset; import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset;
import com.github.gwtbootstrap.client.ui.AlertBlock;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.CheckBox; import com.github.gwtbootstrap.client.ui.CheckBox;
import com.github.gwtbootstrap.client.ui.Dropdown; import com.github.gwtbootstrap.client.ui.Dropdown;
import com.github.gwtbootstrap.client.ui.Heading; import com.github.gwtbootstrap.client.ui.Heading;
import com.github.gwtbootstrap.client.ui.NavLink; import com.github.gwtbootstrap.client.ui.NavLink;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.logical.shared.ValueChangeEvent; import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler; import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.event.shared.HandlerManager;
@ -47,6 +51,15 @@ public class HomeView extends Composite {
@UiField @UiField
Heading pageHeader; Heading pageHeader;
@UiField
AlertBlock actionConfirmAlert;
@UiField
Button buttActionConfirmYes;
@UiField
Button buttonActionConfirmNo;
private List<NavLink> setStatusOptions = new ArrayList<>(); private List<NavLink> setStatusOptions = new ArrayList<>();
@ -116,6 +129,25 @@ public class HomeView extends Composite {
} }
}); });
buttActionConfirmYes.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// TODO Auto-generated method stub
}
});
buttonActionConfirmNo.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
actionConfirmAlert.setVisible(false);
}
});
} }
/** /**
@ -154,5 +186,12 @@ public class HomeView extends Composite {
public void setCheckedCheckboxSelectAll(boolean bool) { public void setCheckedCheckboxSelectAll(boolean bool) {
cbSelectAll.setValue(bool); cbSelectAll.setValue(bool);
} }
public void showConfirm(String msg) {
actionConfirmAlert.setVisible(true);
}
} }

View File

@ -20,6 +20,7 @@
margin-bottom: 20px; margin-bottom: 20px;
font-size: 16px !important; font-size: 16px !important;
} }
.headinghome>small { .headinghome>small {
font-size: 16px !important; font-size: 16px !important;
} }
@ -34,6 +35,13 @@
ui:field="dropdownSetStatus" addStyleNames="{style.margin-left-20}"> ui:field="dropdownSetStatus" addStyleNames="{style.margin-left-20}">
</b:Dropdown> </b:Dropdown>
</g:HorizontalPanel> </g:HorizontalPanel>
<b:AlertBlock type="DEFAULT" close="true"
animation="true" ui:field="actionConfirmAlert" visible="false">
<b:Button ui:field="buttActionConfirmYes">Yes</b:Button>
<b:Button ui:field="buttonActionConfirmNo">No</b:Button>
</b:AlertBlock>
<g:HTMLPanel ui:field="panelContainer"></g:HTMLPanel> <g:HTMLPanel ui:field="panelContainer"></g:HTMLPanel>
</g:HTMLPanel> </g:HTMLPanel>
</ui:UiBinder> </ui:UiBinder>

View File

@ -1,7 +1,6 @@
package org.gcube.portlets.widgets.ckancontentmoderator.client.ui; package org.gcube.portlets.widgets.ckancontentmoderator.client.ui;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.util.UtilFunct; import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.util.UtilFunct;

View File

@ -0,0 +1,22 @@
package org.gcube.portlets.widgets.ckancontentmoderator.server;
import java.io.Serializable;
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
public class ActionRequired implements Serializable{
/**
*
*/
private static final long serialVersionUID = 6975224903479593671L;
String reasonMsg;
ItemStatus from;
ItemStatus to;
}

View File

@ -34,8 +34,8 @@ public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implem
} }
@Override @Override
public void setStatus(String itemId, ItemStatus theStatus) { public void setStatus(ItemStatus theStatus, List<String> itemNames) {
// TODO Auto-generated method stub LOG.info("Called set status " + theStatus + " for Items with name: " + itemNames);
} }
@ -43,8 +43,8 @@ public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implem
* Gets the list items for status. * Gets the list items for status.
* *
* @param theStatus the the status * @param theStatus the the status
* @param offset the offset * @param offset the offset
* @param limit the limit * @param limit the limit
* @return the list items for status * @return the list items for status
* @throws Exception the exception * @throws Exception the exception
*/ */
@ -61,7 +61,7 @@ public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implem
ScopeProvider.instance.set(scope); ScopeProvider.instance.set(scope);
SecurityTokenProvider.instance.set(token); SecurityTokenProvider.instance.set(token);
DataCatalogueImpl catalogueImpl = CatalogueCMSFactory.getFactory().getCatalogueImplPerScope(scope); DataCatalogueImpl catalogueImpl = CatalogueCMSFactory.getFactory().getCatalogueImplPerScope(scope);
CatalogueContentModeratorSystem cmsInstance = catalogueImpl.getCatalogueContentModerator(); CatalogueContentModeratorSystem cmsInstance = catalogueImpl.getCatalogueContentModerator();
List<CkanDataset> datasets = cmsInstance.getListItemsForStatus(theStatus, limit, offset); List<CkanDataset> datasets = cmsInstance.getListItemsForStatus(theStatus, limit, offset);
if (datasets != null) { if (datasets != null) {
int size = datasets.size(); int size = datasets.size();
@ -69,7 +69,7 @@ public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implem
LOG.info("datasetList for input parameters returned by CMS has size: " + size); LOG.info("datasetList for input parameters returned by CMS has size: " + size);
for (CkanDataset ckanDataset : datasets) { for (CkanDataset ckanDataset : datasets) {
CatalogueDataset ds = CatalogueBeansConverter.toCatalogueDataset.apply(ckanDataset); CatalogueDataset ds = CatalogueBeansConverter.toCatalogueDataset.apply(ckanDataset);
String datasetURL = String.format("%s/dataset/%s", catalogueImpl.getCatalogueUrl(),ds.getName()); String datasetURL = String.format("%s/dataset/%s", catalogueImpl.getCatalogueUrl(), ds.getName());
ds.setUrl(datasetURL); ds.setUrl(datasetURL);
LOG.debug("converted dataset is: " + ds); LOG.debug("converted dataset is: " + ds);
datasetList.add(ds); datasetList.add(ds);
@ -81,14 +81,14 @@ public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implem
throw new Exception( throw new Exception(
"Error occurrend on reading items for status: " + theStatus + ". Caused by: " + e.getMessage()); "Error occurrend on reading items for status: " + theStatus + ". Caused by: " + e.getMessage());
} }
LOG.info("returning "+datasetList.size()+ " dataset"); LOG.info("returning " + datasetList.size() + " dataset");
return datasetList; return datasetList;
} }
@Override @Override
public void approveItem(String itemId) { public void approveItem(List<String> itemNames) {
LOG.info("Called approve Item: " + itemId); LOG.info("Called approve Items with name: " + itemNames);
} }
@ -99,8 +99,8 @@ public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implem
} }
@Override @Override
public void permanentlyDelete(String itemId) { public void permanentlyDelete(List<String> itemNames) {
// TODO Auto-generated method stub LOG.info("Called approve Items with name: " + itemNames);
} }