diff --git a/dnet-app/frontends/is/src/app/app-routing.module.ts b/dnet-app/frontends/is/src/app/app-routing.module.ts index 4ac1b9e..b59e8a2 100644 --- a/dnet-app/frontends/is/src/app/app-routing.module.ts +++ b/dnet-app/frontends/is/src/app/app-routing.module.ts @@ -13,6 +13,7 @@ import { WfConfsComponent } from './wf-confs/wf-confs.component'; import { IndexComponent } from './index/index.component'; import { OaiComponent } from './oai/oai.component'; import { SwaggerUiComponent } from './swagger/swagger-ui.component'; +import { OaiExplorerComponent } from './oai-explorer/oai-explorer.component'; const routes: Routes = [ @@ -35,6 +36,7 @@ const routes: Routes = [ { path: "cleaner", component: CleanerTesterComponent }, { path: "index", component: IndexComponent }, { path: "oai", component: OaiComponent }, + { path: "oai-explorer", component: OaiExplorerComponent }, { path: "swagger-ui/:id", component: SwaggerUiComponent } ]; diff --git a/dnet-app/frontends/is/src/app/app.module.ts b/dnet-app/frontends/is/src/app/app.module.ts index 8e15380..6efad9f 100644 --- a/dnet-app/frontends/is/src/app/app.module.ts +++ b/dnet-app/frontends/is/src/app/app.module.ts @@ -48,6 +48,7 @@ import { WfTemplateDialog, WfConfDialog, WfConfLauncherDialog } from './wf-confs import { MatMenuModule } from '@angular/material/menu'; import { MatDatepickerModule } from '@angular/material/datepicker'; import { MatNativeDateModule } from '@angular/material/core'; +import { OaiExplorerComponent } from './oai-explorer/oai-explorer.component'; @NgModule({ declarations: [ @@ -90,6 +91,7 @@ import { MatNativeDateModule } from '@angular/material/core'; WfConfLauncherDialog, IndexComponent, OaiComponent, + OaiExplorerComponent, SwaggerUiComponent ], imports: [ diff --git a/dnet-app/frontends/is/src/app/main-menu-panels/main-menu-panels.component.html b/dnet-app/frontends/is/src/app/main-menu-panels/main-menu-panels.component.html index f06b074..3380997 100644 --- a/dnet-app/frontends/is/src/app/main-menu-panels/main-menu-panels.component.html +++ b/dnet-app/frontends/is/src/app/main-menu-panels/main-menu-panels.component.html @@ -18,6 +18,7 @@
diff --git a/dnet-app/frontends/is/src/app/oai-explorer/oai-explorer.component.html b/dnet-app/frontends/is/src/app/oai-explorer/oai-explorer.component.html new file mode 100644 index 0000000..b82ab4a --- /dev/null +++ b/dnet-app/frontends/is/src/app/oai-explorer/oai-explorer.component.html @@ -0,0 +1,26 @@ ++{{oaiResponse | json}} +diff --git a/dnet-app/frontends/is/src/app/oai-explorer/oai-explorer.component.ts b/dnet-app/frontends/is/src/app/oai-explorer/oai-explorer.component.ts new file mode 100644 index 0000000..802c678 --- /dev/null +++ b/dnet-app/frontends/is/src/app/oai-explorer/oai-explorer.component.ts @@ -0,0 +1,77 @@ +import { Component, Inject, Injectable, OnInit } from '@angular/core'; +import { ActivatedRoute, Params, Router } from '@angular/router'; +import { MatDialog, MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; +import { MDStore, MDStoreRecord, MDStoreVersion } from '../common/is.model'; +import { FormControl, FormGroup, Validators } from '@angular/forms'; +import { ISClient } from '../common/is.client'; +import { combineLatest } from 'rxjs'; + +@Component({ + selector: 'oai-explorer', + templateUrl: './oai-explorer.component.html', + styleUrls: [] +}) +export class OaiExplorerComponent implements OnInit { + + oaiBaseUrl: string = "" + page: number = 1; + oaiResponse = {}; + + constructor(public client: OaiExplorerClient, public router: Router, public route: ActivatedRoute, public dialog: MatDialog) { } + + ngOnInit() { + combineLatest([this.route.params, this.route.queryParams], + (params: Params, queryParams: Params) => ({ params, queryParams }) + ).subscribe((res: { params: Params; queryParams: Params }) => { + this.oaiBaseUrl = res.queryParams['baseUrl']; + + if (this.oaiBaseUrl) { + if (res.queryParams['page'] == 1) { + this.client.callIdentifyVerb(this.oaiBaseUrl, (res: any) => this.oaiResponse = res); + } else if (res.queryParams['page'] == 2) { + this.client.callListSetsVerb(this.oaiBaseUrl, (res: any) => this.oaiResponse = res); + } else if (res.queryParams['page'] == 3) { + this.client.callListMdFormatsVerb(this.oaiBaseUrl, (res: any) => this.oaiResponse = res); + } else if (res.queryParams['page'] == 4) { + this.client.callListRecordsVerb(this.oaiBaseUrl, (res: any) => this.oaiResponse = res); + } else if (res.queryParams['page'] == 5) { + this.client.callListIdentifiersVerb(this.oaiBaseUrl, (res: any) => this.oaiResponse = res); + } else { + this.client.callIdentifyVerb(this.oaiBaseUrl, (res: any) => this.oaiResponse = res); + } + } + }); + } + + changeUrl(baseUrl: string, page: number) { + this.router.navigate(['/oai-explorer'], { queryParams: { baseUrl: baseUrl, page: page } }); + } +} + +@Injectable({ + providedIn: 'root' +}) +export class OaiExplorerClient extends ISClient { + baseUrl = '/proxy/byType/datasource_manager/api'; + + callIdentifyVerb(oaiBaseUrl: string, onSuccess: Function) { + this.httpGet(this.baseUrl + '/oai-explorer/info?baseUrl=' + encodeURIComponent(oaiBaseUrl), onSuccess); + } + + callListSetsVerb(oaiBaseUrl: string, onSuccess: Function) { + this.httpGet(this.baseUrl + '/oai-explorer/sets?baseUrl=' + encodeURIComponent(oaiBaseUrl), onSuccess); + } + + callListMdFormatsVerb(oaiBaseUrl: string, onSuccess: Function) { + this.httpGet(this.baseUrl + '/oai-explorer/mdformats?baseUrl=' + encodeURIComponent(oaiBaseUrl), onSuccess); + } + + callListRecordsVerb(oaiBaseUrl: string, onSuccess: Function) { + this.httpGet(this.baseUrl + '/oai-explorer/records?baseUrl=' + encodeURIComponent(oaiBaseUrl), onSuccess); + } + + callListIdentifiersVerb(oaiBaseUrl: string, onSuccess: Function) { + this.httpGet(this.baseUrl + '/oai-explorer/identifiers?baseUrl=' + encodeURIComponent(oaiBaseUrl), onSuccess); + } + +} diff --git a/dnet-app/libs/dnet-oai-common/src/main/java/eu/dnetlib/common/oai/OaiClient.java b/dnet-app/libs/dnet-oai-common/src/main/java/eu/dnetlib/common/oai/OaiClient.java index 4d63dc1..b2db224 100644 --- a/dnet-app/libs/dnet-oai-common/src/main/java/eu/dnetlib/common/oai/OaiClient.java +++ b/dnet-app/libs/dnet-oai-common/src/main/java/eu/dnetlib/common/oai/OaiClient.java @@ -1,7 +1,6 @@ package eu.dnetlib.common.oai; import java.util.List; -import java.util.Map; import java.util.function.Function; import org.apache.commons.lang3.StringUtils; @@ -10,10 +9,6 @@ import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.Element; import org.dom4j.Node; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.client.RestTemplate; import org.springframework.web.util.UriComponentsBuilder; @@ -134,21 +129,18 @@ public class OaiClient { } private