knox-homepage-ui/home/app/topologies/topology.information.component.html (173 lines of code) (raw):
<!--
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.
-->
<hr/>
<div>
<h4 (click)="toggleBoolean('showTopologies')"><span [class]="'clickable inline-glyph glyhpicon glyphicon-' + (this['showTopologies'] ? 'minus' : 'plus')"></span> Topologies</h4>
</div>
<div *ngIf="this['showTopologies']">
<ng-container *ngFor="let topology of topologies">
<div>
<span [class]="'clickable inline-glyph
glyhpicon glyphicon-' + (this['showTopology_' + topology.topology] ? 'minus' : 'plus')"
(click)="toggleBoolean('showTopology_' + topology.topology)"></span>
<span (click)="toggleBoolean('showTopology_' + topology.topology)"><strong>{{topology.topology}}</strong></span>
<span class="inline-glyph glyphicon glyphicon-pushpin btn btn-xs" *ngIf="topology.pinned"
title="You may unpin this topology in gateway-site.xml by removing it from the list declared in 'knox.homepage.pinned.topologies'"
data-toggle="tooltip"></span>
<span class="inline-glyph glyphicon glyphicon-cog btn btn-xs" *ngIf="!topology.pinned"
title="You may pin this topology in gateway-site.xml using the 'knox.homepage.pinned.topologies' property"
data-toggle="tooltip"></span>
</div>
<div class="table-responsive" *ngIf="this['showTopology_' + topology.topology]">
<h5 *ngIf="topology.uiServices.service.length > 0">UI Services</h5>
<!-- UI services -->
<mat-grid-list cols="4" rowHeight="130px">
<mat-grid-tile *ngFor="let service of topology.uiServices.service" [colspan]="1" [rowspan]="1">
<!-- Services with 1 service URL -->
<div *ngIf="service.serviceUrls.length === 1">
<a href="{{service.serviceUrls[0]}}" target="_blank" *ngIf="!this['enableServiceText_' + service.serviceName.toLowerCase()]">
<img src="assets/service-logos/{{service.serviceName.toLowerCase()}}.png" height="50px" (error)="enableServiceText('enableServiceText_' + service.serviceName.toLowerCase())"/>
</a>
<a href="{{service.serviceUrls[0]}}" target="_blank" *ngIf="this['enableServiceText_' + service.serviceName.toLowerCase()]">
{{service.shortDesc}}
</a>
<mat-grid-tile-footer class="tile-shortDesc">
<h3>{{service.shortDesc}} <span class="small" *ngIf="service.version">(v{{service.version}})</span></h3>
</mat-grid-tile-footer>
<mat-grid-tile-footer class="tile-longDesc" style="height:100px;">
<h3>{{service.description}}</h3>
</mat-grid-tile-footer>
</div>
<!-- Services with more than 1 service URL -->
<div *ngIf="service.serviceUrls.length > 1" (click)="openGroupServiceInformationModal(service)">
<img src="assets/service-logos/{{service.serviceName.toLowerCase()}}.png" height="50px" (error)="enableServiceText('enableServiceText_' + service.serviceName.toLowerCase())"/>
<mat-grid-tile-footer class="tile-shortDesc">
<h3>{{service.shortDesc}} ({{service.serviceUrls.length}})</h3>
</mat-grid-tile-footer>
</div>
</mat-grid-tile>
</mat-grid-list>
<!-- API services -->
<h5 *ngIf="topology.apiServices.service.length > 0">API Services</h5>
<table *ngIf="topology.apiServicesViewVersion === 'v1'" class="table table-hover" [mfData]="topology.apiServices.service" #api="mfDataTable" [mfRowsOnPage]="5">
<colgroup>
<col width="30%">
<col width="70%">
</colgroup>
<thead>
<tr *ngIf="topology.apiServices.service.length === 0"><th colspan="2">No API services found</th></tr>
<tr *ngIf="topology.apiServices.service.length > 0"><th colspan="2">API services</th></tr>
</thead>
<tbody>
<tr *ngFor="let service of api.data">
<td>
<span class="inline-glyph glyphicon glyphicon-info-sign btn btn-xs"
title="{{service.description}}"
data-toggle="tooltip"></span>
{{service.shortDesc}} <span class="small" *ngIf="service.version">(v{{service.version}})</span>
</td>
<td>
<ng-container *ngFor="let serviceUrl of service.serviceUrls">
<a href="{{serviceUrl}}">{{serviceUrl}}</a>
<br *ngIf="service.serviceUrls.length > 1" />
</ng-container>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="4">
<mfBootstrapPaginator [rowsOnPageSet]="[5,10,15]"></mfBootstrapPaginator>
</td>
</tr>
</tfoot>
</table>
<mat-grid-list *ngIf="topology.apiServicesViewVersion === 'v2'" cols="4" rowHeight="130px">
<mat-grid-tile *ngFor="let service of topology.apiServices.service" [colspan]="1" [rowspan]="1">
<span *ngIf="!this['enableServiceText_' + service.serviceName.toLowerCase()]" (click)="openApiServiceInformationModal(service)">
<img src="assets/service-logos/{{service.serviceName.toLowerCase()}}.png" height="50px" (error)="enableServiceText('enableServiceText_' + service.serviceName.toLowerCase())"/>
</span>
<span *ngIf="this['enableServiceText_' + service.serviceName.toLowerCase()]" (click)="openApiServiceInformationModal(service)">
{{service.shortDesc}}
</span>
<mat-grid-tile-footer class="tile-shortDesc">
<h3>{{service.shortDesc}} <span class="small" *ngIf="service.version">(v{{service.version}})</span></h3>
</mat-grid-tile-footer>
<mat-grid-tile-footer class="tile-longDesc" style="height:100px;">
<h3>{{service.description}}</h3>
</mat-grid-tile-footer>
</mat-grid-tile>
</mat-grid-list>
</div>
</ng-container>
<hr />
</div>
<bs-modal #apiServiceInformationModal>
<bs-modal-header [showDismiss]="true" *ngIf="selectedApiService">
<h4 class="modal-title">{{selectedApiService.shortDesc}}</h4>
</bs-modal-header>
<bs-modal-body *ngIf="selectedApiService">
<div class="panel panel-default table-responsive">
<table class="table table-sm">
<colgroup>
<col width="25%">
<col width="75%">
</colgroup>
<tr>
<td style="font-weight: bold;">Knox Service Name</td>
<td>{{selectedApiService.serviceName}} <span class="small" *ngIf="selectedApiService.version">(v{{selectedApiService.version}})</span></td>
</tr>
<tr>
<td style="font-weight: bold;">Description</td>
<td>{{selectedApiService.description}}</td>
</tr>
<tr>
<td style="font-weight: bold;">Sample(s)</td>
<td>
<table class="table table-sm">
<div *ngIf="selectedApiService.samples && selectedApiService.samples.sample.length > 0">
<ng-container *ngFor="let sample of selectedApiService.samples.sample">
<tr><td style="font-weight: bold;">{{sample.description}}</td></tr>
<tr style="margin-bottom: 15px"><td> {{sample.value}}</tr>
</ng-container>
</div>
<div *ngIf="!selectedApiService.samples || selectedApiService.samples.sample.length < 1">
<tr><td style="font-weight: bold;">There is no any sample found in service metadata</td></tr>
<tr>
<td> You may check out the service's documentation and find out how to use its REST API. The service's URL is <a href="{{selectedApiService.serviceUrls[0]}}" target="_blank">{{selectedApiService.serviceUrls[0]}}</a></td>
</tr>
</div>
</table>
</td>
</tr>
</table>
</div>
</bs-modal-body>
<bs-modal-footer>
<button type="button" class="btn btn-primary btn-sm" (click)="apiServiceInformationModal.close()">Close</button>
</bs-modal-footer>
</bs-modal>
<bs-modal #groupServiceInformationModal cssClass="groupServiceInformationModal" [animation]="true">
<bs-modal-header [showDismiss]="true" *ngIf="selectedGroupService">
<h4 class="modal-title">{{selectedGroupService.shortDesc}} <span class="small" *ngIf="selectedGroupService.version">(v{{selectedGroupService.version}})</span></h4>
</bs-modal-header>
<bs-modal-body *ngIf="selectedGroupService">
<span>
{{selectedGroupService.description}}
</span>
<br/><br/>
<span align="center">
<input type="text" placeholder="Search by hostname, port..." (input)="filterServiceUrls($event.target.value)" style="width: 50%">
</span>
<mat-grid-list cols="4" rowHeight="130px">
<mat-grid-tile *ngFor="let serviceUrl of filteredServiceUrls" [colspan]="1" [rowspan]="1">
<a href="{{serviceUrl}}" target="_blank" *ngIf="!this['enableServiceText_' + selectedGroupService.serviceName.toLowerCase()]">
<img src="assets/service-logos/{{selectedGroupService.serviceName.toLowerCase()}}.png" height="50px" (error)="enableServiceText('enableServiceText_' + selectedGroupService.serviceName.toLowerCase())"/>
</a>
<a href="{{serviceUrl}}" target="_blank" *ngIf="this['enableServiceText_' + selectedGroupService.serviceName.toLowerCase()]">
{{selectedGroupService.shortDesc}}
</a>
<mat-grid-tile-footer class="tile-shortDesc">
<h3>{{selectedGroupService.shortDesc}} {{getServiceUrlHostAndPort(serviceUrl)}}</h3>
</mat-grid-tile-footer>
</mat-grid-tile>
</mat-grid-list>
</bs-modal-body>
<bs-modal-footer>
<button type="button" class="btn btn-primary btn-sm" (click)="groupServiceInformationModal.close()">Close</button>
</bs-modal-footer>
</bs-modal>