From 6ea7e68657263e204b242fa1c179f69563592c2a Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Fri, 22 Apr 2022 15:41:03 +0200 Subject: [PATCH] Added sortByFields feature --- .../client/CkanEventHandlerManager.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/CkanEventHandlerManager.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/CkanEventHandlerManager.java index 1c8b702..decbf08 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/CkanEventHandlerManager.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/CkanEventHandlerManager.java @@ -37,7 +37,7 @@ import org.gcube.portlets.widgets.ckan2zenodopublisher.client.CkanToZendoPublish import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.CatalogueItem; import org.gcube.portlets.widgets.ckancontentmoderator.client.CkanContentModeratorCheckConfigs; import org.gcube.portlets.widgets.ckancontentmoderator.client.CkanContentModeratorWidgetTrusted; -import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.table.ItemsTable.DISPLAY_FIELD; +import org.gcube.portlets.widgets.ckancontentmoderator.shared.DISPLAY_FIELD; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form.CreateDatasetForm; import org.gcube.portlets_widgets.catalogue_sharing_widget.client.ShareCatalogueWidget; @@ -238,8 +238,22 @@ public class CkanEventHandlerManager { CkanContentModeratorCheckConfigs config = gcubeCkanDataCatalogue.getCkanModeratorConfig(); + DISPLAY_FIELD[] sortByFields = null; + + try { + if (config.isModeratorRoleAssigned()) { + sortByFields = DISPLAY_FIELD.values(); + } + } catch (Exception e) { + } + + if (sortByFields == null) { + sortByFields = new DISPLAY_FIELD[] { DISPLAY_FIELD.NAME, DISPLAY_FIELD.TITLE, DISPLAY_FIELD.CREATED, + DISPLAY_FIELD.LAST_UPDATE, DISPLAY_FIELD.TYPE }; + } + final CkanContentModeratorWidgetTrusted cmsTrusted = new CkanContentModeratorWidgetTrusted( - ItemStatus.PENDING, DISPLAY_FIELD.values(), DISPLAY_FIELD.NAME, config); + ItemStatus.PENDING, DISPLAY_FIELD.values(), sortByFields, config); cmsTrusted.showAsModal(null); }