Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6684 dataset pg btn responsive #6909

Merged
merged 66 commits into from
Jun 11, 2020
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
f6a38ee
Initial commit for new dataset pg action btn responsive layout [ref #…
mheppler Mar 12, 2020
b1d7f7a
Added new responsive Publish btn dropdown [ref #6684]
mheppler Mar 16, 2020
139e040
Improve responsive widths of dataset pg btns for sm, xs layouts [ref …
mheppler Mar 16, 2020
9d5699d
Improved responsive layout of thumbnail and citation on datatset pg […
mheppler Mar 18, 2020
959748d
Additional responsive cleanup of action btns, citation, metrics, summ…
mheppler Mar 25, 2020
4e2802b
Intial commit for responsive btns on file pg [ref #6684]
mheppler Mar 25, 2020
b638760
Additional responsive btn improvements to file pg [ref #6684]
mheppler Mar 26, 2020
f3f36d8
Initial file pg responsive btn with duplicate btns on dataset pg file…
mheppler Mar 30, 2020
1e55990
Merge branch 'develop' into 6684-dataset-pg-btn-responsive
mheppler Mar 30, 2020
25a44b8
New icon only styling to file table btns on dataset pg [ref #6684]
mheppler Apr 1, 2020
b3e5952
Dataset and file pg action btn render logic, accessibility improveme…
mheppler Apr 9, 2020
5151b4f
Added disabled attribute and classes to publish btns on dataset pg [r…
mheppler Apr 9, 2020
6f61923
#6684 move publish button group logic
sekmiller Apr 10, 2020
bf730de
Dataset and file pg btn updates, bundle text, styles [ref #6684]
mheppler Apr 10, 2020
21968d8
Dataset/file pg dropdown btn caret icon fix [ref #6684]
mheppler Apr 10, 2020
11ddde0
Fixed dataset and file pg btn dropdown align and margin issues [ref #…
mheppler Apr 13, 2020
b268b75
Fixed edit btn render logic for deaccession datasets [ref #6684]
mheppler Apr 15, 2020
be44a82
change DEFAULT_THUMBNAIL_SIZE from 64 to 140 #6769
pdurbin Apr 14, 2020
f7017e5
Fixed size of file thumbnail on dataset pg, edit file pg, replace fil…
mheppler Apr 15, 2020
aed6d83
new dataset thumbnail variable, revert previous #6769
pdurbin Apr 16, 2020
17ae5e1
reverts docs to 64 pixels wide #6769
pdurbin Apr 16, 2020
76449b9
Merge pull request #6830 from IQSS/6684-thumbnails
mheppler Apr 16, 2020
4254a0f
Making the size of the dataset thumbnail flexible.
landreev Apr 17, 2020
8c66e11
Render logic for disabled btns improved on file and dataset pg, clean…
mheppler Apr 17, 2020
2578ac5
fixed the dataset thumbnail test in SearchIT; (the APIs will continue…
landreev Apr 20, 2020
ee7a2f4
Render logic fix for publish and access btns on dataset pg [ref #6684]
mheppler Apr 21, 2020
95d7e04
don't show breadcrumbs for direct child of root datasets #6684
pdurbin Apr 21, 2020
bdce073
Fixed render logic and style class for Access File btn dropdown optio…
mheppler Apr 21, 2020
47d8b9f
#6684 modularize/centralize publish button rendering
sekmiller Apr 22, 2020
806f20d
Added UI hack to Access File dropdown download submenu options on fil…
mheppler Apr 22, 2020
4939e39
Fixed deaccession render logic for download on file pg [ref #6684]
mheppler Apr 22, 2020
237f9a7
#6684 additional render logic for Access Dataset
sekmiller Apr 22, 2020
bab5280
Removed hardcoded image size on dataset thumbnail + widgets pg [ref #…
mheppler May 6, 2020
84012f7
Hide dataset thumbnail for deaccessioned dataset pg, result cards [re…
mheppler May 6, 2020
f4c2e1b
Dataset pg render logic and various code clean up [ref #6684]
mheppler May 6, 2020
e0e688d
Fixed locked render logic on btn on dataset, fixed CSS icon link btn …
mheppler May 8, 2020
9cc3f91
Merge branch 'develop' into 6684-dataset-pg-btn-responsive #6684
mheppler May 8, 2020
6e5f069
Fixed col width issue on dataset theme form due to larger thumbnails …
mheppler May 12, 2020
2669539
Code clean up, stylesheets for file action btns [ref #6684]
mheppler May 12, 2020
31fe93c
Responsive, widgetView layout improvements to citation block, footer …
mheppler May 14, 2020
3902707
Fixed thumbnail size in dataset citation block [ref #6684]
mheppler May 14, 2020
136665c
Fixed render logic for Access File btn on file pg, fixed analytics bu…
mheppler May 26, 2020
b3872b2
Moved inline styles for new button UI to stylesheet [ref #6684]
mheppler May 27, 2020
f147041
Added new shared text to file pg, added min-height for dataset thumb …
mheppler May 27, 2020
c3a7387
Merge branch 'develop' into 6684-dataset-pg-btn-responsive
mheppler May 27, 2020
3d0043f
Resolved double cancel btn on dataset form [ref #6684]
mheppler May 27, 2020
4e64507
Fixed spacing issue for caret on configure icon btn in file table on …
mheppler May 27, 2020
abb6b66
adding release note
djbrooke May 28, 2020
ae05dde
Changed viewParam for fileId on file pg to OmniFaces component to fix…
mheppler May 28, 2020
22c9732
Restored original background colors to publication status labels on d…
mheppler May 28, 2020
c114f51
Moved ingest error popover on file pg to bottom of icon [ref #6684]
mheppler May 29, 2020
2a95581
Added render logic to Access Dataset btn and ui:remove to Download pl…
mheppler May 29, 2020
3d23d75
Increase font size of learn about citations link on dataset and file …
mheppler Jun 1, 2020
fbd5e8b
Removed extra dropdown submen for download and explore options under …
mheppler Jun 1, 2020
5110ad7
#6684 get disable publish button from page bean
sekmiller Jun 2, 2020
a8367f5
#6684 make sure lock test catches any new locks added
sekmiller Jun 3, 2020
864ed46
#6684 update render logic for publish buttons
sekmiller Jun 4, 2020
e837839
Cleaned up publish/submit for review/return to author links under new…
mheppler Jun 4, 2020
7910d21
Added new single-click verion of publish btn to dataset pg, needs ren…
mheppler Jun 4, 2020
69e9626
#6684 finalize?! publish button rendering
sekmiller Jun 4, 2020
f8cdb17
Swapped two publish btns for one with new components for dynamic attr…
mheppler Jun 5, 2020
2cdedea
#6684 check for Create mode on showSubmitForReviewLink
sekmiller Jun 5, 2020
1a1479e
Merge branch 'develop' into 6684-dataset-pg-btn-responsive
sekmiller Jun 8, 2020
a16adff
Fixed merge conflict related to request access javascript [ref #6684,…
mheppler Jun 8, 2020
e7ebdd6
#6684 consolidate publish popups
sekmiller Jun 8, 2020
90ac3a6
Fixed unnecessary duplicate file download javascript [ref #6684, #6943]
mheppler Jun 8, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,8 @@ scripts/installer/default.config
tests/node_modules
tests/package-lock.json
venv

# from thumbnail tests in SearchIT
scripts/search/data/binary/trees.png.thumb140
src/main/webapp/resources/images/cc0.png.thumb140
src/main/webapp/resources/images/dataverseproject.png.thumb140
4 changes: 2 additions & 2 deletions doc/sphinx-guides/source/api/dataaccess.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ the following parameter values are supported (for image and pdf files only):
============== ===========
Value Description
============== ===========
true Generates a thumbnail image, by rescaling to the default thumbnail size (64 pixels)
``N`` Rescales the image to ``N`` pixels.
true Generates a thumbnail image by rescaling to the default thumbnail size (64 pixels wide).
``N`` Rescales the image to ``N`` pixels wide. ``imageThumb=true`` and ``imageThumb=64`` are equivalent.
============== ===========

Multiple File ("bundle") download
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/edu/harvard/iq/dataverse/Dataset.java
Original file line number Diff line number Diff line change
Expand Up @@ -845,8 +845,8 @@ public boolean isAncestorOf( DvObject other ) {
return equals(other) || equals(other.getOwner());
}

public DatasetThumbnail getDatasetThumbnail() {
return DatasetUtil.getThumbnail(this);
public DatasetThumbnail getDatasetThumbnail(int size) {
return DatasetUtil.getThumbnail(this, size);
}

/**
Expand All @@ -857,8 +857,8 @@ public DatasetThumbnail getDatasetThumbnail() {
* @param datasetVersion
* @return A thumbnail of the dataset (may be {@code null}).
*/
public DatasetThumbnail getDatasetThumbnail(DatasetVersion datasetVersion) {
return DatasetUtil.getThumbnail(this, datasetVersion);
public DatasetThumbnail getDatasetThumbnail(DatasetVersion datasetVersion, int size) {
return DatasetUtil.getThumbnail(this, datasetVersion, size);
}

}
18 changes: 16 additions & 2 deletions src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ public String getThumbnailString() {
}

if (!readOnly) {
DatasetThumbnail datasetThumbnail = dataset.getDatasetThumbnail();
DatasetThumbnail datasetThumbnail = dataset.getDatasetThumbnail(ImageThumbConverter.DEFAULT_DATASETLOGO_SIZE);
mheppler marked this conversation as resolved.
Show resolved Hide resolved
if (datasetThumbnail == null) {
thumbnailString = "";
return null;
Expand All @@ -387,7 +387,10 @@ public String getThumbnailString() {

thumbnailString = datasetThumbnail.getBase64image();
} else {
thumbnailString = thumbnailServiceWrapper.getDatasetCardImageAsBase64Url(dataset, workingVersion.getId(),!workingVersion.isDraft());
thumbnailString = thumbnailServiceWrapper.getDatasetCardImageAsBase64Url(dataset,
workingVersion.getId(),
!workingVersion.isDraft(),
ImageThumbConverter.DEFAULT_DATASETLOGO_SIZE);
if (thumbnailString == null) {
thumbnailString = "";
return null;
Expand Down Expand Up @@ -1053,6 +1056,17 @@ public boolean canComputeAllFiles(boolean isCartCompute){
}
return true;
}

public boolean canDownloadFiles(){
//returns true if the page user has permission to download at least one file
for (FileMetadata fmd : workingVersion.getFileMetadatas()) {
if (fileDownloadHelper.canDownloadFile(fmd)) {
return true;
}
}
return false;
}

/*
in getComputeUrl(), we are sending the container/dataset name and the exipiry and signature
for the temporary url of only ONE datafile within the dataset. This is because in the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ public Dataset setNonDatasetFileAsThumbnail(Dataset dataset, InputStream inputSt
logger.fine("In setNonDatasetFileAsThumbnail but inputStream is null! Returning null.");
return null;
}
dataset = DatasetUtil.persistDatasetLogoToStorageAndCreateThumbnail(dataset, inputStream);
dataset = DatasetUtil.persistDatasetLogoToStorageAndCreateThumbnails(dataset, inputStream);
dataset.setThumbnailFile(null);
return merge(dataset);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ public String init() {
if (!permissionsWrapper.canIssueCommand(dataset, UpdateDatasetVersionCommand.class)) {
return permissionsWrapper.notAuthorized();
}
datasetThumbnails = DatasetUtil.getThumbnailCandidates(dataset, considerDatasetLogoAsCandidate);
datasetThumbnail = dataset.getDatasetThumbnail();
datasetThumbnails = DatasetUtil.getThumbnailCandidates(dataset, considerDatasetLogoAsCandidate, ImageThumbConverter.DEFAULT_DATASETLOGO_SIZE);
datasetThumbnail = dataset.getDatasetThumbnail(ImageThumbConverter.DEFAULT_DATASETLOGO_SIZE);
if (datasetThumbnail != null) {
DataFile dataFile = datasetThumbnail.getDataFile();
if (dataFile != null) {
Expand Down Expand Up @@ -117,7 +117,7 @@ public void setDatasetFileThumbnailToSwitchTo(DataFile datasetFileThumbnailToSwi
public void setDataFileAsThumbnail() {
logger.fine("setDataFileAsThumbnail clicked");
updateDatasetThumbnailCommand = new UpdateDatasetThumbnailCommand(dvRequestService.getDataverseRequest(), dataset, UpdateDatasetThumbnailCommand.UserIntent.setDatasetFileAsThumbnail, datasetFileThumbnailToSwitchTo.getId(), null);
String base64image = ImageThumbConverter.getImageThumbnailAsBase64(datasetFileThumbnailToSwitchTo, ImageThumbConverter.DEFAULT_CARDIMAGE_SIZE);
String base64image = ImageThumbConverter.getImageThumbnailAsBase64(datasetFileThumbnailToSwitchTo, ImageThumbConverter.DEFAULT_DATASETLOGO_SIZE);
datasetThumbnail = new DatasetThumbnail(base64image, datasetFileThumbnailToSwitchTo);
}

Expand Down Expand Up @@ -146,7 +146,7 @@ public void handleImageFileUpload(FileUploadEvent event) {
Logger.getLogger(DatasetWidgetsPage.class.getName()).log(Level.SEVERE, null, ex);
return;
}
String base64image = ImageThumbConverter.generateImageThumbnailFromFileAsBase64(file, ImageThumbConverter.DEFAULT_CARDIMAGE_SIZE);
String base64image = ImageThumbConverter.generateImageThumbnailFromFileAsBase64(file, ImageThumbConverter.DEFAULT_DATASETLOGO_SIZE);
if (base64image != null) {
datasetThumbnail = new DatasetThumbnail(base64image, datasetFileThumbnailToSwitchTo);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2573,7 +2573,7 @@ public void deleteDatasetLogoAndUseThisDataFileAsThumbnailInstead() {
}

public boolean isThumbnailIsFromDatasetLogoRatherThanDatafile() {
DatasetThumbnail datasetThumbnail = dataset.getDatasetThumbnail();
DatasetThumbnail datasetThumbnail = dataset.getDatasetThumbnail(ImageThumbConverter.DEFAULT_CARDIMAGE_SIZE);
return datasetThumbnail != null && !datasetThumbnail.isFromDataFile();
}

Expand Down
22 changes: 12 additions & 10 deletions src/main/java/edu/harvard/iq/dataverse/ThumbnailServiceWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import edu.harvard.iq.dataverse.dataaccess.ImageThumbConverter;
import edu.harvard.iq.dataverse.dataset.DatasetUtil;
import static edu.harvard.iq.dataverse.dataset.DatasetUtil.datasetLogoThumbnail;
import static edu.harvard.iq.dataverse.dataset.DatasetUtil.thumb48addedByImageThumbConverter;
import edu.harvard.iq.dataverse.search.SolrSearchResult;
import edu.harvard.iq.dataverse.util.FileUtil;
import java.io.File;
Expand Down Expand Up @@ -51,7 +50,7 @@ public class ThumbnailServiceWrapper implements java.io.Serializable {
private Map<Long, String> dvobjectThumbnailsMap = new HashMap<>();
private Map<Long, DvObject> dvobjectViewMap = new HashMap<>();

private String getAssignedDatasetImage(Dataset dataset) {
private String getAssignedDatasetImage(Dataset dataset, int size) {
if (dataset == null) {
return null;
}
Expand All @@ -70,9 +69,9 @@ private String getAssignedDatasetImage(Dataset dataset) {
return null;
}

String imageSourceBase64 = ImageThumbConverter.getImageThumbnailAsBase64(
assignedThumbnailFile,
ImageThumbConverter.DEFAULT_CARDIMAGE_SIZE);
String imageSourceBase64 = ImageThumbConverter.getImageThumbnailAsBase64(assignedThumbnailFile,
size);
//ImageThumbConverter.DEFAULT_CARDIMAGE_SIZE);

if (imageSourceBase64 != null) {
this.dvobjectThumbnailsMap.put(assignedThumbnailFileId, imageSourceBase64);
Expand Down Expand Up @@ -183,9 +182,10 @@ public String getDatasetCardImageAsBase64Url(SolrSearchResult result) {

Long versionId = result.getDatasetVersionId();

return getDatasetCardImageAsBase64Url(dataset, versionId, result.isPublishedState());
return getDatasetCardImageAsBase64Url(dataset, versionId, result.isPublishedState(), ImageThumbConverter.DEFAULT_CARDIMAGE_SIZE);
}
public String getDatasetCardImageAsBase64Url(Dataset dataset, Long versionId, boolean autoselect) {

public String getDatasetCardImageAsBase64Url(Dataset dataset, Long versionId, boolean autoselect, int size) {
Long datasetId = dataset.getId();
if (datasetId != null) {
if (this.dvobjectThumbnailsMap.containsKey(datasetId)) {
Expand Down Expand Up @@ -222,7 +222,8 @@ public String getDatasetCardImageAsBase64Url(Dataset dataset, Long versionId, bo
// an auxilary file on the dataset level:
// (don't bother checking if it exists; just try to open the input stream)
try {
in = dataAccess.getAuxFileAsInputStream(datasetLogoThumbnail + thumb48addedByImageThumbConverter);
in = dataAccess.getAuxFileAsInputStream(datasetLogoThumbnail + ".thumb" + size);
//thumb48addedByImageThumbConverter);
} catch (Exception ioex) {
//ignore
}
Expand All @@ -248,7 +249,7 @@ public String getDatasetCardImageAsBase64Url(Dataset dataset, Long versionId, bo

// If not, see if the dataset has one of its image files already assigned
// to be the designated thumbnail:
cardImageUrl = this.getAssignedDatasetImage(dataset);
cardImageUrl = this.getAssignedDatasetImage(dataset, size);

if (cardImageUrl != null) {
//logger.info("dataset id " + result.getEntity().getId() + " has a dedicated image assigned; returning " + cardImageUrl);
Expand Down Expand Up @@ -297,7 +298,8 @@ public String getDatasetCardImageAsBase64Url(Dataset dataset, Long versionId, bo
if (dataFileService.isThumbnailAvailable(thumbnailImageFile)) {
cardImageUrl = ImageThumbConverter.getImageThumbnailAsBase64(
thumbnailImageFile,
ImageThumbConverter.DEFAULT_CARDIMAGE_SIZE);
size);
//ImageThumbConverter.DEFAULT_CARDIMAGE_SIZE);
}

if (cardImageUrl != null) {
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/edu/harvard/iq/dataverse/api/Admin.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
import edu.harvard.iq.dataverse.authorization.UserRecordIdentifier;
import edu.harvard.iq.dataverse.authorization.groups.impl.explicit.ExplicitGroupServiceBean;
import edu.harvard.iq.dataverse.authorization.users.User;
import edu.harvard.iq.dataverse.dataaccess.ImageThumbConverter;
import edu.harvard.iq.dataverse.dataset.DatasetThumbnail;
import edu.harvard.iq.dataverse.dataset.DatasetUtil;
import edu.harvard.iq.dataverse.engine.command.DataverseRequest;
Expand Down Expand Up @@ -1281,9 +1282,9 @@ public Response getDatasetThumbnailMetadata(@PathParam("id") Long idSupplied) {
return error(Response.Status.NOT_FOUND, "Could not find dataset based on id supplied: " + idSupplied + ".");
}
JsonObjectBuilder data = Json.createObjectBuilder();
DatasetThumbnail datasetThumbnail = dataset.getDatasetThumbnail();
DatasetThumbnail datasetThumbnail = dataset.getDatasetThumbnail(ImageThumbConverter.DEFAULT_CARDIMAGE_SIZE);
data.add("isUseGenericThumbnail", dataset.isUseGenericThumbnail());
data.add("datasetLogoPresent", DatasetUtil.isDatasetLogoPresent(dataset));
data.add("datasetLogoPresent", DatasetUtil.isDatasetLogoPresent(dataset, ImageThumbConverter.DEFAULT_CARDIMAGE_SIZE));
if (datasetThumbnail != null) {
data.add("datasetThumbnailBase64image", datasetThumbnail.getBase64image());
DataFile dataFile = datasetThumbnail.getDataFile();
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/edu/harvard/iq/dataverse/api/Datasets.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
import edu.harvard.iq.dataverse.api.dto.RoleAssignmentDTO;
import edu.harvard.iq.dataverse.batch.util.LoggingUtil;
import edu.harvard.iq.dataverse.dataaccess.DataAccess;
import edu.harvard.iq.dataverse.dataaccess.ImageThumbConverter;
import edu.harvard.iq.dataverse.dataaccess.S3AccessIO;
import edu.harvard.iq.dataverse.engine.command.exception.CommandException;
import edu.harvard.iq.dataverse.engine.command.exception.UnforcedCommandException;
Expand Down Expand Up @@ -1218,7 +1219,7 @@ public Response getDatasetThumbnailCandidates(@PathParam("id") String idSupplied
}
JsonArrayBuilder data = Json.createArrayBuilder();
boolean considerDatasetLogoAsCandidate = true;
for (DatasetThumbnail datasetThumbnail : DatasetUtil.getThumbnailCandidates(dataset, considerDatasetLogoAsCandidate)) {
for (DatasetThumbnail datasetThumbnail : DatasetUtil.getThumbnailCandidates(dataset, considerDatasetLogoAsCandidate, ImageThumbConverter.DEFAULT_CARDIMAGE_SIZE)) {
JsonObjectBuilder candidate = Json.createObjectBuilder();
String base64image = datasetThumbnail.getBase64image();
if (base64image != null) {
Expand All @@ -1243,7 +1244,7 @@ public Response getDatasetThumbnailCandidates(@PathParam("id") String idSupplied
public Response getDatasetThumbnail(@PathParam("id") String idSupplied) {
try {
Dataset dataset = findDatasetOrDie(idSupplied);
InputStream is = DatasetUtil.getThumbnailAsInputStream(dataset);
InputStream is = DatasetUtil.getThumbnailAsInputStream(dataset, ImageThumbConverter.DEFAULT_CARDIMAGE_SIZE);
if(is == null) {
return notFound("Thumbnail not available");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public class ImageThumbConverter {

public static int DEFAULT_CARDIMAGE_SIZE = 48;
public static int DEFAULT_THUMBNAIL_SIZE = 64;
public static int DEFAULT_DATASETLOGO_SIZE = 140;
public static int DEFAULT_PREVIEW_SIZE = 400;

private static final Logger logger = Logger.getLogger(ImageThumbConverter.class.getCanonicalName());
Expand Down
Loading