wip: use new alert API after rebase

This commit is contained in:
Yohan Boniface 2024-06-13 21:29:20 +02:00
parent e9f9c30639
commit ca16e5b2c9
3 changed files with 5 additions and 7 deletions

View file

@ -235,7 +235,7 @@ export default class Importer {
this.map.importFromUrl(this.url, this.format) this.map.importFromUrl(this.url, this.format)
} }
} catch (e) { } catch (e) {
this.map.alert.open({ content: translate('Invalid umap data'), level: 'error' }) Alert.error(translate('Invalid umap data'))
console.error(e) console.error(e)
} }
} }

View file

@ -2,6 +2,7 @@ import { DomUtil, DomEvent } from '../../../vendors/leaflet/leaflet-src.esm.js'
import { BaseAjax, SingleMixin } from '../autocomplete.js' import { BaseAjax, SingleMixin } from '../autocomplete.js'
import { translate } from '../i18n.js' import { translate } from '../i18n.js'
import * as Utils from '../utils.js' import * as Utils from '../utils.js'
import { uMapAlert as Alert } from '../../components/alerts/alert.js'
const BOUNDARY_TYPES = { const BOUNDARY_TYPES = {
admin_6: 'département', admin_6: 'département',
@ -76,9 +77,7 @@ export class Importer {
}) })
const confirm = () => { const confirm = () => {
if (!boundary || !select.value) { if (!boundary || !select.value) {
this.map.alert.open({ Alert.error(translate('Please choose a theme and a boundary first.'))
content: translate('Please choose a theme and a boundary first.'),
})
return return
} }
importer.url = `${this.baseUrl}/data/${select.value}/${boundary}?format=geojson&aspoint=${asPoint.checked}` importer.url = `${this.baseUrl}/data/${select.value}/${boundary}?format=geojson&aspoint=${asPoint.checked}`

View file

@ -1,6 +1,7 @@
import { DomUtil } from '../../../vendors/leaflet/leaflet-src.esm.js' import { DomUtil } from '../../../vendors/leaflet/leaflet-src.esm.js'
import { BaseAjax, SingleMixin } from '../autocomplete.js' import { BaseAjax, SingleMixin } from '../autocomplete.js'
import { translate } from '../i18n.js' import { translate } from '../i18n.js'
import { uMapAlert as Alert } from '../../components/alerts/alert.js'
const TEMPLATE = ` const TEMPLATE = `
<h3>Overpass</h3> <h3>Overpass</h3>
@ -60,9 +61,7 @@ export class Importer {
const confirm = () => { const confirm = () => {
let tags = container.querySelector('[name=tags]').value let tags = container.querySelector('[name=tags]').value
if (!tags) { if (!tags) {
this.map.alert.open({ Alert.error(translate('Please define an expression for the query first'))
content: translate('Please define an expression for the query first'),
})
return return
} }
const outMode = container.querySelector('[name=out-mode]').value const outMode = container.querySelector('[name=out-mode]').value