juci-icwmp: update connection request button ref #12581
authorReidar Cederqvist <reidar.cederqvist@gmail.com>
Wed, 7 Mar 2018 11:27:13 +0000 (12:27 +0100)
committerReidar Cederqvist <reidar.cederqvist@gmail.com>
Wed, 7 Mar 2018 11:27:13 +0000 (12:27 +0100)
plugins/juci-icwmp/access.json
plugins/juci-icwmp/src/pages/icwmp-config.js

index 2589764..4652b5c 100644 (file)
@@ -4,7 +4,12 @@
                "read": {
                        "uci": [
                                "cwmp"
-                       ]
+                       ],
+                       "ubus": {
+                               "tr069": [
+                                       "inform"
+                               ]
+                       }
                },
                "write": {
                        "uci": [
index aa75ad6..707e917 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 JUCI.app
-.controller("icwmpConfigPage", function($scope, $rpc, $uci, $tr, gettext, $firewall){
+.controller("icwmpConfigPage", function($scope, $rpc, $uci, $tr, gettext, $firewall, $juciAlert){
        $uci.$sync(["cwmp"]).done(function(){
                $scope.acs = $uci.cwmp.acs;
                $scope.cpe = $uci.cwmp.cpe;
@@ -46,10 +46,15 @@ JUCI.app
                { label: $tr(gettext("Debug")),         value: 'DEBUG' }
        ];
 
-       $scope.onTR069ObjectAvailable=$rpc.$has("tr069");
+       $scope.onTR069ObjectAvailable=$rpc.$has("tr069", "inform");
 
-       function contactACS() {
-               $rpc.$call("tr069", "inform '{\"event\":\"connection requested\"}'");
+       $scope.contactACS = function() {
+               $rpc.$call("tr069", "inform", {"event":"connection request"}).done(function(data){
+                       if(data.status === 1)
+                               $juciAlert($tr(gettext("Connection request sent")));
+               }).fail(function(e){
+                       console.error("couldn't call tr069 inform " + e);
+               });
        }
 });