<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at
      http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<div>

    <div>
        <button (click)="gotoTokenGenerationPage();">Generate New Token</button>
        <button type="button" title="Refresh Knox Tokens" (click)="fetchKnoxTokens();">
            <span class="glyphicon glyphicon-refresh"></span>
        </button>
    </div>
    <div class="table-responsive" style="width:100%; overflow: auto; overflow-y: scroll">
        <table class="table table-hover" [mfData]="knoxTokens" #mf="mfDataTable" [mfRowsOnPage]="10">
            <thead>
            <tr>
                <th>Token ID</th>
                <th>Issued</th>
                <th>Expires</th>
                <th>Comment</th>
                <th>Actions</th>
            </tr>
            </thead>
            <tbody>
            <tr *ngFor="let knoxToken of mf.data">
                <td>{{knoxToken.tokenId}}</td>
                <td>{{formatDateTime(knoxToken.issueTimeLong)}}</td>
                <td>{{formatDateTime(knoxToken.expirationLong)}}</td>
                <td>{{knoxToken.metadata.comment}}</td>
                <td>
                    <button *ngIf="knoxToken.metadata.enabled" (click)="disableToken(knoxToken.tokenId);">Disable</button>
                    <button *ngIf="!knoxToken.metadata.enabled" (click)="enableToken(knoxToken.tokenId);">Enable</button>
                    <button (click)="revokeToken(knoxToken.tokenId);">Revoke</button>
                </td>
            </tr>
            </tbody>
		    <tfoot>
		    <tr>
		        <td colspan="5">
		            <mfBootstrapPaginator [rowsOnPageSet]="[5,10,15]"></mfBootstrapPaginator>
		        </td>
		    </tr>
		    </tfoot>
        </table>
    </div>
</div>

