css fix and added an alert block when publishing from the workspace and no file within the folder is available

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@130115 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-07-07 14:52:10 +00:00
parent 2cddc91288
commit 9c23a597aa
4 changed files with 33 additions and 16 deletions

View File

@ -20,7 +20,6 @@
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="${webappDirectory}/WEB-INF/classes" path="src/main/resources">

View File

@ -91,6 +91,7 @@ public class CreateDatasetForm extends Composite{
@UiField Button createButton;
@UiField Button resetButton;
@UiField AlertBlock infoBlock;
@UiField AlertBlock alertNoResources;
@UiField AlertBlock onContinueAlertBlock;
@UiField AlertBlock onCreateAlertBlock;
@UiField VerticalPanel metadataFieldsPanel;
@ -326,15 +327,16 @@ public class CreateDatasetForm extends Composite{
resourcesControlGroup.setVisible(true);
addResourcesCheckBox.getElement().getStyle().setDisplay(Display.INLINE_BLOCK);
resourcesTable = new ResourcesTable(bean.getResources());
// if there are not resources, for now just checked it ( and hide so that the step will be skipped) TODO
if(bean.getResources() == null || bean.getResources().isEmpty()){
// if(bean.getResources() == null || bean.getResources().isEmpty()){
resourcesControlGroup.setVisible(false);
}
alertNoResources.setType(AlertType.WARNING);
alertNoResources.setVisible(true);
// }
// try to retrieve the licenses
setAlertBlock("Retrieving licenses, please wait...", AlertType.INFO, true);
ckanServices.getLicenses(new AsyncCallback<LicensesBean>() {
@ -358,7 +360,7 @@ public class CreateDatasetForm extends Composite{
licenseListbox.setItemSelected(i, true);
}
// everything went ok
setAlertBlock("", AlertType.ERROR, false);
continueButton.setEnabled(true);
@ -827,6 +829,13 @@ public class CreateDatasetForm extends Composite{
return errorMessage;
}
// check if version is a number
try{
Integer.valueOf(versionTextbox.getText());
}catch(Exception e){
return errorMessage = "Version must be a natural number";
}
// check if metadata profile is different from none and its mandatory fields have been fulfilled
if(checkSelectedMetaDataProfile()){
errorMessage = "You must select a metadata profile different frome none";
@ -911,7 +920,7 @@ public class CreateDatasetForm extends Composite{
field.freeze();
}
// freeze table of resources
if(resourcesTable != null)
resourcesTable.freezeTable();

View File

@ -226,9 +226,15 @@
</b:Controls>
</b:ControlGroup>
<!-- Alert block on continue -->
<b:AlertBlock animation="true" visible="false"
ui:field="alertNoResources"
text="Please note that the product you are going to publish wont't have resources.">
</b:AlertBlock>
<!-- Alert block on continue -->
<b:AlertBlock type="INFO" close="false" animation="true"
visible="false" ui:field="onContinueAlertBlock" styleName="{style.block-alert-style}">
visible="false" ui:field="onContinueAlertBlock">
</b:AlertBlock>
<b:Button title="Continue" ui:field="continueButton" type="PRIMARY"
@ -307,8 +313,9 @@
<b:Button title="Create product" ui:field="createButton"
type="PRIMARY" block="true">Create</b:Button>
<b:Button title="Go Back" ui:field="goBackButtonFirstOrSecondStep" block="true">Go
<b:Button title="Go Back" ui:field="goBackButtonFirstOrSecondStep"
block="true">Go
Back</b:Button>
<b:Button title="Go to product" ui:field="goToDatasetButton"

View File

@ -678,7 +678,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
* @param username
* @return
*/
public List<ResourceBeanWrapper> getWorkspaceResourcesInformation(
private List<ResourceBeanWrapper> getWorkspaceResourcesInformation(
List<String> resourceIds, Workspace ws, String username) {
List<ResourceBeanWrapper> toReturn = null;
@ -689,14 +689,16 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
for (String resourceId : resourceIds) {
logger.debug("RESOURCE ID IS " + resourceId);
ResourceBeanWrapper newResource = new ResourceBeanWrapper();
FolderItem item = (FolderItem)ws.getItem(resourceId);
WorkspaceItem item = ws.getItem(resourceId);
newResource.setDescription(item.getDescription());
newResource.setId(item.getId());
newResource.setUrl(item.getPublicLink(true));
newResource.setName(item.getName());
newResource.setToBeAdded(true); // default is true
newResource.setMimeType(item.getMimeType());
newResource.setMimeType(((FolderItem)item).getMimeType());
newResource.setOwner(username);
toReturn.add(newResource);