Updated Navigation Bar with Catalogue functionalities

This commit is contained in:
Francesco Mangiacrapa 2024-02-19 13:07:50 +01:00
parent a9a7f1ccb7
commit 733841fd5e
7 changed files with 209 additions and 28 deletions

View File

@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
## [v2.3.0-SNAPSHOT] - 2024-02-02
- Supported the Edit facility [#26639]
- Support the Delete facility [#26793]
## [v2.2.7] - 2023-12-21

View File

@ -7,6 +7,8 @@ import org.gcube.datacatalogue.grsf_manage_widget.client.view.ManageProductWidge
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ClickedCMSManageProductButtonEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ClickedCMSManageProductButtonEventHandler;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.DeleteItemEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.DeleteItemEventHandler;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.EditMetadataEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.EditMetadataEventHandler;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.InsertMetadataEvent;
@ -41,6 +43,7 @@ import org.gcube.portlets.widgets.ckancontentmoderator.client.ContentModeratorWi
import org.gcube.portlets.widgets.ckancontentmoderator.shared.DISPLAY_FIELD;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.ReloadDatasetPageEvent;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.ReloadDatasetPageEventHandler;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.action.DeleteItemPanel;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form.CreateDatasetForm;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form.UpdateDatasetForm;
import org.gcube.portlets_widgets.catalogue_sharing_widget.client.ShareCatalogueWidget;
@ -326,11 +329,10 @@ public class CkanEventHandlerManager {
@Override
public void onEditMetadata(EditMetadataEvent editMetadataEvent) {
GWT.log("onEditMetadata called");
GWT.log("editMetadataEvent: " + editMetadataEvent);
if (editMetadataEvent.getItemID() != null) {
GWT.log("editMetadataEvent: " + editMetadataEvent);
final Modal modal = new ExtModal(true, true);
modal.setTitle("Update Item");
@ -346,6 +348,31 @@ public class CkanEventHandlerManager {
}
}
});
eventBus.addHandler(DeleteItemEvent.TYPE, new DeleteItemEventHandler() {
@Override
public void onDeleteItem(DeleteItemEvent deleteItemEvent) {
GWT.log("deleteItemEvent: " + deleteItemEvent);
if (deleteItemEvent.getItemID() != null) {
GWT.log("deleteItemEvent: " + deleteItemEvent);
final Modal modal = new ExtModal(true, true);
modal.setTitle("Delete Item");
modal.addStyleName("modal-top-custom");
((Element) modal.getElement().getChildNodes().getItem(1)).addClassName("modal-body-custom");
modal.add(new DeleteItemPanel(eventBus, deleteItemEvent.getItemID()));
modal.setCloseVisible(true);
GWT.log("show");
modal.show();
}
}
});
}
/**

View File

@ -0,0 +1,66 @@
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class DeleteItemEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Feb 19, 2024
*/
public class DeleteItemEvent extends GwtEvent<DeleteItemEventHandler> {
public static Type<DeleteItemEventHandler> TYPE = new Type<DeleteItemEventHandler>();
private String itemID;
/**
* Instantiates a new delete item event.
*
* @param itemID the item ID
*/
public DeleteItemEvent(String itemID) {
this.itemID = itemID;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
/*
* (non-Javadoc)
*
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<DeleteItemEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
/*
* (non-Javadoc)
*
* @see
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
* EventHandler)
*/
@Override
protected void dispatch(DeleteItemEventHandler handler) {
handler.onDeleteItem(this);
}
/**
* Gets the item ID.
*
* @return the item ID
*/
public String getItemID() {
return itemID;
}
}

View File

@ -0,0 +1,21 @@
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface DeleteItemEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Feb 19, 2024
*/
public interface DeleteItemEventHandler extends EventHandler {
/**
* On delete item.
*
* @param deleteItemEvent the delete item event
*/
void onDeleteItem(DeleteItemEvent deleteItemEvent);
}

View File

@ -4,6 +4,7 @@
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ClickedCMSManageProductButtonEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.DeleteItemEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.EditMetadataEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.InsertMetadataEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.PublishOnZenodoEvent;
@ -16,10 +17,11 @@ import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowOrgani
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowStatisticsEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowTypesEvent;
import com.github.gwtbootstrap.client.ui.AlertBlock;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.DropdownButton;
import com.github.gwtbootstrap.client.ui.Label;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.github.gwtbootstrap.client.ui.NavLink;
import com.github.gwtbootstrap.client.ui.Navbar;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT;
@ -45,9 +47,6 @@ public class CkanMetadataManagementPanel extends FlowPanel {
public static final String CATALOGUE_ITEMS_WERE_APPROVED_BY_CATALOGUE_MODERATOR_S = "Catalogue items were approved by Catalogue Moderator(s).";
/**
*
*/
private static final String MY_PREFIX = "My ";
private static final String MANAGE_GRSF_ITEM_TOOLTIP = "By pushing on this button, you will be able to manage the item you are viewing."
@ -56,7 +55,7 @@ public class CkanMetadataManagementPanel extends FlowPanel {
private static final String MANAGE_CMS_ITEMS_TOOLTIP = "By pushing on this button, you will be able to manage (APPROVING or REJECTING) the item under approval."
+ " Manageable items are not APPROVED and NOT PUBLISHED in the Catalogue.";
private AlertBlock nav = new AlertBlock();
private Navbar nav = new Navbar();
// generic
private Button home = new Button("Home");
@ -68,9 +67,9 @@ public class CkanMetadataManagementPanel extends FlowPanel {
// user's own
private InlineHTML separatorMyInfo = null;
private InlineHTML separatorAdminButtons = null;
private Button myDatasets = new Button("My Items");
private Button myOrganizations = new Button("My Organizations");
private Button myGroups = new Button("My Groups");
private NavLink myDatasets = new NavLink("My Items");
private NavLink myOrganizations = new NavLink("My Organizations");
private NavLink myGroups = new NavLink("My Groups");
// statistics
private Button statistics = new Button("Statistics");
@ -80,6 +79,7 @@ public class CkanMetadataManagementPanel extends FlowPanel {
private Button uploadToZenodo = new Button("Upload to Zenodo");
private Button insertMeta = new Button("Publish Item");
private Button editMeta = new Button("Update Item");
private Button deleteItem = new Button("Delete Item");
private Button manageGRSFProduct = new Button("Manage GRSF Item"); // GRSF Manage
private Button manageCModS = new Button("Manage Items"); // Moderation
@ -104,9 +104,9 @@ public class CkanMetadataManagementPanel extends FlowPanel {
items.setType(ButtonType.LINK);
types.setType(ButtonType.LINK);
myDatasets.setType(ButtonType.LINK);
myOrganizations.setType(ButtonType.LINK);
myGroups.setType(ButtonType.LINK);
// myDatasets.setType(ButtonType.LINK);
//myOrganizations.setType(ButtonType.LINK);
// myGroups.setType(ButtonType.LINK);
statistics.setType(ButtonType.LINK);
@ -114,6 +114,7 @@ public class CkanMetadataManagementPanel extends FlowPanel {
uploadToZenodo.setType(ButtonType.LINK);
insertMeta.setType(ButtonType.LINK);
editMeta.setType(ButtonType.LINK);
deleteItem.setType(ButtonType.LINK);
manageGRSFProduct.setType(ButtonType.PRIMARY);
manageGRSFProduct.getElement().getStyle().setFloat(Float.RIGHT);
@ -140,6 +141,7 @@ public class CkanMetadataManagementPanel extends FlowPanel {
myGroups.setIcon(IconType.GROUP);
insertMeta.setIcon(IconType.FILE);
editMeta.setIcon(IconType.EDIT_SIGN);
deleteItem.setIcon(IconType.REMOVE_CIRCLE);
statistics.setIcon(IconType.BAR_CHART);
manageGRSFProduct.setIcon(IconType.CHECK_SIGN);
manageCModS.setIcon(IconType.CHECK_SIGN);
@ -148,6 +150,7 @@ public class CkanMetadataManagementPanel extends FlowPanel {
shareLink.setEnabled(false);
uploadToZenodo.setEnabled(false);
editMeta.setEnabled(false);
deleteItem.setEnabled(false);
insertMeta.setVisible(false);
manageGRSFProduct.setVisible(false);
manageGRSFProduct.setEnabled(false);
@ -164,6 +167,8 @@ public class CkanMetadataManagementPanel extends FlowPanel {
manageCModS.getElement().getStyle().setFontWeight(FontWeight.BOLD);
nav.add(messageModerationEnanbled);
nav.addStyleName("nav_bar_catalogue");
// add to navigation bar
nav.add(home);
nav.add(organizations);
@ -171,25 +176,42 @@ public class CkanMetadataManagementPanel extends FlowPanel {
nav.add(items);
nav.add(types);
nav.add(statistics);
separatorMyInfo = new InlineHTML("<span style=\"font-weight:bold;vertical-alignment:middle;\">|</span>");
separatorMyInfo = new InlineHTML(
"<span style=\"font-weight:bold;vertical-alignment:middle;margin:0 5px;\">|</span>");
separatorMyInfo.setVisible(true);
nav.add(separatorMyInfo);
nav.add(myOrganizations);
nav.add(myGroups);
nav.add(myDatasets);
separatorAdminButtons = new InlineHTML("<span style=\"font-weight:bold;vertical-alignment:middle;\">|</span>");
DropdownButton dropMy = new DropdownButton("My...");
dropMy.setBaseIcon(IconType.USER);
dropMy.add(myOrganizations);
dropMy.add(myGroups);
dropMy.add(myDatasets);
dropMy.setType(ButtonType.LINK);
// nav.add(myOrganizations);
// nav.add(myGroups);
nav.add(dropMy);
separatorAdminButtons = new InlineHTML(
"<span style=\"font-weight:bold;vertical-alignment:middle;margin:0 5px;\">|</span>");
separatorAdminButtons.setVisible(true);
nav.add(separatorAdminButtons);
nav.add(insertMeta);
nav.add(new InlineHTML("<span style=\"font-weight:bold;vertical-alignment:middle;margin:0 5px;\">|</span>"));
nav.add(editMeta);
nav.add(deleteItem);
nav.add(shareLink);
nav.add(uploadToZenodo);
nav.add(insertMeta);
nav.add(editMeta);
nav.add(manageGRSFProduct);
nav.add(manageCModS);
nav.setClose(false);
nav.setType(AlertType.INFO);
nav.getElement().getStyle().setMarginBottom(0, Unit.PX);
nav.getElement().getStyle().setBackgroundColor("#FFF");
// TODO
// nav.setClose(false);
// nav.setType(AlertType.INFO);
// nav.getElement().getStyle().setMarginBottom(0, Unit.PX);
// nav.getElement().getStyle().setBackgroundColor("#FFF");
addHandlers();
add(nav);
}
@ -262,8 +284,18 @@ public class CkanMetadataManagementPanel extends FlowPanel {
@Override
public void onClick(ClickEvent event) {
GWT.log("Edit Meta CLICK");
eventBus.fireEvent(new EditMetadataEvent(GCubeCkanDataCatalogPanel.getLatestSelectedProductIdentifier()));
GWT.log("Edit Meta clicked");
eventBus.fireEvent(
new EditMetadataEvent(GCubeCkanDataCatalogPanel.getLatestSelectedProductIdentifier()));
}
});
deleteItem.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
GWT.log("Delete item clicked");
eventBus.fireEvent(new DeleteItemEvent(GCubeCkanDataCatalogPanel.getLatestSelectedProductIdentifier()));
}
});
@ -446,6 +478,15 @@ public class CkanMetadataManagementPanel extends FlowPanel {
editMeta.setEnabled(value);
}
/**
* Enable delete item button.
*
* @param value the value
*/
public void enableDeleteItemButton(boolean value) {
deleteItem.setEnabled(value);
}
/**
* Visibility publish on zenodo button.
*
@ -454,7 +495,6 @@ public class CkanMetadataManagementPanel extends FlowPanel {
public void visibilityPublishOnZenodoButton(boolean value) {
uploadToZenodo.setVisible(value);
}
/**
* Visibility edit item button.
@ -465,6 +505,15 @@ public class CkanMetadataManagementPanel extends FlowPanel {
editMeta.setVisible(value);
}
/**
* Visibility delete item button.
*
* @param value the value
*/
public void visibilityDeleteItemButton(boolean value) {
deleteItem.setVisible(value);
}
/**
* Show only home/statistics buttons.
*/
@ -476,6 +525,7 @@ public class CkanMetadataManagementPanel extends FlowPanel {
uploadToZenodo.setVisible(false);
insertMeta.setVisible(false);
editMeta.setVisible(false);
deleteItem.setVisible(false);
myDatasets.setVisible(false);
myOrganizations.setVisible(false);
myGroups.setVisible(false);

View File

@ -564,6 +564,7 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
latestSelectedProductIdentifier = productId.toString();
managementPanel.enableShareItemButton(productId != null && !productId.isEmpty());
managementPanel.enableEditItemButton(productId != null && !productId.isEmpty());
managementPanel.enableDeleteItemButton(productId != null && !productId.isEmpty());
managementPanel.enablePublishOnZenodoButton(productId != null && !productId.isEmpty());
managementPanel.enableManageGRSFProductButton(
productId != null && !productId.isEmpty() && manageProductResponse.isManageEnabled());

View File

@ -164,4 +164,19 @@ h1 {
margin-right: 10px;
padding: 8px !important;
border-radius: 12px !important;
margin-top: 5px;
}
.nav_bar_catalogue {
background-color: none !important;
margin-bottom: 0px !important;
margin-left: 10px;
margin-right: 5px;
padding: 5px;
}
.nav_bar_catalogue .navbar-inner {
background-image: none !important;
padding: 10px 5px;
background-color: #FAFAFA;
}