Skip to content

Commit

Permalink
fix: config save cookie (#297)
Browse files Browse the repository at this point in the history
* fix config save cookie

* remove debugging
  • Loading branch information
LexLuthr authored Oct 23, 2024
1 parent 3944336 commit d30120f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 20 deletions.
3 changes: 1 addition & 2 deletions web/static/config/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@
axios.post('/api/config/layers/' + layer, value)
.then(response => {
// Set cookie named 'message' with the value 'Data saved successfully'
document.cookie = 'message=The layer "' + layer + '" saved successfully.; path=/;';

document.cookie = 'message=The layer "' + layer + '" saved successfully. Please restart all nodes using the layer "' + layer + '".; path=/;';
window.location.href = '/pages/config/list/';
})
.catch(error => {
Expand Down
4 changes: 2 additions & 2 deletions web/static/pages/config/list/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-3 pt-4" style="width: 70%">
<h2 style="text-wrap: nowrap">Configuration Editor</h2>
<h4 style="text-wrap: nowrap">Click on a layer to edit its configuration</h4>
<h2 style="white-space: nowrap">Configuration Editor</h2>
<h4 style="white-space: nowrap">Click on a layer to edit its configuration</h4>
<config-list></config-list>
</div>
<div class="col-md-3"></div>
Expand Down
16 changes: 0 additions & 16 deletions web/static/ux/curio-ux.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ class CurioUX extends LitElement {

// how Bootstrap & DataTables expect dark mode declared.
document.documentElement.classList.add('dark');

this.messsage = this.getCookieMessage();

var s = document.body.style;
s.padding = 0;
Expand Down Expand Up @@ -210,20 +208,6 @@ class CurioUX extends LitElement {
`;
}

getCookieMessage() {
const name = 'message';
const cookies = document.cookie.split(';');
for (let i = 0; i < cookies.length; i++) {
const cookie = cookies[i].trim();
if (cookie.startsWith(name + '=')) {
var val = cookie.substring(name.length + 1);
document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
return val;
}
}
return null;
}

};

customElements.define('curio-ux', CurioUX);

0 comments on commit d30120f

Please sign in to comment.