Skip to content

Commit

Permalink
Merge branch 'sensecraft-node-red-dependency:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Links17 authored Jan 15, 2025
2 parents 83fc206 + ed0b775 commit f109dc5
Showing 1 changed file with 29 additions and 15 deletions.
44 changes: 29 additions & 15 deletions flow-manager.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,13 @@

const apiUrl = {
getDeviceInfo: {
url: 'http://127.0.0.1:8090/device/info',
url: 'http://192.168.118.71:8090/device/info',
method: 'GET'
},
restart: {
url: 'http://192.168.118.71:8090/container/restart/',
method: 'POST'
},
getLocalState: {
url: 'flow-manager/states/',
method: 'GET'
Expand All @@ -78,26 +82,36 @@
reloadState: {
url: 'flow-manager/states/',
method: 'POST',
}
},
}

RED.comms.subscribe('flow-manager/flow-manager-envnodes-npm-update', function (topic, msgData) {
console.log(topic, msgData)
if (msgData && msgData.npm_update) {
RED.view.redraw();
const myNotification = RED.notify(
`The plugin has been updated and will be restarted for you soon`, {
type: "success",
timeout: 30000,
buttons: [
{
text: "Thanks",
click: function (e) {
myNotification.close();
// RED.view.redraw();
try {
ajax({
url: apiUrl.restart.url + `node-red`,
method: apiUrl.restart.method,
contentType: 'application/json',
});

const myNotification = RED.notify(
`The plugin has been updated and will be restarted for you soon`, {
type: "success",
timeout: 30000,
buttons: [
{
text: "Thanks",
click: function (e) {
myNotification.close();
}
}
}
]
});
]
});
} catch (error) {
console.log('Failed to restart:' + JSON.stringify(error))
}
}
});

Expand Down

0 comments on commit f109dc5

Please sign in to comment.