profile
viewpoint
Martin Arendtsen Arendtsen Denmark

Arendtsen/acts 0

Another Calendar-based Tarsnap Script

Arendtsen/bellville 0

Python Clickatell HTTP library

Arendtsen/dotfiles 0

netj's dotfiles

Arendtsen/ipv6 0

IPv6-adresse.dk source & data

Arendtsen/kamstrup-mqtt 0

Receives data from Kamstrup energy meter and sends it over MQTT

Arendtsen/Kamstrup-Radius-Interface 0

ESP8266 interface for Kamstrup (Radius provided) electricity meter

Arendtsen/NIPAP 0

Neat IP Address Planner - NIPAP is the best open source IPAM in the known universe, challenging classical IP address management (IPAM) systems in many areas.

Arendtsen/open-vm-tools-formula 0

Salt Stack formula for open-vm-tools

Arendtsen/paperless 0

Scan, index, and archive all of your paper documents

startedelastic/ecs-logging-ruby

started time in 2 days

fork mikker/ecs-logging-ruby

Transform your application logs to structured logs that comply with the Elastic Common Schema (ECS)

https://github.com/elastic/ecs-logging-ruby

fork in 2 days

created repositoryelastic/ecs-logging-ruby

created time in 5 days

startedmtkennerly/dunamai

started time in 7 days

fork davidolrik/pysodium

wrapper for libsodium providing high level crypto primitives

fork in 10 days

startedDrieam/rspec-github

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 10 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 10 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 10 days

startedmozilla/webextension-polyfill

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")+            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")

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));+        }+        else {+            $scope.vrfs = $scope.vrfs.concat(allVrfs.slice(lastElementId, allVrfs.length - 1));

Line is too long.

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

Pull request review commentSpriteLink/NIPAP

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

+/* ng-infinite-scroll - v1.0.0 - 2013-02-23 +Copyright (c) 2012 Brandon Tilley++Permission is hereby granted, free of charge, to any person+obtaining a copy of this software and associated documentation+files (the "Software"), to deal in the Software without+restriction, including without limitation the rights to use,+copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the+Software is furnished to do so, subject to the following+conditions:++The above copyright notice and this permission notice shall be+included in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR+OTHER DEALINGS IN THE SOFTWARE.*/+var mod;mod=angular.module("infinite-scroll",[]),mod.directive("infiniteScroll",["$rootScope","$window","$timeout",function(i,n,e){return{link:function(t,l,o){var r,c,f,a;return n=angular.element(n),f=0,null!=o.infiniteScrollDistance&&t.$watch(o.infiniteScrollDistance,function(i){return f=parseInt(i,10)}),a=!0,r=!1,null!=o.infiniteScrollDisabled&&t.$watch(o.infiniteScrollDisabled,function(i){return a=!i,a&&r?(r=!1,c()):void 0}),c=function(){var e,c,u,d;return d=n.height()+n.scrollTop(),e=l.offset().top+l.height(),c=e-d,u=n.height()*f>=c,u&&a?i.$$phase?t.$eval(o.infiniteScroll):t.$apply(o.infiniteScroll):u?r=!0:void 0},n.on("scroll",c),t.$on("$destroy",function(){return n.off("scroll",c)}),e(function(){return o.infiniteScrollImmediateCheck?t.$eval(o.infiniteScrollImmediateCheck)?c():void 0:c()},0)}}}]);

Did you mean to return a conditional instead of an assignment?<br>Expected an assignment or function call and instead saw an expression.<br>Line is too long.<br>Missing semicolon.

BjornPerssonSigma

comment created time in 12 days

PR opened 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

0 comment

5 changed files

pr created time in 12 days

PR closed 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.

Ps. used a formating tool hence some changes ragarding spaces etc.

+0 -0

0 comment

0 changed file

BjornPerssonSigma

pr closed time in 12 days

startedponyorm/pony

started time in 13 days

more