AW-2714
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
This commit is contained in:
parent
e0f36b043f
commit
c0c9864b07
@ -6,12 +6,14 @@ import { ILayervalue } from '../models/layer.value';
|
|||||||
import { IQueryState } from '@farmmaps/common';
|
import { IQueryState } from '@farmmaps/common';
|
||||||
import { IItem } from '@farmmaps/common';
|
import { IItem } from '@farmmaps/common';
|
||||||
import { Feature,Style } from 'ol';
|
import { Feature,Style } from 'ol';
|
||||||
|
import { IPeriodState } from 'common-map/public-api';
|
||||||
|
|
||||||
export const SETSTATE = '[Map] SetState';
|
export const SETSTATE = '[Map] SetState';
|
||||||
export const SETMAPSTATE = '[Map] MapState';
|
export const SETMAPSTATE = '[Map] MapState';
|
||||||
export const SETVIEWEXTENT = '[Map] SetViewExtent';
|
export const SETVIEWEXTENT = '[Map] SetViewExtent';
|
||||||
export const INIT = '[Map] Init';
|
export const INIT = '[Map] Init';
|
||||||
export const SETPARENT = '[Map] SetParent';
|
export const SETPARENT = '[Map] SetParent';
|
||||||
|
export const SETPERIOD = '[Map] SetPeriod';
|
||||||
export const STARTSEARCH = '[Map] StartSearch';
|
export const STARTSEARCH = '[Map] StartSearch';
|
||||||
export const STARTSEARCHSUCCESS = '[Map] StartSearchSuccess';
|
export const STARTSEARCHSUCCESS = '[Map] StartSearchSuccess';
|
||||||
export const SELECTFEATURE = '[Map] SelectFeature';
|
export const SELECTFEATURE = '[Map] SelectFeature';
|
||||||
@ -86,6 +88,12 @@ export class SetParent implements Action {
|
|||||||
constructor(public parentCode:string) { }
|
constructor(public parentCode:string) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class SetPeriod implements Action {
|
||||||
|
readonly type = SETPERIOD;
|
||||||
|
|
||||||
|
constructor(public period:IPeriodState) { }
|
||||||
|
}
|
||||||
|
|
||||||
export class StartSearch implements Action {
|
export class StartSearch implements Action {
|
||||||
readonly type = STARTSEARCH;
|
readonly type = STARTSEARCH;
|
||||||
|
|
||||||
@ -348,5 +356,6 @@ export type Actions = SetMapState
|
|||||||
| SetLayerValuesLocation
|
| SetLayerValuesLocation
|
||||||
| ToggleLayerValuesEnabled
|
| ToggleLayerValuesEnabled
|
||||||
| GetLayerValueSuccess
|
| GetLayerValueSuccess
|
||||||
| GetLayerValue;
|
| GetLayerValue
|
||||||
|
| SetPeriod;
|
||||||
|
|
||||||
|
@ -82,9 +82,17 @@ export function LocalStorageSync(reducer: ActionReducer<any>): ActionReducer<any
|
|||||||
if(ms) {
|
if(ms) {
|
||||||
r2["mapState"] = JSON.parse(ms);
|
r2["mapState"] = JSON.parse(ms);
|
||||||
}
|
}
|
||||||
|
let sp = window.localStorage.getItem(MODULE_NAME+"_searchPeriod");
|
||||||
|
if(sp) {
|
||||||
|
let p = JSON.parse(sp);
|
||||||
|
r2["period"] = { startDate: new Date(Date.parse(p.startDate)),endDate:new Date(Date.parse(p.endDate))};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(action.type == "[Map] MapState" || action.type == "[Map] SetState") {
|
if(action.type == "[Map] MapState" || action.type == "[Map] SetState") {
|
||||||
window.localStorage.setItem(MODULE_NAME + "_mapState",JSON.stringify(r2["mapState"]));
|
window.localStorage.setItem(MODULE_NAME + "_mapState",JSON.stringify(r2["mapState"]));
|
||||||
|
}
|
||||||
|
if(action.type == "[Map] SetPeriod" ) {
|
||||||
|
window.localStorage.setItem(MODULE_NAME + "_searchPeriod",JSON.stringify(r2["period"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return r2;
|
return r2;
|
||||||
|
@ -33,4 +33,4 @@
|
|||||||
<ng-content></ng-content>
|
<ng-content></ng-content>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<fm-map-select-period-modal [modalState]="openedModalName" (onCloseModal)="handleCloseModal()" (onSelect)="handleSelectPeriod($event)" [startDate]="startDate" [endDate]="endDate"></fm-map-select-period-modal>
|
<fm-map-select-period-modal [modalState]="openedModalName" (onCloseModal)="handleCloseModal()" (onSelect)="handleSelectPeriod($event)" [startDate]="periodLocal.startDate" [endDate]="periodLocal.endDate"></fm-map-select-period-modal>
|
||||||
|
@ -22,7 +22,10 @@ export class MapSearchComponent {
|
|||||||
@Input() set searchMinified(minified: boolean) {
|
@Input() set searchMinified(minified: boolean) {
|
||||||
this.searchMinifiedLocal = minified;
|
this.searchMinifiedLocal = minified;
|
||||||
}
|
}
|
||||||
@Input() period: IPeriodState
|
@Input() set period(period:IPeriodState) {
|
||||||
|
this.periodLocal = tassign(this.periodLocal,{startDate: period.startDate,endDate:period.endDate});
|
||||||
|
this.startEndCaption = this.timespanService.getCaption(period.startDate, period.endDate, 4)
|
||||||
|
}
|
||||||
@Output() onSearch = new EventEmitter<IQueryState>();
|
@Output() onSearch = new EventEmitter<IQueryState>();
|
||||||
@Output() onClear = new EventEmitter<any>();
|
@Output() onClear = new EventEmitter<any>();
|
||||||
@Output() onSearchCollapse = new EventEmitter<any>();
|
@Output() onSearchCollapse = new EventEmitter<any>();
|
||||||
@ -30,6 +33,7 @@ export class MapSearchComponent {
|
|||||||
@Output() onToggleMenu = new EventEmitter<any>();
|
@Output() onToggleMenu = new EventEmitter<any>();
|
||||||
@Output() onOpenModal = new EventEmitter<string>();
|
@Output() onOpenModal = new EventEmitter<string>();
|
||||||
@Output() onCloseModal = new EventEmitter<any>();
|
@Output() onCloseModal = new EventEmitter<any>();
|
||||||
|
@Output() onPeriodChange = new EventEmitter<IPeriodState>();
|
||||||
@Input() openedModalName: string;
|
@Input() openedModalName: string;
|
||||||
@Input() set filterOptions(filterOptions: IQueryState) {
|
@Input() set filterOptions(filterOptions: IQueryState) {
|
||||||
if (filterOptions && filterOptions.query && filterOptions.query.length > 0) {
|
if (filterOptions && filterOptions.query && filterOptions.query.length > 0) {
|
||||||
@ -43,22 +47,17 @@ export class MapSearchComponent {
|
|||||||
} else {
|
} else {
|
||||||
this.searchTextLocal = { name: filterOptions.query };
|
this.searchTextLocal = { name: filterOptions.query };
|
||||||
}
|
}
|
||||||
if (this.dateFilter) {
|
|
||||||
this.filterOptionsLocal.startDate = this.startDate;
|
|
||||||
this.filterOptionsLocal.endDate = this.endDate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public collapsedLocal: boolean = true;
|
public collapsedLocal: boolean = true;
|
||||||
public searchMinifiedLocal: boolean = false;
|
public searchMinifiedLocal: boolean = false;
|
||||||
|
public periodLocal: IPeriodState = { startDate:new Date(new Date(Date.now()).getFullYear(), new Date(Date.now()).getMonth() - 3, 1), endDate:new Date(Date.now())};
|
||||||
public filterOptionsLocal: IQueryState;
|
public filterOptionsLocal: IQueryState;
|
||||||
private extent: number[];
|
private extent: number[];
|
||||||
public searchTextLocal: any;
|
public searchTextLocal: any;
|
||||||
public searchTextLocalOutput: string;
|
public searchTextLocalOutput: string;
|
||||||
public dateFilter: boolean = true;
|
public dateFilter: boolean = true;
|
||||||
public startDate: Date = new Date(new Date(Date.now()).getFullYear(), new Date(Date.now()).getMonth() - 3, 1);
|
public startEndCaption: string = this.timespanService.getCaption(this.periodLocal.startDate, this.periodLocal.endDate, 4);
|
||||||
public endDate: Date = new Date(Date.now());
|
|
||||||
public startEndCaption: string = this.timespanService.getCaption(this.startDate, this.endDate, 4);
|
|
||||||
|
|
||||||
searching = false;
|
searching = false;
|
||||||
searchFailed = false;
|
searchFailed = false;
|
||||||
@ -94,8 +93,8 @@ export class MapSearchComponent {
|
|||||||
this.filterOptionsLocal.parentCode = null;
|
this.filterOptionsLocal.parentCode = null;
|
||||||
this.filterOptionsLocal.query = this.searchTextLocalOutput;
|
this.filterOptionsLocal.query = this.searchTextLocalOutput;
|
||||||
if (this.dateFilter) {
|
if (this.dateFilter) {
|
||||||
this.filterOptionsLocal.startDate = this.startDate;
|
this.filterOptionsLocal.startDate = this.periodLocal.startDate;
|
||||||
this.filterOptionsLocal.endDate = this.endDate;
|
this.filterOptionsLocal.endDate = this.periodLocal.endDate;
|
||||||
}
|
}
|
||||||
this.onSearch.emit(this.filterOptionsLocal);
|
this.onSearch.emit(this.filterOptionsLocal);
|
||||||
}
|
}
|
||||||
@ -117,26 +116,30 @@ export class MapSearchComponent {
|
|||||||
this.filterOptionsLocal.parentCode = null;
|
this.filterOptionsLocal.parentCode = null;
|
||||||
this.filterOptionsLocal.tags = event.item.name;
|
this.filterOptionsLocal.tags = event.item.name;
|
||||||
if (this.dateFilter) {
|
if (this.dateFilter) {
|
||||||
this.filterOptionsLocal.startDate = this.startDate;
|
this.filterOptionsLocal.startDate = this.periodLocal.startDate;
|
||||||
this.filterOptionsLocal.endDate = this.endDate;
|
this.filterOptionsLocal.endDate = this.periodLocal.endDate;
|
||||||
}
|
}
|
||||||
this.onSearch.emit(this.filterOptionsLocal);
|
this.onSearch.emit(this.filterOptionsLocal);
|
||||||
this.searchTextLocal = { name: this.filterOptionsLocal.tags };
|
this.searchTextLocal = { name: this.filterOptionsLocal.tags };
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSelectPeriod(event: { startDate: Date, endDate: Date }) {
|
handleSelectPeriod(event: { startDate: Date, endDate: Date }) {
|
||||||
this.startDate = event.startDate;
|
this.periodLocal = { startDate: event.startDate, endDate: event.endDate}
|
||||||
this.endDate = event.endDate;
|
this.onPeriodChange.emit(this.periodLocal);
|
||||||
this.handleCloseModal();
|
|
||||||
this.startEndCaption = this.timespanService.getCaption(event.startDate, event.endDate, 4);
|
this.startEndCaption = this.timespanService.getCaption(event.startDate, event.endDate, 4);
|
||||||
this.onSearch.emit(this.filterOptionsLocal);
|
if(this.dateFilter) {
|
||||||
|
this.filterOptionsLocal.startDate =event.startDate;
|
||||||
|
this.filterOptionsLocal.endDate = event.endDate;
|
||||||
|
this.onSearch.emit(this.filterOptionsLocal);
|
||||||
|
}
|
||||||
|
this.handleCloseModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
handleChangeEnableDateFilter(enabled) {
|
handleChangeEnableDateFilter(enabled) {
|
||||||
this.dateFilter = enabled;
|
this.dateFilter = enabled;
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
this.filterOptionsLocal.startDate = this.startDate;
|
this.filterOptionsLocal.startDate = this.periodLocal.startDate;
|
||||||
this.filterOptionsLocal.endDate = this.endDate;
|
this.filterOptionsLocal.endDate = this.periodLocal.endDate;
|
||||||
} else {
|
} else {
|
||||||
this.filterOptionsLocal.startDate = null;
|
this.filterOptionsLocal.startDate = null;
|
||||||
this.filterOptionsLocal.endDate = null;
|
this.filterOptionsLocal.endDate = null;
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
<fm-map-file-drop-target [parentCode]="state.parentCode" (onFileDropped)="handleFileDropped($event)"></fm-map-file-drop-target>
|
<fm-map-file-drop-target [parentCode]="state.parentCode" (onFileDropped)="handleFileDropped($event)"></fm-map-file-drop-target>
|
||||||
|
|
||||||
<div *ngIf="noContent">
|
<div *ngIf="noContent">
|
||||||
<fm-map-map-search #mapSearch [openedModalName]="state.openedModalName" (onOpenModal)="handleOpenModal($event)" (onCloseModal)="handleCloseModal()" [ngClass]="{'menuVisible':state.menuVisible}" (onToggleMenu)="handleToggleMenu($event)" (onSearchCollapse)="handleSearchCollapse($event)" (onSearchExpand)="handleSearchExpand($event)" [collapsed]="state.searchCollapsed" [searchMinified]="state.searchMinified" (onSearch)="handleSearch($event)" (onClear)="handleClearSearch($event)" [filterOptions]="state.queryState" [clearEnabled]="state.clearEnabled" [period]="state.period"></fm-map-map-search>
|
<fm-map-map-search #mapSearch [openedModalName]="state.openedModalName" (onOpenModal)="handleOpenModal($event)" (onCloseModal)="handleCloseModal()" [ngClass]="{'menuVisible':state.menuVisible}" (onToggleMenu)="handleToggleMenu($event)" (onSearchCollapse)="handleSearchCollapse($event)" (onSearchExpand)="handleSearchExpand($event)" [collapsed]="state.searchCollapsed" [searchMinified]="state.searchMinified" (onSearch)="handleSearch($event)" (onClear)="handleClearSearch($event)" [filterOptions]="state.queryState" [clearEnabled]="state.clearEnabled" [period]="state.period" (onPeriodChange)="handlePeriodChange($event)"></fm-map-map-search>
|
||||||
</div>
|
</div>
|
||||||
<div class="side-panel-container">
|
<div class="side-panel-container">
|
||||||
<fm-side-panel [resizeable]="true" [visible]="state.panelVisible && noContent" [collapsed]="state.panelCollapsed" [collapsable]="false">
|
<fm-side-panel [resizeable]="true" [visible]="state.panelVisible && noContent" [collapsed]="state.panelCollapsed" [collapsable]="false">
|
||||||
|
@ -434,6 +434,10 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
|||||||
this.store.dispatch(new mapActions.SelectOverlayLayer(itemLayer));
|
this.store.dispatch(new mapActions.SelectOverlayLayer(itemLayer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handlePeriodChange(period:IPeriodState) {
|
||||||
|
this.store.dispatch(new mapActions.SetPeriod(period));
|
||||||
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
if (this.paramSub) this.paramSub.unsubscribe();
|
if (this.paramSub) this.paramSub.unsubscribe();
|
||||||
if (this.itemTypeSub) this.itemTypeSub.unsubscribe();
|
if (this.itemTypeSub) this.itemTypeSub.unsubscribe();
|
||||||
|
@ -3,7 +3,7 @@ import { IItem,Item } from '@farmmaps/common';
|
|||||||
import { IItemLayer,ItemLayer,ITemporalItemLayer,TemporalItemLayer} from '../models/item.layer';
|
import { IItemLayer,ItemLayer,ITemporalItemLayer,TemporalItemLayer} from '../models/item.layer';
|
||||||
import { IMapState} from '../models/map.state';
|
import { IMapState} from '../models/map.state';
|
||||||
import { IQueryState} from '@farmmaps/common';
|
import { IQueryState} from '@farmmaps/common';
|
||||||
import { IPeriodState} from '../models/period.state';
|
import { IPeriodState } from '../models/period.state';
|
||||||
import { IStyles} from '../models/style.cache';
|
import { IStyles} from '../models/style.cache';
|
||||||
import { ILayervalue } from '../models/layer.value';
|
import { ILayervalue } from '../models/layer.value';
|
||||||
import * as mapActions from '../actions/map.actions';
|
import * as mapActions from '../actions/map.actions';
|
||||||
@ -307,7 +307,11 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
|
|||||||
querystate: tassign(a.query, { bbox: a.query.bboxFilter ? state.viewExtent : [] }),
|
querystate: tassign(a.query, { bbox: a.query.bboxFilter ? state.viewExtent : [] }),
|
||||||
replace:a.replace
|
replace:a.replace
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
case mapActions.SETPERIOD: {
|
||||||
|
return tassign(state,{ period: action.period});
|
||||||
}
|
}
|
||||||
|
|
||||||
case mapActions.ADDFEATURESUCCESS: {
|
case mapActions.ADDFEATURESUCCESS: {
|
||||||
|
Loading…
Reference in New Issue
Block a user