parent
597b3bb10f
commit
02eb69a280
2 changed files with 18 additions and 2 deletions
|
@ -285,6 +285,15 @@ L.DomUtil.createFieldset = (container, legend, options) => {
|
|||
return fieldsEl
|
||||
}
|
||||
|
||||
L.DomUtil.createButton = (className, container, content, callback, context) => {
|
||||
const el = L.DomUtil.add('a', className, container, content)
|
||||
el.href = '#'
|
||||
if (callback) {
|
||||
L.DomEvent.on(el, 'click', L.DomEvent.stop).on(el, 'click', callback, context)
|
||||
}
|
||||
return el
|
||||
}
|
||||
|
||||
L.DomUtil.classIf = (el, className, bool) => {
|
||||
if (bool) L.DomUtil.addClass(el, className)
|
||||
else L.DomUtil.removeClass(el, className)
|
||||
|
|
|
@ -398,10 +398,10 @@ L.U.DataLayer = L.Evented.extend({
|
|||
return !((!isNaN(from) && zoom < from) || (!isNaN(to) && zoom > to))
|
||||
},
|
||||
|
||||
fetchRemoteData: function () {
|
||||
fetchRemoteData: function (force) {
|
||||
if (!this.isRemoteLayer()) return
|
||||
if (!this.showAtZoom()) return
|
||||
if (!this.options.remoteData.dynamic && this.hasDataLoaded()) return
|
||||
if (!this.options.remoteData.dynamic && this.hasDataLoaded() && !force) return
|
||||
if (!this.isVisible()) return
|
||||
let url = this.map.localizeUrl(this.options.remoteData.url)
|
||||
if (this.options.remoteData.proxy)
|
||||
|
@ -961,6 +961,13 @@ L.U.DataLayer = L.Evented.extend({
|
|||
const remoteDataContainer = L.DomUtil.createFieldset(container, L._('Remote data'))
|
||||
builder = new L.U.FormBuilder(this, remoteDataFields)
|
||||
remoteDataContainer.appendChild(builder.build())
|
||||
L.DomUtil.createButton(
|
||||
'button umap-verify',
|
||||
remoteDataContainer,
|
||||
L._('Verify remote URL'),
|
||||
() => this.fetchRemoteData(true),
|
||||
this
|
||||
)
|
||||
|
||||
if (this.map.options.urls.datalayer_versions) this.buildVersionsFieldset(container)
|
||||
|
||||
|
|
Loading…
Reference in a new issue