@@ -81,10 +81,12 @@
+
+
diff --git a/src/app/datasets/components/results/results.component.scss b/src/app/datasets/components/results/results.component.scss index 5d715f93..88878ec5 100644 --- a/src/app/datasets/components/results/results.component.scss +++ b/src/app/datasets/components/results/results.component.scss @@ -1,6 +1,18 @@ @import "../../../../../node_modules/bulma/sass/utilities/_all"; @import "../../../../scss/variables.scss"; +//not working in a calc() +$sticky-distance: $header-bar-height + 32px; + +.main-content{ + display: flex; + padding: 2rem; + flex-direction: column; + @media screen and(min-width:$desktop){ + flex-direction: row; + } +} + @media (max-width: $tablet) { .header-dataset { flex-direction: column-reverse; @@ -27,7 +39,7 @@ justify-content: space-between; align-items: center; background: $grey-background-color; - border-bottom: 1px solid $grey-super-light-color; + //border-bottom: 1px solid $grey-super-light-color; cursor: pointer; .filter-title { @@ -65,12 +77,18 @@ .filter-column { padding: 0; top: 10px; - + background: white; + box-shadow: 0px 6px 12px rgba(129, 128, 128, 0.1); + border-radius: 8px; + padding: 0.7rem; + margin-bottom: 1rem; @media screen and (min-width: $desktop) { height: calc(100vh - #{$header-bar-height} - #{$footer-height}); overflow-y: auto; position: sticky; - top: $header-bar-height; + top: $sticky-distance; + margin-right:1rem; + margin-bottom: 0; } } @@ -79,27 +97,30 @@ // Padding more small for mobile padding: 0.5rem; padding-top: 0; + box-shadow: 0px 6px 12px rgba(129, 128, 128, 0.1); + border-radius: 8px; + box-sizing: border-box; @media screen and (min-width: $tablet) { - padding: 1.5rem; + padding: 2rem; } - .tab-results { + .tab-results { margin-top: 1rem; margin-bottom: 1rem; - border-bottom: 1px solid $grey-super-light-color; + border-bottom: 2px solid $grey-background-color; // Make the border have all the screen margin-left: -0.5rem; margin-right: -0.5rem; - padding-left: 0.5rem; - padding-right: 0.5rem; + padding-left: 1.25rem; + padding-right: 1.25rem; @media screen and (min-width: $tablet) { - margin-left: -1.5rem; - margin-right: -1.5rem; + margin-left: -2rem; + margin-right: -2rem; padding-left: 1.5rem; padding-right: 1.5rem; - margin-top: 2rem; + margin-top: 0; } } @@ -204,7 +225,11 @@ span.item-found { margin-bottom: 0.75rem; margin-top: 0.5rem; } - +hr{ + margin-left:-2rem; + margin-right:-2rem; + background:$grey-background-color; +} .pagination-bottom { display: flex; justify-content: center; diff --git a/src/app/shared/components/basic-tabs/basic-tabs.component.scss b/src/app/shared/components/basic-tabs/basic-tabs.component.scss index 79afc83d..490f11d3 100644 --- a/src/app/shared/components/basic-tabs/basic-tabs.component.scss +++ b/src/app/shared/components/basic-tabs/basic-tabs.component.scss @@ -6,12 +6,13 @@ align-content: stretch; flex-wrap: wrap; border-bottom: 1px solid $grey-super-light-color; + margin-top:1.5rem; li { display: flex; align-items: center; padding-right: 2rem; - padding-bottom: 0.4rem; + padding-bottom: 0.8rem; padding-top: 0.4rem; cursor: pointer; position: relative; diff --git a/src/app/shared/components/page-header/page-header.component.scss b/src/app/shared/components/page-header/page-header.component.scss index bdeb0c5f..4d918102 100644 --- a/src/app/shared/components/page-header/page-header.component.scss +++ b/src/app/shared/components/page-header/page-header.component.scss @@ -4,7 +4,7 @@ .page-header { display: flex; padding-top: 1.875rem; - padding-bottom: 1rem; + padding-bottom: 1.875rem; position: relative; .title-item { diff --git a/src/app/user/components/access-management/access-management.component.html b/src/app/user/components/access-management/access-management.component.html index 36c74da0..d96fa176 100644 --- a/src/app/user/components/access-management/access-management.component.html +++ b/src/app/user/components/access-management/access-management.component.html @@ -1,7 +1,8 @@ -
+
+
- +
\ No newline at end of file diff --git a/src/app/user/components/access-management/access-management.component.scss b/src/app/user/components/access-management/access-management.component.scss index baf7d529..555952d0 100644 --- a/src/app/user/components/access-management/access-management.component.scss +++ b/src/app/user/components/access-management/access-management.component.scss @@ -1,3 +1,13 @@ .tabs { margin-bottom: 1rem; } + +.main-container{ + margin-top:0.5rem; +} + +.header-section{ + background-color: white; + padding:0 2rem; +} + diff --git a/src/app/user/components/access-management/available-data/available-data.component.html b/src/app/user/components/access-management/available-data/available-data.component.html index 504a50e7..ccccf280 100644 --- a/src/app/user/components/access-management/available-data/available-data.component.html +++ b/src/app/user/components/access-management/available-data/available-data.component.html @@ -6,12 +6,12 @@
Service
-
+
-
+
@@ -35,7 +35,7 @@
{{ getResourceServices(resource) }}
-
+
-
@@ -54,7 +54,7 @@ {{ service.name }}
-
+
-
-
-
+
+
-
@@ -82,7 +82,7 @@
-
+
@@ -113,7 +113,7 @@
-
- - -
- - +
-
+
+ + +
+
\ No newline at end of file diff --git a/src/app/user/components/auth/password-forgotten/password-forgotten.component.scss b/src/app/user/components/auth/password-forgotten/password-forgotten.component.scss index ba156316..5b785503 100644 --- a/src/app/user/components/auth/password-forgotten/password-forgotten.component.scss +++ b/src/app/user/components/auth/password-forgotten/password-forgotten.component.scss @@ -5,9 +5,13 @@ .password-forgotten-form-container { margin-top: 1rem; } +label{ + margin-top:1rem; +} .button-container { display: flex; justify-content: flex-end; margin-top: 1.75rem; + margin-right:2rem; } diff --git a/src/app/user/components/auth/password-reset/password-reset.component.html b/src/app/user/components/auth/password-reset/password-reset.component.html index 09b2f82e..d1ede0f1 100644 --- a/src/app/user/components/auth/password-reset/password-reset.component.html +++ b/src/app/user/components/auth/password-reset/password-reset.component.html @@ -1,111 +1,107 @@ -
- - +
+
+ +
-
-
-
-
- -

- - - - - - - -

+ +
+
+
+
+ +

+ + + + + + + +

-
-
- You must enter a password. -
+
+
+ You must enter a password. +
-
- Your password must at least contain {{ passwordMinLength }} characters. -
+
+ Your password must at least contain {{ passwordMinLength }} characters. +
-
- Your password contains some forbidden characters (€, ô, é, è, …). -
+
+ Your password contains some forbidden characters (€, ô, é, è, …). +
-
- Your password must contain at least one special character. -
+
+ Your password must contain at least one special character. +
-
- Your password must contain at least one uppercased character. -
+
+ Your password must contain at least one uppercased character. +
-
- Your password must contain at least one lowercased character. -
+
+ Your password must contain at least one lowercased character. +
-
- Your password must contain at least one number. -
+
+ Your password must contain at least one number. +
-
- Your password must not contain obvious words. +
+ Your password must not contain obvious words. +
-
-
-
-
- -

- - - - - - - -

+
+
+
+ +

+ + + + + + + +

-
-
- You must confirm your password. +
+
+ You must confirm your password. +
-
-
-
- The password confirmation doesn't match with the password. +
+
+ The password confirmation doesn't match with the password. +
-
-
-
-
- -
-
-
+
+
diff --git a/src/app/user/components/auth/password-reset/password-reset.component.scss b/src/app/user/components/auth/password-reset/password-reset.component.scss index 37be82de..2bfcc6ac 100644 --- a/src/app/user/components/auth/password-reset/password-reset.component.scss +++ b/src/app/user/components/auth/password-reset/password-reset.component.scss @@ -3,3 +3,8 @@ .is-warning { color: $warning-color; } + +.button-container { + text-align: right; + margin-right: 2rem; +} \ No newline at end of file diff --git a/src/app/user/components/auth/sign-up/sign-up.component.html b/src/app/user/components/auth/sign-up/sign-up.component.html index 1daa10bc..76fe8627 100644 --- a/src/app/user/components/auth/sign-up/sign-up.component.html +++ b/src/app/user/components/auth/sign-up/sign-up.component.html @@ -1,8 +1,10 @@ -
+
+
- +
\ No newline at end of file diff --git a/src/app/user/components/auth/sign-up/sign-up.component.scss b/src/app/user/components/auth/sign-up/sign-up.component.scss index 023f2ea3..579a4630 100644 --- a/src/app/user/components/auth/sign-up/sign-up.component.scss +++ b/src/app/user/components/auth/sign-up/sign-up.component.scss @@ -46,3 +46,6 @@ h1 { font-weight: 600; } } +.validation{ + padding-right:1rem; +} diff --git a/src/app/user/components/user-profil/user-info/user-info.component.html b/src/app/user/components/user-profil/user-info/user-info.component.html index a30cf4ae..3ad7add9 100644 --- a/src/app/user/components/user-profil/user-info/user-info.component.html +++ b/src/app/user/components/user-profil/user-info/user-info.component.html @@ -1,168 +1,170 @@ -
-
-
-
- -

- - - - - - - -

+ +
+
+
+
+ +

+ + + + + + + +

-
-
- You must enter your first name. -
-
- Special characters are forbidden. +
+
+ You must enter your first name. +
+
+ Special characters are forbidden. +
+
-
-
-
-
- -

- - - - - - - -

+
+
+ +

+ + + + + + + +

-
-
- You must enter your last name. -
-
- Special characters are forbidden. +
+
+ You must enter your last name. +
+
+ Special characters are forbidden. +
+
-
-
-
-
- -

- -

-
-
+
+
+ +

+ +

+
+
-
-
- - -

- Check this box if you agree to receive information emails from Data about the operation of services, model - changes, new formats, maintenance operations. Your data will not be sent to partners. -

-
-
+
+
+ + +

+ Check this box if you agree to receive information emails from Data about the operation of services, model + changes, new formats, maintenance operations. Your data will not be sent to partners. +

+
+
-
-
- -

- -

-
-
+
+
+ +

+ +

+
+
-
+
-
-
- -

- -

-
-
+
+
+ +

+ +

+
+
-
-
- -

- -

-
-
+
+
+ +

+ +

+
+
-
-
- -

- -

-
-
+
+
+ +

+ +

+
+
-
-
- -

- -

-
-
+
+
+ +

+ +

+
+
-
-
- - -
-
- You must accept the processing of the information entered in this form to - respond to your request. +
+
+ + +
+
+ You must accept the processing of the information entered in this form to + respond to your request. +
+
+
-
- -
- - -
-
+
+ + +
+
@@ -117,5 +120,4 @@
-
\ No newline at end of file diff --git a/src/app/user/components/user-profil/user-password-update/user-password-update.component.scss b/src/app/user/components/user-profil/user-password-update/user-password-update.component.scss index e69de29b..2369b023 100644 --- a/src/app/user/components/user-profil/user-password-update/user-password-update.component.scss +++ b/src/app/user/components/user-profil/user-password-update/user-password-update.component.scss @@ -0,0 +1,7 @@ +@import '../../../../../scss/variables.scss'; +@import '../../../../../../node_modules/bulma/sass/utilities/_all.sass'; + + .button-gl{ + margin-right:1.5rem; + margin-bottom:3rem; + } \ No newline at end of file diff --git a/src/app/user/components/user-profil/user-profil.component.html b/src/app/user/components/user-profil/user-profil.component.html index 36c74da0..f837bb07 100644 --- a/src/app/user/components/user-profil/user-profil.component.html +++ b/src/app/user/components/user-profil/user-profil.component.html @@ -1,7 +1,8 @@ -
- - - +
+
+ + +
\ No newline at end of file diff --git a/src/app/user/components/user-profil/user-profil.component.scss b/src/app/user/components/user-profil/user-profil.component.scss index e69de29b..ab8467a7 100644 --- a/src/app/user/components/user-profil/user-profil.component.scss +++ b/src/app/user/components/user-profil/user-profil.component.scss @@ -0,0 +1,12 @@ +@import '../../../../scss/variables.scss'; + + +.main-container{ + margin-top:0.5rem; +} + +.header-section{ + background-color: white; + padding:0 2rem; +} + diff --git a/src/i18n/traductions.ts b/src/i18n/traductions.ts index 25a288f9..b80ca58b 100644 --- a/src/i18n/traductions.ts +++ b/src/i18n/traductions.ts @@ -260,7 +260,7 @@ export const pageTitles = { changelog: 'Last changes', actors: 'Actors', signup: 'Sign up', - login: 'Login', + login: 'Log in', passwordReset: 'Password reset', passwordForgotten: 'Password forgotten', contact: 'Contact us', diff --git a/src/scss/variables.scss b/src/scss/variables.scss index e3e1ea4d..9f290ac9 100644 --- a/src/scss/variables.scss +++ b/src/scss/variables.scss @@ -13,6 +13,7 @@ $menu-selected-color: #c8c8d0; $link-color: #0057a8; $yellow-dd-color: #ffdc26; $blue-color: #4668ab; +$table-selected-item-color: #f1f3f8; $orange-color: #B9541D; // Colors for the files (in api and downloads) diff --git a/src/styles.scss b/src/styles.scss index 4f70e82c..4371453f 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -319,10 +319,9 @@ span.required-field, border-bottom-color: $link-color; } } - .btn-red-text { - background: transparent; - border-radius: 2px; + background: white; + border-radius: 4px; font-size: 0.875rem; color: $tomato-color; border: 1px solid $grey-super-light-color; @@ -361,7 +360,7 @@ span.required-field, width: 13.75rem; height: 3.14em; background: $tomato-color; - border-radius: 2px; + border-radius: 4px; border-width: 0; font-size: 0.875rem; font-weight: 600; @@ -411,7 +410,26 @@ span.required-field, } } } +.main-container{ + margin-top:0; +} +.header-section{ + background-color: white; + padding:0 2rem; +} +.centered-form{ + padding-bottom: 5rem; + max-width:850px; + margin:auto; + .form-content{ + margin: 2rem; + padding:2rem; + background-color: white; + box-shadow: 0px 6px 12px rgba(129, 128, 128, 0.1); + border-radius: 8px; + } +} .page-container { margin: auto; min-height: calc(100% - 1rem); -- GitLab From d725211008197b38b4e9f615ca06165f8acc152a Mon Sep 17 00:00:00 2001 From: FORESTIER Fabien Date: Mon, 4 May 2020 14:45:22 +0200 Subject: [PATCH 53/78] Fix mobile display of the user button of the header --- src/app/core/components/main/header/header.component.scss | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/core/components/main/header/header.component.scss b/src/app/core/components/main/header/header.component.scss index a4174106..d48ea257 100644 --- a/src/app/core/components/main/header/header.component.scss +++ b/src/app/core/components/main/header/header.component.scss @@ -374,8 +374,10 @@ svg.is-connected { left: 1rem; } - .put-menu-to-right { - width: 142px; + @media screen and (max-width: $tablet) { + .put-menu-to-right { + width: 142px; + } } .modal.is-active { -- GitLab From 804d1a8a3ad6cf748b77f70075e1508e8a49ce01 Mon Sep 17 00:00:00 2001 From: CARRON Guilhem Date: Mon, 4 May 2020 15:46:35 +0200 Subject: [PATCH 54/78] new ui contact --- .../components/contact/contact.component.html | 28 +++++++++++-------- .../components/contact/contact.component.scss | 14 ++++++++-- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/app/core/components/contact/contact.component.html b/src/app/core/components/contact/contact.component.html index 49483505..87ee2ada 100644 --- a/src/app/core/components/contact/contact.component.html +++ b/src/app/core/components/contact/contact.component.html @@ -1,16 +1,17 @@ -
- +
+
- +
-
+ +
Identity
-
+
@@ -26,8 +27,8 @@
- -
+
+

@@ -52,7 +53,7 @@

-
+

@@ -76,8 +77,9 @@

- -
+
+
+

@@ -102,7 +104,7 @@

-
+

@@ -134,9 +136,12 @@

+
+
+
Message @@ -234,6 +239,7 @@
+
diff --git a/src/app/core/components/contact/contact.component.scss b/src/app/core/components/contact/contact.component.scss index 2e50cf9d..18604b14 100644 --- a/src/app/core/components/contact/contact.component.scss +++ b/src/app/core/components/contact/contact.component.scss @@ -32,18 +32,28 @@ cursor: pointer; background-color: lightgrey; } - +.form-content:not(:first-child){ + margin-top:0; +} +.form-content:first-child{ + margin-bottom:1rem; + .column{ + margin-bottom:0; + } +} .button-wrapper { display: flex; justify-content: flex-end; + padding-right:2rem; + @media screen and (max-width: 550px) { flex-direction: column; align-items: center; justify-content: space-between; + padding-right:0; .button { - width: 100%; &:first-of-type { margin-bottom: 0.5rem; -- GitLab From 65d431ffb25d929ab4ab4115c9dbb892b1ecd427 Mon Sep 17 00:00:00 2001 From: "ext.sopra.ncastejon" Date: Mon, 4 May 2020 16:34:36 +0200 Subject: [PATCH 55/78] TRansform the key for an aggregation: remove the special characters --- .../filter-detail.component.html | 6 +- .../filter-detail/filter-detail.component.ts | 2 +- .../components/results/results.component.ts | 33 ++++++-- .../services/dataset-research.service.ts | 45 +++++----- .../datasets/services/research-url.service.ts | 82 +++++++++++++++---- src/app/elasticsearch/models/filter.model.ts | 10 ++- .../services/elasticsearch.service.ts | 12 +-- 7 files changed, 136 insertions(+), 54 deletions(-) diff --git a/src/app/datasets/components/filter-list/filter-detail/filter-detail.component.html b/src/app/datasets/components/filter-list/filter-detail/filter-detail.component.html index aa35e198..36ceecf6 100644 --- a/src/app/datasets/components/filter-list/filter-detail/filter-detail.component.html +++ b/src/app/datasets/components/filter-list/filter-detail/filter-detail.component.html @@ -15,7 +15,7 @@ [ngClass]="{'active': (aggregation.isActive == true) }">
+ *ngIf="aggregation.subAggregations.length < 2 || aggregation.label === 'ATMO Auvergne-Rhône-Alpes'">
@@ -71,7 +71,7 @@ [name]="subAgg.key+subAgg.parentAggregation.key" class="is-checkradio is-small" [id]="subAgg.key+subAgg.parentAggregation.key"> diff --git a/src/app/datasets/components/filter-list/filter-detail/filter-detail.component.ts b/src/app/datasets/components/filter-list/filter-detail/filter-detail.component.ts index 5005ff01..dbadae2b 100644 --- a/src/app/datasets/components/filter-list/filter-detail/filter-detail.component.ts +++ b/src/app/datasets/components/filter-list/filter-detail/filter-detail.component.ts @@ -34,7 +34,7 @@ export class FilterDetailComponent implements OnInit { const parentAggregationKey = (aggregation.parentAggregation) ? aggregation.parentAggregation.key : ''; this._datasetResearchService.updateAggregation( this.filter.field, aggregation.key, - newValueActive, parentAggregationKey); + newValueActive, parentAggregationKey, true); this._datasetResearchService.triggerSearchChange(); } diff --git a/src/app/datasets/components/results/results.component.ts b/src/app/datasets/components/results/results.component.ts index 9c46ad61..4fac28ad 100644 --- a/src/app/datasets/components/results/results.component.ts +++ b/src/app/datasets/components/results/results.component.ts @@ -50,9 +50,19 @@ export class ResultsComponent implements OnInit, OnDestroy { // Set the title and description for the research page this._meta.updateTag({ name: 'description', content: metaDescription.research }); - this._route.queryParams.subscribe((params) => { - this.manageUrlParameters(params); - }); + // If url with parameters too long, we reset it and display a notif + + if (location.href.length > 2000) { + this._researchUrlService.reset(); + this._notificationService.notify(new Notification({ + message: 'The url was too long bro. Have a join to feel better.', + type: 'warning', + })); + } else { + this._route.queryParams.subscribe((params) => { + this.manageUrlParameters(params); + }); + } if (!this.hasParams) { this.search(); @@ -78,6 +88,7 @@ export class ResultsComponent implements OnInit, OnDestroy { // If there are parameters, we extract them to set the ESoptions for a news search. private manageUrlParameters(params) { if (params && Object.keys(params).length > 0) { + this.hasParams = true; // We need to make an initial request to get the aggregations and subaggregations this._datasetResearchService.getResults().subscribe(() => { @@ -88,29 +99,35 @@ export class ResultsComponent implements OnInit, OnDestroy { this._datasetResearchService.shouldAggregateResultCount = true; // Set the aggregations const aggParameters = this._researchUrlService.aggParameters; + Object.keys(aggParameters).forEach((key) => { - let aggField = `metadata-fr.${key}`; + const aggField = `metadata-fr.${key}`; const oneAgg = aggParameters[key]; + oneAgg.forEach((agg: string) => { + let newAggField = aggField; + // Find out if it's an aggregation or subaggregation const filters = this._datasetResearchService.elasticSearchOptions.filters; let parentAgg = ''; filters.forEach((filter) => { + if (filter.subField === aggField) { - // We need to find the parent aggregatin + // We need to find the parent aggregation filter.aggregations.forEach((aggregation) => { if (aggregation.subAggregations.length > 0) { const index = aggregation.subAggregations.findIndex(el => el.key === agg); + const subAggregation = aggregation.subAggregations[index]; if (subAggregation) { parentAgg = subAggregation.parentAggregation.key; - aggField = subAggregation.parentAggregation.field; + newAggField = subAggregation.parentAggregation.field; } } }); } }); - this._datasetResearchService.updateAggregation(aggField, agg, true, parentAgg); + this._datasetResearchService.updateAggregation(newAggField, agg, true, parentAgg, false); }); }); this._datasetResearchService.triggerSearchChange(); @@ -120,6 +137,8 @@ export class ResultsComponent implements OnInit, OnDestroy { ngOnDestroy() { this.searchChangeSub.unsubscribe(); + // Reset the url parameters + this._researchUrlService.reset(); } search() { diff --git a/src/app/datasets/services/dataset-research.service.ts b/src/app/datasets/services/dataset-research.service.ts index f6663254..e4b64514 100644 --- a/src/app/datasets/services/dataset-research.service.ts +++ b/src/app/datasets/services/dataset-research.service.ts @@ -404,30 +404,34 @@ export class DatasetResearchService { * Some logic is necessary depending if it's a 'parent' aggregation or a subaggregation * When the aggregation is updated, the searchChangeSubject is triggered. */ - updateAggregation(filterField: string, aggregationKey: string, isActive: boolean, aggregationParentKey = '') { + updateAggregation( + filterField: string, aggregationKey: string, + isActive: boolean, aggregationParentKey = '', updateUrlParams = true) { const filterToUpdate = this._elasticsearchOptions.filters.find((el => el.field === filterField)); - const aggregation = filterToUpdate.findInAggregationsAndSubAggregations(aggregationKey, aggregationParentKey); - if (aggregation) { - filterToUpdate.setAggregationAndSubaggregation(aggregation, isActive); - if (aggregation.isActive) { - this._researchUrlService.setAggParameter(aggregation.field, aggregationKey); - } else { - this._researchUrlService.setAggParameter(aggregation.field, null); + if (filterToUpdate) { + // If we find the filter to update + const aggregation = filterToUpdate.findInAggregationsAndSubAggregations(aggregationKey, aggregationParentKey); + + if (aggregation) { + filterToUpdate.setAggregationAndSubaggregation(aggregation, isActive); + if (updateUrlParams) { + this._researchUrlService.setAggParameter(aggregation, isActive); + } } - } - // By default, we set the lastclicked filter. - // But if there is no more active aggregation for this filter, we - // want to set it to null to force display new ES aggregations count. - this._lastFilterClicked = filterField; - const aggrActive = filterToUpdate.findActiveAggregations(); - if (!isActive && aggrActive.length === 0) { - this._lastFilterClicked = null; - } + // By default, we set the lastclicked filter. + // But if there is no more active aggregation for this filter, we + // want to set it to null to force display new ES aggregations count. + this._lastFilterClicked = filterField; + const aggrActive = filterToUpdate.findActiveAggregations(); + if (!isActive && aggrActive.length === 0) { + this._lastFilterClicked = null; + } - this._elasticsearchOptions.pageIndex = 0; - this._elasticsearchOptions.shouldAggregateFilters = true; - this._elasticsearchOptions.shouldAggregateResultCount = true; + this._elasticsearchOptions.pageIndex = 0; + this._elasticsearchOptions.shouldAggregateFilters = true; + this._elasticsearchOptions.shouldAggregateResultCount = true; + } } @@ -450,6 +454,7 @@ export class DatasetResearchService { this._lastFilterClicked = null; this._elasticsearchOptions.shouldAggregateFilters = true; this._elasticsearchOptions.shouldAggregateResultCount = true; + this._researchUrlService.reset(); } searchChanged(value: string) { diff --git a/src/app/datasets/services/research-url.service.ts b/src/app/datasets/services/research-url.service.ts index 97a79dad..f6016c88 100644 --- a/src/app/datasets/services/research-url.service.ts +++ b/src/app/datasets/services/research-url.service.ts @@ -1,6 +1,6 @@ import { Location } from '@angular/common'; import { Injectable } from '@angular/core'; -import { IElasticsearchOptions, ISortOption } from '../../elasticsearch/models'; +import { Aggregation, IElasticsearchOptions, ISortOption } from '../../elasticsearch/models'; import { AppRoutes } from '../../routes'; import { scopesResearch } from '../../shared/variables'; @@ -32,6 +32,7 @@ export class ResearchUrlService { } else { // First we check if it's an aggregation (it should but if someone enter a random filter) const aggs = params[key].split(','); + this._aggParameters[key] = []; aggs.forEach((agg: string) => { this._aggParameters[key].push(agg); @@ -81,27 +82,72 @@ export class ResearchUrlService { } // Set an aggregation parameter in the _aggParameters variable, and change the url - setAggParameter(field: string, value: string) { - const fieldKey = field.replace(/metadata-fr./, ''); - - // If value is null, we remove the param. If not, we add it - if (!value) { - delete this._aggParameters[fieldKey]; - } else { - // If new, init the array - if (!this._aggParameters[fieldKey]) { - this._aggParameters[fieldKey] = []; - } - // If value not exists already - if (!this._aggParameters[fieldKey].includes(value)) { - this._aggParameters[fieldKey].push(value); + setAggParameter(aggregation: Aggregation, isActiveAgg: boolean) { + const fieldKey = aggregation.field.replace(/metadata-fr./, ''); + + // If it's a parent, we active or inactive all the chil + if (!aggregation.parentAggregation) { + // If active agg + if (isActiveAgg) { + this.addAggregation(fieldKey, aggregation.key); + } else { + this.removeAggregation(fieldKey, aggregation.key); } + } + // If one subaggregation is updated: + // - parent aggregation becomes active if all the sub aggregations are active + // - parent aggregation becomes inactive if NOT all the sub aggregations are active + // tslint:disable-next-line: brace-style + else { + const parentAggregation = aggregation.parentAggregation; + const parentFieldKey = parentAggregation.field.replace(/metadata-fr./, ''); + + if (parentAggregation.isAllSubAggregationsActive()) { + // Remove the current field for subaggregations + const aggField = aggregation.field.replace(/metadata-fr./, ''); + delete this._aggParameters[aggField]; + this.addAggregation(parentFieldKey, parentAggregation.key); + } else { + // Remove the parentAgg as filter, and add all the subAgg active + this.removeAggregation(parentFieldKey, parentAggregation.key); + aggregation.parentAggregation.subAggregations.forEach((subAgg) => { + const subAggFieldKey = subAgg.field.replace(/metadata-fr./, ''); + if (subAgg.isActive) { + this.addAggregation(subAggFieldKey, subAgg.key); + } else { + this.removeAggregation(subAggFieldKey, subAgg.key); + } + }); + } } + const params = this.generateUrlParams(); this._location.go(AppRoutes.research.uri, params); } + private addAggregation(fieldKey: string, aggregationKey: string) { + // If new, init the array + if (!this._aggParameters[fieldKey]) { + this._aggParameters[fieldKey] = []; + } + // If value not exists already + if (!this._aggParameters[fieldKey].includes(aggregationKey)) { + this._aggParameters[fieldKey].push(aggregationKey); + } + } + + private removeAggregation(fieldKey: string, aggregationKey: string) { + if (this._aggParameters[fieldKey]) { + const index = this._aggParameters[fieldKey].indexOf(aggregationKey); + if (index !== -1) this._aggParameters[fieldKey].splice(index, 1); + // If array is empty, then we remove the parent field. + if (this._aggParameters[fieldKey].length === 0) { + delete this._aggParameters[fieldKey]; + } + } + } + setPaginationParameter(pageIndex: number) { this._parameters['page'] = pageIndex + 1; const params = this.generateUrlParams(); @@ -144,6 +190,12 @@ export class ResearchUrlService { return params; } + reset() { + this._parameters = {}; + this._aggParameters = {}; + this._location.go(AppRoutes.research.uri, ''); + } + get aggParameters() { return this._aggParameters; } diff --git a/src/app/elasticsearch/models/filter.model.ts b/src/app/elasticsearch/models/filter.model.ts index b6d9dc65..4be4482c 100644 --- a/src/app/elasticsearch/models/filter.model.ts +++ b/src/app/elasticsearch/models/filter.model.ts @@ -20,7 +20,7 @@ export class Aggregation { type: string; constructor(aggBucket: IAggregationBucket) { - this.key = aggBucket.key; + this.key = this.removeSpecialCharacters(aggBucket.key); this.doc_count = aggBucket.doc_count; this.count_per_metadata = aggBucket.count_per_metadata; this.isActive = aggBucket.isActive ? this.isActive : false; @@ -34,7 +34,7 @@ export class Aggregation { } else if (geosource.updateFrequencies[this.key]) { this.label = geosource.updateFrequencies[this.key]; } else { - this.label = this.key; + this.label = aggBucket.key; } // The label display needs some treatment if too long or if have special pattern: @@ -69,6 +69,11 @@ export class Aggregation { } + private removeSpecialCharacters(key: string) { + // return (typeof key === 'string') ? key.replace(/[^a-zA-Z ]/g, '') : key; + return (typeof key === 'string') ? key.replace(/[!@,#$%^&*]/g, '') : key; + } + findInSubAggregations(key: string) { const index = this.subAggregations.findIndex(el => el.key === key); return (index) ? this.subAggregations[index] : null; @@ -115,6 +120,7 @@ export class Filter { findInAggregationsAndSubAggregations(key: string, aggregationParentKey = '') { let aggregationFound = null; + this.aggregations.forEach((aggregation) => { if (aggregation.key === key && aggregationParentKey === '') { aggregationFound = aggregation; diff --git a/src/app/elasticsearch/services/elasticsearch.service.ts b/src/app/elasticsearch/services/elasticsearch.service.ts index 444530f7..9531ca6c 100644 --- a/src/app/elasticsearch/services/elasticsearch.service.ts +++ b/src/app/elasticsearch/services/elasticsearch.service.ts @@ -139,7 +139,7 @@ export class ElasticsearchService { body['sort'] = [sort]; } - // Here the default_field is 'data', meaning that the query + // Here the default_field is 'data', meaning that the query if (options.searchString !== '') { const searchString = this.escapeSpecialCharacters(options.searchString, options.fromAutocompletion, 'AND'); body.query.bool['must'] = [ @@ -446,12 +446,12 @@ export class ElasticsearchService { must: [ { match: { - [field]: activeAgg.key, + [field]: activeAgg.label, }, }, { match: { - [fieldParent]: activeAgg.parentAggregation.key, + [fieldParent]: activeAgg.parentAggregation.label, }, }, ], @@ -466,7 +466,7 @@ export class ElasticsearchService { ignore_unmapped: true, query: { term: { - [field]: activeAgg.key, + [field]: activeAgg.label, }, }, }, @@ -476,7 +476,7 @@ export class ElasticsearchService { } else { // Special treatment for the licences if (filter.label === geosource.filterCategories.licences && - !options.knownLicences.includes(activeAgg.key)) { + !options.knownLicences.includes(activeAgg.label)) { options.otherLicenceAggregations.forEach((agg) => { shouldExpression.push({ term: { @@ -487,7 +487,7 @@ export class ElasticsearchService { } else { shouldExpression.push({ term: { - [field]: activeAgg.key, + [field]: activeAgg.label, }, }); } -- GitLab From ff31a7f0ff40aabf97f2f49f09fe93ddca04f4d7 Mon Sep 17 00:00:00 2001 From: CARRON Guilhem Date: Thu, 2 Apr 2020 13:51:48 +0200 Subject: [PATCH 56/78] Integration new cookie banner --- .../cookie-banner.component.html | 71 ++++++- .../cookie-banner.component.scss | 187 +++++++++++++++--- .../cookie-banner/cookie-banner.component.ts | 16 +- 3 files changed, 235 insertions(+), 39 deletions(-) diff --git a/src/app/core/components/cookie-banner/cookie-banner.component.html b/src/app/core/components/cookie-banner/cookie-banner.component.html index 140c8f9e..9b181c97 100644 --- a/src/app/core/components/cookie-banner/cookie-banner.component.html +++ b/src/app/core/components/cookie-banner/cookie-banner.component.html @@ -1,9 +1,68 @@ -