<commit_before>define([], function() {
    'use strict';

    /**
     *
     * @param {$scope}       $scope
     * @param {$location}    $location
     * @param {PanelBuilder} PanelBuilder
     * @constructor
     */
    function DashboardController($scope, $location, PanelBuilder) {
        this.$scope = $scope;
        this.$location = $location;
        this.PanelBuilder = PanelBuilder;
        this.getPanels();

        $scope.$on('$destroy', this.destroy.bind(this));
    }

    /**
     * Retrieve all dashboard panels
     */
    DashboardController.prototype.getPanels = function() {
        var self = this;
        this.panels = {};

        this.PanelBuilder.getPanelsData().then(function(panels) {
            angular.forEach(panels, function(panel) {

                var entityConfig = panel.entityConfig,
                    rawItems = panel.rawItems,
                    columns = [],
                    identifierField = 'id';

                // Get identifier field, and build columns array (only field defined with `list(true)` in config file)
                angular.forEach(entityConfig.getFields(), function(field) {
                    if(!field.dashboard()) {
                        return;
                    }

                    if(field.identifier()) {
                        identifierField = field.getName();
                    }

                    columns.push({
                        field: field.getName(),
                        label: field.label()
                    });
                });

                self.panels[panel.entityName] = {
                    label: panel.entityConfig.label(),
                    entity: entityConfig,
                    columns: columns,
                    items: rawItems,
                    identifierField: identifierField,
                    options: {
                        grid : {
                            dimensions : [ columns.length, rawItems.length ]
                        }
                    }
                };
            });

        });
    };

    /**
     * Redirect to the entity edition form
     *
     * @param {String} entityName
     * @param {Number} identifier
     * @param {Entity} item
     */
    DashboardController.prototype.edit = function(entityName, identifier, item) {
        this.$location.path('/edit/' + entityName + '/' + item[identifier]);
    };

    DashboardController.prototype.destroy = function() {
        this.$scope = undefined;
        this.$location = undefined;
        this.PanelBuilder = undefined;
    };

    DashboardController.$inject = ['$scope', '$location', 'PanelBuilder'];

    return DashboardController;
});
<commit_msg>Fix dashboard links<commit_after>define([], function() {
    'use strict';

    /**
     *
     * @param {$scope}       $scope
     * @param {$location}    $location
     * @param {PanelBuilder} PanelBuilder
     * @constructor
     */
    function DashboardController($scope, $location, PanelBuilder) {
        this.$scope = $scope;
        this.$location = $location;
        this.PanelBuilder = PanelBuilder;

        this.$scope.edit = this.edit.bind(this);
        this.getPanels();

        $scope.$on('$destroy', this.destroy.bind(this));
    }

    /**
     * Retrieve all dashboard panels
     */
    DashboardController.prototype.getPanels = function() {
        var self = this;
        this.panels = {};

        this.PanelBuilder.getPanelsData().then(function(panels) {
            angular.forEach(panels, function(panel) {

                var entityConfig = panel.entityConfig,
                    rawItems = panel.rawItems,
                    columns = [],
                    identifierField = 'id';

                // Get identifier field, and build columns array (only field defined with `list(true)` in config file)
                angular.forEach(entityConfig.getFields(), function(field) {
                    if(!field.dashboard()) {
                        return;
                    }

                    if(field.identifier()) {
                        identifierField = field.getName();
                    }

                    columns.push({
                        field: field.getName(),
                        label: field.label()
                    });
                });

                self.panels[panel.entityName] = {
                    label: panel.entityConfig.label(),
                    entity: entityConfig,
                    columns: columns,
                    items: rawItems,
                    identifierField: identifierField,
                    options: {
                        grid : {
                            dimensions : [ columns.length, rawItems.length ]
                        }
                    }
                };
            });

        });
    };

    /**
     * Redirect to the entity edition form
     *
     * @param {Object} item
     * @param {Entity} entity
     */
    DashboardController.prototype.edit = function(item, entity) {
        this.$location.path('/edit/' + entity.getName() + '/' + item[entity.getIdentifier().getName()]);
    };

    DashboardController.prototype.destroy = function() {
        this.$scope = undefined;
        this.$location = undefined;
        this.PanelBuilder = undefined;
    };

    DashboardController.$inject = ['$scope', '$location', 'PanelBuilder'];

    return DashboardController;
});

{'fraction_non_alphanumeric': 0.11650664697193501, 'fraction_numerical': 0.0, 'mean_word_length': 1.4139928698752229, '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': '5563114', 'n_tokens_mistral': 1336, 'n_tokens_neox': 1259, 'n_words': 254}