Revisit the "Select Item Resources" step when publishing from Workspace
#26874
This commit is contained in:
parent
ff1500b991
commit
4a5ed9caa5
|
@ -24,7 +24,6 @@ import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.resources.Ad
|
|||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.resources.ManageResources;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils.InfoIconsLabels;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils.WizardCreator;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.workspace.SelectResourceByWEMainPanel;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.DatasetBean;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.MetadataProfileBeanForUpdate;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.OrganizationBean;
|
||||
|
@ -310,7 +309,7 @@ public class UpdateDatasetForm extends Composite {
|
|||
private DatasetBean theDatasetBean;
|
||||
|
||||
// resource table
|
||||
private SelectResourceByWEMainPanel resourcesSelectByWEMainPanel;
|
||||
//private SelectResourceByWEMainPanel resourcesSelectByWEMainPanel;
|
||||
|
||||
// List of opened popup'ids
|
||||
private List<String> popupOpenedIds = new ArrayList<String>();
|
||||
|
@ -515,11 +514,11 @@ public class UpdateDatasetForm extends Composite {
|
|||
// set it as visible anyway
|
||||
tagsPanel.setVisible(true);
|
||||
|
||||
// The resource root is the folder id. Es. ID of the Workspace Root folder.
|
||||
if (datasetBean.getResourceRoot() != null) {
|
||||
resourcesSelectByWEMainPanel = new SelectResourceByWEMainPanel(
|
||||
datasetBean.getResourceRoot());
|
||||
}
|
||||
// // The resource root is the folder id. Es. ID of the Workspace Root folder.
|
||||
// if (datasetBean.getResourceRoot() != null) {
|
||||
// resourcesSelectByWEMainPanel = new SelectResourceByWEMainPanel(
|
||||
// datasetBean.getResourceRoot());
|
||||
// }
|
||||
|
||||
// set organizations
|
||||
List<OrganizationBean> organizations = datasetBean.getOrganizationList();
|
||||
|
@ -946,7 +945,7 @@ public class UpdateDatasetForm extends Composite {
|
|||
// add the resources to the container panel
|
||||
if (workspaceResourcesContainer.getWidget() == null) {
|
||||
workspaceResourcesContainer.getElement().getStyle().setMarginLeft(20, Unit.PX);
|
||||
workspaceResourcesContainer.add(resourcesSelectByWEMainPanel);
|
||||
//workspaceResourcesContainer.add(resourcesSelectByWEMainPanel);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -1156,9 +1155,9 @@ public class UpdateDatasetForm extends Composite {
|
|||
theDatasetBean.setGroups(groups);
|
||||
theDatasetBean.setGroupsForceCreation(groupsToForceCreation);
|
||||
|
||||
if (resourcesSelectByWEMainPanel != null) {
|
||||
theDatasetBean.setResourceRoot(resourcesSelectByWEMainPanel.getResourcesToPublish());
|
||||
}
|
||||
// if (resourcesSelectByWEMainPanel != null) {
|
||||
// theDatasetBean.setResourceRoot(resourcesSelectByWEMainPanel.getResourcesToPublish());
|
||||
// }
|
||||
|
||||
theDatasetBean.setCustomFields(customFieldsMap);
|
||||
|
||||
|
@ -1600,9 +1599,9 @@ public class UpdateDatasetForm extends Composite {
|
|||
|
||||
}
|
||||
|
||||
// freeze table of resources
|
||||
if (resourcesSelectByWEMainPanel != null)
|
||||
resourcesSelectByWEMainPanel.freeze();
|
||||
// // freeze table of resources
|
||||
// if (resourcesSelectByWEMainPanel != null)
|
||||
// resourcesSelectByWEMainPanel.freeze();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,14 +35,23 @@ import com.google.gwt.user.client.ui.HTML;
|
|||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
/**
|
||||
* Form used to add resource(s) to a dataset
|
||||
* The Class AddResourceToDataset.
|
||||
*
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Feb 23, 2024
|
||||
*/
|
||||
public class AddResourceToDataset extends Composite {
|
||||
|
||||
private static AddResourceToDatasetUiBinder uiBinder = GWT.create(AddResourceToDatasetUiBinder.class);
|
||||
|
||||
/**
|
||||
* The Interface AddResourceToDatasetUiBinder.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Feb 23, 2024
|
||||
*/
|
||||
interface AddResourceToDatasetUiBinder extends UiBinder<Widget, AddResourceToDataset> {
|
||||
}
|
||||
|
||||
|
@ -82,6 +91,15 @@ public class AddResourceToDataset extends Composite {
|
|||
|
||||
FlowPanel alertPanel = new FlowPanel();
|
||||
|
||||
/**
|
||||
* Instantiates a new adds the resource to dataset.
|
||||
*
|
||||
* @param eventBus the event bus
|
||||
* @param datasetId the dataset id
|
||||
* @param datasetTitle the dataset title
|
||||
* @param datasetOrg the dataset org
|
||||
* @param datasetUrl the dataset url
|
||||
*/
|
||||
public AddResourceToDataset(HandlerManager eventBus, final String datasetId, String datasetTitle,
|
||||
final String datasetOrg, final String datasetUrl) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
@ -115,6 +133,9 @@ public class AddResourceToDataset extends Composite {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind.
|
||||
*/
|
||||
private void bind() {
|
||||
|
||||
eventBus.addHandler(WorkspaceItemSelectedEvent.TYPE, new WorkspaceItemSelectedEventHandler() {
|
||||
|
@ -149,6 +170,11 @@ public class AddResourceToDataset extends Composite {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* On select from workspace click.
|
||||
*
|
||||
* @param e the e
|
||||
*/
|
||||
@UiHandler("buttoSelectFromWorkspace")
|
||||
void onSelectFromWorkspaceClick(ClickEvent e) {
|
||||
|
||||
|
@ -165,6 +191,11 @@ public class AddResourceToDataset extends Composite {
|
|||
dialog.center();
|
||||
}
|
||||
|
||||
/**
|
||||
* On add button click.
|
||||
*
|
||||
* @param e the e
|
||||
*/
|
||||
@UiHandler("addResourceButton")
|
||||
void onAddButtonClick(ClickEvent e) {
|
||||
|
||||
|
@ -229,7 +260,6 @@ public class AddResourceToDataset extends Composite {
|
|||
showAlert("Unable to add this resource. Check that the url is correct", null, AlertType.ERROR, true,
|
||||
true);
|
||||
|
||||
|
||||
addResourceButton.setEnabled(true);
|
||||
|
||||
}
|
||||
|
@ -250,8 +280,11 @@ public class AddResourceToDataset extends Composite {
|
|||
/**
|
||||
* Show error/success after resource creation attempt.
|
||||
*
|
||||
* @param text
|
||||
* @param type
|
||||
* @param text the text
|
||||
* @param loader the loader
|
||||
* @param type the type
|
||||
* @param scheduleHide the schedule hide
|
||||
* @param setVisible the set visible
|
||||
*/
|
||||
protected void showAlert(String text, LoaderIcon loader, AlertType type, boolean scheduleHide, boolean setVisible) {
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ import com.google.gwt.event.dom.client.ClickHandler;
|
|||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
|
@ -62,7 +61,7 @@ public class ResourceInfoForm extends Composite{
|
|||
resourcePath.setText(resource.getFullPath());
|
||||
closeButton.getElement().getStyle().setFloat(Float.RIGHT);
|
||||
closeButton.setIcon(IconType.REMOVE_CIRCLE);
|
||||
commandPanel.setCellHorizontalAlignment(updateResourceButton, HasHorizontalAlignment.ALIGN_RIGHT);
|
||||
//commandPanel.setCellHorizontalAlignment(updateResourceButton, HasHorizontalAlignment.ALIGN_RIGHT);
|
||||
commandPanel.getElement().getStyle().setMarginTop(10, Unit.PX);
|
||||
updateResourceButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
padding: 5px;
|
||||
border: 1px solid #bbb;
|
||||
border-radius: 5px;
|
||||
height: 320px;
|
||||
width: 700px;
|
||||
height: 300px;
|
||||
/*width: 700px;*/
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
|
@ -32,11 +32,11 @@
|
|||
}
|
||||
|
||||
.custom-input input {
|
||||
width: 350px;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.custom-input textarea {
|
||||
width: 355px;
|
||||
width: 81%;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel addStyleNames="{style.panel-style}">
|
||||
|
@ -45,7 +45,7 @@
|
|||
<b:Legend addStyleNames="{style.legend-style}">
|
||||
<b>Resource Information</b>
|
||||
<b:Button ui:field="closeButton" type="LINK"
|
||||
title="Close details"></b:Button>
|
||||
title="Close details" visible="false"></b:Button>
|
||||
</b:Legend>
|
||||
<b:ControlGroup ui:field="controlName">
|
||||
<b:ControlLabel for="name"
|
||||
|
@ -92,7 +92,7 @@
|
|||
<g:HorizontalPanel width="100%"
|
||||
ui:field="commandPanel">
|
||||
<!-- <b:Button ui:field="cancelButton">Cancel</b:Button> -->
|
||||
<b:Button ui:field="updateResourceButton" type="PRIMARY">Update</b:Button>
|
||||
<b:Button ui:field="updateResourceButton" type="INFO">Update</b:Button>
|
||||
</g:HorizontalPanel>
|
||||
</b:Fieldset>
|
||||
</b:Form>
|
||||
|
|
|
@ -40,14 +40,14 @@
|
|||
<g:HTMLPanel ui:field="containerPickResources"
|
||||
addStyleNames="{style.margin-top-30}">
|
||||
<b:AccordionGroup ui:field="buttPickResources"
|
||||
heading="Add files from..." defaultOpen="false"
|
||||
heading="Select from Workspace..." defaultOpen="false"
|
||||
addStyleNames="accordion-no-border-inner">
|
||||
<b:FluidRow addStyleNames="{style.max-height-250}">
|
||||
<g:VerticalPanel ui:field="wsContainer">
|
||||
</g:VerticalPanel>
|
||||
</b:FluidRow>
|
||||
<b:Button ui:field="buttSelectResource"
|
||||
addStyleNames="{style.margin-top-10}">Select</b:Button>
|
||||
type="INFO" addStyleNames="{style.margin-top-10}">Select</b:Button>
|
||||
</b:AccordionGroup>
|
||||
</g:HTMLPanel>
|
||||
</g:HTMLPanel>
|
||||
|
|
|
@ -7,9 +7,12 @@ import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
|||
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.dom.client.MouseDownEvent;
|
||||
import com.google.gwt.event.dom.client.MouseDownHandler;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
@ -19,7 +22,7 @@ import com.google.gwt.user.client.ui.Widget;
|
|||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Mar 12, 2021
|
||||
* Mar 12, 2021
|
||||
*/
|
||||
public class SelectedResourceWidget extends Composite {
|
||||
|
||||
|
@ -31,7 +34,7 @@ public class SelectedResourceWidget extends Composite {
|
|||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Mar 12, 2021
|
||||
* Mar 12, 2021
|
||||
*/
|
||||
interface SelectedResourceWidgetUiBinder extends UiBinder<Widget, SelectedResourceWidget> {
|
||||
}
|
||||
|
@ -62,6 +65,14 @@ public class SelectedResourceWidget extends Composite {
|
|||
@UiField
|
||||
HTMLPanel editPanel;
|
||||
|
||||
@UiField
|
||||
FlowPanel resourcePanel;
|
||||
|
||||
@UiField
|
||||
FlowPanel selectedResourcesPanelTitle;
|
||||
|
||||
private boolean selectetResource = false;
|
||||
|
||||
/** The resource bean. */
|
||||
private ResourceElementBean resourceBean;
|
||||
|
||||
|
@ -83,10 +94,10 @@ public class SelectedResourceWidget extends Composite {
|
|||
private void updateFields() {
|
||||
this.fieldName.setText(resourceBean.getEditableName());
|
||||
|
||||
if(resourceBean.getDescription()!=null && !resourceBean.getDescription().isEmpty()) {
|
||||
if (resourceBean.getDescription() != null && !resourceBean.getDescription().isEmpty()) {
|
||||
this.fieldDescription.setVisible(true);
|
||||
this.fieldDescription.setText(resourceBean.getDescription());
|
||||
}else
|
||||
} else
|
||||
this.fieldDescription.setVisible(false);
|
||||
}
|
||||
|
||||
|
@ -99,14 +110,7 @@ public class SelectedResourceWidget extends Composite {
|
|||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
editPanel.clear();
|
||||
ResourceInfoForm resourceInformationInfo = new ResourceInfoForm(resourceBean) {
|
||||
protected void onUnload() {
|
||||
super.onUnload();
|
||||
updateFields();
|
||||
};
|
||||
};
|
||||
editPanel.add(resourceInformationInfo);
|
||||
manageEditOpenResource();
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -119,6 +123,33 @@ public class SelectedResourceWidget extends Composite {
|
|||
}
|
||||
});
|
||||
|
||||
MouseDownHandler handler = new MouseDownHandler() {
|
||||
|
||||
@Override
|
||||
public void onMouseDown(MouseDownEvent event) {
|
||||
manageEditOpenResource();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
selectedResourcesPanelTitle.addDomHandler(handler, MouseDownEvent.getType());
|
||||
}
|
||||
|
||||
private void manageEditOpenResource() {
|
||||
|
||||
editPanel.clear();
|
||||
if (selectetResource) {
|
||||
selectetResource = false;
|
||||
} else {
|
||||
ResourceInfoForm resourceInformationInfo = new ResourceInfoForm(resourceBean) {
|
||||
protected void onUnload() {
|
||||
super.onUnload();
|
||||
updateFields();
|
||||
};
|
||||
};
|
||||
editPanel.add(resourceInformationInfo);
|
||||
selectetResource = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,14 +7,6 @@
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
.selected-resources {
|
||||
|
||||
}
|
||||
|
||||
.selected-resources td {
|
||||
vertical-align: middle !important;
|
||||
}
|
||||
|
||||
.margin-bottom-8 {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
@ -26,7 +18,7 @@
|
|||
}
|
||||
|
||||
.title-text {
|
||||
font-weight: bold;
|
||||
/*font-weight: bold;*/
|
||||
font-size: 14px;
|
||||
display: inline;
|
||||
vertical-align: middle;
|
||||
|
@ -41,14 +33,18 @@
|
|||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel addStyleNames="{style.margin-bottom-8}">
|
||||
<g:FlowPanel addStyleNames="{style.selected-resources}">
|
||||
<g:FlowPanel addStyleNames="selected-resources-ws"
|
||||
ui:field="resourcePanel">
|
||||
<!-- <b:Icon type="PUSHPIN" addStyleNames="{style.icon-my-style}"></b:Icon> -->
|
||||
<b:Button ui:field="buttonEdit" icon="PENCIL"
|
||||
title="Edit the resource information" />
|
||||
<b:Button ui:field="buttonDelete" icon="TRASH"
|
||||
title="Remove this resource" />
|
||||
<g:Label ui:field="fieldName"
|
||||
addStyleNames="{style.title-text}"></g:Label>
|
||||
<g:FlowPanel ui:field="selectedResourcesPanelTitle"
|
||||
addStyleNames="selected-resources-ws-title">
|
||||
<g:Label ui:field="fieldName"
|
||||
addStyleNames="{style.title-text}"></g:Label>
|
||||
</g:FlowPanel>
|
||||
<g:Label ui:field="fieldDescription" visible="false"
|
||||
addStyleNames="{style.descr-text}"></g:Label>
|
||||
</g:FlowPanel>
|
||||
|
|
|
@ -62,6 +62,24 @@
|
|||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
.selected-resources-ws {
|
||||
background-color: #f1f3f9 !important;
|
||||
padding: 5px;
|
||||
box-shadow: 0px 3px #888;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.selected-resources-ws td {
|
||||
vertical-align: middle !important;
|
||||
}
|
||||
|
||||
.selected-resources-ws-title {
|
||||
display: inline;
|
||||
}
|
||||
.selected-resources-ws-title:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* WIZARD-CREATOR CLASSES */
|
||||
.wizard-creator {
|
||||
width: 100%;
|
||||
|
|
|
@ -1187,8 +1187,9 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|||
logger.info("Checking if the user " + username + " can publish or not on the catalogue");
|
||||
|
||||
if (!isWithinPortal()) {
|
||||
logger.warn("OUT FROM PORTAL DETECTED RETURNING TRUE");
|
||||
return true;
|
||||
boolean isPublisherFunny = true;
|
||||
logger.warn("OUT FROM PORTAL DETECTED RETURNING: "+isPublisherFunny);
|
||||
return isPublisherFunny;
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
@ -74,6 +74,7 @@ public class CatalogueRoleManager {
|
|||
groups = new HashSet<GCubeGroup>(listGroups);
|
||||
}
|
||||
|
||||
//Used by Workspace?
|
||||
// root (so check into the root, the VOs and the VRES)
|
||||
if(groupManager.isRootVO(currentGroupId)){
|
||||
|
||||
|
|
Loading…
Reference in New Issue