juci-network-netifd: update how wwan get their devices
authorReidar Cederqvist <reidar.cederqvist@gmail.com>
Mon, 19 Mar 2018 14:34:45 +0000 (15:34 +0100)
committerReidar Cederqvist <reidar.cederqvist@gmail.com>
Mon, 19 Mar 2018 14:34:45 +0000 (15:34 +0100)
plugins/juci-network-netifd/src/widgets/proto/network-connection-proto-wwan-edit.js

index 417115b..be5a4eb 100644 (file)
@@ -28,10 +28,10 @@ JUCI.app
                controller: "networkConnectionProtoWwanEditCtrl",
                replace: true
        };
-}).controller("networkConnectionProtoWwanEditCtrl", function($scope, $tr, gettext, $rpc){
-       $rpc.$call("router.usb", "status").done(function(ret){
-               $scope.devices = Object.keys(ret).map(function(r){ return ret[r];}).filter(function(dev){return dev.netdevice;}).map(function(dev){
-                       return { label: dev.description || $tr(gettext("Unknown")), value: dev.netdevice };
+}).controller("networkConnectionProtoWwanEditCtrl", function($scope, $tr, gettext, $rpc, $network){
+       $network.getAdapters().done(function(adapters){
+               $scope.devices = adapters.filter(function(ad){ return ad.is_usb; }).map(function(usb){
+                       return { label: usb.name, value: usb.device };
                });
                $scope.$apply();
        }).fail(function(e){console.log(e);});