dnet-docker/dnet-app/frontends/is/src/app/oai-explorer/oai-explorer.component.html

247 lines
7.7 KiB
HTML

<h2>Oai Explorer</h2>
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;">
<mat-label>OAI BaseUrl</mat-label>
<input matInput [(ngModel)]="oaiBaseUrl" />
<button mat-stroked-button matSuffix color="primary" (click)="pageInfo()" [disabled]="!oaiBaseUrl">
Info
</button>
<button mat-stroked-button matSuffix color="primary" (click)="pageSets()" [disabled]="!oaiBaseUrl">
Sets
</button>
<button mat-stroked-button matSuffix color="primary" (click)="pageFormats()" [disabled]="!oaiBaseUrl">
MD Formats
</button>
<button mat-stroked-button matSuffix color="primary" (click)="pageRecords(undefined, undefined, undefined)"
[disabled]="!oaiBaseUrl">
Records
</button>
<button mat-stroked-button matSuffix color="primary" (click)="pageIdentifiers(undefined, undefined, undefined)"
[disabled]="!oaiBaseUrl" style="margin-right: 0.5em;">
Identifiers
</button>
</mat-form-field>
<p>
<span *ngIf="oaiResponse.url">
<b>OAI URL: </b>
<a href="{{oaiResponse.url}}" target="_blank" *ngIf="oaiResponse.url">{{oaiResponse.url}}</a>
<br />
</span>
<span *ngIf="oaiResponse.verb"><b>OAI Verb: </b> {{oaiResponse.verb}}<br /></span>
<span *ngIf="oaiResponse.httpCode"><b>Response Code: </b> {{oaiResponse.httpCode}}<br /></span>
<span *ngIf="oaiResponse.time"><b>Response Time: </b> {{oaiResponse.time}} ms<br /></span>
</p>
<p>
<span *ngIf="oaiResponse.size > 0 || oaiResponse.total > 0 || oaiResponse.cursor > 0">
<b>Cursor: </b>{{oaiResponse.cursor}}<br />
</span>
<span *ngIf="oaiResponse.size > 0"><b>Size: </b> {{oaiResponse.size}}<br /></span>
<span *ngIf="oaiResponse.total > 0"><b>Total: </b> {{oaiResponse.total}}<br /></span>
<span *ngIf="oaiResponse.resumptionToken && page == 2">
<b>Next Page: </b>
<a (click)="pageSets(oaiResponse.resumptionToken)">{{oaiResponse.resumptionToken}}</a>
</span>
<span *ngIf="oaiResponse.resumptionToken && page == 4">
<b>Next Page: </b>
<a (click)="pageRecords(undefined, undefined, oaiResponse.resumptionToken)">{{oaiResponse.resumptionToken}}</a>
</span>
<span *ngIf="oaiResponse.resumptionToken && page == 5">
<b>Next Page: </b>
<a (click)="pageIdentifiers(undefined, undefined, oaiResponse.resumptionToken)">{{oaiResponse.resumptionToken}}</a>
</span>
</p>
<mat-card *ngIf="!oaiResponse.valid" style="margin-top: 2em;">
<mat-card-content>
<pre>{{oaiResponse.error}}</pre>
</mat-card-content>
</mat-card>
<!-- INFO -->
<mat-card *ngIf="oaiResponse.valid && page == 1" style="margin-top: 2em;">
<mat-card-content>
<table>
<tr>
<th align="left" width="20%">Repository Name</th>
<td>{{oaiResponse.body.repositoryName}}</td>
</tr>
<tr>
<th align="left" width="20%">Base URL</th>
<td>{{oaiResponse.body.baseURL}}</td>
</tr>
<tr>
<th align="left" width="20%">Protocol Version</th>
<td>{{oaiResponse.body.protocolVersion}}</td>
</tr>
<tr>
<th align="left" width="20%">Earliest Datestamp</th>
<td>{{oaiResponse.body.earliestDatestamp}}</td>
</tr>
<tr>
<th align="left" width="20%">Deleted Record</th>
<td>{{oaiResponse.body.deletedRecord}}</td>
</tr>
<tr>
<th align="left" width="20%">Granularity</th>
<td>{{oaiResponse.body.granularity}}</td>
</tr>
<tr *ngFor="let email of oaiResponse.body.adminEmails">
<th align="left" width="20%">Admin Email</th>
<td>{{email}}</td>
</tr>
<tr *ngFor="let c of oaiResponse.body.compressions">
<th align="left" width="20%">Compression</th>
<td>{{c}}</td>
</tr>
<tr *ngFor="let desc of oaiResponse.body.descriptions">
<th align="left" width="20%">Description</th>
<td>{{desc}}</td>
</tr>
</table>
</mat-card-content>
</mat-card>
<!-- SETS -->
<ng-container *ngIf="oaiResponse.valid && page == 2 && oaiResponse.body && oaiResponse.body.length">
<mat-card *ngFor=" let s of oaiResponse.body" style="margin-top: 2em;">
<mat-card-content>
<table>
<tr>
<th align="left" width="20%">Set Spec</th>
<td>{{s.setSpec}}</td>
</tr>
<tr>
<th align="left" width="20%">Set Name</th>
<td>{{s.setName}}</td>
</tr>
<tr *ngIf="s.description">
<th align="left" width="20%">Description</th>
<td>{{s.description}}</td>
</tr>
</table>
</mat-card-content>
<mat-card-actions>
<button mat-stroked-button matSuffix color="primary" (click)="pageRecords(s.setSpec, undefined, undefined)">
Records
</button>
<button mat-stroked-button matSuffix color="primary" (click)="pageIdentifiers(s.setSpec, undefined, undefined)">
Identifiers
</button>
</mat-card-actions>
</mat-card>
</ng-container>
<!-- FORMATS -->
<ng-container *ngIf="oaiResponse.valid && page == 3 && oaiResponse.body && oaiResponse.body.length">
<mat-card *ngFor=" let f of oaiResponse.body" style="margin-top: 2em;">
<mat-card-content>
<table>
<tr>
<th align="left" width="20%">Metadata Prefix</th>
<td>{{f.metadataPrefix}}</td>
</tr>
<tr>
<th align="left" width="20%">Metadata Namespace</th>
<td>{{f.metadataNamespace}}</td>
</tr>
<tr>
<th align="left" width="20%">Metadata Schema</th>
<td>{{f.metadataSchema}}</td>
</tr>
</table>
</mat-card-content>
<mat-card-actions>
<button mat-stroked-button matSuffix color="primary"
(click)="pageRecords(undefined, f.metadataPrefix, undefined)">
Records
</button>
<button mat-stroked-button matSuffix color="primary"
(click)="pageIdentifiers(undefined, f.metadataPrefix, undefined)">
Identifiers
</button>
</mat-card-actions>
</mat-card>
</ng-container>
<!-- Records -->
<ng-container *ngIf="oaiResponse.valid && page == 4 && oaiResponse.body && oaiResponse.body.length">
<mat-card *ngFor=" let r of oaiResponse.body" style="margin-top: 2em;">
<mat-card-content>
<table>
<tr>
<th align="left" width="20%">ID</th>
<td>{{r.id}} <span class="badge-label badge-failure" *ngIf="r.deleted == true">deleted</span></td>
</tr>
<tr>
<th align="left" width="20%">Date</th>
<td>{{r.date}}</td>
</tr>
<tr *ngFor="let s of r.sets">
<th align="left" width="20%">In Set</th>
<td>{{s}}</td>
</tr>
</table>
</mat-card-content>
<mat-card-content style="overflow: scroll;">
<pre>{{r.body | xml}}</pre>
</mat-card-content>
</mat-card>
</ng-container>
<!-- Identifiers -->
<ng-container *ngIf="oaiResponse.valid && page == 5 && oaiResponse.body && oaiResponse.body.length">
<mat-card *ngFor=" let r of oaiResponse.body" style="margin-top: 2em;">
<mat-card-content>
<table>
<tr>
<th align="left" width="20%">ID</th>
<td>{{r.id}} <span class="badge-label badge-failure" *ngIf="r.deleted == true">deleted</span></td>
</tr>
<tr>
<th align="left" width="20%">Date</th>
<td>{{r.date}}</td>
</tr>
<tr *ngFor="let s of r.sets">
<th align="left" width="20%">In Set</th>
<td>{{s}}</td>
</tr>
</table>
</mat-card-content>
<mat-card-actions>
<button mat-stroked-button matSuffix color="primary" (click)="pageSingleRecord(r.id, currFormat)">
Get Record
</button>
</mat-card-actions>
</mat-card>
</ng-container>
<!-- Single Record -->
<mat-card *ngIf="oaiResponse.valid && page == 6 && oaiResponse.body">
<mat-card-content>
<table>
<tr>
<th align="left" width="20%">ID</th>
<td>
{{oaiResponse.body.id}} <span class="badge-label badge-failure"
*ngIf="oaiResponse.body.deleted == true">deleted</span>
</td>
</tr>
<tr>
<th align="left" width="20%">Date</th>
<td>{{oaiResponse.body.date}}</td>
</tr>
<tr *ngFor="let s of oaiResponse.body.sets">
<th align="left" width="20%">In Set</th>
<td>{{s}}</td>
</tr>
</table>
</mat-card-content>
<mat-card-content>
<pre>{{oaiResponse.body.body | xml}}</pre>
</mat-card-content>
</mat-card>