<commit_before>(function(){
'use strict';

/* Directives */
    var genoBrowserDirectives = angular.module('genoBrowserDirectives', ['genoBrowserControllers','genoBrowserServices', 'ui.bootstrap', 'angularFileUpload']);

    genoBrowserDirectives.directive("userToolbar", ['$window', 'API',
        function ($window, API) {
            return {
                restrict: "E",
                templateUrl: "/partials/user_toolbar.html",
                link: function (scope, element, attrs) {
                    scope.user = {
                        'username':'',
                        'password':''
                    };

                    scope.isAuthenticated = function() {
                        return $window.sessionStorage.token;
                    };

                    scope.login = function() {
                        API.authenticate(scope.user, function(data) {
                            $window.sessionStorage.token = data.token;
                        }, function (response) {
                            delete $window.sessionStorage.token;
                        });
                        $window.location.reload();
                    };

                    scope.logout = function() {
                        delete $window.sessionStorage.token;
                        $window.location.reload();
                    };
                }
            };
        }
    ]);

    genoBrowserDirectives.directive('viewList',['$location', 'Views', 'Tracks', '$modal', '$route', function($location, Views, Tracks, $modal, $route){
        return {
            restrict: 'E',
            templateUrl: 'partials/views.html',
            link: function (scope, element, attrs) {
                // First see if the route indicates a loaded view
                var location_view_id = parseInt($location.path().slice(-1)[0]);
                scope.views = Views.query(function(views) {
                    // Find the view with a matching id and set it as loaded
                    var loaded_view = views.filter(function(element){
                        return element.view_id === location_view_id;
                    })[0];
                    // It will be set as undefined if no view is currently loaded
                    scope.loaded_view = loaded_view;
                });

                // Start off with no views selected
                scope.selected_view = null;

                // use this to select a view, called when the user clicks a view<commit_msg>Reset view path after login/logout (before reload)<commit_after>(function(){
'use strict';

/* Directives */
    var genoBrowserDirectives = angular.module('genoBrowserDirectives', ['genoBrowserControllers','genoBrowserServices', 'ui.bootstrap', 'angularFileUpload']);

    genoBrowserDirectives.directive("userToolbar", ['$window', 'API', '$location',
        function ($window, API, $location) {
            return {
                restrict: "E",
                templateUrl: "/partials/user_toolbar.html",
                link: function (scope, element, attrs) {
                    scope.user = {
                        'username':'',
                        'password':''
                    };

                    scope.isAuthenticated = function() {
                        return $window.sessionStorage.token;
                    };

                    scope.login = function() {
                        API.authenticate(scope.user, function(data) {
                            $window.sessionStorage.token = data.token;
                        }, function (response) {
                            delete $window.sessionStorage.token;
                        });
                        $location.path('/');
                        $window.location.reload();
                    };

                    scope.logout = function() {
                        delete $window.sessionStorage.token;
                        $location.path('/');
                        $window.location.reload();
                    };
                }
            };
        }
    ]);

    genoBrowserDirectives.directive('viewList',['$location', 'Views', 'Tracks', '$modal', '$route', function($location, Views, Tracks, $modal, $route){
        return {
            restrict: 'E',
            templateUrl: 'partials/views.html',
            link: function (scope, element, attrs) {
                // First see if the route indicates a loaded view
                var location_view_id = parseInt($location.path().slice(-1)[0]);
                scope.views = Views.query(function(views) {
                    // Find the view with a matching id and set it as loaded
                    var loaded_view = views.filter(function(element){
                        return element.view_id === location_view_id;
                    })[0];
                    // It will be set as undefined if no view is currently loaded
                    scope.loaded_view = loaded_view;
                });

                // Start off with no views selected
                scope.selected_view = null;

                // use this to select a view, called when the user clicks a view
{'fraction_non_alphanumeric': 0.10917199922435525, 'fraction_numerical': 0.0011634671320535194, 'mean_word_length': 1.3466787989080982, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5255595', 'n_tokens_mistral': 1223, 'n_tokens_neox': 1140, 'n_words': 283}