Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(feature): excludeAttribute works with offlineButton #628

Merged
merged 20 commits into from
May 4, 2020
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
930cf17
Merge pull request #5 from infra-geo-ouverte/1.0.0-alpha
drekss Aug 9, 2019
e1e5d45
Merge pull request #8 from infra-geo-ouverte/1.0.0-alpha
drekss Aug 13, 2019
aa8c4e3
Merge pull request #12 from infra-geo-ouverte/1.0.0-alpha
drekss Aug 28, 2019
74ca893
Merge pull request #16 from infra-geo-ouverte/master
drekss Sep 29, 2019
e04d3b8
Merge pull request #17 from infra-geo-ouverte/master
drekss Oct 4, 2019
ce783db
Merge pull request #18 from infra-geo-ouverte/master
drekss Oct 11, 2019
af80ed7
Merge pull request #19 from infra-geo-ouverte/master
drekss Oct 29, 2019
197663e
Merge pull request #20 from infra-geo-ouverte/master
drekss Oct 29, 2019
16532c1
Merge pull request #21 from infra-geo-ouverte/master
drekss Oct 30, 2019
f2a365a
Merge pull request #22 from infra-geo-ouverte/master
drekss Oct 31, 2019
776658c
Merge pull request #25 from infra-geo-ouverte/master
drekss Nov 9, 2019
dafec8a
Merge pull request #26 from infra-geo-ouverte/master
drekss Nov 15, 2019
2765fef
Merge pull request #28 from infra-geo-ouverte/master
drekss Dec 5, 2019
1d3547b
Merge pull request #30 from infra-geo-ouverte/master
drekss Dec 18, 2019
2b7387a
Merge pull request #32 from infra-geo-ouverte/master
drekss Feb 28, 2020
082316e
Merge pull request #33 from infra-geo-ouverte/next
drekss Mar 4, 2020
84f6224
fix(feature): excludeAttribute offline now works with the offline button
drekss Mar 24, 2020
47c50c5
remove extra
drekss Mar 24, 2020
d90e71e
using offlineButtonToggle$
May 4, 2020
94f8b12
remove uselesss attribute
May 4, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { getEntityTitle, getEntityIcon } from '@igo2/common';

import { Feature } from '../shared';
import { SearchSource } from '../../search/shared/sources/source';
import { IgoMap } from '../../map/shared/map';

@Component({
selector: 'igo-feature-details',
Expand All @@ -30,6 +31,8 @@ export class FeatureDetailsComponent {
this.cdRef.detectChanges();
}

@Input() map: IgoMap;

@Input()
get feature(): Feature {
return this._feature;
Expand Down Expand Up @@ -87,13 +90,21 @@ export class FeatureDetailsComponent {
filterFeatureProperties(feature) {
const allowedFieldsAndAlias = feature.meta ? feature.meta.alias : undefined;
const properties = {};
let offlineButtonState;

if (this.map) {
this.map.offlineButtonToggle$.subscribe(state => {
offlineButtonState = state;
});
}

if (allowedFieldsAndAlias) {
Object.keys(allowedFieldsAndAlias).forEach(field => {
properties[allowedFieldsAndAlias[field]] = feature.properties[field];
});
return properties;
} else {
} else if (offlineButtonState !== undefined) {
if (!offlineButtonState) {
if (this.state.connection && feature.meta && feature.meta.excludeAttribute) {
const excludeAttribute = feature.meta.excludeAttribute;
excludeAttribute.forEach(attribute => {
Expand All @@ -105,7 +116,27 @@ export class FeatureDetailsComponent {
delete feature.properties[attribute];
});
}
return feature.properties;
} else {
if (feature.meta && feature.meta.excludeAttributeOffline) {
const excludeAttributeOffline = feature.meta.excludeAttributeOffline;
excludeAttributeOffline.forEach(attribute => {
delete feature.properties[attribute];
});
}
}
} else {
if (this.state.connection && feature.meta && feature.meta.excludeAttribute) {
const excludeAttribute = feature.meta.excludeAttribute;
excludeAttribute.forEach(attribute => {
delete feature.properties[attribute];
});
} else if (!this.state.connection && feature.meta && feature.meta.excludeAttributeOffline) {
const excludeAttributeOffline = feature.meta.excludeAttributeOffline;
excludeAttributeOffline.forEach(attribute => {
delete feature.properties[attribute];
});
}
}
return feature.properties;
}
}