mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +02:00
chore: highlight bar buttons according to open panel
Co-authored-by: Yohan Boniface <yohanboniface@free.fr>
This commit is contained in:
parent
99db1c82f4
commit
0451b4a882
15 changed files with 81 additions and 57 deletions
|
@ -476,15 +476,6 @@ i.info {
|
||||||
.umap-download:before {
|
.umap-download:before {
|
||||||
background-position: -72px -78px;
|
background-position: -72px -78px;
|
||||||
}
|
}
|
||||||
.permissions-panel,
|
|
||||||
.umap-upload,
|
|
||||||
.umap-share,
|
|
||||||
.umap-datalayer-container,
|
|
||||||
.umap-layer-properties-container,
|
|
||||||
.umap-browse-data,
|
|
||||||
.umap-tilelayer-switcher-container {
|
|
||||||
padding: 0 10px;
|
|
||||||
}
|
|
||||||
.umap-field-datalist {
|
.umap-field-datalist {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
@ -615,6 +606,6 @@ input[type=hidden].blur + [type="button"] {
|
||||||
input.highlightable:not(:placeholder-shown) {
|
input.highlightable:not(:placeholder-shown) {
|
||||||
border: 1px solid var(--color-brightCyan);
|
border: 1px solid var(--color-brightCyan);
|
||||||
}
|
}
|
||||||
.umap-upload [type=url] {
|
.umap-import [type=url] {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,3 +107,20 @@
|
||||||
border-bottom-right-radius: 0;
|
border-bottom-right-radius: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:has(.right[data-highlight="caption"]) li[data-ref="caption"] button,
|
||||||
|
:has(.right[data-highlight="caption"]) li[data-ref="caption"] button:hover,
|
||||||
|
:has(.right[data-highlight="import"]) li[data-ref="import"] button,
|
||||||
|
:has(.right[data-highlight="import"]) li[data-ref="import"] button:hover,
|
||||||
|
:has(.right[data-highlight="layers"]) li[data-ref="layers"] button,
|
||||||
|
:has(.right[data-highlight="layers"]) li[data-ref="layers"] button:hover,
|
||||||
|
:has(.right[data-highlight="tilelayers"]) li[data-ref="tilelayers"] button,
|
||||||
|
:has(.right[data-highlight="tilelayers"]) li[data-ref="tilelayers"] button:hover,
|
||||||
|
:has(.right[data-highlight="center"]) li[data-ref="center"] button,
|
||||||
|
:has(.right[data-highlight="center"]) li[data-ref="center"] button:hover,
|
||||||
|
:has(.right[data-highlight="permissions"]) li[data-ref="permissions"] button,
|
||||||
|
:has(.right[data-highlight="permissions"]) li[data-ref="permissions"] button:hover,
|
||||||
|
:has(.right[data-highlight="settings"]) li[data-ref="settings"] button,
|
||||||
|
:has(.right[data-highlight="settings"]) li[data-ref="settings"] button:hover {
|
||||||
|
background-color: var(--color-mediumGray);
|
||||||
|
}
|
||||||
|
|
|
@ -897,6 +897,7 @@ export class DataLayer extends ServerStored {
|
||||||
|
|
||||||
this._umap.editPanel.open({
|
this._umap.editPanel.open({
|
||||||
content: container,
|
content: container,
|
||||||
|
highlight: 'layers',
|
||||||
actions: [backButton],
|
actions: [backButton],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import Dialog from './ui/dialog.js'
|
||||||
import * as Utils from './utils.js'
|
import * as Utils from './utils.js'
|
||||||
|
|
||||||
const TEMPLATE = `
|
const TEMPLATE = `
|
||||||
<div class="umap-upload">
|
<div class="umap-import">
|
||||||
<h3><i class="icon icon-16 icon-upload"></i><span>${translate('Import data')}</span></h3>
|
<h3><i class="icon icon-16 icon-upload"></i><span>${translate('Import data')}</span></h3>
|
||||||
<fieldset class="formbox">
|
<fieldset class="formbox">
|
||||||
<legend class="counter">${translate('Choose data')}</legend>
|
<legend class="counter">${translate('Choose data')}</legend>
|
||||||
|
@ -261,7 +261,10 @@ export default class Importer extends Utils.WithTemplate {
|
||||||
|
|
||||||
open() {
|
open() {
|
||||||
if (!this.container) this.build()
|
if (!this.container) this.build()
|
||||||
const onLoad = this._umap.editPanel.open({ content: this.container })
|
const onLoad = this._umap.editPanel.open({
|
||||||
|
content: this.container,
|
||||||
|
highlight: 'import',
|
||||||
|
})
|
||||||
onLoad.then(() => this.onLoad())
|
onLoad.then(() => this.onLoad())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,12 +166,16 @@ export class MapPermissions extends ServerStored {
|
||||||
Alert.info(translate('Please save the map first'))
|
Alert.info(translate('Please save the map first'))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const container = DomUtil.create('div', 'permissions-panel')
|
const container = DomUtil.create('div', 'umap-edit-permissions')
|
||||||
DomUtil.createTitle(container, translate('Update permissions'), 'icon-key')
|
DomUtil.createTitle(container, translate('Update permissions'), 'icon-key')
|
||||||
if (this.isAnonymousMap()) this._editAnonymous(container)
|
if (this.isAnonymousMap()) this._editAnonymous(container)
|
||||||
else this._editWithOwner(container)
|
else this._editWithOwner(container)
|
||||||
this._editDatalayers(container)
|
this._editDatalayers(container)
|
||||||
this._umap.editPanel.open({ content: container, className: 'dark' })
|
this._umap.editPanel.open({
|
||||||
|
content: container,
|
||||||
|
className: 'dark',
|
||||||
|
highlight: 'permissions',
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async attach() {
|
async attach() {
|
||||||
|
|
|
@ -217,7 +217,7 @@ const ManageTilelayerMixin = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
updateTileLayers: function () {
|
editTileLayers: function () {
|
||||||
if (this._controls.tilelayersChooser) {
|
if (this._controls.tilelayersChooser) {
|
||||||
this._controls.tilelayersChooser.openSwitcher({ edit: true })
|
this._controls.tilelayersChooser.openSwitcher({ edit: true })
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ class Rule {
|
||||||
.map((str) => `${value}${str || ''}`)
|
.map((str) => `${value}${str || ''}`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this._umap.editPanel.open({ content: container })
|
this._umap.editPanel.open({ content: container, highlight: 'settings' })
|
||||||
}
|
}
|
||||||
|
|
||||||
renderToolbox(row) {
|
renderToolbox(row) {
|
||||||
|
|
|
@ -219,9 +219,9 @@ const EDIT_BAR_TEMPLATE = `
|
||||||
<li data-ref="caption" hidden><button data-getstarted type="button" title="${translate('Edit map name and caption')}"><i class="icon icon-24 icon-caption"></i></button></li>
|
<li data-ref="caption" hidden><button data-getstarted type="button" title="${translate('Edit map name and caption')}"><i class="icon icon-24 icon-caption"></i></button></li>
|
||||||
<li data-ref="import" hidden><button type="button"><i class="icon icon-24 icon-upload"></i></button></li>
|
<li data-ref="import" hidden><button type="button"><i class="icon icon-24 icon-upload"></i></button></li>
|
||||||
<li data-ref="layers" hidden><button type="button" title="${translate('Manage layers')}"><i class="icon icon-24 icon-layers"></i></button></li>
|
<li data-ref="layers" hidden><button type="button" title="${translate('Manage layers')}"><i class="icon icon-24 icon-layers"></i></button></li>
|
||||||
<li data-ref="tiles" hidden><button type="button" title="${translate('Change tilelayers')}"><i class="icon icon-24 icon-tilelayer"></i></button></li>
|
<li data-ref="tilelayers" hidden><button type="button" title="${translate('Change tilelayers')}"><i class="icon icon-24 icon-tilelayer"></i></button></li>
|
||||||
<li data-ref="center" hidden><button type="button"><i class="icon icon-24 icon-center"></i></button></li>
|
<li data-ref="center" hidden><button type="button"><i class="icon icon-24 icon-center"></i></button></li>
|
||||||
<li data-ref="key" hidden><button type="button" title="${translate('Update permissions and editors')}"><i class="icon icon-24 icon-key"></i></button></li>
|
<li data-ref="permissions" hidden><button type="button" title="${translate('Update permissions and editors')}"><i class="icon icon-24 icon-key"></i></button></li>
|
||||||
<li data-ref="settings" hidden><button data-getstarted type="button" title="${translate('Map advanced properties')}"><i class="icon icon-24 icon-settings"></i></button></li>
|
<li data-ref="settings" hidden><button data-getstarted type="button" title="${translate('Map advanced properties')}"><i class="icon icon-24 icon-settings"></i></button></li>
|
||||||
</ul>
|
</ul>
|
||||||
`
|
`
|
||||||
|
@ -249,9 +249,9 @@ export class EditBar extends WithTemplate {
|
||||||
this._onClick('caption', () => this._umap.editCaption())
|
this._onClick('caption', () => this._umap.editCaption())
|
||||||
this._onClick('import', () => this._umap.importer.open())
|
this._onClick('import', () => this._umap.importer.open())
|
||||||
this._onClick('layers', () => this._umap.editDatalayers())
|
this._onClick('layers', () => this._umap.editDatalayers())
|
||||||
this._onClick('tiles', () => this._leafletMap.updateTileLayers())
|
this._onClick('tilelayers', () => this._leafletMap.editTileLayers())
|
||||||
this._onClick('center', () => this._umap.editCenter())
|
this._onClick('center', () => this._umap.editCenter())
|
||||||
this._onClick('key', () => this._umap.permissions.edit())
|
this._onClick('permissions', () => this._umap.permissions.edit())
|
||||||
this._onClick('settings', () => this._umap.edit())
|
this._onClick('settings', () => this._umap.edit())
|
||||||
this._addTitle('import', 'IMPORT_PANEL')
|
this._addTitle('import', 'IMPORT_PANEL')
|
||||||
this._addTitle('marker', 'DRAW_MARKER')
|
this._addTitle('marker', 'DRAW_MARKER')
|
||||||
|
@ -267,9 +267,9 @@ export class EditBar extends WithTemplate {
|
||||||
this.elements.caption.hidden = this._umap.properties.editMode !== 'advanced'
|
this.elements.caption.hidden = this._umap.properties.editMode !== 'advanced'
|
||||||
this.elements.import.hidden = this._umap.properties.editMode !== 'advanced'
|
this.elements.import.hidden = this._umap.properties.editMode !== 'advanced'
|
||||||
this.elements.layers.hidden = this._umap.properties.editMode !== 'advanced'
|
this.elements.layers.hidden = this._umap.properties.editMode !== 'advanced'
|
||||||
this.elements.tiles.hidden = this._umap.properties.editMode !== 'advanced'
|
this.elements.tilelayers.hidden = this._umap.properties.editMode !== 'advanced'
|
||||||
this.elements.center.hidden = this._umap.properties.editMode !== 'advanced'
|
this.elements.center.hidden = this._umap.properties.editMode !== 'advanced'
|
||||||
this.elements.key.hidden = this._umap.properties.editMode !== 'advanced'
|
this.elements.permissions.hidden = this._umap.properties.editMode !== 'advanced'
|
||||||
this.elements.settings.hidden = this._umap.properties.editMode !== 'advanced'
|
this.elements.settings.hidden = this._umap.properties.editMode !== 'advanced'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,13 +25,16 @@ export class Panel {
|
||||||
return this.container.classList.contains('on')
|
return this.container.classList.contains('on')
|
||||||
}
|
}
|
||||||
|
|
||||||
open({ content, className, actions = [] } = {}) {
|
open({ content, className, highlight, actions = [] } = {}) {
|
||||||
if (this.isOpen()) {
|
if (this.isOpen()) {
|
||||||
this.onClose()
|
this.onClose()
|
||||||
}
|
}
|
||||||
this.container.className = `with-transition panel window ${this.className} ${
|
this.container.className = `with-transition panel window ${this.className} ${
|
||||||
this.mode || ''
|
this.mode || ''
|
||||||
}`
|
}`
|
||||||
|
if (highlight) {
|
||||||
|
this.container.dataset.highlight = highlight
|
||||||
|
}
|
||||||
document.body.classList.add(`panel-${this.className.split(' ')[0]}-on`)
|
document.body.classList.add(`panel-${this.className.split(' ')[0]}-on`)
|
||||||
this.container.innerHTML = ''
|
this.container.innerHTML = ''
|
||||||
const actionsContainer = DomUtil.create('ul', 'buttons', this.container)
|
const actionsContainer = DomUtil.create('ul', 'buttons', this.container)
|
||||||
|
@ -75,6 +78,7 @@ export class Panel {
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
document.body.classList.remove(`panel-${this.className.split(' ')[0]}-on`)
|
document.body.classList.remove(`panel-${this.className.split(' ')[0]}-on`)
|
||||||
|
this.container.dataset.highlight = null
|
||||||
this.onClose()
|
this.onClose()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -744,7 +744,7 @@ export default class Umap extends ServerStored {
|
||||||
editCaption() {
|
editCaption() {
|
||||||
if (!this.editEnabled) return
|
if (!this.editEnabled) return
|
||||||
if (this.properties.editMode !== 'advanced') return
|
if (this.properties.editMode !== 'advanced') return
|
||||||
const container = DomUtil.create('div', 'umap-edit-container')
|
const container = DomUtil.create('div')
|
||||||
const metadataFields = ['properties.name', 'properties.description']
|
const metadataFields = ['properties.name', 'properties.description']
|
||||||
|
|
||||||
DomUtil.createTitle(container, translate('Edit map details'), 'icon-caption')
|
DomUtil.createTitle(container, translate('Edit map details'), 'icon-caption')
|
||||||
|
@ -765,13 +765,13 @@ export default class Umap extends ServerStored {
|
||||||
]
|
]
|
||||||
const creditsBuilder = new MutatingForm(this, creditsFields, { umap: this })
|
const creditsBuilder = new MutatingForm(this, creditsFields, { umap: this })
|
||||||
credits.appendChild(creditsBuilder.build())
|
credits.appendChild(creditsBuilder.build())
|
||||||
this.editPanel.open({ content: container })
|
this.editPanel.open({ content: container, highlight: 'caption' })
|
||||||
}
|
}
|
||||||
|
|
||||||
editCenter() {
|
editCenter() {
|
||||||
if (!this.editEnabled) return
|
if (!this.editEnabled) return
|
||||||
if (this.properties.editMode !== 'advanced') return
|
if (this.properties.editMode !== 'advanced') return
|
||||||
const container = DomUtil.create('div', 'umap-edit-container')
|
const container = DomUtil.create('div')
|
||||||
const metadataFields = [
|
const metadataFields = [
|
||||||
['properties.zoom', { handler: 'IntInput', label: translate('Default zoom') }],
|
['properties.zoom', { handler: 'IntInput', label: translate('Default zoom') }],
|
||||||
[
|
[
|
||||||
|
@ -800,7 +800,7 @@ export default class Umap extends ServerStored {
|
||||||
})
|
})
|
||||||
container.appendChild(form)
|
container.appendChild(form)
|
||||||
container.appendChild(button)
|
container.appendChild(button)
|
||||||
this.editPanel.open({ content: container })
|
this.editPanel.open({ content: container, highlight: 'center' })
|
||||||
}
|
}
|
||||||
|
|
||||||
_editControls(container) {
|
_editControls(container) {
|
||||||
|
@ -1157,7 +1157,11 @@ export default class Umap extends ServerStored {
|
||||||
}
|
}
|
||||||
this._advancedActions(container)
|
this._advancedActions(container)
|
||||||
|
|
||||||
this.editPanel.open({ content: container, className: 'dark' })
|
this.editPanel.open({
|
||||||
|
content: container,
|
||||||
|
className: 'dark',
|
||||||
|
highlight: 'settings',
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
reset() {
|
reset() {
|
||||||
|
@ -1546,7 +1550,7 @@ export default class Umap extends ServerStored {
|
||||||
this
|
this
|
||||||
)
|
)
|
||||||
|
|
||||||
this.editPanel.open({ content: container })
|
this.editPanel.open({ content: container, highlight: 'layers' })
|
||||||
}
|
}
|
||||||
|
|
||||||
getDataLayerByUmapId(id) {
|
getDataLayerByUmapId(id) {
|
||||||
|
|
|
@ -432,12 +432,12 @@ U.TileLayerChooser = L.Control.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
openSwitcher: function (options = {}) {
|
openSwitcher: function (options = {}) {
|
||||||
const container = L.DomUtil.create('div', 'umap-tilelayer-switcher-container')
|
const container = L.DomUtil.create('div', 'umap-edit-tilelayers')
|
||||||
L.DomUtil.createTitle(container, L._('Change tilelayers'), 'icon-tilelayer')
|
L.DomUtil.createTitle(container, L._('Change tilelayers'), 'icon-tilelayer')
|
||||||
this._tilelayers_container = L.DomUtil.create('ul', '', container)
|
this._tilelayers_container = L.DomUtil.create('ul', '', container)
|
||||||
this.buildList(options)
|
this.buildList(options)
|
||||||
const panel = options.edit ? this.map._umap.editPanel : this.map._umap.panel
|
const panel = options.edit ? this.map._umap.editPanel : this.map._umap.panel
|
||||||
panel.open({ content: container })
|
panel.open({ content: container, highlight: 'tilelayers' })
|
||||||
},
|
},
|
||||||
|
|
||||||
buildList: function (options) {
|
buildList: function (options) {
|
||||||
|
|
|
@ -688,7 +688,7 @@ a.umap-control-caption,
|
||||||
/* Tilelayer switcher */
|
/* Tilelayer switcher */
|
||||||
/* ********************************* */
|
/* ********************************* */
|
||||||
|
|
||||||
.umap-tilelayer-switcher-container li {
|
.umap-edit-tilelayers li {
|
||||||
border: 1px solid rgb(116, 116, 116);
|
border: 1px solid rgb(116, 116, 116);
|
||||||
border-radius: 4px 4px 4px 4px;
|
border-radius: 4px 4px 4px 4px;
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
|
@ -700,7 +700,7 @@ a.umap-control-caption,
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
.umap-tilelayer-switcher-container li div {
|
.umap-edit-tilelayers li div {
|
||||||
background-color: rgb(116, 116, 116);
|
background-color: rgb(116, 116, 116);
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
color: rgb(247, 246, 241);
|
color: rgb(247, 246, 241);
|
||||||
|
@ -712,8 +712,8 @@ a.umap-control-caption,
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.umap-tilelayer-switcher-container li:hover div:before,
|
.umap-edit-tilelayers li:hover div:before,
|
||||||
.umap-tilelayer-switcher-container .selected div:before {
|
.umap-edit-tilelayers .selected div:before {
|
||||||
content: "✓";
|
content: "✓";
|
||||||
font-size: 1.3em;
|
font-size: 1.3em;
|
||||||
line-height: 56px;
|
line-height: 56px;
|
||||||
|
@ -721,7 +721,7 @@ a.umap-control-caption,
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset-inline-start: 7px;
|
inset-inline-start: 7px;
|
||||||
}
|
}
|
||||||
.umap-tilelayer-switcher-container li img {
|
.umap-edit-tilelayers li img {
|
||||||
display: block;
|
display: block;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
--color-darkBlue: #263B58;
|
--color-darkBlue: #263B58;
|
||||||
--color-lighterGray: #f6f6f6;
|
--color-lighterGray: #f6f6f6;
|
||||||
--color-lightGray: #ddd;
|
--color-lightGray: #ddd;
|
||||||
--color-mediumGray: #3e4444;
|
--color-mediumGray: #474e4e;
|
||||||
--color-darkGray: #323737;
|
--color-darkGray: #323737;
|
||||||
--color-darkerGray: #2a2e30;
|
--color-darkerGray: #2a2e30;
|
||||||
--color-light: white;
|
--color-light: white;
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
--block-shadow: 0 1px 7px var(--color-mediumGray);
|
--block-shadow: 0 1px 7px var(--color-mediumGray);
|
||||||
}
|
}
|
||||||
.dark {
|
.dark {
|
||||||
--background-color: var(--color-darkGray);
|
--background-color: var(--color-mediumGray);
|
||||||
--text-color: #efefef;
|
--text-color: #efefef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -471,7 +471,7 @@ def test_vertexmarker_not_shown_if_too_many(live_server, map, page, settings):
|
||||||
settings.UMAP_ALLOW_ANONYMOUS = True
|
settings.UMAP_ALLOW_ANONYMOUS = True
|
||||||
page.goto(f"{live_server.url}/en/map/new/#15/48.4395/3.3189")
|
page.goto(f"{live_server.url}/en/map/new/#15/48.4395/3.3189")
|
||||||
page.get_by_title("Import data").click()
|
page.get_by_title("Import data").click()
|
||||||
page.locator(".umap-upload textarea").fill(geojson)
|
page.locator(".umap-import textarea").fill(geojson)
|
||||||
page.locator('select[name="format"]').select_option("geojson")
|
page.locator('select[name="format"]').select_option("geojson")
|
||||||
page.get_by_role("button", name="Import data", exact=True).click()
|
page.get_by_role("button", name="Import data", exact=True).click()
|
||||||
page.locator("path").click()
|
page.locator("path").click()
|
||||||
|
|
|
@ -76,7 +76,7 @@ def test_umap_import_from_textarea(live_server, tilelayer, page, settings):
|
||||||
page.goto(f"{live_server.url}/map/new/")
|
page.goto(f"{live_server.url}/map/new/")
|
||||||
page.get_by_role("button", name="Open browser").click()
|
page.get_by_role("button", name="Open browser").click()
|
||||||
page.get_by_title("Import data").click()
|
page.get_by_title("Import data").click()
|
||||||
textarea = page.locator(".umap-upload textarea")
|
textarea = page.locator(".umap-import textarea")
|
||||||
path = Path(__file__).parent.parent / "fixtures/test_upload_data.umap"
|
path = Path(__file__).parent.parent / "fixtures/test_upload_data.umap"
|
||||||
textarea.fill(path.read_text())
|
textarea.fill(path.read_text())
|
||||||
page.locator('select[name="format"]').select_option("umap")
|
page.locator('select[name="format"]').select_option("umap")
|
||||||
|
@ -111,7 +111,7 @@ def test_import_geojson_from_textarea(tilelayer, live_server, page):
|
||||||
button = page.get_by_title("Import data")
|
button = page.get_by_title("Import data")
|
||||||
expect(button).to_be_visible()
|
expect(button).to_be_visible()
|
||||||
button.click()
|
button.click()
|
||||||
textarea = page.locator(".umap-upload textarea")
|
textarea = page.locator(".umap-import textarea")
|
||||||
path = Path(__file__).parent.parent / "fixtures/test_upload_data.json"
|
path = Path(__file__).parent.parent / "fixtures/test_upload_data.json"
|
||||||
textarea.fill(path.read_text())
|
textarea.fill(path.read_text())
|
||||||
page.locator('select[name="format"]').select_option("geojson")
|
page.locator('select[name="format"]').select_option("geojson")
|
||||||
|
@ -136,7 +136,7 @@ def test_import_invalid_data(tilelayer, live_server, page):
|
||||||
button = page.get_by_title("Import data")
|
button = page.get_by_title("Import data")
|
||||||
expect(button).to_be_visible()
|
expect(button).to_be_visible()
|
||||||
button.click()
|
button.click()
|
||||||
textarea = page.locator(".umap-upload textarea")
|
textarea = page.locator(".umap-import textarea")
|
||||||
textarea.fill("invalid data")
|
textarea.fill("invalid data")
|
||||||
for format in ["geojson", "csv", "gpx", "kml", "georss", "osm", "umap"]:
|
for format in ["geojson", "csv", "gpx", "kml", "georss", "osm", "umap"]:
|
||||||
page.locator('select[name="format"]').select_option(format)
|
page.locator('select[name="format"]').select_option(format)
|
||||||
|
@ -156,7 +156,7 @@ def test_import_kml_from_textarea(tilelayer, live_server, page):
|
||||||
button = page.get_by_title("Import data")
|
button = page.get_by_title("Import data")
|
||||||
expect(button).to_be_visible()
|
expect(button).to_be_visible()
|
||||||
button.click()
|
button.click()
|
||||||
textarea = page.locator(".umap-upload textarea")
|
textarea = page.locator(".umap-import textarea")
|
||||||
path = Path(__file__).parent.parent / "fixtures/test_upload_data.kml"
|
path = Path(__file__).parent.parent / "fixtures/test_upload_data.kml"
|
||||||
textarea.fill(path.read_text())
|
textarea.fill(path.read_text())
|
||||||
page.locator('select[name="format"]').select_option("kml")
|
page.locator('select[name="format"]').select_option("kml")
|
||||||
|
@ -180,7 +180,7 @@ def test_import_gpx_from_textarea(tilelayer, live_server, page, settings):
|
||||||
button = page.get_by_title("Import data")
|
button = page.get_by_title("Import data")
|
||||||
expect(button).to_be_visible()
|
expect(button).to_be_visible()
|
||||||
button.click()
|
button.click()
|
||||||
textarea = page.locator(".umap-upload textarea")
|
textarea = page.locator(".umap-import textarea")
|
||||||
path = Path(__file__).parent.parent / "fixtures/test_upload_data.gpx"
|
path = Path(__file__).parent.parent / "fixtures/test_upload_data.gpx"
|
||||||
textarea.fill(path.read_text())
|
textarea.fill(path.read_text())
|
||||||
page.locator('select[name="format"]').select_option("gpx")
|
page.locator('select[name="format"]').select_option("gpx")
|
||||||
|
@ -237,7 +237,7 @@ def test_import_osm_from_textarea(tilelayer, live_server, page):
|
||||||
button = page.get_by_title("Import data")
|
button = page.get_by_title("Import data")
|
||||||
expect(button).to_be_visible()
|
expect(button).to_be_visible()
|
||||||
button.click()
|
button.click()
|
||||||
textarea = page.locator(".umap-upload textarea")
|
textarea = page.locator(".umap-import textarea")
|
||||||
path = Path(__file__).parent.parent / "fixtures/test_upload_data_osm.json"
|
path = Path(__file__).parent.parent / "fixtures/test_upload_data_osm.json"
|
||||||
textarea.fill(path.read_text())
|
textarea.fill(path.read_text())
|
||||||
page.locator('select[name="format"]').select_option("osm")
|
page.locator('select[name="format"]').select_option("osm")
|
||||||
|
@ -257,7 +257,7 @@ def test_import_csv_from_textarea(tilelayer, live_server, page):
|
||||||
button = page.get_by_title("Import data")
|
button = page.get_by_title("Import data")
|
||||||
expect(button).to_be_visible()
|
expect(button).to_be_visible()
|
||||||
button.click()
|
button.click()
|
||||||
textarea = page.locator(".umap-upload textarea")
|
textarea = page.locator(".umap-import textarea")
|
||||||
path = Path(__file__).parent.parent / "fixtures/test_upload_data.csv"
|
path = Path(__file__).parent.parent / "fixtures/test_upload_data.csv"
|
||||||
textarea.fill(path.read_text())
|
textarea.fill(path.read_text())
|
||||||
page.locator('select[name="format"]').select_option("csv")
|
page.locator('select[name="format"]').select_option("csv")
|
||||||
|
@ -276,7 +276,7 @@ def test_can_import_in_existing_datalayer(live_server, datalayer, page, openmap)
|
||||||
expect(layers).to_have_count(1)
|
expect(layers).to_have_count(1)
|
||||||
page.get_by_role("button", name="Edit").click()
|
page.get_by_role("button", name="Edit").click()
|
||||||
page.get_by_title("Import data").click()
|
page.get_by_title("Import data").click()
|
||||||
textarea = page.locator(".umap-upload textarea")
|
textarea = page.locator(".umap-import textarea")
|
||||||
path = Path(__file__).parent.parent / "fixtures/test_upload_data.csv"
|
path = Path(__file__).parent.parent / "fixtures/test_upload_data.csv"
|
||||||
textarea.fill(path.read_text())
|
textarea.fill(path.read_text())
|
||||||
page.locator('select[name="format"]').select_option("csv")
|
page.locator('select[name="format"]').select_option("csv")
|
||||||
|
@ -297,7 +297,7 @@ def test_can_replace_datalayer_data(live_server, datalayer, page, openmap):
|
||||||
expect(layers).to_have_count(1)
|
expect(layers).to_have_count(1)
|
||||||
page.get_by_role("button", name="Edit").click()
|
page.get_by_role("button", name="Edit").click()
|
||||||
page.get_by_title("Import data").click()
|
page.get_by_title("Import data").click()
|
||||||
textarea = page.locator(".umap-upload textarea")
|
textarea = page.locator(".umap-import textarea")
|
||||||
path = Path(__file__).parent.parent / "fixtures/test_upload_data.csv"
|
path = Path(__file__).parent.parent / "fixtures/test_upload_data.csv"
|
||||||
textarea.fill(path.read_text())
|
textarea.fill(path.read_text())
|
||||||
page.locator('select[name="format"]').select_option("csv")
|
page.locator('select[name="format"]').select_option("csv")
|
||||||
|
@ -318,7 +318,7 @@ def test_can_import_in_new_datalayer(live_server, datalayer, page, openmap):
|
||||||
expect(layers).to_have_count(1)
|
expect(layers).to_have_count(1)
|
||||||
page.get_by_role("button", name="Edit").click()
|
page.get_by_role("button", name="Edit").click()
|
||||||
page.get_by_title("Import data").click()
|
page.get_by_title("Import data").click()
|
||||||
textarea = page.locator(".umap-upload textarea")
|
textarea = page.locator(".umap-import textarea")
|
||||||
path = Path(__file__).parent.parent / "fixtures/test_upload_data.csv"
|
path = Path(__file__).parent.parent / "fixtures/test_upload_data.csv"
|
||||||
textarea.fill(path.read_text())
|
textarea.fill(path.read_text())
|
||||||
page.locator("select[name=format]").select_option("csv")
|
page.locator("select[name=format]").select_option("csv")
|
||||||
|
@ -364,7 +364,7 @@ def test_should_remove_dot_in_property_names(live_server, page, settings, tilela
|
||||||
}
|
}
|
||||||
page.goto(f"{live_server.url}/map/new/")
|
page.goto(f"{live_server.url}/map/new/")
|
||||||
page.get_by_title("Import data").click()
|
page.get_by_title("Import data").click()
|
||||||
textarea = page.locator(".umap-upload textarea")
|
textarea = page.locator(".umap-import textarea")
|
||||||
textarea.fill(json.dumps(data))
|
textarea.fill(json.dumps(data))
|
||||||
page.locator('select[name="format"]').select_option("geojson")
|
page.locator('select[name="format"]').select_option("geojson")
|
||||||
page.get_by_role("button", name="Import data", exact=True).click()
|
page.get_by_role("button", name="Import data", exact=True).click()
|
||||||
|
@ -425,7 +425,7 @@ def test_import_geometry_collection(live_server, page, tilelayer):
|
||||||
button = page.get_by_title("Import data")
|
button = page.get_by_title("Import data")
|
||||||
expect(button).to_be_visible()
|
expect(button).to_be_visible()
|
||||||
button.click()
|
button.click()
|
||||||
textarea = page.locator(".umap-upload textarea")
|
textarea = page.locator(".umap-import textarea")
|
||||||
textarea.fill(json.dumps(data))
|
textarea.fill(json.dumps(data))
|
||||||
page.locator('select[name="format"]').select_option("geojson")
|
page.locator('select[name="format"]').select_option("geojson")
|
||||||
page.get_by_role("button", name="Import data", exact=True).click()
|
page.get_by_role("button", name="Import data", exact=True).click()
|
||||||
|
@ -459,7 +459,7 @@ def test_import_multipolygon(live_server, page, tilelayer):
|
||||||
button = page.get_by_title("Import data")
|
button = page.get_by_title("Import data")
|
||||||
expect(button).to_be_visible()
|
expect(button).to_be_visible()
|
||||||
button.click()
|
button.click()
|
||||||
textarea = page.locator(".umap-upload textarea")
|
textarea = page.locator(".umap-import textarea")
|
||||||
textarea.fill(json.dumps(data))
|
textarea.fill(json.dumps(data))
|
||||||
page.locator('select[name="format"]').select_option("geojson")
|
page.locator('select[name="format"]').select_option("geojson")
|
||||||
page.get_by_role("button", name="Import data", exact=True).click()
|
page.get_by_role("button", name="Import data", exact=True).click()
|
||||||
|
@ -491,7 +491,7 @@ def test_import_multipolyline(live_server, page, tilelayer):
|
||||||
button = page.get_by_title("Import data")
|
button = page.get_by_title("Import data")
|
||||||
expect(button).to_be_visible()
|
expect(button).to_be_visible()
|
||||||
button.click()
|
button.click()
|
||||||
textarea = page.locator(".umap-upload textarea")
|
textarea = page.locator(".umap-import textarea")
|
||||||
textarea.fill(json.dumps(data))
|
textarea.fill(json.dumps(data))
|
||||||
page.locator('select[name="format"]').select_option("geojson")
|
page.locator('select[name="format"]').select_option("geojson")
|
||||||
page.get_by_role("button", name="Import data", exact=True).click()
|
page.get_by_role("button", name="Import data", exact=True).click()
|
||||||
|
@ -506,7 +506,7 @@ def test_import_csv_without_valid_latlon_headers(tilelayer, live_server, page):
|
||||||
layers = page.locator(".umap-browser .datalayer")
|
layers = page.locator(".umap-browser .datalayer")
|
||||||
markers = page.locator(".leaflet-marker-icon")
|
markers = page.locator(".leaflet-marker-icon")
|
||||||
page.get_by_title("Import data").click()
|
page.get_by_title("Import data").click()
|
||||||
textarea = page.locator(".umap-upload textarea")
|
textarea = page.locator(".umap-import textarea")
|
||||||
textarea.fill("a,b,c\n12.23,48.34,mypoint\n12.23,48.34,mypoint2")
|
textarea.fill("a,b,c\n12.23,48.34,mypoint\n12.23,48.34,mypoint2")
|
||||||
page.locator('select[name="format"]').select_option("csv")
|
page.locator('select[name="format"]').select_option("csv")
|
||||||
page.get_by_role("button", name="Import data", exact=True).click()
|
page.get_by_role("button", name="Import data", exact=True).click()
|
||||||
|
@ -523,7 +523,7 @@ def test_import_csv_with_commas_in_latlon(tilelayer, live_server, page, settings
|
||||||
layers = page.locator(".umap-browser .datalayer")
|
layers = page.locator(".umap-browser .datalayer")
|
||||||
markers = page.locator(".leaflet-marker-icon")
|
markers = page.locator(".leaflet-marker-icon")
|
||||||
page.get_by_title("Import data").click()
|
page.get_by_title("Import data").click()
|
||||||
textarea = page.locator(".umap-upload textarea")
|
textarea = page.locator(".umap-import textarea")
|
||||||
textarea.fill("lat;lon;foobar\n12,24;48,34;mypoint\n12,23;48,35;mypoint2")
|
textarea.fill("lat;lon;foobar\n12,24;48,34;mypoint\n12,23;48,35;mypoint2")
|
||||||
page.locator('select[name="format"]').select_option("csv")
|
page.locator('select[name="format"]').select_option("csv")
|
||||||
page.get_by_role("button", name="Import data", exact=True).click()
|
page.get_by_role("button", name="Import data", exact=True).click()
|
||||||
|
@ -758,7 +758,7 @@ def test_import_osm_relation(tilelayer, live_server, page):
|
||||||
button = page.get_by_title("Import data")
|
button = page.get_by_title("Import data")
|
||||||
expect(button).to_be_visible()
|
expect(button).to_be_visible()
|
||||||
button.click()
|
button.click()
|
||||||
textarea = page.locator(".umap-upload textarea")
|
textarea = page.locator(".umap-import textarea")
|
||||||
file_path = Path(__file__).parent.parent / "fixtures/test_import_osm_relation.json"
|
file_path = Path(__file__).parent.parent / "fixtures/test_import_osm_relation.json"
|
||||||
textarea.fill(file_path.read_text())
|
textarea.fill(file_path.read_text())
|
||||||
page.locator('select[name="format"]').select_option("osm")
|
page.locator('select[name="format"]').select_option("osm")
|
||||||
|
@ -778,7 +778,7 @@ def test_import_georss_from_textarea(tilelayer, live_server, page):
|
||||||
button = page.get_by_title("Import data")
|
button = page.get_by_title("Import data")
|
||||||
expect(button).to_be_visible()
|
expect(button).to_be_visible()
|
||||||
button.click()
|
button.click()
|
||||||
textarea = page.locator(".umap-upload textarea")
|
textarea = page.locator(".umap-import textarea")
|
||||||
path = Path(__file__).parent.parent / "fixtures/test_upload_georss.xml"
|
path = Path(__file__).parent.parent / "fixtures/test_upload_georss.xml"
|
||||||
textarea.fill(path.read_text())
|
textarea.fill(path.read_text())
|
||||||
page.locator('select[name="format"]').select_option("georss")
|
page.locator('select[name="format"]').select_option("georss")
|
||||||
|
|
Loading…
Reference in a new issue