Skip to content

Commit

Permalink
feat(wfs): wfs table
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbeau committed Apr 4, 2019
1 parent 8a1b52d commit e76307c
Show file tree
Hide file tree
Showing 10 changed files with 185 additions and 25 deletions.
68 changes: 64 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
"@igo2/geo": "^0.26.2",
"@igo2/tools": "^0.26.2",
"@igo2/utils": "^0.26.2",
"@turf/helpers": "^6.1.4",
"@turf/line-intersect": "^6.0.2",
"classlist.js": "^1.1.20150312",
"file-saver": "^1.3.8",
"hammerjs": "^2.0.8",
Expand Down
2 changes: 1 addition & 1 deletion proxy.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"secure": false,
"changeOrigin": true
},
"/igo2/api/": {
"/apis/": {
"target": "https://geoegl.msp.gouv.qc.ca",
"secure": false,
"changeOrigin": true
Expand Down
26 changes: 26 additions & 0 deletions src/app/pages/portal/portal.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
</button>

<igo-search-bar
[minLength]="minSearchTermLength"
(change)="onSearchTermChange($event)"
(search)="onSearch($event)">
</igo-search-bar>
Expand Down Expand Up @@ -58,15 +59,34 @@
[@controlStateX]="(mediaService.media$ | async) !== 'mobile' &&
sidenavOpened ? 'right' : 'left'">
</igo-baselayers-switcher> -->
<igo-baselayers-switcher [map]="map"></igo-baselayers-switcher>
</igo-map-browser>

<igo-expansion-panel
[(expanded)]="expansionPanelExpanded"
[backdropShown]="expansionPanelBackdropShown">

<ng-container expansionPanelHeader>
<igo-editor-selector igoWfsEditorSelector [store]="editorStore" [map]="map"></igo-editor-selector>
<igo-actionbar
*ngIf="editor"
[store]="editor.actionStore"
[horizontal]="true"
[xPosition]="'after'"
[yPosition]="'above'"
[withToggleButton]="true"
[withTitle]="actionbarWithTitle"
[mode]="actionbarMode">
</igo-actionbar>
</ng-container>

<igo-entity-table
*ngIf="editor"
class="table-compact table-centered"
[store]="editor.entityStore"
[template]="editor.tableTemplate">
</igo-entity-table>

</igo-expansion-panel>

</mat-sidenav-container>
Expand All @@ -81,6 +101,12 @@
[feature]="searchResult.data">
</igo-feature-details>

<igo-editor-outlet
*ngIf="toastPanelContent === 'editor'"
[editor]="editor"
(deactivateWidget)="onDeactivateEditorWidget()">
</igo-editor-outlet>

</igo-toast-panel>

<!-- <igo-toast
Expand Down
40 changes: 40 additions & 0 deletions src/app/pages/portal/portal.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,43 @@ igo-toast-panel.igo-toast-panel-opened {
left: 0;
}
}


igo-expansion-panel:not(.igo-expansion-panel-expanded) {
@include small-screen {
igo-editor-selector,
igo-actionbar {
display: none;
}
}

@include tablet {
igo-editor-selector,
igo-actionbar {
display: none;
}
}

@include mobile {
igo-editor-selector,
igo-actionbar {
display: none;
}
}
}

igo-expansion-panel {
igo-editor-selector {
width: calc(#{$igo-sidenav-width} - #{$igo-icon-size} - 65px)
}

@include mobile {
igo-editor-selector {
width: calc(#{$igo-sidenav-width} - (2 * #{$igo-icon-size}) - 65px);
}
}

igo-actionbar {
margin-left: 5px;
}
}
38 changes: 33 additions & 5 deletions src/app/pages/portal/portal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ import { MapBrowserPointerEvent as OlMapBrowserPointerEvent } from 'ol/MapBrowse
import { MediaService, ConfigService, Media } from '@igo2/core';
import {
ActionbarMode,
Editor,
EditorStore,
EntityRecord,
EntityStore,
getEntityTitle,
Tool,
Toolbox
} from '@igo2/common';
import { AuthService } from '@igo2/auth';
import { Context, DetailedContext } from '@igo2/context';
import { DetailedContext } from '@igo2/context';
import {
DataSourceService,
Feature,
Expand All @@ -33,6 +34,7 @@ import {

import {
ContextState,
EditionState,
ToolState,
MapState,
SearchState
Expand All @@ -58,14 +60,14 @@ export class PortalComponent implements OnInit, OnDestroy {
};

public searchResult: SearchResult;
public minSearchTermLength = 2;

public expansionPanelExpanded = false;
public sidenavOpened = false;

// True after the initial context is loaded
private contextLoaded = false;
private context$$: Subscription;
private selectedEditor$$: Subscription;
private searchResults$$: Subscription;
private focusedSearchResult$$: Subscription;

Expand Down Expand Up @@ -108,31 +110,49 @@ export class PortalComponent implements OnInit, OnDestroy {

get toastPanelContent(): string {
let content;
if (this.searchResult !== undefined) {
if (this.editor !== undefined && this.editor.hasWidget) {
content = 'editor';
} else if (this.searchResult !== undefined) {
content = this.searchResult.meta.dataType.toLowerCase();
}
return content;
}

get toastPanelTitle(): string {
let title;
if (this.searchResult !== undefined) {
if (
this.toastPanelContent !== 'editor' &&
this.searchResult !== undefined
) {
title = getEntityTitle(this.searchResult);
}
return title;
}

get toastPanelOpened(): boolean {
const content = this.toastPanelContent;
if (content === 'editor') {
return true;
}
return this._toastPanelOpened;
}
set toastPanelOpened(value: boolean) {
this._toastPanelOpened = value;
}
private _toastPanelOpened = false;

get editorStore(): EditorStore {
return this.editionState.store;
}

get editor(): Editor {
return this.editionState.editor$.value;
}

constructor(
private route: ActivatedRoute,
private configService: ConfigService,
private editionState: EditionState,
public authService: AuthService,
public mediaService: MediaService,
public layerService: LayerService,
Expand Down Expand Up @@ -210,6 +230,10 @@ export class PortalComponent implements OnInit, OnDestroy {
return;
}

if (term.length < this.minSearchTermLength) {
return;
}

this.onBeforeSearch();
}

Expand Down Expand Up @@ -245,6 +269,10 @@ export class PortalComponent implements OnInit, OnDestroy {
}
}

onDeactivateEditorWidget() {
this.closeToastPanel();
}

private closeToastPanel() {
this.toastPanelOpened = false;
}
Expand Down
10 changes: 8 additions & 2 deletions src/app/pages/portal/portal.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ import {

import { IgoCoreModule } from '@igo2/core';
import {
IgoActionModule,
IgoEditionModule,
IgoEntityModule,
IgoPanelModule,
IgoBackdropModule,
IgoFlexibleModule,
IgoToolModule
} from '@igo2/common';

import {
IgoGeoEditionModule,
IgoFeatureModule,
IgoImportExportModule,
IgoMapModule,
Expand Down Expand Up @@ -45,10 +48,13 @@ import { PortalComponent } from './portal.component';
IgoMapModule,
IgoQueryModule.forRoot(),
IgoSearchModule.forRoot(),
IgoActionModule,
IgoEditionModule,
IgoEntityModule,
IgoGeoEditionModule,
IgoPanelModule,
IgoToolModule,
IgoBackdropModule,
IgoFlexibleModule,
IgoExpansionPanelModule,
IgoToastPanelModule,
IgoIntegrationModule,
Expand Down
Loading

0 comments on commit e76307c

Please sign in to comment.