Commit 180d0642 authored by ncastejon's avatar ncastejon
Browse files

Change dataset-export to dataset-resources. Get resource information from microservice

parent f8e8468d
......@@ -5700,12 +5700,14 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
......@@ -5720,17 +5722,20 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
......@@ -5847,7 +5852,8 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"ini": {
"version": "1.3.5",
......@@ -5859,6 +5865,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
......@@ -5873,6 +5880,7 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
......@@ -5880,12 +5888,14 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"minipass": {
"version": "2.2.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.1",
"yallist": "^3.0.0"
......@@ -5904,6 +5914,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
......@@ -5984,7 +5995,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
......@@ -5996,6 +6008,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
......@@ -6117,6 +6130,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
......
......@@ -13,7 +13,7 @@ export class OrganizationsService {
) { }
getOrganizations() {
return this._httpClient.get<IOrganization[]>(environment.backend.url + '/organizations').pipe(
return this._httpClient.get<IOrganization[]>(environment.backendUrls.organizations + '/organizations').pipe(
map((organizationsBack) => {
const organizations = [];
organizationsBack.forEach((organization) => {
......
......@@ -30,7 +30,7 @@
</a>
</li>
<li [routerLinkActive]="'is-active'">
<a (click)="setPosition()" [routerLink]="[AppRoutes.export.uri]">
<a (click)="setPosition()" [routerLink]="[AppRoutes.resources.uri]">
<span i18n="@@dataset.detail.resources">Resources</span>
</a>
</li>
......
<div class="columns is-centered">
<div class="card column is-half licence">
<header class="card-header">
<p class="card-header-title" i18n="@@dataset.services.intro">
Consume our services and access related data
</p>
</header>
<div class="card-content">
<div class="unlock-icon has-text-centered">
<span class="icon">
<i class="fas fa-unlock"></i>
</span>
</div>
<div class="license-link">
<p class="has-text-justified" >
<span i18n="@@dataset.services.license.pt1">This data set is subject to </span>
<a (click)="toggleLicenseModal()" i18n="@@dataset.services.license.pt2">Open license</a>,
<span i18n="@@dataset.services.license.pt3"> you can consume the associated services without prior authorization. For more details on the use of the services available on this portal, go to the documentation.</span>
</p>
</div>
</div>
</div>
</div>
<div class="columns">
<div class="column">
<h4 i18n="@@dataset.services.queryableTitle">
Queryable services
</h4>
<p i18n="@@dataset.services.queryableText">Utilisez nos services requêtables afin de composer le jeu de données qui vous intéresse</p>
</div>
</div>
<div class="columns services" *ngIf="services">
<div class="column is-4" *ngIf="services.wms">
<app-dataset-service-detail [service]="services.wms"></app-dataset-service-detail>
</div>
<div class="column is-4" *ngIf="services.wfs">
<app-dataset-service-detail [service]="services.wfs"></app-dataset-service-detail>
</div>
</div>
<div class="columns">
<div class="column">
<h4 i18n="@@dataset.services.downloadableTitle">
Services de téléchargement
</h4>
<p i18n="@@dataset.services.downloadableText">
Utilisez les services de téléchargement pour récupérer les données sur votre appareil
</p>
</div>
</div>
<div class="columns services" *ngIf="services">
<div class="column is-4" *ngIf="services.pdf" gIf="services.pdf">
<app-dataset-service-detail [service]="services.pdf"></app-dataset-service-detail>
</div>
<div class="column is-4" *ngIf="services.json">
<app-dataset-service-detail [service]="services.json"></app-dataset-service-detail>
</div>
</div>
<app-license-modal (close)="toggleLicenseModal()" [isOpen]="displayLicenseModal"></app-license-modal>
import { Component, OnInit, OnDestroy } from '@angular/core';
import { DatasetDetailService } from '../../../services';
import { Metadata } from '../../../models';
import { Subscription } from 'rxjs';
import { linkFormats } from '../../../models/metadata.model';
import { geosource } from '../../../../../i18n/geosource/geosource';
@Component({
selector: 'app-dataset-export',
templateUrl: './dataset-export.component.html',
styleUrls: ['./dataset-export.component.scss'],
})
export class DatasetExportComponent implements OnInit, OnDestroy {
metadata: Metadata;
services: any;
displayLicenseModal = false;
sub: Subscription;
constructor(
private _datasetDetailService: DatasetDetailService,
) { }
ngOnInit() {
this.initialize();
this.sub = this._datasetDetailService.dataset$.subscribe(() => {
this.initialize();
});
}
ngOnDestroy() {
this.sub.unsubscribe();
}
initialize() {
this.metadata = this._datasetDetailService.datasetMetadata;
if (this.metadata) {
this.services = {};
this.metadata.link.forEach((link) => {
if (link.protocol === linkFormats.wfs) {
this.services['wfs'] = {
key: 'wfs',
title: geosource.datasetServices.wfsTitle,
subtitle: geosource.datasetServices.wfsSubtitle,
description: geosource.datasetServices.wfsDescription,
url: link.url,
};
} else if (link.protocol === linkFormats.wms) {
this.services['wms'] = {
key: 'wms',
title: geosource.datasetServices.wmsTitle,
subtitle: geosource.datasetServices.wmsSubtitle,
description: geosource.datasetServices.wmsDescription,
url: link.url,
};
} else if (link.protocol === linkFormats.pdf) {
this.services['pdf'] = {
key: 'pdf',
title: geosource.datasetServices.pdfTitle,
subtitle: geosource.datasetServices.pdfSubtitle,
description: link.description,
url: link.url,
};
} else if (link.protocol === linkFormats.json) {
this.services['json'] = {
key: 'json',
title: geosource.datasetServices.jsonTitle,
subtitle: geosource.datasetServices.jsonSubtitle,
description: link.description,
url: link.url,
};
}
});
}
}
toggleLicenseModal() {
this.displayLicenseModal = !this.displayLicenseModal;
}
}
<ng-container *ngIf="metadata">
<div class="columns is-centered">
<div class="card column is-half licence">
<header class="card-header">
<p class="card-header-title" i18n="@@dataset.services.intro">
Consume our services and access related data
</p>
</header>
<div class="card-content">
<div class="unlock-icon has-text-centered">
<span class="icon">
<i class="fas fa-unlock"></i>
</span>
</div>
<div class="license-link">
<p class="has-text-justified">
<span i18n="@@dataset.services.license.pt1">This data set is subject to </span>
<a (click)="toggleLicenseModal()" i18n="@@dataset.services.license.pt2">Open license</a>,
<span i18n="@@dataset.services.license.pt3"> you can consume the associated services without prior
authorization. For more details on the use of the services available on this portal, go to the
documentation.</span>
</p>
</div>
</div>
</div>
</div>
<div class="columns is-multiline">
<div class="column is-12 title-resource" (click)="queryablePanelOpen = !queryablePanelOpen">
<span class="icon">
<i class="fas fa-wrench fa-lg"></i>
</span>
<div>Queryable Resources</div>
<div class="open-close">
<span class="icon" *ngIf="queryablePanelOpen">
<i class="fas fa-minus fa-lg"></i>
</span>
<span class="icon" *ngIf="!queryablePanelOpen">
<i class="fas fa-plus fa-lg"></i>
</span></div>
</div>
<ng-container *ngIf="queryablePanelOpen">
<div class="column is-12 resource" *ngFor="let resource of queryableResources">
<div><strong>{{ resource.name }}</strong> - {{ resource.description }}</div>
<div>{{ resource.metadataLink.url }}</div>
</div>
</ng-container>
</div>
<div class="columns is-multiline">
<div class="column is-12 title-resource" (click)="downloadablePanelOpen = !downloadablePanelOpen">
<span class="icon">
<i class="far fa-arrow-alt-circle-down fa-lg"></i>
</span>
Downloadable Resources
<div class="open-close">
<span class="icon" *ngIf="downloadablePanelOpen">
<i class="fas fa-minus fa-lg"></i>
</span>
<span class="icon" *ngIf="!downloadablePanelOpen">
<i class="fas fa-plus fa-lg"></i>
</span>
</div>
</div>
<ng-container *ngIf="downloadablePanelOpen">
<div class="column is-12 resource" *ngFor="let resource of downloadableResources">
<div><strong>{{ resource.name }}</strong></div>
<div>{{ resource.metadataLink.url }}</div>
</div>
</ng-container>
</div>
<app-license-modal (close)="toggleLicenseModal()" [isOpen]="displayLicenseModal"></app-license-modal>
</ng-container>
@import "../../../../../scss/variables";
@import "../../../../../../node_modules/bulma/sass/utilities/_all";
.licence {
margin-top: 2rem;
}
......@@ -36,3 +39,24 @@ h4 {
color: 'black';
}
}
.title-resource {
background-color: white;
color: $red;
}
div.title-resource {
cursor: pointer;
display: flex;
.icon:first-of-type {
padding-right: 10px;
}
.open-close {
margin-left: auto;
}
}
.resource {
background-color: #f9f9f9;
border-bottom: 1px solid lightgrey;
}
import { Component, OnInit, OnDestroy } from '@angular/core';
import { DatasetDetailService, ResourcesService } from '../../../services';
import { Metadata, Resource } from '../../../models';
import { Subscription } from 'rxjs';
import { linkFormats, IMetadataLink } from '../../../models/metadata.model';
import { geosource } from '../../../../../i18n/geosource/geosource';
@Component({
selector: 'app-dataset-resources',
templateUrl: './dataset-resources.component.html',
styleUrls: ['./dataset-resources.component.scss'],
})
export class DatasetResourcesComponent implements OnInit, OnDestroy {
metadata: Metadata;
resources: Resource[];
displayLicenseModal = false;
sub: Subscription;
// To display in the template
queryableResources: Resource[];
downloadableResources: Resource[];
// Variables for open/use resources panels
queryablePanelOpen = true;
downloadablePanelOpen = true;
constructor(
private _datasetDetailService: DatasetDetailService,
private _resourcesService: ResourcesService,
) { }
ngOnInit() {
this.queryableResources = [];
this.downloadableResources = [];
console.log('ng on inits');
this.initialize();
this._resourcesService.getResources().subscribe((resources) => {
this.resources = resources;
this.initialize();
this.sub = this._datasetDetailService.dataset$.subscribe(() => {
this.initialize();
});
});
}
ngOnDestroy() {
this.sub.unsubscribe();
}
initialize() {
//
console.log(this.resources);
this.metadata = this._datasetDetailService.datasetMetadata;
if (this.metadata !== undefined && this.resources !== undefined) {
this.metadata.link.forEach((link) => {
this.resources.forEach((resource) => {
if (link.protocol === resource.type) {
resource.metadataLink = link;
if (resource.queryable) {
this.queryableResources.push(resource);
} else {
this.downloadableResources.push(resource);
}
}
});
});
}
}
toggleLicenseModal() {
this.displayLicenseModal = !this.displayLicenseModal;
}
}
import { DatasetListComponent } from './dataset-list/dataset-list.component';
import { DatasetDetailComponent } from './dataset-detail/dataset-detail.component';
import { DatasetExportComponent } from './dataset-detail/dataset-export/dataset-export.component';
import { DatasetResourcesComponent } from './dataset-detail/dataset-resources/dataset-resources.component';
// tslint:disable-next-line:max-line-length
import { DatasetServiceDetailComponent } from './dataset-detail/dataset-export/dataset-service-detail/dataset-service-detail.component';
import { LicenseModalComponent } from './dataset-detail/dataset-export/license-modal/license-modal.component';
import { DatasetServiceDetailComponent } from './dataset-detail/dataset-resources/dataset-service-detail/dataset-service-detail.component';
import { LicenseModalComponent } from './dataset-detail/dataset-resources/license-modal/license-modal.component';
import { DatasetMapComponent } from './dataset-detail/dataset-map/dataset-map.component';
import { DatasetInfoComponent } from './dataset-detail/dataset-info/dataset-info.component';
import { DatasetDataComponent } from './dataset-detail/dataset-data/dataset-data.component';
......@@ -20,7 +20,7 @@ import { FilterDetailComponent } from './filter-list/filter-detail/filter-detail
export {
DatasetDetailComponent,
DatasetExportComponent,
DatasetResourcesComponent,
DatasetServiceDetailComponent,
LicenseModalComponent,
DatasetMapComponent,
......@@ -39,7 +39,7 @@ export {
// tslint:disable-next-line:variable-name
export const GeosourceComponents = [
DatasetDetailComponent,
DatasetExportComponent,
DatasetResourcesComponent,
DatasetServiceDetailComponent,
LicenseModalComponent,
DatasetMapComponent,
......
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { DatasetListComponent, DatasetDetailComponent, ResearchComponent, DatasetInfoComponent,
DatasetMapComponent, DatasetExportComponent, DatasetDataComponent } from './components';
DatasetMapComponent, DatasetResourcesComponent, DatasetDataComponent } from './components';
import { AppRoutes } from '../routes';
export const routes: Routes = [
......@@ -55,10 +55,10 @@ export const routes: Routes = [
},
},
{
path: AppRoutes.export.uri,
component: DatasetExportComponent,
path: AppRoutes.resources.uri,
component: DatasetResourcesComponent,
data: {
title: AppRoutes.export.title,
title: AppRoutes.resources.title,
},
},
],
......
......@@ -10,3 +10,4 @@ export { SearchCompletion } from './search-completion.model';
export { SearchSuggestion } from './suggestion.model';
export { Data } from './data.model';
export { DatasetChild } from './dataset-child.model';
export { Resource, IResource } from './resource.model';
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment