Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-j-davies committed Apr 24, 2021
1 parent 76cf78a commit de7aa6f
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 3 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@

.DS_Store
.DS_Store
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Marcus Davies
Copyright (c) 2021 Marcus Davies

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
26 changes: 26 additions & 0 deletions core/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const Server = function (Accesories, Bridge, RouteSetup, AccessoryIniter) {
app.get('/ui/createroute',_CreateRoute)
app.post('/ui/createroute',_DoCreateRoute)
app.get('/ui/editroute', _EditRoute)
app.post('/ui/editroute', _DoEditRoute)
app.get('/ui/bridge', _BridgeWEB)
app.post('/ui/bridge', _DoBridgeConfig)

Expand Down Expand Up @@ -147,6 +148,31 @@ const Server = function (Accesories, Bridge, RouteSetup, AccessoryIniter) {
res.send(HTML)
}

// Do edit route
function _DoEditRoute(req,res){

if (!_CheckAuth(req, res)) {
return;
}

let NRD = req.body;
let Name = NRD.name;
let ORD = CONFIG.routes[Name];

delete NRD.name;
NRD.type = ORD.type;

CONFIG.routes[Name] = NRD;
UTIL.updateRouteConfig(Name,NRD)

_RouteSetup();

res.contentType('application/json')
res.send({success:true})


}

// Create Route
function _CreateRoute(req,res){

Expand Down
30 changes: 30 additions & 0 deletions ui/static/JS/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,36 @@ function SaveNewRoute(Type){
});
}

function SaveRouteChanges(ID){


let ParamElements = $(".RouteParam");

let Data = {
name:ID,
}
ParamElements.each((index,element) => {

let EL = $(element)
Data[EL.attr('data-param')] = EL.val();

});

$.ajax({
type: "POST",
url: "../../../ui/editroute",
data: JSON.stringify(Data),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(data){

if(data.success){
location.href = '../../../ui/routing'
}
}
});
}


/******************************************* */

Expand Down

0 comments on commit de7aa6f

Please sign in to comment.