{"version":3,"file":"bundle.min.js","sources":["scripts/bundle.min.js"],"sourcesContent":["/******************************************************************************\n * Copyright © 2017 XIN Community *\n * *\n * See the DEVELOPER-AGREEMENT.txt and LICENSE.txt files at the top-level *\n * directory of this distribution for the individual copyright holder *\n * information and the developer policies on copyright and licensing. *\n * *\n * Unless otherwise agreed in a custom licensing agreement, no part of the *\n * XIN software, including this file, may be copied, modified, propagated, *\n * or distributed except according to the terms contained in the LICENSE.txt *\n * file. *\n * *\n * Removal or modification of this copyright notice is prohibited. *\n * *\n ******************************************************************************/\n\nangular.module('peers',\n ['restangular', 'datatables', 'datatables.bootstrap', 'ui.bootstrap', 'ui.router', 'nvd3', 'ngSanitize','cc.autorefresh', 'ng-countryflags']);\n\nangular.module('peers').constant('peerConfig', {\n 'apiUrl': window.getEnvConfig(\"PEER_EXPLORER_API_URL\") || 'http://185.103.75.217:8888/',\n //Replace IP with your own VPS\n 'peerEndPoint': 'api/nodes'\n});\n\nangular.module('peers').constant('PEER_CONSTANTS', {\n 'REFRESH_INTERVAL_MILLI_SECONDS': window.getEnvConfig(\"CONSTANTS_REFRESH_INTERVAL\") || 60000,\n 'VERSION': window.getEnvConfig(\"RELEASE_VERSION\") || '0.4.1',\n 'NETWORK_ENVIRONMENT': window.getEnvConfig(\"NETWORK_ENVIRONMENT\"),\n});\n\nangular.module('peers').config(['RestangularProvider', 'peerConfig', '$stateProvider', '$urlRouterProvider',\n function (RestangularProvider, peerConfig, $stateProvider, $urlRouterProvider) {\n\n RestangularProvider.setBaseUrl(peerConfig.apiUrl);\n\n $stateProvider.state('peerExplorer.peers', {\n url: '^/peers',\n templateUrl: './peers/peers.html',\n controller: 'PeersCtrl'\n\n });\n\n }]);\n\nangular.module('peers').filter('searchTerm', ['$sce', function ($sce) {\n return function (val) {\n if (val) {\n return '' + val + '';\n } else {\n return '';\n }\n };\n}]);\n\nangular.module('peers').directive('compile', ['$compile', function ($compile) {\n return function (scope, element, attrs) {\n scope.$watch(\n function (scope) {\n // watch the 'compile' expression for changes\n return scope.$eval(attrs.compile);\n },\n function (value) {\n // when the 'compile' expression changes\n // assign it into the current DOM\n element.html(value);\n\n // compile the new DOM and link it to the current\n // scope.\n // NOTE: we only compile .childNodes so that\n // we don't get into infinite loop compiling ourselves\n $compile(element.contents())(scope);\n }\n );\n };\n}]);\n\n/******************************************************************************\n * Copyright © 2017 XIN Community *\n * *\n * See the DEVELOPER-AGREEMENT.txt and LICENSE.txt files at the top-level *\n * directory of this distribution for the individual copyright holder *\n * information and the developer policies on copyright and licensing. *\n * *\n * Unless otherwise agreed in a custom licensing agreement, no part of the *\n * XIN software, including this file, may be copied, modified, propagated, *\n * or distributed except according to the terms contained in the LICENSE.txt *\n * file. *\n * *\n * Removal or modification of this copyright notice is prohibited. *\n * *\n ******************************************************************************/\n\nangular.module('peers')\n .service('PeerService', ['Restangular', 'peerConfig', '$q', function (Restangular, peerConfig, $q) {\n this.getPeers = function (page, results) {\n var params = {\n 'page': page,\n 'results': results,\n 'filter': 'numberOfActivePeers',\n 'order': 'desc'\n };\n\n return Restangular.all(peerConfig.peerEndPoint).customGET('', params);\n };\n\n this.getStats = function () {\n return Restangular.all('api').one('getStats').customGET('', '');\n };\n\n }]);\n\n/******************************************************************************\n * Copyright © 2017 XIN Community *\n * *\n * See the DEVELOPER-AGREEMENT.txt and LICENSE.txt files at the top-level *\n * directory of this distribution for the individual copyright holder *\n * information and the developer policies on copyright and licensing. *\n * *\n * Unless otherwise agreed in a custom licensing agreement, no part of the *\n * XIN software, including this file, may be copied, modified, propagated, *\n * or distributed except according to the terms contained in the LICENSE.txt *\n * file. *\n * *\n * Removal or modification of this copyright notice is prohibited. *\n * *\n ******************************************************************************/\n\nangular.module('peers').controller('PeersCtrl',\n ['$scope', 'PeerService', 'DTOptionsBuilder', 'DTColumnBuilder', '$interval', '$uibModal', '$compile',\n function ($scope, PeerService, DTOptionsBuilder, DTColumnBuilder, $interval, $uibModal, $compile) {\n\n $scope.chartOptions = {\n chart: {\n type: 'discreteBarChart',\n height: 20,\n margin: {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n },\n x: function (d) {\n return d.label;\n },\n y: function (d) {\n return d.value;\n },\n showValues: false,\n duration: 500,\n xAxis: {\n axisLabel: '',\n axisLabelDistance: 0,\n ticks: 0\n },\n yAxis: {\n axisLabel: '',\n axisLabelDistance: 0,\n ticks: 0\n },\n\n color: function () {\n return '#666';\n },\n\n\n },\n\n };\n\n $scope.dtOptions = DTOptionsBuilder.newOptions()\n .withPaginationType('numbers')\n .withDOM('frtip')\n .withDataProp('data')\n .withOption('responsive', true)\n .withOption('paging', true)\n .withOption('ordering', false)\n .withOption('info', false)\n .withOption('serverSide', true)\n .withDataProp('peers')\n .withOption('processing', true)\n .withOption('bFilter', false)\n .withOption('stateSave', true)\n .withOption('fnRowCallback',\n function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {\n $compile(nRow)($scope);\n })\n .withOption('ajax', function (data, callback, settings) {\n var pageNum = (data.start / data.length) + 1;\n var totalNumberOfNodes = 0;\n PeerService.getStats().then(function (success) {\n totalNumberOfNodes = success.totalNodes;\n PeerService.getPeers(pageNum, data.length).then(function (response) {\n var data = {'peers': response};\n callback({\n 'iTotalRecords': totalNumberOfNodes,\n 'iTotalDisplayRecords': totalNumberOfNodes,\n 'peers': data.peers\n });\n });\n }, function (error) {\n\n });\n })\n .withDisplayLength(10).withBootstrap()\n .withOption('rank', [1, 'desc'])\n .withOption('rowReordering', true);\n\n $scope.dtColumns = [\n DTColumnBuilder.newColumn('connected').withTitle('Connected').notSortable()\n .renderWith(function (data, type, row, meta) {\n return getConnectedUiModel(row.active) + '
' + formatDate(row.lastConnected, true) + '';\n }),\n\n DTColumnBuilder.newColumn('state').withTitle('State').notSortable()\n .renderWith(function (data, type, row, meta) {\n if (!row.peerState) {\n return \"n/a\";\n }\n\n if (row.peerState.isDownloading) {\n return iconToolTip('