<commit_before>/*
 *  Waltz
 * Copyright (c) <NAME>. All rights reserved.
 * The use and distribution terms for this software are covered by the
 * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
 * which can be found in the file epl-v10.html at the root of this distribution.
 * By using this software in any fashion, you are agreeing to be bound by
 * the terms of this license.
 * You must not remove this notice, or any other, from this software.
 *
 */

import _ from "lodash";
import {
    lifecyclePhaseDisplayNames,
    applicationKindDisplayNames,
    investmentRatingNames
} from "../../common/services/display_names";


const BINDINGS = {
    applications: '=',
    csvName: '@?'

};


function controller(uiGridConstants, $scope, $animate) {

    const vm = this;

    const csvName = angular.isDefined(vm.csvName) ? vm.csvName : 'applications.csv';
    vm.selectedApp = undefined;

    vm.gridOptions = {
        enableGridMenu: true,
        exporterCsvFilename: csvName,
        exporterMenuPdf: false,
        enableSorting: true,
        enableFiltering: true,
        enableHorizontalScrollbar: uiGridConstants.scrollbars.NEVER,
        onRegisterApi: (gridApi) => {
            $animate.enabled(gridApi.grid.element, false);
        },
        columnDefs: [
            {
                field: 'info',
                displayName: '',
                enableSorting: false,
                enableColumnMenu: false,
                enableFiltering: false,
                width: 40,
                cellTemplate: '<div class="ui-grid-cell-contents text-center"> <a class="clickable" ng-click="grid.appScope.ctrl.onAppSelect(row.entity)"> <waltz-icon name="info-circle" size="lg"></waltz-icon></a></div>'
            },
            {
                field: 'name',
                cellTemplate: '<div class="ui-grid-cell-contents">\n    <a ng-if="row.entity[\'management\'] == \'IT\'"\n       ui-sref="main.app.view ({ id: row.entity[\'id\'] })" ng-bind="COL_FIELD">\n    </a>\n    <span ng-if="row.entity[\'management\'] == \'End User\'" ng-bind="COL_FIELD"></span>\n</div>'
            },
            {
                field: 'assetCode',
                cellTemplatae: '<div class="ui-grid-cell-contents"><span ng-bind="COL_FIELD"></span></div>',
                filter: {
                    type: uiGridConstants.filter.SELECT
                }
            },
            {
                field: 'kind',
                cellTemplate: '<div class="ui-grid-cell-contents"><span ng-bind="COL_FIELD | toDisplayName:\'applicationKind\'"></span></div>',
                filter: {
                    type: uiGridConstants.filter.SELECT,
                    selectOptions: _.map(applicationKindDisplayNames, (label, value) => ({ label, value }))<commit_msg>Application table showing incorrect filter type for asset code column<commit_after>/*
 *  Waltz
 * Copyright (c) <NAME>. All rights reserved.
 * The use and distribution terms for this software are covered by the
 * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
 * which can be found in the file epl-v10.html at the root of this distribution.
 * By using this software in any fashion, you are agreeing to be bound by
 * the terms of this license.
 * You must not remove this notice, or any other, from this software.
 *
 */

import _ from "lodash";
import {
    lifecyclePhaseDisplayNames,
    applicationKindDisplayNames,
    investmentRatingNames
} from "../../common/services/display_names";


const BINDINGS = {
    applications: '=',
    csvName: '@?'

};


function controller(uiGridConstants, $scope, $animate) {

    const vm = this;

    const csvName = angular.isDefined(vm.csvName) ? vm.csvName : 'applications.csv';
    vm.selectedApp = undefined;

    vm.gridOptions = {
        enableGridMenu: true,
        exporterCsvFilename: csvName,
        exporterMenuPdf: false,
        enableSorting: true,
        enableFiltering: true,
        enableHorizontalScrollbar: uiGridConstants.scrollbars.NEVER,
        onRegisterApi: (gridApi) => {
            $animate.enabled(gridApi.grid.element, false);
        },
        columnDefs: [
            {
                field: 'info',
                displayName: '',
                enableSorting: false,
                enableColumnMenu: false,
                enableFiltering: false,
                width: 40,
                cellTemplate: '<div class="ui-grid-cell-contents text-center"> <a class="clickable" ng-click="grid.appScope.ctrl.onAppSelect(row.entity)"> <waltz-icon name="info-circle" size="lg"></waltz-icon></a></div>'
            },
            {
                field: 'name',
                cellTemplate: '<div class="ui-grid-cell-contents">\n    <a ng-if="row.entity[\'management\'] == \'IT\'"\n       ui-sref="main.app.view ({ id: row.entity[\'id\'] })" ng-bind="COL_FIELD">\n    </a>\n    <span ng-if="row.entity[\'management\'] == \'End User\'" ng-bind="COL_FIELD"></span>\n</div>'
            },
            {
                field: 'assetCode',
                cellTemplatae: '<div class="ui-grid-cell-contents"><span ng-bind="COL_FIELD"></span></div>'
            },
            {
                field: 'kind',
                cellTemplate: '<div class="ui-grid-cell-contents"><span ng-bind="COL_FIELD | toDisplayName:\'applicationKind\'"></span></div>',
                filter: {
                    type: uiGridConstants.filter.SELECT,
                    selectOptions: _.map(applicationKindDisplayNames, (label, value) => ({ label, value }))
{'fraction_non_alphanumeric': 0.13838402015475976, 'fraction_numerical': 0.002879251394637394, 'mean_word_length': 2.233275159976731, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 49, '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': '4148690', 'n_tokens_mistral': 1622, 'n_tokens_neox': 1559, 'n_words': 364}