Commit f379a90c authored by ncastejon's avatar ncastejon
Browse files

Merge branch 'us_211_resources'

parents 67bcc5ea 180d0642
Pipeline #1383 passed with stages
in 16 minutes and 28 seconds
......@@ -13,7 +13,7 @@ export class OrganizationsService {
) { }
getOrganizations() {
return this._httpClient.get<IOrganization[]>(environment.backend.url).pipe(
return this._httpClient.get<IOrganization[]>(environment.backendUrls.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';
import { IMetadataLink } from '.';
export interface IResource {
id: number;
name: string;
type: string;
description: string;
queryable: boolean;
downloadable: boolean;
outputFormats: string[];
}
export class Resource implements IResource {
id: number;
name: string;
type: string;
description: string;
queryable: boolean;
downloadable: boolean;
outputFormats: string[];
metadataLink: IMetadataLink;
constructor(resource? : IResource) {
this.id = resource.id;
this.name = resource.name;
this.type = resource.type;
this.description = resource.description;
this.queryable = resource.queryable;
this.downloadable = resource.downloadable;
this.outputFormats = resource.outputFormats;
}
}
Markdown is supported
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