diff --git a/frontends/dnet-is-application/src/app/app-routing.module.ts b/frontends/dnet-is-application/src/app/app-routing.module.ts
index f943a72f..d6808958 100644
--- a/frontends/dnet-is-application/src/app/app-routing.module.ts
+++ b/frontends/dnet-is-application/src/app/app-routing.module.ts
@@ -6,7 +6,7 @@ import { WfHistoryComponent } from './wf-history/wf-history.component';
import { ResourcesComponent } from './resources/resources.component';
import { VocabulariesComponent, VocabularyEditorComponent } from './vocabularies/vocabularies.component';
import { ContextViewerComponent, ContextsComponent } from './contexts/contexts.component';
-import { DsmSearchComponent, DsmResultsComponent, DsmApiComponent, DsmAddApiComponent } from './dsm/dsm.component';
+import { DsmSearchComponent, DsmResultsComponent, DsmApiComponent } from './dsm/dsm.component';
const routes: Routes = [
{ path:"info" , component:InfoComponent },
@@ -19,7 +19,6 @@ const routes: Routes = [
{ path:"voc_editor" , component:VocabularyEditorComponent },
{ path:"dsm/search" , component:DsmSearchComponent },
{ path:"dsm/results/:page/:size" , component:DsmResultsComponent },
- { path:"dsm/addApi" , component:DsmAddApiComponent },
{ path:"dsm/api" , component:DsmApiComponent }
];
diff --git a/frontends/dnet-is-application/src/app/app.module.ts b/frontends/dnet-is-application/src/app/app.module.ts
index fb494434..70619647 100644
--- a/frontends/dnet-is-application/src/app/app.module.ts
+++ b/frontends/dnet-is-application/src/app/app.module.ts
@@ -18,6 +18,7 @@ import { MatBadgeModule } from '@angular/material/badge';
import { MatCardModule } from '@angular/material/card';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input'
+import { MatSelectModule } from '@angular/material/select'
import { MatTableModule } from '@angular/material/table';
import { ProtocolsComponent } from './protocols/protocols.component';
import { MainMenuPanelsComponent } from './main-menu-panels/main-menu-panels.component';
@@ -29,7 +30,7 @@ import { ResourcesComponent, ResContentDialog, ResCreateNewDialog, ResMetadataDi
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { ContextsComponent, ContextViewerComponent, ContextParamsDialog } from './contexts/contexts.component';
import { VocabulariesComponent, VocabularyEditorComponent, VocDialog, VocTermDialog } from './vocabularies/vocabularies.component';
-import { DsmSearchComponent, DsmResultsComponent, DsmApiComponent, DsmAddApiComponent, DsmBrowseDialog } from './dsm/dsm.component';
+import { DsmSearchComponent, DsmResultsComponent, DsmApiComponent, DsmAddApiDialog, DsmBrowseDialog } from './dsm/dsm.component';
import { MatPaginatorModule } from '@angular/material/paginator';
@NgModule({
@@ -55,7 +56,7 @@ import { MatPaginatorModule } from '@angular/material/paginator';
DsmSearchComponent,
DsmResultsComponent,
DsmApiComponent,
- DsmAddApiComponent,
+ DsmAddApiDialog,
DsmBrowseDialog
],
imports: [
@@ -75,6 +76,7 @@ import { MatPaginatorModule } from '@angular/material/paginator';
MatCardModule,
MatFormFieldModule,
MatInputModule,
+ MatSelectModule,
MatTableModule,
MatExpansionModule,
MatDialogModule,
diff --git a/frontends/dnet-is-application/src/app/common/is.model.ts b/frontends/dnet-is-application/src/app/common/is.model.ts
index c7de0524..9440b454 100644
--- a/frontends/dnet-is-application/src/app/common/is.model.ts
+++ b/frontends/dnet-is-application/src/app/common/is.model.ts
@@ -25,7 +25,7 @@ export interface Module {
files: string[];
}
-export interface ProtocolParams {
+export interface ProtocolParam {
name: string
label: string
type: string
@@ -35,7 +35,7 @@ export interface ProtocolParams {
export interface Protocol {
id: string
- params: ProtocolParams[]
+ params: ProtocolParam[]
}
export interface WfHistoryEntry {
@@ -140,3 +140,8 @@ export interface Page {
number: number
}
+export interface DsmConf {
+ compatibilityLevels: string[],
+ contentDescTypes: string[],
+ protocols: Protocol[]
+}
diff --git a/frontends/dnet-is-application/src/app/common/is.service.ts b/frontends/dnet-is-application/src/app/common/is.service.ts
index c04a34e0..f110c17e 100644
--- a/frontends/dnet-is-application/src/app/common/is.service.ts
+++ b/frontends/dnet-is-application/src/app/common/is.service.ts
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
-import { Page, ResourceType, Protocol, WfHistoryEntry, SimpleResource, Context, ContextNode, Vocabulary, VocabularyTerm, KeyValue, BrowseTerm, Datasource } from './is.model';
+import { Page, DsmConf, ResourceType, Protocol, WfHistoryEntry, SimpleResource, Context, ContextNode, Vocabulary, VocabularyTerm, KeyValue, BrowseTerm, Datasource } from './is.model';
import { FormGroup } from '@angular/forms';
import { MatSnackBar } from '@angular/material/snack-bar';
@@ -185,6 +185,13 @@ export class ISService {
});
}
+ dsmConf(onSuccess: Function) {
+ this.client.get('./ajax/dsm/conf').subscribe({
+ next: data => onSuccess(data),
+ error: error => this.showError(error)
+ });
+ }
+
dsmBrowsableFields(onSuccess: Function) {
this.client.get('./ajax/dsm/browsableFields').subscribe({
next: data => onSuccess(data),
diff --git a/frontends/dnet-is-application/src/app/dsm/dsm-add-api.component.html b/frontends/dnet-is-application/src/app/dsm/dsm-add-api.component.html
deleted file mode 100644
index dee08cb9..00000000
--- a/frontends/dnet-is-application/src/app/dsm/dsm-add-api.component.html
+++ /dev/null
@@ -1 +0,0 @@
-dsm add api
diff --git a/frontends/dnet-is-application/src/app/dsm/dsm-add-api.dialog.html b/frontends/dnet-is-application/src/app/dsm/dsm-add-api.dialog.html
new file mode 100644
index 00000000..4dbb0b24
--- /dev/null
+++ b/frontends/dnet-is-application/src/app/dsm/dsm-add-api.dialog.html
@@ -0,0 +1,96 @@
+
+
+
\ No newline at end of file
diff --git a/frontends/dnet-is-application/src/app/dsm/dsm-results.component.html b/frontends/dnet-is-application/src/app/dsm/dsm-results.component.html
index 6b2c6855..104c7d75 100644
--- a/frontends/dnet-is-application/src/app/dsm/dsm-results.component.html
+++ b/frontends/dnet-is-application/src/app/dsm/dsm-results.component.html
@@ -74,7 +74,7 @@
-
+
diff --git a/frontends/dnet-is-application/src/app/dsm/dsm.component.ts b/frontends/dnet-is-application/src/app/dsm/dsm.component.ts
index 557322e8..a1e75b22 100644
--- a/frontends/dnet-is-application/src/app/dsm/dsm.component.ts
+++ b/frontends/dnet-is-application/src/app/dsm/dsm.component.ts
@@ -1,5 +1,5 @@
import { Component, Inject, OnInit, ViewChild } from '@angular/core';
-import { Page, BrowseTerm, Datasource, KeyValue } from '../common/is.model';
+import { Page, BrowseTerm, Datasource, KeyValue, DsmConf, ProtocolParam } from '../common/is.model';
import { ISService } from '../common/is.service';
import { ActivatedRoute, Params } from '@angular/router';
import { MatDialog, MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
@@ -8,6 +8,8 @@ import { MatSort } from '@angular/material/sort';
import { combineLatest } from 'rxjs';
import { Router } from '@angular/router';
import { PageEvent } from '@angular/material/paginator';
+import { FormControl, FormGroup, Validators } from '@angular/forms';
+import { MatSelectChange } from '@angular/material/select';
@Component({
selector: 'app-dsm-search',
@@ -67,23 +69,26 @@ export class DsmResultsComponent implements OnInit {
this.pageSize = parseInt(params['size']);
this.field = queryParams['field'];
this.value = queryParams['value'];
-
- if (this.field) {
- this.service.dsmSearchByField(this.field, this.value, this.currPage, this.pageSize, (page:Page) => {
- this.results = page.content;
- this.nResults = page.totalElements;
- this.nPages = page.totalPages;
- });
- } else {
- this.service.dsmSearch(this.value, this.currPage, this.pageSize, (page:Page) => {
- this.results = page.content;
- this.nResults = page.totalElements;
- this.nPages = page.totalPages;
- });
- }
+ this.reload();
});
}
+ reload() {
+ if (this.field) {
+ this.service.dsmSearchByField(this.field, this.value, this.currPage, this.pageSize, (page:Page) => {
+ this.results = page.content;
+ this.nResults = page.totalElements;
+ this.nPages = page.totalPages;
+ });
+ } else {
+ this.service.dsmSearch(this.value, this.currPage, this.pageSize, (page:Page) => {
+ this.results = page.content;
+ this.nResults = page.totalElements;
+ this.nPages = page.totalPages;
+ });
+ }
+ }
+
changePage(event: PageEvent) {
let path = '/dsm/results/' + event.pageIndex + '/' + event.pageSize;
let qp = this.field ?
@@ -94,6 +99,18 @@ export class DsmResultsComponent implements OnInit {
queryParams: qp
});
}
+
+ openAddApiDialog(dsId:string, dsName:string) {
+ const dialogRef = this.dialog.open(DsmAddApiDialog, {
+ data: { dsId: dsId, dsName: dsName },
+ width: '80%'
+ });
+
+ dialogRef.afterClosed().subscribe(result => {
+ if (result) this.reload();
+ });
+ }
+
}
@Component({
@@ -105,24 +122,12 @@ export class DsmApiComponent {
}
-@Component({
- selector: 'app-dsm-add-api',
- templateUrl: './dsm-add-api.component.html',
- styleUrls: ['./dsm.component.css']
-})
-export class DsmAddApiComponent {
-
-}
-
-
-
-
@Component({
selector: 'dsm-browse-dialog',
templateUrl: 'dsm-browse-dialog.html',
styleUrls: ['./dsm.component.css']
})
-export class DsmBrowseDialog implements OnInit{
+export class DsmBrowseDialog implements OnInit {
datasource: MatTableDataSource = new MatTableDataSource([]);
colums: string[] = ['name', 'total'];
@@ -148,4 +153,67 @@ export class DsmBrowseDialog implements OnInit{
onNoClick(): void {
this.dialogRef.close();
}
-}
\ No newline at end of file
+}
+
+
+@Component({
+ selector: 'dsm-add-api-dialog',
+ templateUrl: './dsm-add-api.dialog.html',
+ styleUrls: ['./dsm.component.css']
+})
+export class DsmAddApiDialog {
+ apiPrefix:string = '';
+
+
+ apiIdControl = new FormControl('');
+
+ addApiForm = new FormGroup({
+ apiId: this.apiIdControl,
+ compatibility : new FormControl(''),
+ contentdescription : new FormControl(''),
+ protocol : new FormControl(''),
+ baseurl : new FormControl(''),
+ metadataIdentifierPath : new FormControl('')
+ });
+
+ protocols:string[] = [];
+ compatibilityLevels:string[] = [];
+ contentDescTypes:string[] = [];
+
+ protocolsMap:any = {};
+ selProtParams:ProtocolParam[] = [];
+
+
+ constructor(public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: any, public service: ISService) {
+ this.apiPrefix = 'api_________::' + data.dsId + '::';
+ this.service.dsmConf((conf:DsmConf) => {
+ this.compatibilityLevels = conf.compatibilityLevels;
+ this.contentDescTypes = conf.contentDescTypes;
+ conf.protocols.forEach((p) => {
+ this.protocols.push(p.id);
+ this.protocolsMap[p.id] = p.params;
+ });
+ });
+ }
+
+ onChangeProtocol(e:MatSelectChange):void {
+
+ if (this.protocolsMap[e.value]) {
+ this.selProtParams = this.protocolsMap[e.value];
+ } else {
+ this.selProtParams = this.protocolsMap[e.value];
+ }
+ }
+
+ onSubmit():void {
+ //const api = DsmAddApiDialog.value;
+ //api.apiId = this.apiPrefix + api.apiId; IMPORTANT
+ //this.service.dsmAddApi(api, (data: void) => this.dialogRef.close(1), this.metadataForm);
+
+
+ }
+
+ onNoClick(): void {
+ this.dialogRef.close();
+ }
+}
diff --git a/frontends/dnet-is-application/src/app/protocols/protocols.component.ts b/frontends/dnet-is-application/src/app/protocols/protocols.component.ts
index b9e7ca17..788cb85e 100644
--- a/frontends/dnet-is-application/src/app/protocols/protocols.component.ts
+++ b/frontends/dnet-is-application/src/app/protocols/protocols.component.ts
@@ -1,11 +1,11 @@
import { Component } from '@angular/core';
import { ISService } from '../common/is.service';
import { MatTableDataSource } from '@angular/material/table';
-import { Protocol, ProtocolParams } from '../common/is.model';
+import { Protocol, ProtocolParam } from '../common/is.model';
export interface ProtocolDatasource {
protocol: string;
- datasource: MatTableDataSource;
+ datasource: MatTableDataSource;
}
@Component({