Edit that significantly changes the reflow uses a reload trick to work

This commit is contained in:
Herbert Wolverson 2024-06-28 12:25:34 -05:00
parent 557fa730cc
commit 10b640e3de

View File

@ -17,6 +17,14 @@ export class Dashboard {
this.dashlets = []; this.dashlets = [];
this.channels = []; this.channels = [];
this.#editButton(); this.#editButton();
if (localStorage.getItem("forceEditMode")) {
localStorage.removeItem("forceEditMode");
requestAnimationFrame(() => {
setTimeout(() => {
this.editMode();
})
});
}
} }
#editButton() { #editButton() {
@ -203,6 +211,7 @@ export class Dashboard {
data: JSON.stringify(request), data: JSON.stringify(request),
contentType : 'application/json', contentType : 'application/json',
success: () => { success: () => {
localStorage.setItem("forceEditMode", "true");
window.location.reload(); window.location.reload();
} }
}) })
@ -244,6 +253,7 @@ export class Dashboard {
success: (data) => { success: (data) => {
this.dashletIdentities = data; this.dashletIdentities = data;
this.layout.save(this.dashletIdentities); this.layout.save(this.dashletIdentities);
localStorage.setItem("forceEditMode", "true");
window.location.reload(); window.location.reload();
} }
}); });
@ -587,32 +597,41 @@ export class Dashboard {
clickTrash(i) { clickTrash(i) {
this.dashletIdentities.splice(i, 1); this.dashletIdentities.splice(i, 1);
this.#replaceDashletList(); this.layout.save(this.dashletIdentities);
localStorage.setItem("forceEditMode", "true");
window.location.reload();
} }
zoomIn(i) { zoomIn(i) {
console.log(i);
if (this.dashletIdentities[i].size < 12) { if (this.dashletIdentities[i].size < 12) {
this.dashletIdentities[i].size += 1; this.dashletIdentities[i].size += 1;
} }
this.#replaceDashletList(); this.layout.save(this.dashletIdentities);
localStorage.setItem("forceEditMode", "true");
window.location.reload();
} }
zoomOut(i) { zoomOut(i) {
if (this.dashletIdentities[i].size > 1) { if (this.dashletIdentities[i].size > 1) {
this.dashletIdentities[i].size -= 1; this.dashletIdentities[i].size -= 1;
} }
this.#replaceDashletList(); this.layout.save(this.dashletIdentities);
localStorage.setItem("forceEditMode", "true");
window.location.reload();
} }
removeAll() { removeAll() {
this.dashletIdentities = []; this.dashletIdentities = [];
this.layout.save(this.dashletIdentities); this.layout.save(this.dashletIdentities);
localStorage.setItem("forceEditMode", "true");
window.location.reload(); window.location.reload();
} }
addAll() { addAll() {
this.dashletIdentities = DashletMenu; this.dashletIdentities = DashletMenu;
this.layout.save(this.dashletIdentities); this.layout.save(this.dashletIdentities);
localStorage.setItem("forceEditMode", "true");
window.location.reload(); window.location.reload();
} }