Skip to content

Commit

Permalink
Updates the order of TonY Portal records and adds UI for user sorting…
Browse files Browse the repository at this point in the history
…/filtering (#354)

* *Creates sorted table of TonY records*

When viewing the TonY Portal page, the records are displayed in a random order. This fix displays TonY records sorted by most recent process completion date.

* *Adds custom toString() method to class JobMetadata*

When printing a JobMetadata object using the built in toString() method, a string representation of the object is printed rather than the metadata associated with each object (id, user, started, completed, etc). This fix prints out the associated values for each JobMetadata object when using the toString() method.

* fixed line length

* *Updated toString() function to remove new lines *

In my original toString() function, I included new lines in
the returned string to better display the output.
It’s preferable in this case to retain the default output and
allow the user to construct their own custum string.
Also in this change, I  perform a minor fix to merge the
first two string segments of the output where before
they were separate strings.

* *Updated toString() function to remove new lines *

In my original toString() function, I included new lines in
the returned string to better display the output.
It’s preferable in this case to retain the default output and
allow the user to construct their own custum string.
Also in this change, I  perform a minor fix to merge the
first two string segments of the output where before
they were separate strings.

* *Updates TonY Portal Default View to Order by Multiple Fields*

On the TonY portal, jobs are currently ordered by completed
date.  However jobs that are in progress (without a completed date)
retain a random order.  This change fixes this issue by ordering
records first by completed date (desc), then by started date( desc),
and then by username (asc). Therefore, if multiple records have
identical completed date timestamps these records will be ordered
by start date. And if multiple records have identical start and complete
timestamps, then these will be ordered by username.

* *Adds User Sorting and Filtering Functionality to Tony Portal Page*

Currently on the TonY Portal, by default records are sorted first by
completed date, then started date, then user id. There is no user
initiated sorting or filtering functionality. This update adds the ability
to sort by column and filter by keyword.  In addition, Bootstrap is
added to enhance the table format.

* *Replaces CDNs with local file copies on TonY Portal*

When utilizing the TonY portal, users will need to be
online in order to enable the sorting/filtering mechanism
of the TonY portal in addition to bootstrap formatting
due to the usage of CDNs of various packages such as
bootstrap, jquery, and datatables. This update replaces
the original CDNs with local copies of the relevant
files in order for TonY portal to work offline in
addition to online.

* 072319 erwa review fixes

* * Fixes issue with testPlayBinary *

Encountered an issue in which assets are
not present in the classloader during
testPlayBinary, but are present during
runPlayBinary.  Will open an issue on
the Play Git repo for them to take a look.
In the meantime, this fix adds the project
directory to the classpath in order for
the assets to load during testPlay. In
addition, this commit fixes a minor
formatting issue in tableMetadata.scala.html.

* * Updated Java jdk *

Java jdk updated to openjdk8 from oraclejdk8.
Change was done to pass travis CI as per
UWFrankGu's comment.
  • Loading branch information
i-ony authored Aug 5, 2019
1 parent 27202d5 commit e7ba614
Show file tree
Hide file tree
Showing 36 changed files with 579 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: java
git:
depth: 3
jdk:
- oraclejdk8
- openjdk8
env:
- HADOOP_VERSION=3.1.1
script: "./gradlew clean check --stacktrace --info"
Expand Down
8 changes: 4 additions & 4 deletions tony-portal/app/controllers/JobsMetadataPageController.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ public Result index() {

return ok(views.html.metadata.render(cache.asMap().values()
.stream()
.sorted(Comparator.comparingLong(JobMetadata::getCompleted).reversed())
.sorted((Comparator
.comparingLong(JobMetadata::getCompleted)
.thenComparingLong(JobMetadata::getStarted)).reversed()
.thenComparing(JobMetadata::getUser))
.collect(Collectors.toList())));
}
}



133 changes: 112 additions & 21 deletions tony-portal/app/views/tableMetadata.scala.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,38 @@
@(metricsList: Collection[JobMetadata])

<table>
<html>

<head>

<!-- Required meta tags for Bootstrap-->
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>

<!-- Bootstrap core CSS -->
<link rel="stylesheet" media="screen"
href='@routes.Assets.versioned("portal_assets/bootstrap-4.3.1-dist/css/bootstrap.min.css")'>

<style>

.rmv_elmt {
color: rgba(0, 0, 0, 0)
}

body {
margin: 12px;
}

</style>

</head>

<body>


<table id="table_id" class="display">

<thead>
<tr>
<th>App ID</th>
<th>Configuration</th>
Expand All @@ -10,25 +42,84 @@
<th>Status</th>
<th>ResourceManager Link</th>
</tr>
</thead>

<tbody>
@for(s <- metricsList) {
<tr>
<td>
<a href=@s.getJobLink target="_blank">@s.getId</a>
</td>
<td>
<a href=@s.getConfigLink target="_blank">tony-final.xml</a>
</td>
<td>@s.getStartedDate.format(Constants.TIME_FORMAT)</td>
@if(s.getCompleted == -1) {
<td>-</td>
} else {
<td>@s.getCompletedDate.format(Constants.TIME_FORMAT)</td>
}
<td>@s.getUser</td>
<td>@s.getStatus</td>
<td>
<a href=@s.getRMLink target="_blank">Link</a>
</td>
</tr>
<tr>
<td>
<a href=@s.getJobLink target="_blank">@s.getId</a>
</td>
<td>
<a href=@s.getConfigLink target="_blank">tony-final.xml</a>
</td>
<td>@s.getStartedDate.format(Constants.TIME_FORMAT)</td>
@if(s.getCompleted == -1) {
<td>-</td>
} else {
<td>@s.getCompletedDate.format(Constants.TIME_FORMAT)</td>
}
<td>@s.getUser</td>
<td>@s.getStatus</td>
<td>
<a href=@s.getRMLink target="_blank">Link</a>
</td>
</tr>
}
</table>
</tbody>

@* rmv_elmt tags the labels that will not have a footer filter*@

<tfoot>
<tr>
<th>App ID</th>
<th>Configuration</th>
<th>Started</th>
<th>Completed</th>
<th>User</th>
<th>Status</th>
<th class="rmv_elmt">ResourceManager Link</th>
</tr>
</tfoot>
</table>
</body>


<script type="text/javascript" src='@routes.Assets.versioned("portal_assets/jquery-3.4.1.slim.min.js")'></script>
<link rel="stylesheet" media="screen"
href='@routes.Assets.versioned("portal_assets/DataTables/DataTables-1.10.18/css/jquery.dataTables.min.css")'>
<script type="text/javascript"
src='@routes.Assets.versioned("portal_assets/DataTables/DataTables-1.10.18/js/jquery.dataTables.min.js")'></script>
<script type="text/javascript" src='@routes.Assets.versioned("portal_assets/popper.min.js")'></script>
<script type="text/javascript"
src='@routes.Assets.versioned("portal_assets/bootstrap-4.3.1-dist/js/bootstrap.min.js")'></script>


<script type="text/javascript">

$(document).ready(function () {
// Setup - add a text input to each footer cell except the rmv_elmt value
$('#table_id tfoot th').each(function (i) {
var title = $('#table_id tfoot th').eq($(this).index()).text();
if (title != "ResourceManager Link") {
$(this).html('<input type="text" placeholder="Search ' + title + '" data-index="' + i + '" />');
}
});

var table = $('#table_id').DataTable({
paging: true,
fixedColumns: true
});

// Filter event handler
$(table.table().container()).on('keyup', 'tfoot input', function () {
table
.column($(this).data('index'))
.search(this.value)
.draw();
});
});

</script>

</html>
3 changes: 3 additions & 0 deletions tony-portal/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ model {
baseName = "${project.name}-${project.version}"
}
}
tasks.testPlayBinary {
classpath.add project.files("$projectDir")
}
}

// To avoid conflicts with Play's logback binding
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e7ba614

Please sign in to comment.