blob: 10481b7123571020c5ac98553ae577ed4806a180 [file] [log] [blame]
"use strict";angular.module("xos.vpnDashboard",["ngResource","ngCookies","ngLodash","ui.router","xos.helpers"]).config(["$stateProvider",function(n){n.state("vpnList",{url:"/",template:"<vpn-list></vpn-list>"})}]).config(["$compileProvider",function(n){n.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|file|blob):/)}]).service("Vpn",["$http","$q",function(n,t){this.getVpnTenants=function(){var e=t.defer();return n.get("/xoslib/vpntenant/").then(function(n){e.resolve(n.data)})["catch"](function(n){e.reject(n)}),e.promise}}]).config(["$httpProvider",function(n){n.interceptors.push("NoHyperlinks")}]).directive("vpnList",function(){return{restrict:"E",scope:{},bindToController:!0,controllerAs:"vm",templateUrl:"templates/vpn-list.tpl.html",controller:["Vpn",function(n){var t=this;n.getVpnTenants().then(function(n){t.vpns=n;for(var e=0;e<t.vpns.length;e++){var i=new Blob([t.vpns[e].script_text],{type:"text/plain"});t.vpns[e].script_text=(window.URL||window.webkitURL).createObjectURL(i)}})["catch"](function(n){throw new Error(n)})}]}}),angular.module("xos.vpnDashboard").run(["$templateCache",function(n){n.put("templates/vpn-list.tpl.html",'<div style="display: table;">\n <div class="row">\n <h1 class="cell">VPN List</h1>\n </div>\n <div class="row">\n <div class="cell header">ID</div>\n <div class="cell header">VPN Network</div>\n <div class="cell header">VPN Subnet</div>\n <div class="cell header">Script Link</div>\n </div>\n <div class="row" ng-repeat="vpn in vm.vpns">\n <div class="cell">{{ vpn.id }}</div>\n <div class="cell">{{ vpn.server_network }}</div>\n <div class="cell">{{ vpn.vpn_subnet }}</div>\n <div class="cell">\n <a download="connect-{{ vpn.id }}.vpn" ng-href="{{ vpn.script_text }}">Script</a>\n </div>\n </div>\n</div>\n')}]),angular.module("xos.vpnDashboard").run(["$location",function(n){n.path("/")}]),angular.bootstrap(angular.element("#xosVpnDashboard"),["xos.vpnDashboard"]);