Download client configuration when script link is clicked
diff --git a/views/ngXosViews/vpnDashboard/src/js/main.js b/views/ngXosViews/vpnDashboard/src/js/main.js
index 4923b1c..ab6fe72 100644
--- a/views/ngXosViews/vpnDashboard/src/js/main.js
+++ b/views/ngXosViews/vpnDashboard/src/js/main.js
@@ -12,6 +12,10 @@
   .state('vpn-list', {
     url: '/',
     template: '<vpn-list></vpn-list>'
+  })
+  .state('cleint-script', {
+    url: '/client/:pk',
+    template: '<client-script></client-script>'
   });
 })
 .service('Vpn', function($http, $q){
@@ -28,6 +32,19 @@
     });
 
     return deferred.promise;
+  }
+  this.getVpnTenants = (pk) => {
+    let deferred = $q.defer();
+
+    $http.get('/xoslib/clientscript/', {params: {pk: pk}})
+    .then((res) => {
+      deferred.resolve(res.data)
+    })
+    .catch((e) => {
+      deferred.reject(e);
+    });
+
+    return deferred.promise;
   };
 })
 .config(function($httpProvider){
@@ -43,7 +60,7 @@
     controller: function(Vpn){
       // retrieving user list
       Vpn.getVpnTenants()
-      .then((vpns) => {
+      .then(vpns) => {
         this.vpns = vpns;
       })
       .catch((e) => {
@@ -51,4 +68,25 @@
       });
     }
   };
+})
+.directive('clientScript', function(){
+  return {
+    restrict: 'E',
+    scope: {
+      pk: '=pk',
+    },
+    bindToController: true,
+    controllerAs: 'vm',
+    templateUrl: 'templates/client-script.tpl.html',
+    controller: function(Vpn){
+      // retrieving user list
+      Vpn.getClientScript(pk)
+      .then(script_location) => {
+        this.script_location = script_location;
+      })
+      .catch((e) => {
+        throw new Error(e);
+      });
+    }
+  };
 });
diff --git a/views/ngXosViews/vpnDashboard/src/templates/client-script.tpl.html b/views/ngXosViews/vpnDashboard/src/templates/client-script.tpl.html
new file mode 100644
index 0000000..882f2eb
--- /dev/null
+++ b/views/ngXosViews/vpnDashboard/src/templates/client-script.tpl.html
@@ -0,0 +1,4 @@
+<a href="/static/vpn/{{ vm.script_location }}" download id="download" hidden></a>
+<script>
+document.getElementById('download').click();
+</script>
diff --git a/views/ngXosViews/vpnDashboard/src/templates/vpn-list.tpl.html b/views/ngXosViews/vpnDashboard/src/templates/vpn-list.tpl.html
index c50bd47..8d4df52 100644
--- a/views/ngXosViews/vpnDashboard/src/templates/vpn-list.tpl.html
+++ b/views/ngXosViews/vpnDashboard/src/templates/vpn-list.tpl.html
@@ -12,6 +12,6 @@
   <div class="cell">{{vpn.server_network}}</div>
   <div class="cell">{{vpn.vpn_subnet}}</div>
   <div class="cell">
-    <a href="/static/vpn/{{ vpn.script }}?pk={{ vpn.pk }}" target="_blank">Script</a>
+    <a href="client/{{ vpn.pk }}/" target="_blank">Script</a>
   </div>
 </div>
diff --git a/xos/core/xoslib/methods/vpnview.py b/xos/core/xoslib/methods/vpnview.py
index fcbe577..9789604 100644
--- a/xos/core/xoslib/methods/vpnview.py
+++ b/xos/core/xoslib/methods/vpnview.py
@@ -19,4 +19,5 @@
     def get(self, request, format=None):
         if (not request.user.is_authenticated()):
             raise PermissionDenied("You must be authenticated in order to use this API")
-        return Response(VPNTenant.get_tenant_objects())
+        pk = request.QUERY_PARAMS.get('pk', None)
+        return Response(VPNTenant.get_tenant_objects().filter(pk=pk))