Viewing File: /usr/local/cpanel/whostmgr/docroot/templates/ipv6/range.min.js

var ipv6RangesApp=angular.module("ipv6RangesApp",["apiService","formUtilities"]);ipv6RangesApp.controller("RangeList",["$scope","api",function($scope,api){$scope.rangeName="";$scope.rangeCIDR="";$scope.rangeEnabled=1;$scope.rangeNote="";$scope.notice={};api.get("ipv6_range_list").then(function(result){if(result.status){$scope.ranges=result.data.range}else{$scope.ranges=[];$scope.notice=result}});$scope.closeNotice=function(){$scope.notice={}};$scope.addRange=function(){$scope.notice={};$scope.range.$setDirty();if($scope.range.$valid){var apiData={name:$scope.rangeName,range:$scope.rangeCIDR,CIDR:$scope.rangeCIDR,enabled:$scope.rangeEnabled,note:$scope.rangeNote};api.post("ipv6_range_add",apiData).then(function(result){if(result.status){$scope.ranges.push(apiData);$scope.rangeName="";$scope.rangeCIDR="";$scope.rangeEnabled=1;$scope.rangeNote="";$scope.range.$setPristine();$("#range_form").addClass("closed-form");result.message=LOCALE.maketext("“[_1]” successfully added to the range list.",apiData.name)}$scope.notice=result})}else{if($scope.range.name.$viewValue===undefined||$scope.range.name.$viewValue===""){$scope.range.name.$setViewValue("");$scope.range.name.$setDirty()}if($scope.range.cidr.$viewValue===undefined||$scope.range.cidr.$viewValue===""){$scope.range.cidr.$setViewValue("");$scope.range.cidr.$setDirty()}}};$scope.clearRangeForm=function(){$scope.notice={};$scope.rangeName="";$scope.rangeCIDR="";$scope.rangeEnabled=1;$scope.rangeNote=""};$scope.deleteRange=function(range){var index=$scope.ranges.indexOf(range),rangeName=$scope.ranges[index].name,confirmDelete=confirm(LOCALE.maketext("Delete the “[_1]” range?",rangeName));$scope.notice={};if(confirmDelete){api.post("ipv6_range_remove",{name:range.name}).then(function(result){if(result.status){$scope.ranges.splice(index,1);result.message=LOCALE.maketext("“[_1]” successfully removed from the range list.",rangeName);$scope.notice=result}$scope.notice=result})}}}]);
Back to Directory File Manager