mdstore type in ui

This commit is contained in:
Michele Artini 2023-02-10 12:18:06 +01:00
parent a22b725e3c
commit e52cdba8a3
10 changed files with 36 additions and 14 deletions

View File

@ -167,6 +167,7 @@ export interface MDStore {
id: string,
format: string,
layout: string,
type: string,
interpretation: string,
datasourceName: string,
datasourceId: string,
@ -176,7 +177,7 @@ export interface MDStore {
lastUpdate: string,
size: number,
numberOfVersions: number,
hdfsPath: string
params: any
}
export interface MDStoreVersion {
@ -186,7 +187,7 @@ export interface MDStoreVersion {
readCount: number,
lastUpdate: string,
size: number,
hdfsPath: string;
params: any
}
export interface MDStoreRecord {

View File

@ -234,7 +234,7 @@ export class ISService {
});
}
addMDStore(format: string, layout: string, interpretation: string, dsName: string, dsId: string, apiId: string, onSuccess: Function, relatedForm?: FormGroup) {
addMDStore(format: string, layout: string, interpretation: string, type: string, dsName: string, dsId: string, apiId: string, onSuccess: Function, relatedForm?: FormGroup) {
const headers = new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded')
let body = new HttpParams()
@ -247,7 +247,9 @@ export class ISService {
+ '/'
+ encodeURIComponent(layout)
+ '/'
+ encodeURIComponent(interpretation),
+ encodeURIComponent(interpretation)
+ '/'
+ encodeURIComponent(type),
body, { headers: headers }).subscribe({
next: data => onSuccess(data),
error: error => this.showError(error, relatedForm)

View File

@ -23,6 +23,16 @@
<strong>required</strong></mat-error>
</mat-form-field>
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;">
<mat-label>Type</mat-label>
<mat-select matInput formControlName="type">
<mat-option value="HDFS">hdfs</mat-option>
<mat-option value="MOCK">mock</mat-option>
</mat-select>
<mat-error *ngIf="newMdstoreForm.get('type')?.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" />

View File

@ -29,8 +29,8 @@
</td>
</tr>
<tr>
<th>Hdfs Path</th>
<td>{{version?.hdfsPath}}</td>
<th>Parameters</th>
<td>{{version?.params}}</td>
</tr>
<tr>
<th>Last Update</th>

View File

@ -15,11 +15,11 @@
</thead>
<tbody>
<tr *ngFor="let v of versions" [ngClass]="{'active-row': v.id == data.currentVersion}">
<td title="{{v.hdfsPath}}">
<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 />
<span class="small"><b>Parameters:</b> {{v.params}}</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>

View File

@ -40,8 +40,12 @@
<td>{{md.size}}</td>
</tr>
<tr>
<th>HDFS Path</th>
<td>{{md.hdfsPath}}</td>
<th>Type</th>
<td>{{md.type}}</td>
</tr>
<tr>
<th>Parameters</th>
<td>{{md.params}}</td>
</tr>
<tr>
<th>Versions</th>

View File

@ -151,6 +151,7 @@ export class AddMDStoreDialog {
format: new FormControl('', [Validators.required]),
layout: new FormControl('', [Validators.required]),
interpretation: new FormControl('', [Validators.required]),
type: new FormControl('', [Validators.required]),
dsName: new FormControl(''),
dsId: new FormControl(''),
apiId: new FormControl(''),
@ -164,11 +165,12 @@ export class AddMDStoreDialog {
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 type: string = this.newMdstoreForm.get('type')?.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, type, dsName, dsId, apiId, (data: void) => this.dialogRef.close(1), this.newMdstoreForm);
}
onNoClick(): void {

View File

@ -2,6 +2,7 @@ package eu.dnetlib.data.mdstore.model;
import java.io.Serializable;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
@ -51,7 +52,7 @@ public class MDStore implements Serializable {
@Type(type = "jsonb")
@Column(name = "params", columnDefinition = "jsonb")
private Map<String, Object> params;
private Map<String, Object> params = new LinkedHashMap<>();
@Column(name = "creation_date")
@Temporal(TemporalType.TIMESTAMP)

View File

@ -2,6 +2,7 @@ package eu.dnetlib.data.mdstore.model;
import java.io.Serializable;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
@ -43,7 +44,7 @@ public class MDStoreVersion implements Serializable {
@Type(type = "jsonb")
@Column(name = "params", columnDefinition = "jsonb")
private Map<String, Object> params;
private Map<String, Object> params = new LinkedHashMap<>();
public String getId() {
return id;

View File

@ -2,6 +2,7 @@ package eu.dnetlib.data.mdstore.model;
import java.io.Serializable;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
@ -68,7 +69,7 @@ public class MDStoreWithInfo implements Serializable {
@Type(type = "jsonb")
@Column(name = "params", columnDefinition = "jsonb")
private Map<String, Object> params;
private Map<String, Object> params = new LinkedHashMap<>();
public String getId() {
return id;