mstore list page
This commit is contained in:
parent
1491e8a5d2
commit
c9c0ac00b8
|
@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
public class SwaggerController {
|
||||
|
||||
@RequestMapping(value = {
|
||||
"/docs", "swagger-ui.html", "swagger-ui/"
|
||||
"/", "/docs", "swagger-ui.html", "swagger-ui/"
|
||||
})
|
||||
public String apiDoc() {
|
||||
return "redirect:swagger-ui/index.html";
|
||||
|
|
|
@ -12,7 +12,6 @@ import eu.dnetlib.dhp.schema.mdstore.MDStoreVersion;
|
|||
import eu.dnetlib.dhp.schema.mdstore.MDStoreWithInfo;
|
||||
import eu.dnetlib.errors.MDStoreManagerException;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
|
||||
public class AbstractMDStoreController extends AbstractDnetController {
|
||||
|
||||
|
@ -27,32 +26,26 @@ public class AbstractMDStoreController extends AbstractDnetController {
|
|||
|
||||
@Operation(summary = "Return a mdstores by id")
|
||||
@GetMapping("/mdstore/{mdId}")
|
||||
public MDStoreWithInfo getMdStore(@Parameter(name = "the mdstore identifier") @PathVariable final String mdId) throws MDStoreManagerException {
|
||||
public MDStoreWithInfo getMdStore(@PathVariable final String mdId) throws MDStoreManagerException {
|
||||
return service.findMdStore(mdId);
|
||||
}
|
||||
|
||||
@Operation(summary = "Increase the read count of the current mdstore")
|
||||
@GetMapping("/mdstore/{mdId}/startReading")
|
||||
public MDStoreVersion startReading(@Parameter(name = "the mdstore identifier") @PathVariable final String mdId) throws MDStoreManagerException {
|
||||
return service.startReading(mdId);
|
||||
}
|
||||
|
||||
@Operation(summary = "Create a new mdstore")
|
||||
@PostMapping("/new/{format}/{layout}/{interpretation}")
|
||||
public MDStoreWithInfo createMDStore(
|
||||
@Parameter(name = "mdstore format") @PathVariable final String format,
|
||||
@Parameter(name = "mdstore layout") @PathVariable final String layout,
|
||||
@Parameter(name = "mdstore interpretation") @PathVariable final String interpretation,
|
||||
@Parameter(name = "datasource name") @RequestParam(required = true) final String dsName,
|
||||
@Parameter(name = "datasource id") @RequestParam(required = true) final String dsId,
|
||||
@Parameter(name = "api id") @RequestParam(required = true) final String apiId) throws MDStoreManagerException {
|
||||
@PathVariable final String format,
|
||||
@PathVariable final String layout,
|
||||
@PathVariable final String interpretation,
|
||||
@RequestParam(required = true) final String dsName,
|
||||
@RequestParam(required = true) final String dsId,
|
||||
@RequestParam(required = true) final String apiId) throws MDStoreManagerException {
|
||||
final String id = service.createMDStore(format, layout, interpretation, dsName, dsId, apiId);
|
||||
return service.findMdStore(id);
|
||||
}
|
||||
|
||||
@Operation(summary = "Delete a mdstore by id")
|
||||
@DeleteMapping("/mdstore/{mdId}")
|
||||
public StatusResponse delete(@Parameter(name = "the id of the mdstore that will be deleted") @PathVariable final String mdId)
|
||||
public StatusResponse delete(@PathVariable final String mdId)
|
||||
throws MDStoreManagerException {
|
||||
service.deleteMdStore(mdId);
|
||||
|
||||
|
@ -68,15 +61,15 @@ public class AbstractMDStoreController extends AbstractDnetController {
|
|||
@Operation(summary = "Create a new preliminary version of a mdstore")
|
||||
@GetMapping("/mdstore/{mdId}/newVersion")
|
||||
public MDStoreVersion prepareNewVersion(
|
||||
@Parameter(name = "the id of the mdstore for which will be created a new version") @PathVariable final String mdId) {
|
||||
@PathVariable final String mdId) {
|
||||
return service.prepareMdStoreVersion(mdId);
|
||||
}
|
||||
|
||||
@Operation(summary = "Promote a preliminary version to current")
|
||||
@GetMapping("/version/{versionId}/commit/{size}")
|
||||
public MDStoreVersion commitVersion(
|
||||
@Parameter(name = "the id of the version that will be promoted to the current version") @PathVariable final String versionId,
|
||||
@Parameter(name = "the size of the new current mdstore") @PathVariable final long size) throws MDStoreManagerException {
|
||||
@PathVariable final String versionId,
|
||||
@PathVariable final long size) throws MDStoreManagerException {
|
||||
try {
|
||||
return service.commitMdStoreVersion(versionId, size);
|
||||
} finally {
|
||||
|
@ -86,7 +79,7 @@ public class AbstractMDStoreController extends AbstractDnetController {
|
|||
|
||||
@Operation(summary = "Abort a preliminary version")
|
||||
@GetMapping("/version/{versionId}/abort")
|
||||
public StatusResponse commitVersion(@Parameter(name = "the id of the version to abort") @PathVariable final String versionId)
|
||||
public StatusResponse commitVersion(@PathVariable final String versionId)
|
||||
throws MDStoreManagerException {
|
||||
|
||||
service.deleteMdStoreVersion(versionId, true);
|
||||
|
@ -96,15 +89,15 @@ public class AbstractMDStoreController extends AbstractDnetController {
|
|||
|
||||
@Operation(summary = "Return an existing mdstore version")
|
||||
@GetMapping("/version/{versionId}")
|
||||
public MDStoreVersion getVersion(@Parameter(name = "the id of the version that has to be deleted") @PathVariable final String versionId)
|
||||
public MDStoreVersion getVersion(@PathVariable final String versionId)
|
||||
throws MDStoreManagerException {
|
||||
return service.findVersion(versionId);
|
||||
}
|
||||
|
||||
@Operation(summary = "Delete a mdstore version")
|
||||
@DeleteMapping("/version/{versionId}")
|
||||
public StatusResponse deleteVersion(@Parameter(name = "the id of the version that has to be deleted") @PathVariable final String versionId,
|
||||
@Parameter(name = "if true, the controls on writing and readcount values will be skipped") @RequestParam(required = false, defaultValue = "false") final boolean force)
|
||||
public StatusResponse deleteVersion(@PathVariable final String versionId,
|
||||
@RequestParam(required = false, defaultValue = "false") final boolean force)
|
||||
throws MDStoreManagerException {
|
||||
|
||||
service.deleteMdStoreVersion(versionId, force);
|
||||
|
@ -114,15 +107,13 @@ public class AbstractMDStoreController extends AbstractDnetController {
|
|||
|
||||
@Operation(summary = "Decrease the read count of a mdstore version")
|
||||
@GetMapping("/version/{versionId}/endReading")
|
||||
public MDStoreVersion endReading(@Parameter(name = "the id of the version that has been completely read") @PathVariable final String versionId)
|
||||
throws MDStoreManagerException {
|
||||
public MDStoreVersion endReading(@PathVariable final String versionId) throws MDStoreManagerException {
|
||||
return service.endReading(versionId);
|
||||
}
|
||||
|
||||
@Operation(summary = "Reset the read count of a mdstore version")
|
||||
@GetMapping("/version/{versionId}/resetReading")
|
||||
public MDStoreVersion resetReading(@Parameter(name = "the id of the version") @PathVariable final String versionId)
|
||||
throws MDStoreManagerException {
|
||||
public MDStoreVersion resetReading(@PathVariable final String versionId) throws MDStoreManagerException {
|
||||
return service.resetReading(versionId);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import eu.dnetlib.errors.MDStoreManagerException;
|
|||
public class MDInspectorController {
|
||||
|
||||
@Autowired
|
||||
private MDStoreService databaseUtils;
|
||||
private MDStoreService service;
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(MDInspectorController.class);
|
||||
|
||||
|
@ -32,12 +32,12 @@ public class MDInspectorController {
|
|||
|
||||
if (isMdstoreId(id)) {
|
||||
log.debug("MDSTORE: " + id);
|
||||
md = databaseUtils.findMdStore(id);
|
||||
ver = databaseUtils.findVersion(md.getCurrentVersion());
|
||||
md = service.findMdStore(id);
|
||||
ver = service.findVersion(md.getCurrentVersion());
|
||||
} else {
|
||||
log.debug("VERSION: " + id);
|
||||
ver = databaseUtils.findVersion(id);
|
||||
md = databaseUtils.findMdStore(ver.getMdstore());
|
||||
ver = service.findVersion(id);
|
||||
md = service.findMdStore(ver.getMdstore());
|
||||
}
|
||||
|
||||
map.addAttribute("mdId", md.getId());
|
||||
|
|
|
@ -10,9 +10,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import eu.dnetlib.dhp.schema.mdstore.MDStoreVersion;
|
||||
import eu.dnetlib.errors.MDStoreManagerException;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
@RestController
|
||||
|
@ -26,13 +26,19 @@ public class MDStoreApiController extends AbstractMDStoreController {
|
|||
return service.listMdStoreIDs();
|
||||
}
|
||||
|
||||
@Operation(summary = "Increase the read count of the current mdstore")
|
||||
@GetMapping("/mdstore/{mdId}/startReading")
|
||||
public MDStoreVersion startReading(@PathVariable final String mdId) throws MDStoreManagerException {
|
||||
return service.startReading(mdId);
|
||||
}
|
||||
|
||||
@Operation(summary = "Fix the inconsistencies on HDFS")
|
||||
@GetMapping("/hdfs/inconsistencies")
|
||||
public Set<String> fixHdfsInconsistencies(
|
||||
@Parameter(name = "force the deletion of hdfs paths") @RequestParam(required = false, defaultValue = "false") final boolean delete)
|
||||
@RequestParam(required = false, defaultValue = "false") final boolean forceDelete)
|
||||
throws MDStoreManagerException {
|
||||
|
||||
return service.fixHdfsInconsistencies(delete);
|
||||
return service.fixHdfsInconsistencies(forceDelete);
|
||||
}
|
||||
|
||||
@Operation(summary = "Delete expired versions")
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
package eu.dnetlib.data.mdstore;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
|
@ -51,12 +54,15 @@ public class MDStoreService {
|
|||
|
||||
private static final Logger log = LoggerFactory.getLogger(MDStoreService.class);
|
||||
|
||||
public Iterable<MDStoreWithInfo> listMdStores() {
|
||||
return mdstoreWithInfoRepository.findAll();
|
||||
public List<MDStoreWithInfo> listMdStores() {
|
||||
|
||||
return StreamSupport.stream(mdstoreWithInfoRepository.findAll().spliterator(), false)
|
||||
.sorted(Comparator.comparing((Function<MDStoreWithInfo, String>) md -> md.getDatasourceName()).thenComparing(md -> md.getId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<String> listMdStoreIDs() {
|
||||
return mdstoreRepository.findAll().stream().map(MDStore::getId).collect(Collectors.toList());
|
||||
return mdstoreRepository.findAll().stream().map(MDStore::getId).sorted().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public long countMdStores() {
|
||||
|
@ -64,7 +70,7 @@ public class MDStoreService {
|
|||
}
|
||||
|
||||
public Iterable<MDStoreVersion> listVersions(final String mdId) {
|
||||
return mdstoreVersionRepository.findByMdstore(mdId);
|
||||
return mdstoreVersionRepository.findByMdstoreOrderById(mdId);
|
||||
}
|
||||
|
||||
public List<String> listExpiredVersions() {
|
||||
|
|
|
@ -14,6 +14,6 @@ public interface MDStoreVersionRepository extends JpaRepository<MDStoreVersion,
|
|||
|
||||
long countByMdstoreAndReadCountGreaterThan(String id, int count);
|
||||
|
||||
Iterable<MDStoreVersion> findByMdstore(String mdId);
|
||||
Iterable<MDStoreVersion> findByMdstoreOrderById(String mdId);
|
||||
|
||||
}
|
||||
|
|
|
@ -275,11 +275,15 @@ export class ISService {
|
|||
});
|
||||
}
|
||||
|
||||
deleteMDStoreVersion(versionId:string, force:boolean, onSuccess: Function) {
|
||||
let params = new HttpParams();
|
||||
if (force) { params = params.append('force', true); }
|
||||
deleteMDStoreVersion(versionId:string, onSuccess: Function) {
|
||||
this.client.delete<any>('./ajax/mdstores/version/' + encodeURIComponent(versionId)).subscribe({
|
||||
next: data => onSuccess(data),
|
||||
error: error => this.showError(error)
|
||||
});
|
||||
}
|
||||
|
||||
this.client.delete<any>('./ajax/mdstores/version/' + encodeURIComponent(versionId), {params: params}).subscribe({
|
||||
resetReadingMDStoreVersion(versionId:string, onSuccess: Function) {
|
||||
this.client.get<any>('./ajax/mdstores/version/' + encodeURIComponent(versionId) + '/resetReading').subscribe({
|
||||
next: data => onSuccess(data),
|
||||
error: error => this.showError(error)
|
||||
});
|
||||
|
|
|
@ -1,50 +1,51 @@
|
|||
<form [formGroup]="newMdstoreForm" (ngSubmit)="onSubmit()">
|
||||
<h1 mat-dialog-title>New MDStore</h1>
|
||||
|
||||
<div mat-dialog-content>
|
||||
<h1 mat-dialog-title>New MDStore</h1>
|
||||
|
||||
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;">
|
||||
<mat-label>Format</mat-label>
|
||||
<input matInput formControlName="format" />
|
||||
<mat-error *ngIf="newMdstoreForm.get('format')?.invalid">This field is <strong>required</strong></mat-error>
|
||||
</mat-form-field>
|
||||
<div mat-dialog-content>
|
||||
|
||||
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;">
|
||||
<mat-label>Layout</mat-label>
|
||||
<input matInput formControlName="layout" />
|
||||
<mat-error *ngIf="newMdstoreForm.get('layout')?.invalid">This field is <strong>required</strong></mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;">
|
||||
<mat-label>Format</mat-label>
|
||||
<input matInput formControlName="format" />
|
||||
<mat-error *ngIf="newMdstoreForm.get('format')?.invalid">This field is <strong>required</strong></mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;">
|
||||
<mat-label>Interpretation</mat-label>
|
||||
<input matInput formControlName="interpretation" />
|
||||
<mat-error *ngIf="newMdstoreForm.get('interpretation')?.invalid">This field is <strong>required</strong></mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;">
|
||||
<mat-label>Layout</mat-label>
|
||||
<input matInput formControlName="layout" />
|
||||
<mat-error *ngIf="newMdstoreForm.get('layout')?.invalid">This field is <strong>required</strong></mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;">
|
||||
<mat-label>Datasource Name</mat-label>
|
||||
<input matInput formControlName="dsName" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;">
|
||||
<mat-label>Interpretation</mat-label>
|
||||
<input matInput formControlName="interpretation" />
|
||||
<mat-error *ngIf="newMdstoreForm.get('interpretation')?.invalid">This field is
|
||||
<strong>required</strong></mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;">
|
||||
<mat-label>Datasource ID</mat-label>
|
||||
<input matInput formControlName="dsId" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;">
|
||||
<mat-label>Datasource Name</mat-label>
|
||||
<input matInput formControlName="dsName" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;">
|
||||
<mat-label>API ID</mat-label>
|
||||
<input matInput formControlName="apiId" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;">
|
||||
<mat-label>Datasource ID</mat-label>
|
||||
<input matInput formControlName="dsId" />
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;">
|
||||
<mat-label>API ID</mat-label>
|
||||
<input matInput formControlName="apiId" />
|
||||
</mat-form-field>
|
||||
|
||||
<div mat-dialog-actions>
|
||||
<button mat-stroked-button color="primary" type="submit" [disabled]="!newMdstoreForm.valid">Submit</button>
|
||||
<button mat-stroked-button color="primary" mat-dialog-close>Close</button>
|
||||
<mat-error *ngIf="newMdstoreForm.errors?.['serverError']">
|
||||
{{ newMdstoreForm.errors?.['serverError'] }}
|
||||
</mat-error>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<div mat-dialog-actions>
|
||||
<button mat-stroked-button color="primary" type="submit" [disabled]="!newMdstoreForm.valid">Submit</button>
|
||||
<button mat-stroked-button color="primary" mat-dialog-close>Close</button>
|
||||
<mat-error *ngIf="newMdstoreForm.errors?.['serverError']">
|
||||
{{ newMdstoreForm.errors?.['serverError'] }}
|
||||
</mat-error>
|
||||
</div>
|
||||
|
||||
</form>
|
|
@ -1,48 +1,45 @@
|
|||
<h1 mat-dialog-title>MDStore Versions</h1>
|
||||
|
||||
<div mat-dialog-content>
|
||||
<p class="small" style="text-align: right;">
|
||||
<input type="checkbox" [(ngModel)]="forceDelete" />
|
||||
force delete
|
||||
</p>
|
||||
|
||||
<table class="mdstore-table small">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 50%">ID</th>
|
||||
<th style="width: 20%; text-align: center;">Read Count</th>
|
||||
<th style="width: 20%; text-align: center;">Last Update</th>
|
||||
<th style="width: 10%; text-align: right;">Size</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let v of versions" [ngClass]="{'active-row': v.id == data.currentVersion}">
|
||||
<td>
|
||||
<mat-icon fontIcon="edit" *ngIf="v.writing" title="writing..."></mat-icon>
|
||||
<b> {{v.id}}</b>
|
||||
<br />
|
||||
<span class="small"><b>Path:</b> {{v.hdfsPath}}</span><br />
|
||||
<button mat-stroked-button color="primary" (click)="openInspectorPage(v)">inspect</button>
|
||||
<button mat-stroked-button color="basic" *ngIf="v.writing"
|
||||
(click)="commitVersion(v)">commit</button>
|
||||
<button mat-stroked-button color="warn" *ngIf="v.writing"
|
||||
ng-click="abortVersion(v.id)">abort</button>
|
||||
<button mat-stroked-button color="warn" *ngIf="v.id != data.currentVersion"
|
||||
ng-click="deleteVersion(v.id, forceVersionDelete)">delete</button>
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
{{v.readCount}}
|
||||
<button mat-stroked-button color="primary" (click)="resetReading(v)"
|
||||
[disabled]="v.readCount == 0">reset</button>
|
||||
</td>
|
||||
<td style="text-align: center;" title="{{v.lastUpdate}}">{{v.lastUpdate | date:"MMM dd, yyyy 'at' HH:mm"}}</td>
|
||||
<td style="text-align: right;">{{v.size}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div style="text-align: right;">
|
||||
<button mat-stroked-button color="primary" (click)="reload()">refresh</button>
|
||||
</div>
|
||||
<table class="mdstore-table small">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 50%">ID</th>
|
||||
<th style="width: 20%; text-align: center;">Read Count</th>
|
||||
<th style="width: 20%; text-align: center;">Last Update</th>
|
||||
<th style="width: 10%; text-align: right;">Size</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let v of versions" [ngClass]="{'active-row': v.id == data.currentVersion}">
|
||||
<td title="{{v.hdfsPath}}">
|
||||
<mat-icon fontIcon="edit" *ngIf="v.writing" title="writing..."></mat-icon>
|
||||
<b> {{v.id}}</b>
|
||||
<br />
|
||||
<span class="small"><b>Path:</b> {{v.hdfsPath}}</span><br />
|
||||
<button mat-stroked-button color="primary" (click)="openInspectorPage(v)">inspect</button>
|
||||
<button mat-stroked-button color="basic" *ngIf="v.writing" (click)="commitVersion(v)">commit</button>
|
||||
<button mat-stroked-button color="warn" *ngIf="v.writing" (click)="abortVersion(v)">abort</button>
|
||||
<button mat-stroked-button color="warn" *ngIf="!v.writing && v.readCount == 0 && v.id != data.currentVersion"
|
||||
(click)="deleteVersion(v)">delete</button>
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
{{v.readCount}}
|
||||
<button mat-stroked-button color="primary" (click)="resetReading(v)"
|
||||
[disabled]="v.readCount == 0">reset</button>
|
||||
</td>
|
||||
<td style="text-align: center;" title="{{v.lastUpdate}}">{{v.lastUpdate | date:"MMM dd,
|
||||
yyyy 'at' HH:mm"}}</td>
|
||||
<td style="text-align: right;">{{v.size}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<div mat-dialog-actions>
|
||||
<button mat-stroked-button color="primary" mat-dialog-close>Close</button>
|
||||
<button mat-stroked-button color="primary" mat-dialog-close>Close</button>
|
||||
</div>
|
|
@ -1,33 +1,33 @@
|
|||
.mdstore-table {
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
border-collapse: collapse;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.mdstore-table tr:not(:last-child) {
|
||||
border-bottom: 1pt solid lightgrey;
|
||||
border-bottom: 1pt solid lightgrey;
|
||||
}
|
||||
|
||||
.mdstore-table th, .mdstore-table td{
|
||||
text-align: left;
|
||||
font-size: 0.9em;
|
||||
vertical-align: top;
|
||||
padding-left: 1em;
|
||||
padding-right: 1em;
|
||||
.mdstore-table th,
|
||||
.mdstore-table td {
|
||||
text-align: left;
|
||||
font-size: 0.9em;
|
||||
vertical-align: top;
|
||||
padding-left: 1em;
|
||||
padding-right: 1em;
|
||||
}
|
||||
|
||||
.mdstore-table td button, .mdstore-table td a.mdc-button {
|
||||
font-size: 0.8em !important;
|
||||
padding: 0 !important;
|
||||
height: 2.5em !important;
|
||||
.mdstore-table td button,
|
||||
.mdstore-table td a.mdc-button {
|
||||
font-size: 0.8em !important;
|
||||
padding: 0 !important;
|
||||
height: 2.5em !important;
|
||||
}
|
||||
|
||||
.mdstore-table tr.active-row {
|
||||
background-color: #daffda;
|
||||
background-color: #daffda;
|
||||
}
|
||||
|
||||
.mdstore-table mat-icon {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
font-size: 1em;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
font-size: 1em;
|
||||
}
|
|
@ -1,60 +1,61 @@
|
|||
<h2>Metadata Stores</h2>
|
||||
|
||||
<button mat-stroked-button color="primary" (click)="openAddMdstoreDialog()">create a new mdstore</button>
|
||||
<button mat-stroked-button color="primary" (click)="reload()">refresh</button>
|
||||
|
||||
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%; margin-top: 10px;">
|
||||
<mat-label><b>Filter</b> (Total: {{(mdstores | searchFilter: searchText).length}})</mat-label>
|
||||
<input matInput [(ngModel)]="searchText" placeholder="Filter..." autofocus />
|
||||
<mat-label><b>Filter</b> (Total: {{(mdstores | searchFilter: searchText).length}})</mat-label>
|
||||
<input matInput [(ngModel)]="searchText" placeholder="Filter..." autofocus />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-card *ngFor="let md of mdstores | searchFilter: searchText" style="margin-top: 10px;">
|
||||
<mat-card-header>
|
||||
<mat-card-title>{{md.id}}</mat-card-title>
|
||||
<mat-card-subtitle>{{md.datasourceName}}</mat-card-subtitle>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<table class="mdstore-table">
|
||||
<tr>
|
||||
<th style="width: 30%">Format / Layout / Interpretation</th>
|
||||
<td style="width: 70%">{{md.format}} / {{md.layout}} / {{md.interpretation}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Datasource</th>
|
||||
<td>
|
||||
<b>Name:</b> {{md.datasourceName}}<br />
|
||||
<b>ID:</b> {{md.datasourceId}}<br />
|
||||
<b>API:</b> {{md.apiId}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Creation Date</th>
|
||||
<td>{{md.creationDate}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Last Update</th>
|
||||
<td>{{md.lastUpdate}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Size</th>
|
||||
<td>{{md.size}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>HDFS Path</th>
|
||||
<td>{{md.hdfsPath}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Versions</th>
|
||||
<td>
|
||||
<a (click)="openVersionsDialog(md)">{{md.numberOfVersions}} version(s)</a>
|
||||
/
|
||||
<a (click)="createNewVersion(md)">prepare new version</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
<a [routerLink]="['/mdrecords/' + md.currentVersion + '/50']" mat-stroked-button color="primary">inspect</a>
|
||||
<button mat-stroked-button color="warn" (click)="deleteMdstore(md)">delete</button>
|
||||
<button mat-stroked-button color="info">zeppelin</button>
|
||||
</mat-card-actions>
|
||||
<mat-card-header>
|
||||
<mat-card-title>{{md.id}}</mat-card-title>
|
||||
<mat-card-subtitle>{{md.datasourceName}}</mat-card-subtitle>
|
||||
</mat-card-header>
|
||||
<mat-card-content style="padding-top: 1em; padding-bottom: 1em;">
|
||||
<table class="mdstore-table">
|
||||
<tr>
|
||||
<th style="width: 30%">Format / Layout / Interpretation</th>
|
||||
<td style="width: 70%">{{md.format}} / {{md.layout}} / {{md.interpretation}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Datasource</th>
|
||||
<td>
|
||||
<b>Name:</b> {{md.datasourceName}}<br />
|
||||
<b>ID:</b> {{md.datasourceId}}<br />
|
||||
<b>API:</b> {{md.apiId}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Creation Date</th>
|
||||
<td>{{md.creationDate}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Last Update</th>
|
||||
<td>{{md.lastUpdate}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Size</th>
|
||||
<td>{{md.size}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>HDFS Path</th>
|
||||
<td>{{md.hdfsPath}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Versions</th>
|
||||
<td>
|
||||
<a (click)="openVersionsDialog(md)">{{md.numberOfVersions}} version(s)</a>
|
||||
/
|
||||
<a (click)="createNewVersion(md)">prepare new version</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
<a [routerLink]="['/mdrecords/' + md.currentVersion + '/50']" mat-stroked-button color="primary">inspect</a>
|
||||
<button mat-stroked-button color="warn" (click)="deleteMdstore(md)">delete</button>
|
||||
<button mat-stroked-button color="info">zeppelin</button>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
|
@ -6,148 +6,148 @@ import { MDStore, MDStoreVersion } from '../common/is.model';
|
|||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'app-mdstores',
|
||||
templateUrl: './mdstores.component.html',
|
||||
styleUrls: ['./mdstores.component.css']
|
||||
selector: 'app-mdstores',
|
||||
templateUrl: './mdstores.component.html',
|
||||
styleUrls: ['./mdstores.component.css']
|
||||
})
|
||||
export class MdstoresComponent implements OnInit {
|
||||
|
||||
mdstores:MDStore[] = [];
|
||||
searchText:string = '';
|
||||
mdstores: MDStore[] = [];
|
||||
searchText: string = '';
|
||||
|
||||
constructor(public service: ISService, public route: ActivatedRoute, public dialog: MatDialog) {}
|
||||
constructor(public service: ISService, public route: ActivatedRoute, public dialog: MatDialog) { }
|
||||
|
||||
ngOnInit() { this.reload() }
|
||||
reload() { this.service.loadMDStores((data: MDStore[]) => this.mdstores = data); }
|
||||
ngOnInit() { this.reload() }
|
||||
reload() { this.service.loadMDStores((data: MDStore[]) => this.mdstores = data); }
|
||||
|
||||
openVersionsDialog(md:MDStore): void {
|
||||
const dialogRef = this.dialog.open(MDStoreVersionsDialog, {
|
||||
data: md,
|
||||
width: '80%'
|
||||
});
|
||||
openVersionsDialog(md: MDStore): void {
|
||||
const dialogRef = this.dialog.open(MDStoreVersionsDialog, {
|
||||
data: md,
|
||||
width: '80%'
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
if (result) this.reload();
|
||||
});
|
||||
}
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
if (result) this.reload();
|
||||
});
|
||||
}
|
||||
|
||||
openAddMdstoreDialog(): void {
|
||||
const dialogRef = this.dialog.open(AddMDStoreDialog, {
|
||||
data: {},
|
||||
width: '80%'
|
||||
});
|
||||
openAddMdstoreDialog(): void {
|
||||
const dialogRef = this.dialog.open(AddMDStoreDialog, {
|
||||
data: {},
|
||||
width: '80%'
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
if (result) this.reload();
|
||||
});
|
||||
}
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
if (result) this.reload();
|
||||
});
|
||||
}
|
||||
|
||||
createNewVersion(md:MDStore): void {
|
||||
this.service.prepareNewMDStoreVersion(md.id, (data:MDStoreVersion) => {
|
||||
md.numberOfVersions = md.numberOfVersions + 1;
|
||||
this.openVersionsDialog(md);
|
||||
});
|
||||
}
|
||||
createNewVersion(md: MDStore): void {
|
||||
this.service.prepareNewMDStoreVersion(md.id, (data: MDStoreVersion) => {
|
||||
md.numberOfVersions = md.numberOfVersions + 1;
|
||||
this.openVersionsDialog(md);
|
||||
});
|
||||
}
|
||||
|
||||
deleteMdstore(md:MDStore) {
|
||||
if (confirm('Are you sure?')) {
|
||||
this.service.deleteMDStore(md.id, (data: void) => this.reload());
|
||||
}
|
||||
}
|
||||
deleteMdstore(md: MDStore) {
|
||||
if (confirm('Are you sure?')) {
|
||||
this.service.deleteMDStore(md.id, (data: void) => this.reload());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-mdstore-inspector',
|
||||
templateUrl: './mdstore-inspector.component.html',
|
||||
styleUrls: ['./mdstores.component.css']
|
||||
selector: 'app-mdstore-inspector',
|
||||
templateUrl: './mdstore-inspector.component.html',
|
||||
styleUrls: ['./mdstores.component.css']
|
||||
})
|
||||
export class MdstoreInspectorComponent {
|
||||
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'mdstores-versions-dialog',
|
||||
templateUrl: './mdstores-versions-dialog.html',
|
||||
styleUrls: ['./mdstores.component.css']
|
||||
selector: 'mdstores-versions-dialog',
|
||||
templateUrl: './mdstores-versions-dialog.html',
|
||||
styleUrls: ['./mdstores.component.css']
|
||||
})
|
||||
export class MDStoreVersionsDialog {
|
||||
forceDelete:boolean = false;
|
||||
versions:MDStoreVersion[] = [];
|
||||
|
||||
constructor(public dialogRef: MatDialogRef<MDStoreVersionsDialog>, @Inject(MAT_DIALOG_DATA) public data: any, public service: ISService, public router: Router) {
|
||||
this.reload();
|
||||
}
|
||||
versions: MDStoreVersion[] = [];
|
||||
|
||||
reload() {
|
||||
this.service.loadMDStoreVersions(this.data.id, (res:MDStoreVersion[]) => this.versions = res);
|
||||
}
|
||||
constructor(public dialogRef: MatDialogRef<MDStoreVersionsDialog>, @Inject(MAT_DIALOG_DATA) public data: any, public service: ISService, public router: Router) {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
openInspectorPage(version:MDStoreVersion):void {
|
||||
const url = this.router.serializeUrl(
|
||||
this.router.createUrlTree(['/mdrecords/' + encodeURIComponent(version.id) + '/50'])
|
||||
);
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
reload() {
|
||||
this.service.loadMDStoreVersions(this.data.id, (res: MDStoreVersion[]) => this.versions = res);
|
||||
}
|
||||
|
||||
resetReading(version:MDStoreVersion):void {
|
||||
//TODO
|
||||
}
|
||||
openInspectorPage(version: MDStoreVersion): void {
|
||||
const url = this.router.serializeUrl(
|
||||
this.router.createUrlTree(['/mdrecords/' + encodeURIComponent(version.id) + '/50'])
|
||||
);
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
|
||||
commitVersion(version:MDStoreVersion):void {
|
||||
let size:number = parseInt(prompt("New Size", "0") || "0");
|
||||
if (size >= 0) {
|
||||
this.service.commitMDStoreVersion(version.id, size, (data:void) => {
|
||||
this.reload();
|
||||
//TODO this version should be promoved as current
|
||||
});
|
||||
}
|
||||
}
|
||||
resetReading(version: MDStoreVersion): void {
|
||||
this.service.resetReadingMDStoreVersion(version.id, (data: void) => version.readCount = 0);
|
||||
}
|
||||
|
||||
abortVersion(version:MDStoreVersion):void {
|
||||
this.service.abortMDStoreVersion(version.id, (data:void) => this.reload());
|
||||
}
|
||||
commitVersion(version: MDStoreVersion): void {
|
||||
let size: number = parseInt(prompt("New Size", "0") || "0");
|
||||
if (size >= 0) {
|
||||
this.service.commitMDStoreVersion(version.id, size, (data: void) => {
|
||||
this.data.currentVersion = version.id;
|
||||
this.reload();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
deleteVersion(version:MDStoreVersion):void {
|
||||
this.service.deleteMDStoreVersion(version.id, this.forceDelete, (data:void) => this.reload());
|
||||
}
|
||||
abortVersion(version: MDStoreVersion): void {
|
||||
this.service.abortMDStoreVersion(version.id, (data: void) => this.reload());
|
||||
}
|
||||
|
||||
onNoClick(): void {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
deleteVersion(version: MDStoreVersion): void {
|
||||
this.service.deleteMDStoreVersion(version.id, (data: void) => this.reload());
|
||||
}
|
||||
|
||||
onNoClick(): void {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'add-mdstore-dialog',
|
||||
templateUrl: './add-mdstore-dialog.html',
|
||||
styleUrls: ['./mdstores.component.css']
|
||||
selector: 'add-mdstore-dialog',
|
||||
templateUrl: './add-mdstore-dialog.html',
|
||||
styleUrls: ['./mdstores.component.css']
|
||||
})
|
||||
export class AddMDStoreDialog {
|
||||
|
||||
newMdstoreForm = new FormGroup({
|
||||
format: new FormControl('', [Validators.required]),
|
||||
layout : new FormControl('', [Validators.required]),
|
||||
interpretation : new FormControl('', [Validators.required]),
|
||||
dsName : new FormControl(''),
|
||||
dsId : new FormControl(''),
|
||||
apiId : new FormControl(''),
|
||||
});
|
||||
newMdstoreForm = new FormGroup({
|
||||
format: new FormControl('', [Validators.required]),
|
||||
layout: new FormControl('', [Validators.required]),
|
||||
interpretation: new FormControl('', [Validators.required]),
|
||||
dsName: new FormControl(''),
|
||||
dsId: new FormControl(''),
|
||||
apiId: new FormControl(''),
|
||||
});
|
||||
|
||||
constructor(public dialogRef: MatDialogRef<MDStoreVersionsDialog>, @Inject(MAT_DIALOG_DATA) public data: any, public service: ISService) {
|
||||
constructor(public dialogRef: MatDialogRef<MDStoreVersionsDialog>, @Inject(MAT_DIALOG_DATA) public data: any, public service: ISService) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
onSubmit():void {
|
||||
let format:string = this.newMdstoreForm.get('format')?.value!;
|
||||
let layout:string = this.newMdstoreForm.get('layout')?.value!;
|
||||
let interpretation:string = this.newMdstoreForm.get('interpretation')?.value!;
|
||||
let dsName:string = this.newMdstoreForm.get('dsName')?.value!;
|
||||
let dsId:string = this.newMdstoreForm.get('dsId')?.value!;
|
||||
let apiId:string = this.newMdstoreForm.get('apiId')?.value!;
|
||||
onSubmit(): void {
|
||||
let format: string = this.newMdstoreForm.get('format')?.value!;
|
||||
let layout: string = this.newMdstoreForm.get('layout')?.value!;
|
||||
let interpretation: string = this.newMdstoreForm.get('interpretation')?.value!;
|
||||
let dsName: string = this.newMdstoreForm.get('dsName')?.value!;
|
||||
let dsId: string = this.newMdstoreForm.get('dsId')?.value!;
|
||||
let apiId: string = this.newMdstoreForm.get('apiId')?.value!;
|
||||
|
||||
this.service.addMDStore(format, layout, interpretation, dsName, dsId, apiId, (data: void) => this.dialogRef.close(1), this.newMdstoreForm);
|
||||
}
|
||||
this.service.addMDStore(format, layout, interpretation, dsName, dsId, apiId, (data: void) => this.dialogRef.close(1), this.newMdstoreForm);
|
||||
}
|
||||
|
||||
onNoClick(): void {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
onNoClick(): void {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
}
|
|
@ -1,7 +1,4 @@
|
|||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { AppModule } from './app/app.module';
|
||||
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule)
|
||||
.catch(err => console.error(err));
|
||||
platformBrowserDynamic().bootstrapModule(AppModule).catch(err => console.error(err));
|
||||
|
|
Loading…
Reference in New Issue