ocket8888 commented on a change in pull request #5086:
URL: https://github.com/apache/trafficcontrol/pull/5086#discussion_r501212918



##########
File path: traffic_portal/app/src/common/modules/table/jobs/table.jobs.tpl.html
##########
@@ -22,34 +22,53 @@
         <ol class="breadcrumb pull-left">
             <li class="active">Invalidation Requests</li>
         </ol>
-        <div class="pull-right" role="group" ng-show="!settings.isNew">
-            <button class="btn btn-primary" title="Create Invalidation 
Request" ng-click="createJob()"><i class="fa fa-plus"></i></button>
-            <button class="btn btn-default" title="Refresh" 
ng-click="refresh()"><i class="fa fa-refresh"></i></button>
+        <div class="pull-right">
+            <div class="form-inline" role="search">
+                <input id="quickSearch" name="quickSearch" type="search" 
class="form-control text-input" placeholder="Quick search..." 
ng-model="quickSearch" ng-change="onQuickSearchChanged()" aria-label="Search"/>
+                <div class="input-group text-input">
+                    <span class="input-group-addon">
+                        <label for="pageSize">Page size</label>
+                    </span>
+                    <input id="pageSize" name="pageSize" type="number" 
class="form-control" placeholder="100" ng-model="pageSize" 
ng-change="onPageSizeChanged()" aria-label="Page Size"/>

Review comment:
       nit but you don't need an aria-label if you have an actual label. I 
don't think it's hurting anything, though.

##########
File path: 
traffic_portal/app/src/common/modules/table/jobs/TableJobsController.js
##########
@@ -17,10 +17,134 @@
  * under the License.
  */
 
-var TableJobsController = function(jobs, $scope, $state, locationUtils) {
+var TableJobsController = function(tableName, jobs, $document, $scope, $state, 
$uibModal, locationUtils, jobService, messageModel, dateUtils) {
+
+       /**
+        * Gets value to display a default tooltip.
+        */
+       function defaultTooltip(params) {
+               return params.value;
+       }
+
+       function dateCellFormatter(params) {
+               return params.value.toUTCString();
+       }
+
+       columns = [
+               {
+                       headerName: "Delivery Service",
+                       field: "deliveryService",
+                       hide: false
+               },
+               {
+                       headerName: "Asset URL",
+                       field: "assetUrl",
+                       hide: false
+               },
+               {
+                       headerName: "Parameters",
+                       field: "parameters",
+                       hide: false
+               },
+               {
+                       headerName: "Start (UTC)",
+                       field: "startTime",
+                       hide: false,
+                       filter: "agDateColumnFilter",
+                       tooltip: dateCellFormatter,
+                       valueFormatter: dateCellFormatter
+               },
+               {
+                       headerName: "Expires (UTC)",
+                       field: "expires",
+                       hide: false,
+                       filter: "agDateColumnFilter",
+                       tooltip: dateCellFormatter,
+                       valueFormatter: dateCellFormatter
+               },
+               {
+                       headerName: "Created By",
+                       field: "createdBy",
+                       hide: false
+               }
+       ];
+
+       /** All of the jobs - startTime fields converted to actual Dates and 
derived expires field from TTL */
+       $scope.jobs = jobs.map(
+               function(x) {
+                       // need to convert this to a date object for ag-grid 
filter to work properly
+                       x.startTime = new Date(x.startTime.replace("+00", "Z"));
+
+                       // going to derive the expires date from start + TTL 
(hours). Format: TTL:24h
+                       let ttl = parseInt(x.parameters.slice('TTL:'.length, 
x.parameters.length-1), 10);
+                       x.expires = new Date(x.startTime.getTime() + 
ttl*3600*1000);
+               });
 
        $scope.jobs = jobs;
 
+       $scope.quickSearch = '';
+
+       $scope.pageSize = 100;
+
+       /** Options, configuration, data and callbacks for the ag-grid table. */
+       $scope.gridOptions = {
+               columnDefs: columns,
+               enableCellTextSelection: true,
+               defaultColDef: {
+                       filter: true,
+                       sortable: true,
+                       resizable: true,
+                       tooltip: defaultTooltip
+               },
+               rowClassRules: {
+                       'active-job': function(params) {
+                               return new Date(params.data.expires) > new 
Date();

Review comment:
       expires is already a Date according to the `.map` you did before, so 
this construction should be redundant.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to