+ :model-value="optionValues.trackMe === 'true'"
+ @update:model-value="onTrackMeChange">
{{ window.t('maps', 'Track my position') }}
-
- {{ window.t('maps', 'Open geo links') }}
-
+
+ :model-value="optionValues.displaySlider === 'true'"
+ @update:model-value="onDisplaySliderChange">
{{ window.t('maps', 'Display time filter slider') }}
@@ -44,7 +43,7 @@
\ No newline at end of file
+
diff --git a/src/components/map/SearchField.vue b/src/components/map/SearchField.vue
index 7e51b3dd3..dd3584538 100644
--- a/src/components/map/SearchField.vue
+++ b/src/components/map/SearchField.vue
@@ -1,26 +1,19 @@
@@ -28,12 +21,12 @@
{{ option.label }}
-
+
{{ option.value || option.label }}
-
+
{{ t('maps', 'No suggestions') }}
@@ -91,18 +84,10 @@ export default {
return part.replace(/\S/g, (char) => { return accented[char.toUpperCase()] || char })
})
const regex = new RegExp(queryParts.join('|'), 'i')
- return this.formattedOptions.filter((option) => {
+ return this.options.filter((option) => {
return regex.test(option.label || option.value)
})
},
- formattedOptions() {
- return this.options.map((o) => {
- return {
- ...o,
- multiselectKey: o.id + o.type,
- }
- })
- },
options() {
if (this.currentCoordinateOption && this.currentSearchQueryOption) {
return [this.currentCoordinateOption, this.currentSearchQueryOption, ...this.allData]
@@ -135,6 +120,9 @@ export default {
},
methods: {
+ getOptionKey(option) {
+ return `${option.id}${option.type}`
+ },
focus() {
const input = this.$refs.select.$el.querySelector('input')
input.focus()
@@ -145,19 +133,17 @@ export default {
}
*/
},
- onOptionSelected(option, id) {
+ onOptionSelected(option) {
if (option?.type === 'query') {
+ this.mySelectedOption = null
this.searchOsm(option.value)
- } else {
- if (option) {
- this.$emit('validate', option)
- this.mySelectedOption = option
- }
+ return
+ }
+
+ this.mySelectedOption = option
+ if (option) {
+ this.$emit('validate', option)
}
- },
- onUpdateValue(e) {
- },
- onChange(e) {
},
onSearchChange(query) {
this.query = query
@@ -202,7 +188,6 @@ export default {
}
},
searchOsm(query) {
- this.mySelectedOption = this.currentSearchQueryOption
this.currentSearchQueryOption = null
this.searching = true
network.searchAddress(query, 5).then((response) => {
diff --git a/src/main.js b/src/main.js
index cf095ba0a..6a247779e 100644
--- a/src/main.js
+++ b/src/main.js
@@ -26,7 +26,6 @@ import '../css/style.scss'
import optionsController from './optionsController.js'
import { emit } from '@nextcloud/event-bus'
-import { generateUrl } from '@nextcloud/router'
import L from 'leaflet'
import 'lrm-graphhopper'
@@ -77,10 +76,6 @@ if (!window.OCA.Files.Sidebar) {
}, window.OCA.Files)
}
-if (window.navigator.registerProtocolHandler) {
- window.navigator.registerProtocolHandler('geo', generateUrl('/apps/maps/openGeoLink/') + '%s', 'Nextcloud Maps')
-}
-
function main() {
const app = createApp(App);
@@ -106,4 +101,4 @@ function main() {
document.addEventListener('DOMContentLoaded', () => {
optionsController.restoreOptions(main)
-})
\ No newline at end of file
+})
diff --git a/src/network.js b/src/network.js
index df393934e..f19406bf2 100644
--- a/src/network.js
+++ b/src/network.js
@@ -53,8 +53,8 @@ export function searchContacts(query = '', myMapId = null) {
const req = {
params: {
myMapId,
+ query,
},
- query,
}
const url = generateUrl('/apps/maps/contacts-search')
return axios.get(url, req)
diff --git a/src/views/App.vue b/src/views/App.vue
index 09450b67e..61848f982 100644
--- a/src/views/App.vue
+++ b/src/views/App.vue
@@ -7,7 +7,7 @@
+ @register-geo-link="onRegisterGeoLink">
assertTrue($result instanceof TemplateResponse);
}
+ public function testCanBeConstructedWithoutAuthenticatedUser(): void {
+ $controller = new PageController(
+ 'maps',
+ $this->createMock(IRequest::class),
+ null,
+ $this->eventDispatcher,
+ $this->appConfig,
+ $this->initialState,
+ $this->urlGenerator,
+ );
+
+ $this->assertInstanceOf(PageController::class, $controller);
+ }
+
public function testOpenGeoLink(): void {
$result = $this->controller->openGeoLink('geo:1.1,2.2');
diff --git a/tests/Unit/Service/MyMapsServiceTest.php b/tests/Unit/Service/MyMapsServiceTest.php
new file mode 100644
index 000000000..3a97a9160
--- /dev/null
+++ b/tests/Unit/Service/MyMapsServiceTest.php
@@ -0,0 +1,34 @@
+createMock(IRootFolder::class);
+ $userFolder = $this->createMock(Folder::class);
+
+ $root->expects(self::once())
+ ->method('getUserFolder')
+ ->with('john')
+ ->willReturn($userFolder);
+ $userFolder->expects(self::once())
+ ->method('getFirstNodeById')
+ ->with(42)
+ ->willReturn(null);
+
+ $service = new MyMapsService($root);
+
+ self::assertNull($service->getMyMap(42, 'john'));
+ }
+}