From: Paul Donald Date: Tue, 3 Dec 2024 15:25:20 +0000 (+0100) Subject: treewide: explicitly declare rpc calls with const X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=2ffaab3fca7df8c4ef0c77601073dd2a6e1442d4;p=openwrt-luci.git treewide: explicitly declare rpc calls with const Signed-off-by: Sergey Ponomarev --- diff --git a/applications/luci-app-aria2/htdocs/luci-static/resources/view/aria2/config.js b/applications/luci-app-aria2/htdocs/luci-static/resources/view/aria2/config.js index 84b5075fd7..11aae877ed 100644 --- a/applications/luci-app-aria2/htdocs/luci-static/resources/view/aria2/config.js +++ b/applications/luci-app-aria2/htdocs/luci-static/resources/view/aria2/config.js @@ -8,9 +8,9 @@ 'require ui'; 'require view'; -var callServiceList, CBIAria2Status, CBIRpcSecret, CBIRpcUrl; +var CBIAria2Status, CBIRpcSecret, CBIRpcUrl; -callServiceList = rpc.declare({ +const callServiceList = rpc.declare({ object: 'service', method: 'list', params: [ 'name' ], diff --git a/applications/luci-app-dawn/htdocs/luci-static/resources/dawn/dawn-common.js b/applications/luci-app-dawn/htdocs/luci-static/resources/dawn/dawn-common.js index 9dec2c6ec1..9852994fd3 100644 --- a/applications/luci-app-dawn/htdocs/luci-static/resources/dawn/dawn-common.js +++ b/applications/luci-app-dawn/htdocs/luci-static/resources/dawn/dawn-common.js @@ -2,21 +2,21 @@ 'require baseclass'; 'require rpc'; -let callDawnGetNetwork, callDawnGetHearingMap, callHostHints; -callDawnGetNetwork = rpc.declare({ + +const callDawnGetNetwork = rpc.declare({ object: 'dawn', method: 'get_network', expect: { } }); -callDawnGetHearingMap = rpc.declare({ +const callDawnGetHearingMap = rpc.declare({ object: 'dawn', method: 'get_hearing_map', expect: { } }); -callHostHints = rpc.declare({ +const callHostHints = rpc.declare({ object: 'luci-rpc', method: 'getHostHints', expect: { } diff --git a/applications/luci-app-upnp/htdocs/luci-static/resources/view/status/include/80_upnp.js b/applications/luci-app-upnp/htdocs/luci-static/resources/view/status/include/80_upnp.js index 3173fb35bc..0110a48775 100644 --- a/applications/luci-app-upnp/htdocs/luci-static/resources/view/status/include/80_upnp.js +++ b/applications/luci-app-upnp/htdocs/luci-static/resources/view/status/include/80_upnp.js @@ -4,28 +4,28 @@ 'require rpc'; 'require uci'; -var callUpnpGetStatus, callUpnpDeleteRule, handleDelRule; -callUpnpGetStatus = rpc.declare({ + +const callUpnpGetStatus = rpc.declare({ object: 'luci.upnp', method: 'get_status', expect: { } }); -callUpnpDeleteRule = rpc.declare({ +const callUpnpDeleteRule = rpc.declare({ object: 'luci.upnp', method: 'delete_rule', params: [ 'token' ], expect: { result : "OK" }, }); -handleDelRule = function(num, ev) { +function handleDelRule(num, ev) { dom.parent(ev.currentTarget, '.tr').style.opacity = 0.5; ev.currentTarget.classList.add('spinning'); ev.currentTarget.disabled = true; ev.currentTarget.blur(); callUpnpDeleteRule(num); -}; +} return baseclass.extend({ title: _('Active UPnP IGD & PCP/NAT-PMP Port Maps'), diff --git a/applications/luci-app-upnp/htdocs/luci-static/resources/view/upnp/upnp.js b/applications/luci-app-upnp/htdocs/luci-static/resources/view/upnp/upnp.js index c89e075ae7..5731f78242 100644 --- a/applications/luci-app-upnp/htdocs/luci-static/resources/view/upnp/upnp.js +++ b/applications/luci-app-upnp/htdocs/luci-static/resources/view/upnp/upnp.js @@ -6,35 +6,35 @@ 'require rpc'; 'require form'; -var callInitAction, callUpnpGetStatus, callUpnpDeleteRule, handleDelRule; -callInitAction = rpc.declare({ + +const callInitAction = rpc.declare({ object: 'luci', method: 'setInitAction', params: [ 'name', 'action' ], expect: { result: false } }); -callUpnpGetStatus = rpc.declare({ +const callUpnpGetStatus = rpc.declare({ object: 'luci.upnp', method: 'get_status', expect: { } }); -callUpnpDeleteRule = rpc.declare({ +const callUpnpDeleteRule = rpc.declare({ object: 'luci.upnp', method: 'delete_rule', params: [ 'token' ], expect: { result : "OK" }, }); -handleDelRule = function(num, ev) { +function handleDelRule(num, ev) { dom.parent(ev.currentTarget, '.tr').style.opacity = 0.5; ev.currentTarget.classList.add('spinning'); ev.currentTarget.disabled = true; ev.currentTarget.blur(); callUpnpDeleteRule(num); -}; +} return view.extend({ load: function() {