Added grid icons for adding empty rows/columns

This commit is contained in:
Magnus Åhall 2026-08-22 09:14:42 +02:00
parent 8b51b444f6
commit d8a5c6d6c9
2 changed files with 270 additions and 15 deletions

View file

@ -112,8 +112,10 @@ export class SmonDashboard extends CustomHTMLElement {// {{{
<div style="display: flex; gap: 8px;">
<button data-el="edit-dashboard">Edit dashboard</button>
<button class="only-on-edit" data-el="add-columns">Add columns</button>
<button class="only-on-edit" data-el="add-rows">Add rows</button>
<svg class="only-on-edit" data-el="grid-add-empty-columns" style="width: 36px; height: 36px; cursor: pointer;"><use href="/images/${_VERSION}/grid_management.svg#add-empty-columns" /></svg>
<svg class="only-on-edit" data-el="grid-add-empty-rows" style="width: 36px; height: 36px; cursor: pointer;"><use href="/images/${_VERSION}/grid_management.svg#add-empty-rows" /></svg>
<button class="only-on-edit" data-el="update-dashboard">Update dashboard</button>
</div>
@ -164,8 +166,8 @@ export class SmonDashboard extends CustomHTMLElement {// {{{
this.widgetsEdited = false
this.elEditDashboard.addEventListener('click', () => this.classList.toggle('edit'))
this.elAddColumns.addEventListener('click', () => { this.addColumns += 5; this.render() })
this.elAddRows.addEventListener('click', () => { this.addRows += 5; this.render() })
this.elGridAddEmptyColumns.addEventListener('click', () => { this.addColumns += 5; this.render() })
this.elGridAddEmptyRows.addEventListener('click', () => { this.addRows += 5; this.render() })
this.elUpdateDashboard.addEventListener('click', () => this.updateDashboard())
this.elEditUpdate.addEventListener('click', () => this.editUpdate())
@ -185,7 +187,7 @@ export class SmonDashboard extends CustomHTMLElement {// {{{
this.render()
this.fetchData() // Retrieve one as fast as possible since setInterval doesn't run before an interval.
setInterval(() => this.fetchData(), 1000)
setInterval(() => this.fetchData(), 10000)
}// }}}
render() {// {{{