profile
viewpoint
Kristian Larsson plajjan Deutsche Telekom / Terastream, @SpriteLink Stockholm, Sweden http://labs.spritelink.net/ Network Automation Ninja at Deutsche Telekom / TeraStream.

arbox/org-sync 119

Issue Tracking Synchronization for Emacs Org-mode.

plajjan/bgpflow 4

NetFlow collector with integrated BGP collector

plajjan/bmpd 2

A daemon for the BGP Monitoring Protocol (BMP).

plajjan/java-CiscoVigenere 2

Java library for Cisco Vigenere encryption and decryption

plajjan/3ggraph 1

Graph live information from a 3G dongle

startedplajjan/vrnetlab

started time in 5 hours

startedplajjan/vrnetlab

started time in a day

startedplajjan/vrnetlab

started time in a day

startedplajjan/vrnetlab

started time in 5 days

startedplajjan/vrnetlab

started time in 6 days

startedplajjan/vrnetlab

started time in 7 days

fork lukego/LISP-Machine

Archive of LISP Machine, Inc.

fork in 9 days

issue commentplajjan/vrnetlab

vMX 20.1R1.11 shows unhealthy state but vrcons working fine.

I can confirm I always had this same issue with vMX (never showed as "healthy")

kalmanoharan

comment created time in 10 days

startedplajjan/vrnetlab

started time in 10 days

push eventSpriteLink/NIPAP

Björn Persson

commit sha e40f3a52df5be5913607e79387c2e90677f28a45

Fixing slow load on VRF page and adding functionality for infinite scroll.

view details

Lukas Garberg

commit sha eb49f3bff74872f564be99236bbbf62dcf3788b5

Merge pull request #1267 from BjornPerssonSigma/slowVRF Fixing slow load on VRF page and adding functionality for infinite sc…

view details

push time in 11 days

PR merged SpriteLink/NIPAP

Fixing slow load on VRF page and adding functionality for infinite sc…

Fix on the VRF page so that users can search before the loading of all data has been made. Have also implemented infinite scroll, that is loading data by scrolling, so that it fits with angular.js.

The change has shortened the loading time and made it possible to search before the initial load has been made. There are still some delay of around 4-6 seconds before the initial load will show on the screen.

License for Infinite scroll has been added to the ng-infinite-scroll.min.js - file.

+146 -22

1 comment

5 changed files

BjornPerssonSigma

pr closed time in 11 days

pull request commentSpriteLink/NIPAP

Fixing slow load on VRF page and adding functionality for infinite sc…

LGTM, thanks a lot!

BjornPerssonSigma

comment created time in 11 days

created repositoryjob/rpkidump

created time in 11 days

startedios-xr/model-driven-telemetry

started time in 11 days

Pull request review commentSpriteLink/NIPAP

Fixing slow load on VRF page and adding functionality for infinite sc…

 var nipapAppControllers = angular.module('nipapApp.controllers', []);  */ nipapAppControllers.controller('VRFListController', function ($scope, $http) { -	// Fetch VRFs from backend-	$http.post('/xhr/list_vrf',-		JSON.stringify({}),-		{ 'headers': { 'Content-Type': 'application/json' } })-		.then(function (response) {-			if (response.data.hasOwnProperty('error')) {-				showDialogNotice('Error', response.data.message);-			} else {-				$scope.vrfs = response.data;-			}-		})-		.catch(function (response) {-			var msg = response.data || "Unknown failure";-			showDialogNotice('Error', response.status + ': ' + msg);-		});+	var isSmartSearch;

Can't see this extra indent in my code. It should be a new blank row below "nipapAppControllers.controller('VRFListController', function ($scope, $http) {"

image

I tried to follow how the following method was written: "/*

  • PoolListController - used to list pools on the /pool/list-page */ nipapAppControllers.controller('PoolListController', function ($scope, $http) {" image
BjornPerssonSigma

comment created time in 12 days

Pull request review commentSpriteLink/NIPAP

Fixing slow load on VRF page and adding functionality for infinite sc…

 var nipapAppControllers = angular.module('nipapApp.controllers', []);  */ nipapAppControllers.controller('VRFListController', function ($scope, $http) { -	// Fetch VRFs from backend-	$http.post('/xhr/list_vrf',-		JSON.stringify({}),-		{ 'headers': { 'Content-Type': 'application/json' } })-		.then(function (response) {-			if (response.data.hasOwnProperty('error')) {-				showDialogNotice('Error', response.data.message);-			} else {-				$scope.vrfs = response.data;-			}-		})-		.catch(function (response) {-			var msg = response.data || "Unknown failure";-			showDialogNotice('Error', response.status + ': ' + msg);-		});+	var isSmartSearch;+    var allVrfs;+    var VRF_BATCH_SIZE = 100;+    var smartOffset = 0;++    if ($scope.query === '' || $scope.query === undefined) {+        fetchAllVrfs();+    }++    /*+     * Fetch all Vrfs+     */+    function fetchAllVrfs(){+    $scope.isLoading = true;+    $http.post('/xhr/list_vrf',+        JSON.stringify({}),+        { 'headers': { 'Content-Type': 'application/json' } })+        .then(function (response) {+            if (response.data.hasOwnProperty('error')) {+                showDialogNotice('Error', response.data.message);+            } else {+                allVrfs = response.data;+                $scope.vrfs = allVrfs.slice(0, VRF_BATCH_SIZE);+            }+        })+        .catch(function (response) {+            var msg = response.data || "Unknown failure";+            showDialogNotice('Error', response.status + ': ' + msg);+        });+    $scope.isLoading = false;+    }++    /*+     * Smart search for VRF list+     */+    $scope.smartSearch = function (offset = 0) {+        if ($scope.query === '') {+            return;+        }++        if (offset === 0){+          smartOffset = 0;+        }++        if ($scope.isLoading)+            return;++        var search_q = {

Identifier 'search_q' is not in camel case.

BjornPerssonSigma

comment created time in 12 days

Pull request review commentSpriteLink/NIPAP

Fixing slow load on VRF page and adding functionality for infinite sc…

 var nipapAppControllers = angular.module('nipapApp.controllers', []);  */ nipapAppControllers.controller('VRFListController', function ($scope, $http) { -	// Fetch VRFs from backend-	$http.post('/xhr/list_vrf',-		JSON.stringify({}),-		{ 'headers': { 'Content-Type': 'application/json' } })-		.then(function (response) {-			if (response.data.hasOwnProperty('error')) {-				showDialogNotice('Error', response.data.message);-			} else {-				$scope.vrfs = response.data;-			}-		})-		.catch(function (response) {-			var msg = response.data || "Unknown failure";-			showDialogNotice('Error', response.status + ': ' + msg);-		});+	var isSmartSearch;+    var allVrfs;+    var VRF_BATCH_SIZE = 100;+    var smartOffset = 0;++    if ($scope.query === '' || $scope.query === undefined) {+        fetchAllVrfs();+    }++    /*+     * Fetch all Vrfs+     */+    function fetchAllVrfs(){+    $scope.isLoading = true;+    $http.post('/xhr/list_vrf',+        JSON.stringify({}),+        { 'headers': { 'Content-Type': 'application/json' } })+        .then(function (response) {+            if (response.data.hasOwnProperty('error')) {+                showDialogNotice('Error', response.data.message);+            } else {+                allVrfs = response.data;+                $scope.vrfs = allVrfs.slice(0, VRF_BATCH_SIZE);+            }+        })+        .catch(function (response) {+            var msg = response.data || "Unknown failure";+            showDialogNotice('Error', response.status + ': ' + msg);+        });+    $scope.isLoading = false;+    }++    /*+     * Smart search for VRF list+     */+    $scope.smartSearch = function (offset = 0) {

'default parameters' is only available in ES6 (use 'esversion: 6').

BjornPerssonSigma

comment created time in 12 days

Pull request review commentSpriteLink/NIPAP

Fixing slow load on VRF page and adding functionality for infinite sc…

 var nipapAppControllers = angular.module('nipapApp.controllers', []);  */ nipapAppControllers.controller('VRFListController', function ($scope, $http) { -	// Fetch VRFs from backend-	$http.post('/xhr/list_vrf',-		JSON.stringify({}),-		{ 'headers': { 'Content-Type': 'application/json' } })-		.then(function (response) {-			if (response.data.hasOwnProperty('error')) {-				showDialogNotice('Error', response.data.message);-			} else {-				$scope.vrfs = response.data;-			}-		})-		.catch(function (response) {-			var msg = response.data || "Unknown failure";-			showDialogNotice('Error', response.status + ': ' + msg);-		});+	var isSmartSearch;+    var allVrfs;+    var VRF_BATCH_SIZE = 100;+    var smartOffset = 0;++    if ($scope.query === '' || $scope.query === undefined) {+        fetchAllVrfs();+    }++    /*+     * Fetch all Vrfs+     */+    function fetchAllVrfs(){+    $scope.isLoading = true;+    $http.post('/xhr/list_vrf',+        JSON.stringify({}),+        { 'headers': { 'Content-Type': 'application/json' } })+        .then(function (response) {+            if (response.data.hasOwnProperty('error')) {+                showDialogNotice('Error', response.data.message);+            } else {+                allVrfs = response.data;+                $scope.vrfs = allVrfs.slice(0, VRF_BATCH_SIZE);+            }+        })+        .catch(function (response) {+            var msg = response.data || "Unknown failure";+            showDialogNotice('Error', response.status + ': ' + msg);+        });+    $scope.isLoading = false;+    }++    /*+     * Smart search for VRF list+     */+    $scope.smartSearch = function (offset = 0) {+        if ($scope.query === '') {+            return;+        }++        if (offset === 0){+          smartOffset = 0;+        }++        if ($scope.isLoading)+            return;

Expected '{' and instead saw 'return'.

BjornPerssonSigma

comment created time in 12 days

Pull request review commentSpriteLink/NIPAP

Fixing slow load on VRF page and adding functionality for infinite sc…

 var nipapAppControllers = angular.module('nipapApp.controllers', []);  */ nipapAppControllers.controller('VRFListController', function ($scope, $http) { -	// Fetch VRFs from backend-	$http.post('/xhr/list_vrf',-		JSON.stringify({}),-		{ 'headers': { 'Content-Type': 'application/json' } })-		.then(function (response) {-			if (response.data.hasOwnProperty('error')) {-				showDialogNotice('Error', response.data.message);-			} else {-				$scope.vrfs = response.data;-			}-		})-		.catch(function (response) {-			var msg = response.data || "Unknown failure";-			showDialogNotice('Error', response.status + ': ' + msg);-		});+	var isSmartSearch;+    var allVrfs;+    var VRF_BATCH_SIZE = 100;+    var smartOffset = 0;++    if ($scope.query === '' || $scope.query === undefined) {+        fetchAllVrfs();+    }++    /*+     * Fetch all Vrfs+     */+    function fetchAllVrfs(){+    $scope.isLoading = true;+    $http.post('/xhr/list_vrf',+        JSON.stringify({}),+        { 'headers': { 'Content-Type': 'application/json' } })+        .then(function (response) {+            if (response.data.hasOwnProperty('error')) {+                showDialogNotice('Error', response.data.message);+            } else {+                allVrfs = response.data;+                $scope.vrfs = allVrfs.slice(0, VRF_BATCH_SIZE);+            }+        })+        .catch(function (response) {+            var msg = response.data || "Unknown failure";+            showDialogNotice('Error', response.status + ': ' + msg);+        });+    $scope.isLoading = false;+    }++    /*+     * Smart search for VRF list+     */+    $scope.smartSearch = function (offset = 0) {+        if ($scope.query === '') {+            return;+        }++        if (offset === 0){+          smartOffset = 0;+        }++        if ($scope.isLoading)+            return;++        var search_q = {+            'query_string': $scope.query,+            'max_result': VRF_BATCH_SIZE,+            'offset': offset,+        }+        $scope.isLoading = true;+        $http.post('/xhr/smart_search_vrf',+            JSON.stringify(search_q),+            { 'headers': { 'Content-Type': 'application/json' } })+            .then(function (response) {+                if (offset === 0) {+                    $scope.vrfs = response.data.result;+                } else {+                  $scope.vrfs = $scope.vrfs.concat(response.data.result);+                }+            })+            .catch(function (response) {+                var msg = response.data || "Unknown failure";

Mixed double and single quotes.

BjornPerssonSigma

comment created time in 12 days

Pull request review commentSpriteLink/NIPAP

Fixing slow load on VRF page and adding functionality for infinite sc…

 var nipapAppControllers = angular.module('nipapApp.controllers', []);  */ nipapAppControllers.controller('VRFListController', function ($scope, $http) { -	// Fetch VRFs from backend-	$http.post('/xhr/list_vrf',-		JSON.stringify({}),-		{ 'headers': { 'Content-Type': 'application/json' } })-		.then(function (response) {-			if (response.data.hasOwnProperty('error')) {-				showDialogNotice('Error', response.data.message);-			} else {-				$scope.vrfs = response.data;-			}-		})-		.catch(function (response) {-			var msg = response.data || "Unknown failure";-			showDialogNotice('Error', response.status + ': ' + msg);-		});+	var isSmartSearch;+    var allVrfs;+    var VRF_BATCH_SIZE = 100;+    var smartOffset = 0;++    if ($scope.query === '' || $scope.query === undefined) {+        fetchAllVrfs();+    }++    /*+     * Fetch all Vrfs+     */+    function fetchAllVrfs(){+    $scope.isLoading = true;+    $http.post('/xhr/list_vrf',+        JSON.stringify({}),+        { 'headers': { 'Content-Type': 'application/json' } })+        .then(function (response) {+            if (response.data.hasOwnProperty('error')) {+                showDialogNotice('Error', response.data.message);+            } else {+                allVrfs = response.data;+                $scope.vrfs = allVrfs.slice(0, VRF_BATCH_SIZE);+            }+        })+        .catch(function (response) {+            var msg = response.data || "Unknown failure";+            showDialogNotice('Error', response.status + ': ' + msg);+        });+    $scope.isLoading = false;+    }++    /*+     * Smart search for VRF list+     */+    $scope.smartSearch = function (offset = 0) {+        if ($scope.query === '') {+            return;+        }++        if (offset === 0){+          smartOffset = 0;+        }++        if ($scope.isLoading)+            return;++        var search_q = {+            'query_string': $scope.query,+            'max_result': VRF_BATCH_SIZE,+            'offset': offset,+        }

Missing semicolon.

BjornPerssonSigma

comment created time in 12 days

Pull request review commentSpriteLink/NIPAP

Fixing slow load on VRF page and adding functionality for infinite sc…

 var nipapAppControllers = angular.module('nipapApp.controllers', []);  */ nipapAppControllers.controller('VRFListController', function ($scope, $http) { -	// Fetch VRFs from backend-	$http.post('/xhr/list_vrf',-		JSON.stringify({}),-		{ 'headers': { 'Content-Type': 'application/json' } })-		.then(function (response) {-			if (response.data.hasOwnProperty('error')) {-				showDialogNotice('Error', response.data.message);-			} else {-				$scope.vrfs = response.data;-			}-		})-		.catch(function (response) {-			var msg = response.data || "Unknown failure";-			showDialogNotice('Error', response.status + ': ' + msg);-		});+	var isSmartSearch;+    var allVrfs;+    var VRF_BATCH_SIZE = 100;+    var smartOffset = 0;++    if ($scope.query === '' || $scope.query === undefined) {+        fetchAllVrfs();+    }++    /*+     * Fetch all Vrfs+     */+    function fetchAllVrfs(){+    $scope.isLoading = true;+    $http.post('/xhr/list_vrf',+        JSON.stringify({}),+        { 'headers': { 'Content-Type': 'application/json' } })+        .then(function (response) {+            if (response.data.hasOwnProperty('error')) {+                showDialogNotice('Error', response.data.message);+            } else {+                allVrfs = response.data;+                $scope.vrfs = allVrfs.slice(0, VRF_BATCH_SIZE);+            }+        })+        .catch(function (response) {+            var msg = response.data || "Unknown failure";+            showDialogNotice('Error', response.status + ': ' + msg);+        });+    $scope.isLoading = false;+    }++    /*+     * Smart search for VRF list+     */+    $scope.smartSearch = function (offset = 0) {+        if ($scope.query === '') {+            return;+        }++        if (offset === 0){+          smartOffset = 0;+        }++        if ($scope.isLoading)+            return;++        var search_q = {+            'query_string': $scope.query,+            'max_result': VRF_BATCH_SIZE,+            'offset': offset,+        }+        $scope.isLoading = true;+        $http.post('/xhr/smart_search_vrf',+            JSON.stringify(search_q),

Identifier 'search_q' is not in camel case.

BjornPerssonSigma

comment created time in 12 days

Pull request review commentSpriteLink/NIPAP

Fixing slow load on VRF page and adding functionality for infinite sc…

 var nipapAppControllers = angular.module('nipapApp.controllers', []);  */ nipapAppControllers.controller('VRFListController', function ($scope, $http) { -	// Fetch VRFs from backend-	$http.post('/xhr/list_vrf',-		JSON.stringify({}),-		{ 'headers': { 'Content-Type': 'application/json' } })-		.then(function (response) {-			if (response.data.hasOwnProperty('error')) {-				showDialogNotice('Error', response.data.message);-			} else {-				$scope.vrfs = response.data;-			}-		})-		.catch(function (response) {-			var msg = response.data || "Unknown failure";-			showDialogNotice('Error', response.status + ': ' + msg);-		});+	var isSmartSearch;+    var allVrfs;+    var VRF_BATCH_SIZE = 100;+    var smartOffset = 0;++    if ($scope.query === '' || $scope.query === undefined) {+        fetchAllVrfs();+    }++    /*+     * Fetch all Vrfs+     */+    function fetchAllVrfs(){+    $scope.isLoading = true;+    $http.post('/xhr/list_vrf',+        JSON.stringify({}),+        { 'headers': { 'Content-Type': 'application/json' } })+        .then(function (response) {+            if (response.data.hasOwnProperty('error')) {+                showDialogNotice('Error', response.data.message);+            } else {+                allVrfs = response.data;+                $scope.vrfs = allVrfs.slice(0, VRF_BATCH_SIZE);+            }+        })+        .catch(function (response) {+            var msg = response.data || "Unknown failure";+            showDialogNotice('Error', response.status + ': ' + msg);+        });+    $scope.isLoading = false;+    }++    /*+     * Smart search for VRF list+     */+    $scope.smartSearch = function (offset = 0) {+        if ($scope.query === '') {+            return;+        }++        if (offset === 0){+          smartOffset = 0;+        }++        if ($scope.isLoading)+            return;++        var search_q = {+            'query_string': $scope.query,+            'max_result': VRF_BATCH_SIZE,+            'offset': offset,+        }+        $scope.isLoading = true;+        $http.post('/xhr/smart_search_vrf',+            JSON.stringify(search_q),+            { 'headers': { 'Content-Type': 'application/json' } })+            .then(function (response) {+                if (offset === 0) {+                    $scope.vrfs = response.data.result;+                } else {+                  $scope.vrfs = $scope.vrfs.concat(response.data.result);+                }+            })+            .catch(function (response) {+                var msg = response.data || "Unknown failure";+                showDialogNotice('Error', response.status + ': ' + msg);+            });+        $scope.isLoading = false;+    }

Missing semicolon.

BjornPerssonSigma

comment created time in 12 days

Pull request review commentSpriteLink/NIPAP

Fixing slow load on VRF page and adding functionality for infinite sc…

 var nipapAppControllers = angular.module('nipapApp.controllers', []);  */ nipapAppControllers.controller('VRFListController', function ($scope, $http) { -	// Fetch VRFs from backend-	$http.post('/xhr/list_vrf',-		JSON.stringify({}),-		{ 'headers': { 'Content-Type': 'application/json' } })-		.then(function (response) {-			if (response.data.hasOwnProperty('error')) {-				showDialogNotice('Error', response.data.message);-			} else {-				$scope.vrfs = response.data;-			}-		})-		.catch(function (response) {-			var msg = response.data || "Unknown failure";-			showDialogNotice('Error', response.status + ': ' + msg);-		});+	var isSmartSearch;+    var allVrfs;+    var VRF_BATCH_SIZE = 100;+    var smartOffset = 0;++    if ($scope.query === '' || $scope.query === undefined) {+        fetchAllVrfs();+    }++    /*+     * Fetch all Vrfs+     */+    function fetchAllVrfs(){+    $scope.isLoading = true;+    $http.post('/xhr/list_vrf',+        JSON.stringify({}),+        { 'headers': { 'Content-Type': 'application/json' } })+        .then(function (response) {+            if (response.data.hasOwnProperty('error')) {+                showDialogNotice('Error', response.data.message);+            } else {+                allVrfs = response.data;+                $scope.vrfs = allVrfs.slice(0, VRF_BATCH_SIZE);+            }+        })+        .catch(function (response) {+            var msg = response.data || "Unknown failure";+            showDialogNotice('Error', response.status + ': ' + msg);+        });+    $scope.isLoading = false;+    }++    /*+     * Smart search for VRF list+     */+    $scope.smartSearch = function (offset = 0) {+        if ($scope.query === '') {+            return;+        }++        if (offset === 0){+          smartOffset = 0;+        }++        if ($scope.isLoading)+            return;++        var search_q = {+            'query_string': $scope.query,+            'max_result': VRF_BATCH_SIZE,+            'offset': offset,+        }+        $scope.isLoading = true;+        $http.post('/xhr/smart_search_vrf',+            JSON.stringify(search_q),+            { 'headers': { 'Content-Type': 'application/json' } })+            .then(function (response) {+                if (offset === 0) {+                    $scope.vrfs = response.data.result;+                } else {+                  $scope.vrfs = $scope.vrfs.concat(response.data.result);+                }+            })+            .catch(function (response) {+                var msg = response.data || "Unknown failure";+                showDialogNotice('Error', response.status + ': ' + msg);+            });+        $scope.isLoading = false;+    }++    // Check and run functionallity based on+    // smart search or loading of all Vrfs+    $scope.checkAndRunNextPage = function() {+        if ($scope.query === '' || typeof $scope.query === "undefined") {

Mixed double and single quotes.

BjornPerssonSigma

comment created time in 12 days

Pull request review commentSpriteLink/NIPAP

Fixing slow load on VRF page and adding functionality for infinite sc…

 var nipapAppControllers = angular.module('nipapApp.controllers', []);  */ nipapAppControllers.controller('VRFListController', function ($scope, $http) { -	// Fetch VRFs from backend-	$http.post('/xhr/list_vrf',-		JSON.stringify({}),-		{ 'headers': { 'Content-Type': 'application/json' } })-		.then(function (response) {-			if (response.data.hasOwnProperty('error')) {-				showDialogNotice('Error', response.data.message);-			} else {-				$scope.vrfs = response.data;-			}-		})-		.catch(function (response) {-			var msg = response.data || "Unknown failure";-			showDialogNotice('Error', response.status + ': ' + msg);-		});+	var isSmartSearch;+    var allVrfs;+    var VRF_BATCH_SIZE = 100;+    var smartOffset = 0;++    if ($scope.query === '' || $scope.query === undefined) {+        fetchAllVrfs();+    }++    /*+     * Fetch all Vrfs+     */+    function fetchAllVrfs(){+    $scope.isLoading = true;+    $http.post('/xhr/list_vrf',+        JSON.stringify({}),+        { 'headers': { 'Content-Type': 'application/json' } })+        .then(function (response) {+            if (response.data.hasOwnProperty('error')) {+                showDialogNotice('Error', response.data.message);+            } else {+                allVrfs = response.data;+                $scope.vrfs = allVrfs.slice(0, VRF_BATCH_SIZE);+            }+        })+        .catch(function (response) {+            var msg = response.data || "Unknown failure";+            showDialogNotice('Error', response.status + ': ' + msg);+        });+    $scope.isLoading = false;+    }++    /*+     * Smart search for VRF list+     */+    $scope.smartSearch = function (offset = 0) {+        if ($scope.query === '') {+            return;+        }++        if (offset === 0){+          smartOffset = 0;+        }++        if ($scope.isLoading)+            return;++        var search_q = {+            'query_string': $scope.query,+            'max_result': VRF_BATCH_SIZE,+            'offset': offset,+        }+        $scope.isLoading = true;+        $http.post('/xhr/smart_search_vrf',+            JSON.stringify(search_q),+            { 'headers': { 'Content-Type': 'application/json' } })+            .then(function (response) {+                if (offset === 0) {+                    $scope.vrfs = response.data.result;+                } else {+                  $scope.vrfs = $scope.vrfs.concat(response.data.result);+                }+            })+            .catch(function (response) {+                var msg = response.data || "Unknown failure";+                showDialogNotice('Error', response.status + ': ' + msg);+            });+        $scope.isLoading = false;+    }++    // Check and run functionallity based on+    // smart search or loading of all Vrfs+    $scope.checkAndRunNextPage = function() {+        if ($scope.query === '' || typeof $scope.query === "undefined") {+            isSmartSearch = false;+        } else {+            isSmartSearch = true;+        }++        if (typeof $scope.vrfs === "undefined")

Mixed double and single quotes.

BjornPerssonSigma

comment created time in 12 days

Pull request review commentSpriteLink/NIPAP

Fixing slow load on VRF page and adding functionality for infinite sc…

 var nipapAppControllers = angular.module('nipapApp.controllers', []);  */ nipapAppControllers.controller('VRFListController', function ($scope, $http) { -	// Fetch VRFs from backend-	$http.post('/xhr/list_vrf',-		JSON.stringify({}),-		{ 'headers': { 'Content-Type': 'application/json' } })-		.then(function (response) {-			if (response.data.hasOwnProperty('error')) {-				showDialogNotice('Error', response.data.message);-			} else {-				$scope.vrfs = response.data;-			}-		})-		.catch(function (response) {-			var msg = response.data || "Unknown failure";-			showDialogNotice('Error', response.status + ': ' + msg);-		});+	var isSmartSearch;+    var allVrfs;+    var VRF_BATCH_SIZE = 100;+    var smartOffset = 0;++    if ($scope.query === '' || $scope.query === undefined) {+        fetchAllVrfs();+    }++    /*+     * Fetch all Vrfs+     */+    function fetchAllVrfs(){+    $scope.isLoading = true;+    $http.post('/xhr/list_vrf',+        JSON.stringify({}),+        { 'headers': { 'Content-Type': 'application/json' } })+        .then(function (response) {+            if (response.data.hasOwnProperty('error')) {+                showDialogNotice('Error', response.data.message);+            } else {+                allVrfs = response.data;+                $scope.vrfs = allVrfs.slice(0, VRF_BATCH_SIZE);+            }+        })+        .catch(function (response) {+            var msg = response.data || "Unknown failure";+            showDialogNotice('Error', response.status + ': ' + msg);+        });+    $scope.isLoading = false;+    }++    /*+     * Smart search for VRF list+     */+    $scope.smartSearch = function (offset = 0) {+        if ($scope.query === '') {+            return;+        }++        if (offset === 0){+          smartOffset = 0;+        }++        if ($scope.isLoading)+            return;++        var search_q = {+            'query_string': $scope.query,+            'max_result': VRF_BATCH_SIZE,+            'offset': offset,+        }+        $scope.isLoading = true;+        $http.post('/xhr/smart_search_vrf',+            JSON.stringify(search_q),+            { 'headers': { 'Content-Type': 'application/json' } })+            .then(function (response) {+                if (offset === 0) {+                    $scope.vrfs = response.data.result;+                } else {+                  $scope.vrfs = $scope.vrfs.concat(response.data.result);+                }+            })+            .catch(function (response) {+                var msg = response.data || "Unknown failure";+                showDialogNotice('Error', response.status + ': ' + msg);+            });+        $scope.isLoading = false;+    }++    // Check and run functionallity based on+    // smart search or loading of all Vrfs+    $scope.checkAndRunNextPage = function() {+        if ($scope.query === '' || typeof $scope.query === "undefined") {+            isSmartSearch = false;+        } else {+            isSmartSearch = true;+        }++        if (typeof $scope.vrfs === "undefined")+            return;++        if(isSmartSearch){+          smartOffset += VRF_BATCH_SIZE;+          $scope.smartSearch(smartOffset);++        } else {+            if(typeof allVrfs === "undefined"){

Mixed double and single quotes.

BjornPerssonSigma

comment created time in 12 days

Pull request review commentSpriteLink/NIPAP

Fixing slow load on VRF page and adding functionality for infinite sc…

 var nipapAppControllers = angular.module('nipapApp.controllers', []);  */ nipapAppControllers.controller('VRFListController', function ($scope, $http) { -	// Fetch VRFs from backend-	$http.post('/xhr/list_vrf',-		JSON.stringify({}),-		{ 'headers': { 'Content-Type': 'application/json' } })-		.then(function (response) {-			if (response.data.hasOwnProperty('error')) {-				showDialogNotice('Error', response.data.message);-			} else {-				$scope.vrfs = response.data;-			}-		})-		.catch(function (response) {-			var msg = response.data || "Unknown failure";-			showDialogNotice('Error', response.status + ': ' + msg);-		});+	var isSmartSearch;+    var allVrfs;+    var VRF_BATCH_SIZE = 100;+    var smartOffset = 0;++    if ($scope.query === '' || $scope.query === undefined) {+        fetchAllVrfs();+    }++    /*+     * Fetch all Vrfs+     */+    function fetchAllVrfs(){+    $scope.isLoading = true;+    $http.post('/xhr/list_vrf',+        JSON.stringify({}),+        { 'headers': { 'Content-Type': 'application/json' } })+        .then(function (response) {+            if (response.data.hasOwnProperty('error')) {+                showDialogNotice('Error', response.data.message);+            } else {+                allVrfs = response.data;+                $scope.vrfs = allVrfs.slice(0, VRF_BATCH_SIZE);+            }+        })+        .catch(function (response) {+            var msg = response.data || "Unknown failure";+            showDialogNotice('Error', response.status + ': ' + msg);+        });+    $scope.isLoading = false;+    }++    /*+     * Smart search for VRF list+     */+    $scope.smartSearch = function (offset = 0) {+        if ($scope.query === '') {+            return;+        }++        if (offset === 0){+          smartOffset = 0;+        }++        if ($scope.isLoading)+            return;++        var search_q = {+            'query_string': $scope.query,+            'max_result': VRF_BATCH_SIZE,+            'offset': offset,+        }+        $scope.isLoading = true;+        $http.post('/xhr/smart_search_vrf',+            JSON.stringify(search_q),+            { 'headers': { 'Content-Type': 'application/json' } })+            .then(function (response) {+                if (offset === 0) {+                    $scope.vrfs = response.data.result;+                } else {+                  $scope.vrfs = $scope.vrfs.concat(response.data.result);+                }+            })+            .catch(function (response) {+                var msg = response.data || "Unknown failure";+                showDialogNotice('Error', response.status + ': ' + msg);+            });+        $scope.isLoading = false;+    }++    // Check and run functionallity based on+    // smart search or loading of all Vrfs+    $scope.checkAndRunNextPage = function() {+        if ($scope.query === '' || typeof $scope.query === "undefined") {+            isSmartSearch = false;+        } else {+            isSmartSearch = true;+        }++        if (typeof $scope.vrfs === "undefined")+            return;

Expected '{' and instead saw 'return'.

BjornPerssonSigma

comment created time in 12 days

Pull request review commentSpriteLink/NIPAP

Fixing slow load on VRF page and adding functionality for infinite sc…

 var nipapAppControllers = angular.module('nipapApp.controllers', []);  */ nipapAppControllers.controller('VRFListController', function ($scope, $http) { -	// Fetch VRFs from backend-	$http.post('/xhr/list_vrf',-		JSON.stringify({}),-		{ 'headers': { 'Content-Type': 'application/json' } })-		.then(function (response) {-			if (response.data.hasOwnProperty('error')) {-				showDialogNotice('Error', response.data.message);-			} else {-				$scope.vrfs = response.data;-			}-		})-		.catch(function (response) {-			var msg = response.data || "Unknown failure";-			showDialogNotice('Error', response.status + ': ' + msg);-		});+	var isSmartSearch;+    var allVrfs;+    var VRF_BATCH_SIZE = 100;+    var smartOffset = 0;++    if ($scope.query === '' || $scope.query === undefined) {+        fetchAllVrfs();+    }++    /*+     * Fetch all Vrfs+     */+    function fetchAllVrfs(){+    $scope.isLoading = true;+    $http.post('/xhr/list_vrf',+        JSON.stringify({}),+        { 'headers': { 'Content-Type': 'application/json' } })+        .then(function (response) {+            if (response.data.hasOwnProperty('error')) {+                showDialogNotice('Error', response.data.message);+            } else {+                allVrfs = response.data;+                $scope.vrfs = allVrfs.slice(0, VRF_BATCH_SIZE);+            }+        })+        .catch(function (response) {+            var msg = response.data || "Unknown failure";+            showDialogNotice('Error', response.status + ': ' + msg);+        });+    $scope.isLoading = false;+    }++    /*+     * Smart search for VRF list+     */+    $scope.smartSearch = function (offset = 0) {+        if ($scope.query === '') {+            return;+        }++        if (offset === 0){+          smartOffset = 0;+        }++        if ($scope.isLoading)+            return;++        var search_q = {+            'query_string': $scope.query,+            'max_result': VRF_BATCH_SIZE,+            'offset': offset,+        }+        $scope.isLoading = true;+        $http.post('/xhr/smart_search_vrf',+            JSON.stringify(search_q),+            { 'headers': { 'Content-Type': 'application/json' } })+            .then(function (response) {+                if (offset === 0) {+                    $scope.vrfs = response.data.result;+                } else {+                  $scope.vrfs = $scope.vrfs.concat(response.data.result);+                }+            })+            .catch(function (response) {+                var msg = response.data || "Unknown failure";+                showDialogNotice('Error', response.status + ': ' + msg);+            });+        $scope.isLoading = false;+    }++    // Check and run functionallity based on+    // smart search or loading of all Vrfs+    $scope.checkAndRunNextPage = function() {+        if ($scope.query === '' || typeof $scope.query === "undefined") {+            isSmartSearch = false;+        } else {+            isSmartSearch = true;+        }++        if (typeof $scope.vrfs === "undefined")+            return;++        if(isSmartSearch){+          smartOffset += VRF_BATCH_SIZE;+          $scope.smartSearch(smartOffset);++        } else {+            if(typeof allVrfs === "undefined"){+                fetchAllVrfs();+            } else {+                performVrfNextPage(allVrfs);+            }+        }+    }++    // Dynamically adding values to $scope.vrfs if fetched all Vrfs+    function performVrfNextPage(allVrfData) {+        if ($scope.vrfs.length === allVrfData) {+            return;+        }++        if($scope.isLoading)+            return;

Expected '{' and instead saw 'return'.

BjornPerssonSigma

comment created time in 12 days

Pull request review commentSpriteLink/NIPAP

Fixing slow load on VRF page and adding functionality for infinite sc…

 var nipapAppControllers = angular.module('nipapApp.controllers', []);  */ nipapAppControllers.controller('VRFListController', function ($scope, $http) { -	// Fetch VRFs from backend-	$http.post('/xhr/list_vrf',-		JSON.stringify({}),-		{ 'headers': { 'Content-Type': 'application/json' } })-		.then(function (response) {-			if (response.data.hasOwnProperty('error')) {-				showDialogNotice('Error', response.data.message);-			} else {-				$scope.vrfs = response.data;-			}-		})-		.catch(function (response) {-			var msg = response.data || "Unknown failure";-			showDialogNotice('Error', response.status + ': ' + msg);-		});+	var isSmartSearch;+    var allVrfs;+    var VRF_BATCH_SIZE = 100;+    var smartOffset = 0;++    if ($scope.query === '' || $scope.query === undefined) {+        fetchAllVrfs();+    }++    /*+     * Fetch all Vrfs+     */+    function fetchAllVrfs(){+    $scope.isLoading = true;+    $http.post('/xhr/list_vrf',+        JSON.stringify({}),+        { 'headers': { 'Content-Type': 'application/json' } })+        .then(function (response) {+            if (response.data.hasOwnProperty('error')) {+                showDialogNotice('Error', response.data.message);+            } else {+                allVrfs = response.data;+                $scope.vrfs = allVrfs.slice(0, VRF_BATCH_SIZE);+            }+        })+        .catch(function (response) {+            var msg = response.data || "Unknown failure";+            showDialogNotice('Error', response.status + ': ' + msg);+        });+    $scope.isLoading = false;+    }++    /*+     * Smart search for VRF list+     */+    $scope.smartSearch = function (offset = 0) {+        if ($scope.query === '') {+            return;+        }++        if (offset === 0){+          smartOffset = 0;+        }++        if ($scope.isLoading)+            return;++        var search_q = {+            'query_string': $scope.query,+            'max_result': VRF_BATCH_SIZE,+            'offset': offset,+        }+        $scope.isLoading = true;+        $http.post('/xhr/smart_search_vrf',+            JSON.stringify(search_q),+            { 'headers': { 'Content-Type': 'application/json' } })+            .then(function (response) {+                if (offset === 0) {+                    $scope.vrfs = response.data.result;+                } else {+                  $scope.vrfs = $scope.vrfs.concat(response.data.result);+                }+            })+            .catch(function (response) {+                var msg = response.data || "Unknown failure";+                showDialogNotice('Error', response.status + ': ' + msg);+            });+        $scope.isLoading = false;+    }++    // Check and run functionallity based on+    // smart search or loading of all Vrfs+    $scope.checkAndRunNextPage = function() {+        if ($scope.query === '' || typeof $scope.query === "undefined") {+            isSmartSearch = false;+        } else {+            isSmartSearch = true;+        }++        if (typeof $scope.vrfs === "undefined")+            return;++        if(isSmartSearch){+          smartOffset += VRF_BATCH_SIZE;+          $scope.smartSearch(smartOffset);++        } else {+            if(typeof allVrfs === "undefined"){+                fetchAllVrfs();+            } else {+                performVrfNextPage(allVrfs);+            }+        }+    }

Missing semicolon.

BjornPerssonSigma

comment created time in 12 days

Pull request review commentSpriteLink/NIPAP

Fixing slow load on VRF page and adding functionality for infinite sc…

 var nipapAppControllers = angular.module('nipapApp.controllers', []);  */ nipapAppControllers.controller('VRFListController', function ($scope, $http) { -	// Fetch VRFs from backend-	$http.post('/xhr/list_vrf',-		JSON.stringify({}),-		{ 'headers': { 'Content-Type': 'application/json' } })-		.then(function (response) {-			if (response.data.hasOwnProperty('error')) {-				showDialogNotice('Error', response.data.message);-			} else {-				$scope.vrfs = response.data;-			}-		})-		.catch(function (response) {-			var msg = response.data || "Unknown failure";-			showDialogNotice('Error', response.status + ': ' + msg);-		});+	var isSmartSearch;+    var allVrfs;+    var VRF_BATCH_SIZE = 100;+    var smartOffset = 0;++    if ($scope.query === '' || $scope.query === undefined) {+        fetchAllVrfs();+    }++    /*+     * Fetch all Vrfs+     */+    function fetchAllVrfs(){+    $scope.isLoading = true;+    $http.post('/xhr/list_vrf',+        JSON.stringify({}),+        { 'headers': { 'Content-Type': 'application/json' } })+        .then(function (response) {+            if (response.data.hasOwnProperty('error')) {+                showDialogNotice('Error', response.data.message);+            } else {+                allVrfs = response.data;+                $scope.vrfs = allVrfs.slice(0, VRF_BATCH_SIZE);+            }+        })+        .catch(function (response) {+            var msg = response.data || "Unknown failure";+            showDialogNotice('Error', response.status + ': ' + msg);+        });+    $scope.isLoading = false;+    }++    /*+     * Smart search for VRF list+     */+    $scope.smartSearch = function (offset = 0) {+        if ($scope.query === '') {+            return;+        }++        if (offset === 0){+          smartOffset = 0;+        }++        if ($scope.isLoading)+            return;++        var search_q = {+            'query_string': $scope.query,+            'max_result': VRF_BATCH_SIZE,+            'offset': offset,+        }+        $scope.isLoading = true;+        $http.post('/xhr/smart_search_vrf',+            JSON.stringify(search_q),+            { 'headers': { 'Content-Type': 'application/json' } })+            .then(function (response) {+                if (offset === 0) {+                    $scope.vrfs = response.data.result;+                } else {+                  $scope.vrfs = $scope.vrfs.concat(response.data.result);+                }+            })+            .catch(function (response) {+                var msg = response.data || "Unknown failure";+                showDialogNotice('Error', response.status + ': ' + msg);+            });+        $scope.isLoading = false;+    }++    // Check and run functionallity based on+    // smart search or loading of all Vrfs+    $scope.checkAndRunNextPage = function() {+        if ($scope.query === '' || typeof $scope.query === "undefined") {+            isSmartSearch = false;+        } else {+            isSmartSearch = true;+        }++        if (typeof $scope.vrfs === "undefined")+            return;++        if(isSmartSearch){+          smartOffset += VRF_BATCH_SIZE;+          $scope.smartSearch(smartOffset);++        } else {+            if(typeof allVrfs === "undefined"){+                fetchAllVrfs();+            } else {+                performVrfNextPage(allVrfs);+            }+        }+    }++    // Dynamically adding values to $scope.vrfs if fetched all Vrfs+    function performVrfNextPage(allVrfData) {+        if ($scope.vrfs.length === allVrfData) {+            return;+        }++        if($scope.isLoading)+            return;++        var lastElementId = $scope.vrfs.length - 1;++        if (lastElementId + VRF_BATCH_SIZE <= allVrfs.length - 1) {+            $scope.vrfs = $scope.vrfs.concat(allVrfs.slice(lastElementId, lastElementId + VRF_BATCH_SIZE));

Line is too long.

BjornPerssonSigma

comment created time in 12 days

more