Add client view that shows all VPNs with a script link
diff --git a/views/ngXosViews/vpnDashboard/src/js/main.js b/views/ngXosViews/vpnDashboard/src/js/main.js
index 7a576df..a93f720 100644
--- a/views/ngXosViews/vpnDashboard/src/js/main.js
+++ b/views/ngXosViews/vpnDashboard/src/js/main.js
@@ -45,20 +45,17 @@
controllerAs: 'vm',
templateUrl: 'templates/vpn-list.tpl.html',
controller: function(Vpn){
- // retrieving user list
Vpn.getVpnTenants()
.then((vpns) => {
this.vpns = vpns;
+ for (var i = 0; i < this.vpns.length; i++) {
+ var blob = new Blob([ this.vpns[i].script_text ], { type : 'text/plain' });
+ this.vpns[i].script_text = (window.URL || window.webkitURL).createObjectURL( blob );
+ }
})
.catch((e) => {
throw new Error(e);
});
-
- this.getScriptLocation = function(vpn) {
- var content = vpn.create_client_script();
- var blob = new Blob([ content ], { type : 'text/plain' });
- return (window.URL || window.webkitURL).createObjectURL( blob );
- }
}
};
});
diff --git a/views/ngXosViews/vpnDashboard/src/templates/vpn-list.tpl.html b/views/ngXosViews/vpnDashboard/src/templates/vpn-list.tpl.html
index 95d197f..a8fa8f3 100644
--- a/views/ngXosViews/vpnDashboard/src/templates/vpn-list.tpl.html
+++ b/views/ngXosViews/vpnDashboard/src/templates/vpn-list.tpl.html
@@ -13,7 +13,7 @@
<div class="cell">{{ vpn.server_network }}</div>
<div class="cell">{{ vpn.vpn_subnet }}</div>
<div class="cell">
- <a download="connect-{{ vpn.id }}.vpn" ng-href="{{ vm.getScriptLocation(vpn) }}">Script</a>
+ <a download="connect-{{ vpn.id }}.vpn" ng-href="{{ vpn.script_text }}">Script</a>
</div>
</div>
</div>