-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tdrd 487 results of your metadata checks UI download errors in excel …
…file (#4149) Support flow to get metadata error download button
- Loading branch information
Showing
13 changed files
with
527 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package services | ||
|
||
import configuration.ApplicationConfig | ||
import software.amazon.awssdk.core.ResponseBytes | ||
import software.amazon.awssdk.core.async.AsyncResponseTransformer | ||
import software.amazon.awssdk.services.s3.S3AsyncClient | ||
import software.amazon.awssdk.services.s3.model.{GetObjectRequest, GetObjectResponse} | ||
import uk.gov.nationalarchives.aws.utils.s3.S3Clients._ | ||
|
||
import javax.inject.Inject | ||
import scala.concurrent.{ExecutionContext, Future} | ||
import scala.jdk.FutureConverters.CompletionStageOps | ||
|
||
class DownloadService @Inject() (val applicationConfig: ApplicationConfig)(implicit val ec: ExecutionContext) { | ||
private val s3Endpoint = applicationConfig.s3Endpoint | ||
|
||
def downloadFile(bucket: String, key: String): Future[ResponseBytes[GetObjectResponse]] = { | ||
downloadFile(bucket, key, s3Async(s3Endpoint)) | ||
} | ||
|
||
def downloadFile(bucket: String, key: String, s3AsyncClient: S3AsyncClient): Future[ResponseBytes[GetObjectResponse]] = { | ||
val getObjectRequest = GetObjectRequest.builder.bucket(bucket).key(key).build() | ||
s3AsyncClient.getObject(getObjectRequest, AsyncResponseTransformer.toBytes[GetObjectResponse]).asScala | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
app/views/draftmetadata/draftMetadataChecksErrorsNoDownload.scala.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@import views.html.partials._ | ||
|
||
@import java.util.UUID | ||
@(consignmentId: UUID, consignmentRef: String, name: String, actionMessage: String, detailsMessage: String)(implicit request: RequestHeader, messages: Messages) | ||
|
||
@main("Results of CSV Checks", name = name) { | ||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
@draftMetadataChecksActionProcess(actionMessage, detailsMessage) | ||
<p class="govuk-body">Once you have addressed this issue upload a revised metadata file.</p> | ||
|
||
<div class="govuk-button-group"> | ||
<a class="govuk-button" href="@{ | ||
routes.DraftMetadataUploadController.draftMetadataUploadPage(consignmentId) | ||
}" role="button" draggable="false" data-module="govuk-button">Re-upload metadata</a> | ||
</div> | ||
|
||
</div> | ||
@transferReference(consignmentRef, isJudgmentUser = false) | ||
</div> | ||
} |
33 changes: 33 additions & 0 deletions
33
app/views/draftmetadata/draftMetadataChecksWithErrorDownload.scala.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
@import views.html.partials._ | ||
|
||
@import java.util.UUID | ||
@(consignmentId: UUID, consignmentRef: String, name: String, actionMessage: String, detailsMessage: String)(implicit request: RequestHeader, messages: Messages) | ||
|
||
@main("Results of CSV Checks", name = name) { | ||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
@draftMetadataChecksActionProcess(actionMessage, detailsMessage) | ||
|
||
<p class="govuk-body">The report below contains details about issues found.</p> | ||
|
||
<button class="govuk-button govuk-button--secondary govuk-!-margin-bottom-8" data-module="govuk-button"> | ||
<span aria-hidden="true" class="tna-button-icon tna-button-icon--download"> | ||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 23 23"> | ||
<path fill="#020202" d="m11.5 16.75-6.563-6.563 1.838-1.903 3.412 3.413V1h2.626v10.697l3.412-3.413 1.837 1.903L11.5 16.75ZM3.625 22c-.722 0-1.34-.257-1.853-.77A2.533 2.533 0 0 1 1 19.375v-3.938h2.625v3.938h15.75v-3.938H22v3.938c0 .722-.257 1.34-.77 1.855a2.522 2.522 0 0 1-1.855.77H3.625Z"/> | ||
</svg> | ||
</span> | ||
Download report | ||
</button> | ||
|
||
<p class="govuk-body">Once you have addressed this issue upload a revised metadata file.</p> | ||
|
||
<div class="govuk-button-group"> | ||
<a class="govuk-button" href="@{ | ||
routes.DraftMetadataUploadController.draftMetadataUploadPage(consignmentId) | ||
}" role="button" draggable="false" data-module="govuk-button">Re-upload metadata</a> | ||
</div> | ||
|
||
</div> | ||
@transferReference(consignmentRef, isJudgmentUser = false) | ||
</div> | ||
} |
37 changes: 37 additions & 0 deletions
37
app/views/partials/draftMetadataChecksActionProcess.scala.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
@(actionMessage: String, detailsMessage: String)(implicit request: RequestHeader, messages: Messages) | ||
|
||
<h1 class="govuk-heading-l"> | ||
Results of your metadata checks | ||
</h1> | ||
<p class="govuk-body">There was an issue with your uploaded metadata file.</p> | ||
|
||
<p class="govuk-body"></p> | ||
|
||
<dl class="govuk-summary-list"> | ||
<div class="govuk-summary-list__row"> | ||
<dt class="govuk-summary-list__key"> | ||
Status | ||
</dt> | ||
<dd class="govuk-summary-list__value"> | ||
<strong class="govuk-tag govuk-tag--orange">Issues found</strong> | ||
</dd> | ||
</div> | ||
|
||
<div class="govuk-summary-list__row"> | ||
<dt class="govuk-summary-list__key"> | ||
Details | ||
</dt> | ||
<dd class="govuk-summary-list__value"> | ||
@detailsMessage | ||
</dd> | ||
</div> | ||
|
||
<div class="govuk-summary-list__row"> | ||
<dt class="govuk-summary-list__key"> | ||
Action | ||
</dt> | ||
<dd class="govuk-summary-list__value"> | ||
@actionMessage | ||
</dd> | ||
</div> | ||
</dl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.