Skip to content

Commit

Permalink
Merge pull request #296 from clowder-framework/release/1.19.1
Browse files Browse the repository at this point in the history
Release/1.19.1
  • Loading branch information
lmarini committed Oct 20, 2021
2 parents cefe45a + cfdcb46 commit efb78f3
Show file tree
Hide file tree
Showing 19 changed files with 209 additions and 185 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ jobs:
- clowder
- mongo-init
- monitor
- check
include:
- name: clowder
FOLDER: "."
Expand All @@ -50,10 +49,6 @@ jobs:
FOLDER: scripts/monitor
IMAGE: monitor
README: ""
- name: check
FOLDER: scripts/check
IMAGE: check
README: ""
steps:
- uses: actions/checkout@v2

Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## 1.19.1 - 2021-10-19

### Added
- Support the [DefaultAWSCredentialsProviderChain](https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/DefaultAWSCredentialsProviderChain.html)
for passing in credentials to the S3ByteStorageService.

### Fixed
- Cleaning up after a failed upload should no longer decrement the file + byte counts.
- Fix the broken preview after file deletion within a folder. [#277](https://github.com/clowder-framework/clowder/issues/277)
- Fix public spaces not displaying correctly if not logged in.

### Changed
- Now building mongo-init and monitor docker containers with python 3.8
- Upgraded extractor parameters jsonform to version `2.2.5`.

### Removed
- Check image is now part of [ncsa/checks](https://github.com/ncsa/checks/)

## 1.19.0 - 2021-10-05
**_Important:_** This update requires a MongoDB update schema due to the new ability of showing summary statistics at the
space level. Make sure to start the application with -DMONGOUPDATE=1.
Expand Down
18 changes: 18 additions & 0 deletions app/api/Folders.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import scala.collection.mutable.ListBuffer
class Folders @Inject() (
folders: FolderService,
datasets: DatasetService,
collections: CollectionService,
files: FileService,
events: EventService,
routing: ExtractorRoutingService) extends ApiController {
Expand Down Expand Up @@ -316,6 +317,23 @@ class Folders @Inject() (
if(dataset.files.contains(fileId)) {
folders.addFile(newFolder.id, fileId)
datasets.removeFile(datasetId, fileId)

// when moving a file in the root of a dataset inside a folder
// check if that file has been used as thumbnail
// if yes, update the thumbnail of both dataset and collection
if(!file.thumbnail_id.isEmpty && !dataset.thumbnail_id.isEmpty){
if (file.thumbnail_id.get.equals(dataset.thumbnail_id.get)){
datasets.newThumbnail(dataset.id)
collections.get(dataset.collections).found.foreach(collection => {
if(!collection.thumbnail_id.isEmpty){
if(collection.thumbnail_id.get.equals(dataset.thumbnail_id.get)){
collections.createThumbnail(collection.id)
}
}
})
}
}

files.index(fileId)
datasets.index(datasetId)
Ok(toJson(Map("status" -> "success", "fileName" -> file.filename, "folderName" -> newFolder.name)))
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/Spaces.scala
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class Spaces @Inject() (spaces: SpaceService, users: UserService, events: EventS
val collectionsInSpace = spaces.getCollectionsInSpace(Some(id.stringify), Some(size))
val datasetsInSpace = datasets.listSpace(size, id.toString(), user)
val spaceBytes : Long = s.spaceBytes
val spaceFiles : Integer = getFilesPerSpace(id, user.get)
val spaceFiles : Integer = getFilesPerSpace(id, user)
val publicDatasetsInSpace = datasets.listSpaceStatus(size, id.toString(), "publicAll", user)
val usersInSpace = spaces.getUsersInSpace(id, None)
var curationObjectsInSpace: List[CurationObject] = List()
Expand Down Expand Up @@ -641,9 +641,9 @@ class Spaces @Inject() (spaces: SpaceService, users: UserService, events: EventS
}
}

private def getFilesPerSpace(spaceId: UUID, user: models.User) : Integer = {
private def getFilesPerSpace(spaceId: UUID, user: Option[User]) : Integer = {
var spaceFiles: Integer = 0
val allDatasetsInSpace = datasets.listSpace(0, spaceId.toString(), Some(user))
val allDatasetsInSpace = datasets.listSpace(0, spaceId.toString(), user)
for (ds <- allDatasetsInSpace) {
val files_in_ds = ds.files.length
spaceFiles += files_in_ds
Expand Down
8 changes: 6 additions & 2 deletions app/services/mongodb/MongoDBFileService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -847,20 +847,24 @@ class MongoDBFileService @Inject() (
}
}


// delete the actual file
if(isLastPointingToLoader(file.loader, file.loader_id)) {
val fileSize = if(isLastPointingToLoader(file.loader, file.loader_id)) {
for(preview <- previews.findByFileId(file.id)){
previews.removePreview(preview)
}
if(!file.thumbnail_id.isEmpty)
thumbnails.remove(UUID(file.thumbnail_id.get))
ByteStorageService.delete(file.loader, file.loader_id, FileDAO.COLLECTION)
file.length
} else {
0
}

import UUIDConversions._
FileDAO.removeById(file.id)
appConfig.incrementCount('files, -1)
appConfig.incrementCount('bytes, -file.length)
appConfig.incrementCount('bytes, -1 * fileSize)
current.plugin[ElasticsearchPlugin].foreach {
_.delete(id.stringify)
}
Expand Down

0 comments on commit efb78f3

Please sign in to comment.