forked from guardian/grid
-
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.
Merge pull request guardian#3554 from guardian/group-migration-failures
introduce new grouped view of migration failures (aka 'overview')
- Loading branch information
Showing
8 changed files
with
175 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
package lib | ||
|
||
final case class FailedMigrationDetails(imageId: String, cause: String) | ||
final case class FailedMigrationDetails(imageId: String, lastModified: String, crops: String, usages: String) | ||
|
||
final case class FailedMigrationSummary(totalFailed: Long, totalFailedRelation: String, returned: Long, details: Seq[FailedMigrationDetails]) | ||
final case class FailedMigrationSummary(totalFailed: Long, details: Seq[FailedMigrationDetails]) | ||
|
||
final case class FailedMigrationsGrouping(message: String, count: Long, exampleIDs: Seq[String]) | ||
|
||
final case class FailedMigrationsOverview(totalFailed: Long, grouped: Seq[FailedMigrationsGrouping]) |
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 |
---|---|---|
|
@@ -5,41 +5,40 @@ | |
failures: FailedMigrationSummary, | ||
apiBaseUrl: String, | ||
uiBaseUrl: String, | ||
filter: String, | ||
page: Int, | ||
) | ||
|
||
@navigation = { | ||
@if(page > 1) { | ||
<a href="?page=@(page - 1)">Previous page</a> | ||
<a href="@routes.ThrallController.migrationFailures(filter, Some(page - 1))">Previous page</a> | ||
} | ||
<a href="?page=@(page + 1)">Next page</a> | ||
} | ||
|
||
@totalFailures = @{ | ||
(failures.totalFailedRelation match { | ||
case "lte" | "lt" => "Less than " | ||
case "gte" | "gt" => "More than " | ||
case _ => "" | ||
}) + failures.totalFailed + " images failed in total!" | ||
<a href="@routes.ThrallController.migrationFailures(filter, Some(page + 1))">Next page</a> | ||
} | ||
|
||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Migration Failures - Page @(page)</title> | ||
<title>Migration Failures - Page @(page) - @filter</title> | ||
<link rel="stylesheet" href="@routes.Assets.versioned("stylesheets/main.css")" /> | ||
</head> | ||
<body> | ||
<h1> | ||
Migration Failures - Page @(page) | ||
</h1> | ||
<p>@totalFailures</p> | ||
@navigation | ||
<div class="sticky headingSection"> | ||
<a href="@routes.ThrallController.migrationFailuresOverview()">< back to Migration Failures Overview</a> | ||
<h1> | ||
Migration Failures - Page @(page) - <code>@filter</code> | ||
</h1> | ||
<p>@failures.totalFailed images failed with the above message!</p> | ||
@navigation | ||
</div> | ||
|
||
<table> | ||
<tr> | ||
<tr class="sticky headingRow"> | ||
<th>Image ID</th> | ||
<th>Failure cause</th> | ||
<th>Last Modified</th> | ||
<th>Crop Count</th> | ||
<th>Usage Count</th> | ||
<th>Click to reattempt migration</th> | ||
</tr> | ||
@for(failure <- failures.details) { | ||
|
@@ -48,7 +47,15 @@ <h1> | |
<a href="@uiBaseUrl/images/@failure.imageId" target="_blank">[Grid]</a> | ||
<a href="@apiBaseUrl/images/@failure.imageId" target="_blank">[API]</a> | ||
</td> | ||
<td>@failure.cause</td> | ||
<td>@failure.lastModified</td> | ||
<td>@failure.crops</td> | ||
<td> | ||
@failure.usages | ||
<br/> | ||
<a href="https://content.guardianapis.com/[email protected]&format=json&api-key=[KEY]"> | ||
Full Usage Search in CAPI | ||
</a> | ||
</td> | ||
<td>@form(action = routes.ThrallController.migrateSingleImage){ | ||
<label for="id" class="hidden">Image ID:</label> | ||
<input type="text" id="id" value="@failure.imageId" name="id" class="hidden"> | ||
|
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,51 @@ | ||
@import lib.FailedMigrationsOverview | ||
@( | ||
failuresOverview: FailedMigrationsOverview, | ||
apiBaseUrl: String, | ||
uiBaseUrl: String | ||
) | ||
|
||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Migration Failures Overview</title> | ||
<link rel="stylesheet" href="@routes.Assets.versioned("stylesheets/main.css")" /> | ||
</head> | ||
<body> | ||
<div class="sticky headingSection"> | ||
<h1> | ||
Migration Failures Overview | ||
</h1> | ||
<p>@failuresOverview.totalFailed images failed in total!</p> | ||
</div> | ||
<table> | ||
<tr> | ||
<th>Failure cause</th> | ||
<th>Count</th> | ||
<th>Examples</th> | ||
</tr> | ||
@for(failureGrouping <- failuresOverview.grouped) { | ||
<tr> | ||
<td> | ||
<a href="@routes.ThrallController.migrationFailures(failureGrouping.message, None)"> | ||
@failureGrouping.message | ||
</a> | ||
</td> | ||
<td>@failureGrouping.count</td> | ||
<td> | ||
<ul> | ||
@for(failureExampleID <- failureGrouping.exampleIDs) { | ||
<li> | ||
<pre class="imageId">@failureExampleID</pre> | ||
<a href="@uiBaseUrl/images/@failureExampleID" target="_blank">[Grid]</a> | ||
<a href="@apiBaseUrl/images/@failureExampleID" target="_blank">[API]</a> | ||
</li> | ||
} | ||
</ul> | ||
</td> | ||
</tr> | ||
} | ||
</table> | ||
</body> | ||
</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
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