Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: config save cookie #297

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion web/static/config/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@
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=/;';
console.log('Setting cookie:', document.cookie);

window.location.href = '/pages/config/list/';
})
Expand Down
1 change: 1 addition & 0 deletions web/static/pages/config/list/config-list.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class ConfigList extends StyledLitElement {
}

render() {
console.log('Read cookie:', this.message);
LexLuthr marked this conversation as resolved.
Show resolved Hide resolved
return html`
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">

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);