-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed map context search and field search for wfs/odata layers (#602)
* fixed map context search and field search for wfs/odata layers * fixing the bugs of the previous version of the commit, moving code into utilities, tests * context search supports numeric, date and boolean formats * fixed test * included contextual search for numeric, boolean and date fields * undo changes when forming an empty filter * objects of one layer are limited to 100, not all found objects * added limit flag on entries * improving method safety Co-authored-by: viatkinviatkin <svyatkin@skyori.ru>
- Loading branch information
1 parent
3dedb48
commit 9a197af
Showing
11 changed files
with
255 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
export default function getBooleanFromString(str = '') { | ||
let result = null; | ||
switch (str.toLowerCase()) { | ||
case '1' : case 'да': case 'true': case 'yes': | ||
result = true; | ||
break; | ||
case '0' : case 'нет': case 'false': case 'no': | ||
result = false; | ||
break; | ||
|
||
} | ||
return result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
const dateFormats = ['DD.MM.YYYY', 'DD-MM-YYYY', 'DD/MM/YYYY', 'YYYY/MM/DD', 'YYYY.MM.DD', 'YYYY-MM-DD']; | ||
const timeFormats = [' HH:mm', ' HH:mm:ss', 'THH:mm:ss.SSSSZ', '']; | ||
|
||
let getDateFormatFromString = (str) => { | ||
|
||
let dateFormat = dateFormats.find(dateFormat => moment(str.split(/[\sT]+/)[0], dateFormat, true).isValid()); | ||
|
||
let timeFormat = timeFormats.find(timeFormat=> moment(str, dateFormat + timeFormat, true).isValid()); | ||
|
||
return { dateFormat, timeFormat }; | ||
}; | ||
|
||
let createTimeInterval = (date, dateFormat) => { | ||
if (!date || !dateFormat) { | ||
return []; | ||
} | ||
|
||
let startInterval = date.toISOString(); | ||
let endInterval = null; | ||
switch (date.creationData().format) { | ||
case dateFormat: | ||
|
||
// Search the entire day | ||
endInterval = date.add(1, 'days').toISOString(); | ||
break; | ||
|
||
case dateFormat + ' HH:mm': | ||
|
||
// Search by the exact time in the interval of one minute | ||
endInterval = date.add(60 - date.seconds(), 'seconds').toISOString(); | ||
break; | ||
case dateFormat + ' HH:mm:ss': | ||
|
||
// Search by the exact time in the interval of one second | ||
endInterval = date.add(1, 'seconds').toISOString(); | ||
break; | ||
default: | ||
return [startInterval]; | ||
} | ||
|
||
return [startInterval, endInterval]; | ||
}; | ||
|
||
export { | ||
getDateFormatFromString, createTimeInterval | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from 'ember-flexberry-gis/utils/get-boolean-from-string'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from 'ember-flexberry-gis/utils/get-date-from-string'; |
Oops, something went wrong.