<commit_before>'use strict';

var log = log4javascript.getLogger("clusterController-logger");
var $jq = jQuery.noConflict();

angular.module('uluwatuControllers').controller('clusterController', ['$scope', '$rootScope', '$filter', 'UluwatuCluster', 'GlobalStack', 'Cluster', 'GlobalStackInstance', '$interval', 'UserEvents', 'PeriscopeCluster', 'PlatformVariant',
    function($scope, $rootScope, $filter, UluwatuCluster, GlobalStack, Cluster, GlobalStackInstance, $interval, UserEvents, PeriscopeCluster, PlatformVariant) {

        $rootScope.ledStyles = {
            "REQUESTED": "state2-run-blink",
            "CREATE_IN_PROGRESS": "state2-run-blink",
            "AVAILABLE": "state5-run",
            "UPDATE_IN_PROGRESS": "state2-run-blink",
            "UPDATE_REQUESTED": "state1-ready-blink",
            "UPDATE_FAILED": "state3-stop",
            "CREATE_FAILED": "state3-stop",
            "ENABLE_SECURITY_FAILED": "state3-stop",
            "DELETE_IN_PROGRESS": "state0-stop-blink",
            "DELETE_FAILED": "state3-stop",
            "DELETE_COMPLETED": "state3-stop",
            "STOPPED": "state4-ready",
            "STOP_REQUESTED": "state1-ready-blink",
            "START_REQUESTED": "state1-ready-blink",
            "STOP_IN_PROGRESS": "state1-ready-blink",
            "START_IN_PROGRESS": "state1-ready-blink",
            "START_FAILED": "state3-stop",
            "STOP_FAILED": "state3-stop"
        }

        $rootScope.buttonStyles = {
            "REQUESTED": "fa-pause",
            "CREATE_IN_PROGRESS": "fa-pause",
            "AVAILABLE": "fa-stop",
            "UPDATE_IN_PROGRESS": "fa-pause",
            "UPDATE_REQUESTED": "fa-refresh",
            "UPDATE_FAILED": "fa-play",
            "CREATE_FAILED": "fa-play",
            "ENABLE_SECURITY_FAILED": "fa-play",
            "DELETE_IN_PROGRESS": "fa-pause",
            "DELETE_FAILED": "fa-play",
            "DELETE_COMPLETED": "fa-stop",
            "STOPPED": "fa-play",
            "STOP_REQUESTED": "fa-refresh",
            "START_REQUESTED": "fa-refresh",
            "STOP_IN_PROGRESS": "fa-refresh",
            "START_IN_PROGRESS": "fa-refresh",
            "START_FAILED": "fa-play",
            "STOP_FAILED": "fa-play"
        }

        $scope.configStrategies = [
            "ALWAYS_APPLY",
            "ALWAYS_APPLY_DONT_OVERRIDE_CUSTOM_VALUES",
            "NEVER_APPLY",
            "ONLY_STACK_DEFAULTS_APPLY"
        ]

        $rootScope.activeCluster = {};

        $scope.detailsShow = true;
        $scope.periscopeShow = false;
        $scope.metricsShow = false;
        $scope.showAdvancedOptionForm = false;
        $scope.newCredential = {};
        $scope.inherited = {
            forcedTermination: false
        };
        $scope.updateStatuses = [
                "REQUESTED", "CREATE_IN_PROGRESS", "UPDATE_IN_PROGRESS", "DELETE_IN_PROGRESS", "START_REQUESTED", "START_IN_PROGRESS"
            ],
            $scope.terminatableStatuses = [
                'CREATED', 'FAILED', 'UNREGISTERED', 'DECOMMISSIONED'
            ];
        getUluwatuClusters();
        initCluster();
        initWizard();

        function initWizard() {
            $scope.configureHostGroups = false;
            $scope.configureFailureAction = false;
            $scope.configureAmbariRepository = false;
            $scope.configureAmbariDatabase = false;
            $scope.configureSecurity = false;
            $scope.configureFileSystem = false;
            $scope.configureCluster = true;
            $scope.configureReview = false;
        }

        $scope.showWizardActualElement = function(element) {
            $scope.configureHostGroups = false;
            $scope.configureFailureAction = false;
            $scope.configureAmbariRepository = false;
            $scope.configureAmbariDatabase = false;
            $scope.configureSecurity = false;
            $scope.configureFileSystem = false;
            $scope.configureCluster = false;
            $scope.configureReview = false;

            if (element == 'configureHostGroups') {
                $scope.configureHostGroups = true;
            } else if (element == 'configureFailureAction') {
                $scope.configureFailureAction = true;
            } else if (element == 'configureAmbariRepository') {
                $scope.configureAmbariRepository = true;
            } else if (element == 'configureAmbariDatabase') {
                $scope.configureAmbariDatabase = true;
            } else if (element == 'configureSecurity') {
                $scope.configureSecurity = true;
            } else if (element == 'configureFileSystem') {
                $scope.configureFileSystem = true;
            } else if (element == 'configureCluster') {
                $scope.configureCluster = true;
            } else if (element == 'configureReview') {
                $scope.configureReview = true;
            }
        }

        $scope.showAdvancedOption = function() {
            if ($scope.showAdvancedOptionForm === false) {
                $scope.showAdvancedOptionForm = true;
                initWizard();
            } else {
                $scope.showAdvancedOptionForm = false;
                initWizard();
            }
        }

        $scope.selectedAdjustmentChange = function() {
            if ($scope.cluster.bestEffort === "BEST_EFFORT") {
                $scope.cluster.failurePolicy.adjustmentType = "BEST_EFFORT";
            } else {
                $scope.cluster.failurePolicy.adjustmentType = "EXACT";
                $scope.cluster.failurePolicy.threshold = 3;
            }
        }

        $scope.selectBlueprintreinstallChange = function() {
            var actualBp = $filter('filter')($rootScope.blueprints, {
                id: $rootScope.reinstallClusterObject.blueprintId
            }, true);
            var hostGroups = [];
            var index = 0;
            if ($rootScope.activeCluster.instanceGroups.length > 0) {
                $rootScope.activeCluster.instanceGroups.forEach(function(value) {
                    var tmpRecipes = $filter('filter')($rootScope.activeCluster.cluster.hostGroups, {
                        instanceGroupName: value.group
                    }, true)[0];
                    hostGroups.push({
                        name: actualBp[0].ambariBlueprint.host_groups[index].name,
                        instanceGroupName: value.group,
                        constraint: {
                            instanceGroupName: value.group,
                            hostCount: 1
                        },
                        recipeIds: tmpRecipes != undefined ? tmpRecipes.recipeIds : []
                    });
                    index++;
                });
            } else {
                actualBp[0].ambariBlueprint.host_groups.forEach(function(bpHostGroup) {
                    hostGroups.push({
                        name: bpHostGroup.name,
                        instanceGroupName: bpHostGroup.name,
                        constraint: {
                            constraintTemplateName: $rootScope.constraints[0].name,
                            hostCount: 1
                        },
                        recipeIds: []
                    });
                });
            }
            $rootScope.reinstallClusterObject.hostgroups = hostGroups;
            $rootScope.reinstallClusterObject.fullBp = actualBp[0];
        }

        $scope.selectedBlueprintChange = function() {
            if ($rootScope.activeCredential) {
                var tmpCloudPlatform = $rootScope.activeCredential.cloudPlatform;
                var templatesByProvider = $filter('filter')($rootScope.templates, {
                    cloudPlatform: tmpCloudPlatform
                }, true);
                var tmpTemplate = $filter('orderBy')(templatesByProvider, 'name', false)[0];
                var tmpTemplateId = null;
                if (tmpTemplate != null) {
                    tmpTemplateId = tmpTemplate.id;
                }
                var actualBp = $filter('filter')($rootScope.blueprints, {
                    id: $scope.cluster.blueprintId
                }, true);
                var instanceGroups = [];
                var hostGroups = [];
                var sgroupsActiveId = null;
                if ($rootScope.securitygroups && $rootScope.securitygroups.length != 0) {
                    var sgroups = $filter('orderBy')($rootScope.securitygroups, 'name', false);
                    sgroupsActiveId = sgroups[0].id;
                }
                actualBp[0].ambariBlueprint.host_groups.forEach(function(k) {
                    instanceGroups.push({
                        templateId: tmpTemplateId,
                        securityGroupId: sgroupsActiveId,
                        group: k.name,
                        nodeCount: 1,
                        type: "CORE"
                    });
                    hostGroups.push({
                        name: k.name,
                        constraint: {
                            instanceGroupName: k.name,
                            hostCount: 1
                        },
                        recipeIds: []
                    })
                });


                $scope.cluster.instanceGroups = instanceGroups;
                $scope.cluster.hostGroups = hostGroups;
                $scope.cluster.activeGroup = $filter('orderBy')($scope.cluster.instanceGroups, 'group', false)[0].group;
            } else {
                var constraintTemplates = $rootScope.constraints;
                var tmpConstraint = $filter('orderBy')(constraintTemplates, 'name', false)[0];
                var tmpConstraintName
                if (tmpConstraint != null) {
                    tmpConstraintName = tmpConstraint.name;
                }
                var actualBp = $filter('filter')($rootScope.blueprints, {
                    id: $scope.cluster.blueprintId
                }, true);
                var hostGroups = [];
                actualBp[0].ambariBlueprint.host_groups.forEach(function(k) {
                    hostGroups.push({
                        name: k.name,
                        constraint: {
                            constraintTemplateName: tmpConstraintName,
                            hostCount: 1
                        },
                        recipeIds: []
                    })
                });
                $scope.cluster.hostGroups = hostGroups;
                $scope.cluster.activeGroup = $scope.cluster.hostGroups[0].name;
            }
        }

        $scope.isUndefined = function(variable) {
            return angular.isUndefined(variable) || variable === null;
        }

        $scope.changeRecipeRun = function(recipeId, hostGroupName, model) {
            var recipe = $filter('filter')($rootScope.recipes, {
                id: recipeId
            }, true)[0];
            if (model === true) {
                $filter('filter')($scope.cluster.hostGroups, {
                    name: hostGroupName
                }, true)[0].recipeIds.push(recipe.id);
            } else {
                var recipeList = $filter('filter')($scope.cluster.hostGroups, {
                    name: hostGroupName
                }, true)[0];
                var index = recipeList.recipeIds.indexOf(recipe.id);
                $filter('filter')($scope.cluster.hostGroups, {
                    name: hostGroupName
                }, true)[0].recipeIds.splice(index, 1);
            }
        }

        $scope.isVisibleServiceValue = function(element) {
            return element.indexOf("null") !== 0
        }

        $scope.isEmptyObj = function(obj) {
            var prop;
            for (prop in obj) {
                if (obj.hasOwnProperty(prop)) {
                    return false
                }
            }
            return true
        }

        $scope.toggleAmbariStackDetailsVerify = function() {
            if ($scope.isUndefined($scope.cluster.ambariStackDetails)) {
                $scope.cluster.ambariStackDetails = {};
            }
            if ($scope.isUndefined($scope.cluster.ambariStackDetails.verify) || $scope.cluster.ambariStackDetails.verify == false) {
                $scope.cluster.ambariStackDetails.verify = true;
            } else {
                delete $scope.cluster.ambariStackDetails.verify;
            }
        }

        $scope.createCluster = function() {
            var blueprint = $filter('filter')($rootScope.blueprints, {
                id: $scope.cluster.blueprintId
            }, true)[0];
            var tmpNodeCount = 0;
            angular.forEach($scope.cluster.hostGroups, function(hg) {
                if ($scope.cluster.instanceGroups) {
                    angular.forEach($scope.cluster.instanceGroups, function(ig) {
                        if (ig.group === hg.name) {
                            hg.constraint.hostCount = ig.nodeCount;
                        }
                    });
                }
                tmpNodeCount += hg.nodeCount;
            });

            if (blueprint.hostGroupCount > tmpNodeCount) {
                $scope.showErrorMessage($rootScope.msg.hostgroup_invalid_node_count);
                return;
            }
            if (!$scope.isUndefined($scope.cluster.ambariStackDetails)) {
                for (var item in $scope.cluster.ambariStackDetails) {
                    if ($scope.cluster.ambariStackDetails[item] === "" || $scope.cluster.ambariStackDetails[item] === undefined) {
                        delete $scope.cluster.ambariStackDetails[item];
                    }
                }
            }
            if (!$scope.isUndefined($scope.cluster.fileSystem) && $scope.cluster.fileSystem.type == "LOCAL") {
                delete $scope.cluster.fileSystem;
            } else if (!$scope.isUndefined($scope.cluster.fileSystem) && $scope.cluster.fileSystem.type != "LOCAL") {<commit_msg>CLOUD-65235 fixed javascript test for nodecount<commit_after>'use strict';

var log = log4javascript.getLogger("clusterController-logger");
var $jq = jQuery.noConflict();

angular.module('uluwatuControllers').controller('clusterController', ['$scope', '$rootScope', '$filter', 'UluwatuCluster', 'GlobalStack', 'Cluster', 'GlobalStackInstance', '$interval', 'UserEvents', 'PeriscopeCluster', 'PlatformVariant',
    function($scope, $rootScope, $filter, UluwatuCluster, GlobalStack, Cluster, GlobalStackInstance, $interval, UserEvents, PeriscopeCluster, PlatformVariant) {

        $rootScope.ledStyles = {
            "REQUESTED": "state2-run-blink",
            "CREATE_IN_PROGRESS": "state2-run-blink",
            "AVAILABLE": "state5-run",
            "UPDATE_IN_PROGRESS": "state2-run-blink",
            "UPDATE_REQUESTED": "state1-ready-blink",
            "UPDATE_FAILED": "state3-stop",
            "CREATE_FAILED": "state3-stop",
            "ENABLE_SECURITY_FAILED": "state3-stop",
            "DELETE_IN_PROGRESS": "state0-stop-blink",
            "DELETE_FAILED": "state3-stop",
            "DELETE_COMPLETED": "state3-stop",
            "STOPPED": "state4-ready",
            "STOP_REQUESTED": "state1-ready-blink",
            "START_REQUESTED": "state1-ready-blink",
            "STOP_IN_PROGRESS": "state1-ready-blink",
            "START_IN_PROGRESS": "state1-ready-blink",
            "START_FAILED": "state3-stop",
            "STOP_FAILED": "state3-stop"
        }

        $rootScope.buttonStyles = {
            "REQUESTED": "fa-pause",
            "CREATE_IN_PROGRESS": "fa-pause",
            "AVAILABLE": "fa-stop",
            "UPDATE_IN_PROGRESS": "fa-pause",
            "UPDATE_REQUESTED": "fa-refresh",
            "UPDATE_FAILED": "fa-play",
            "CREATE_FAILED": "fa-play",
            "ENABLE_SECURITY_FAILED": "fa-play",
            "DELETE_IN_PROGRESS": "fa-pause",
            "DELETE_FAILED": "fa-play",
            "DELETE_COMPLETED": "fa-stop",
            "STOPPED": "fa-play",
            "STOP_REQUESTED": "fa-refresh",
            "START_REQUESTED": "fa-refresh",
            "STOP_IN_PROGRESS": "fa-refresh",
            "START_IN_PROGRESS": "fa-refresh",
            "START_FAILED": "fa-play",
            "STOP_FAILED": "fa-play"
        }

        $scope.configStrategies = [
            "ALWAYS_APPLY",
            "ALWAYS_APPLY_DONT_OVERRIDE_CUSTOM_VALUES",
            "NEVER_APPLY",
            "ONLY_STACK_DEFAULTS_APPLY"
        ]

        $rootScope.activeCluster = {};

        $scope.detailsShow = true;
        $scope.periscopeShow = false;
        $scope.metricsShow = false;
        $scope.showAdvancedOptionForm = false;
        $scope.newCredential = {};
        $scope.inherited = {
            forcedTermination: false
        };
        $scope.updateStatuses = [
                "REQUESTED", "CREATE_IN_PROGRESS", "UPDATE_IN_PROGRESS", "DELETE_IN_PROGRESS", "START_REQUESTED", "START_IN_PROGRESS"
            ],
            $scope.terminatableStatuses = [
                'CREATED', 'FAILED', 'UNREGISTERED', 'DECOMMISSIONED'
            ];
        getUluwatuClusters();
        initCluster();
        initWizard();

        function initWizard() {
            $scope.configureHostGroups = false;
            $scope.configureFailureAction = false;
            $scope.configureAmbariRepository = false;
            $scope.configureAmbariDatabase = false;
            $scope.configureSecurity = false;
            $scope.configureFileSystem = false;
            $scope.configureCluster = true;
            $scope.configureReview = false;
        }

        $scope.showWizardActualElement = function(element) {
            $scope.configureHostGroups = false;
            $scope.configureFailureAction = false;
            $scope.configureAmbariRepository = false;
            $scope.configureAmbariDatabase = false;
            $scope.configureSecurity = false;
            $scope.configureFileSystem = false;
            $scope.configureCluster = false;
            $scope.configureReview = false;

            if (element == 'configureHostGroups') {
                $scope.configureHostGroups = true;
            } else if (element == 'configureFailureAction') {
                $scope.configureFailureAction = true;
            } else if (element == 'configureAmbariRepository') {
                $scope.configureAmbariRepository = true;
            } else if (element == 'configureAmbariDatabase') {
                $scope.configureAmbariDatabase = true;
            } else if (element == 'configureSecurity') {
                $scope.configureSecurity = true;
            } else if (element == 'configureFileSystem') {
                $scope.configureFileSystem = true;
            } else if (element == 'configureCluster') {
                $scope.configureCluster = true;
            } else if (element == 'configureReview') {
                $scope.configureReview = true;
            }
        }

        $scope.showAdvancedOption = function() {
            if ($scope.showAdvancedOptionForm === false) {
                $scope.showAdvancedOptionForm = true;
                initWizard();
            } else {
                $scope.showAdvancedOptionForm = false;
                initWizard();
            }
        }

        $scope.selectedAdjustmentChange = function() {
            if ($scope.cluster.bestEffort === "BEST_EFFORT") {
                $scope.cluster.failurePolicy.adjustmentType = "BEST_EFFORT";
            } else {
                $scope.cluster.failurePolicy.adjustmentType = "EXACT";
                $scope.cluster.failurePolicy.threshold = 3;
            }
        }

        $scope.selectBlueprintreinstallChange = function() {
            var actualBp = $filter('filter')($rootScope.blueprints, {
                id: $rootScope.reinstallClusterObject.blueprintId
            }, true);
            var hostGroups = [];
            var index = 0;
            if ($rootScope.activeCluster.instanceGroups.length > 0) {
                $rootScope.activeCluster.instanceGroups.forEach(function(value) {
                    var tmpRecipes = $filter('filter')($rootScope.activeCluster.cluster.hostGroups, {
                        instanceGroupName: value.group
                    }, true)[0];
                    hostGroups.push({
                        name: actualBp[0].ambariBlueprint.host_groups[index].name,
                        instanceGroupName: value.group,
                        constraint: {
                            instanceGroupName: value.group,
                            hostCount: 1
                        },
                        recipeIds: tmpRecipes != undefined ? tmpRecipes.recipeIds : []
                    });
                    index++;
                });
            } else {
                actualBp[0].ambariBlueprint.host_groups.forEach(function(bpHostGroup) {
                    hostGroups.push({
                        name: bpHostGroup.name,
                        instanceGroupName: bpHostGroup.name,
                        constraint: {
                            constraintTemplateName: $rootScope.constraints[0].name,
                            hostCount: 1
                        },
                        recipeIds: []
                    });
                });
            }
            $rootScope.reinstallClusterObject.hostgroups = hostGroups;
            $rootScope.reinstallClusterObject.fullBp = actualBp[0];
        }

        $scope.selectedBlueprintChange = function() {
            if ($rootScope.activeCredential) {
                var tmpCloudPlatform = $rootScope.activeCredential.cloudPlatform;
                var templatesByProvider = $filter('filter')($rootScope.templates, {
                    cloudPlatform: tmpCloudPlatform
                }, true);
                var tmpTemplate = $filter('orderBy')(templatesByProvider, 'name', false)[0];
                var tmpTemplateId = null;
                if (tmpTemplate != null) {
                    tmpTemplateId = tmpTemplate.id;
                }
                var actualBp = $filter('filter')($rootScope.blueprints, {
                    id: $scope.cluster.blueprintId
                }, true);
                var instanceGroups = [];
                var hostGroups = [];
                var sgroupsActiveId = null;
                if ($rootScope.securitygroups && $rootScope.securitygroups.length != 0) {
                    var sgroups = $filter('orderBy')($rootScope.securitygroups, 'name', false);
                    sgroupsActiveId = sgroups[0].id;
                }
                actualBp[0].ambariBlueprint.host_groups.forEach(function(k) {
                    instanceGroups.push({
                        templateId: tmpTemplateId,
                        securityGroupId: sgroupsActiveId,
                        group: k.name,
                        nodeCount: 1,
                        type: "CORE"
                    });
                    hostGroups.push({
                        name: k.name,
                        constraint: {
                            instanceGroupName: k.name,
                            hostCount: 1
                        },
                        recipeIds: []
                    })
                });


                $scope.cluster.instanceGroups = instanceGroups;
                $scope.cluster.hostGroups = hostGroups;
                $scope.cluster.activeGroup = $filter('orderBy')($scope.cluster.instanceGroups, 'group', false)[0].group;
            } else {
                var constraintTemplates = $rootScope.constraints;
                var tmpConstraint = $filter('orderBy')(constraintTemplates, 'name', false)[0];
                var tmpConstraintName
                if (tmpConstraint != null) {
                    tmpConstraintName = tmpConstraint.name;
                }
                var actualBp = $filter('filter')($rootScope.blueprints, {
                    id: $scope.cluster.blueprintId
                }, true);
                var hostGroups = [];
                actualBp[0].ambariBlueprint.host_groups.forEach(function(k) {
                    hostGroups.push({
                        name: k.name,
                        constraint: {
                            constraintTemplateName: tmpConstraintName,
                            hostCount: 1
                        },
                        recipeIds: []
                    })
                });
                $scope.cluster.hostGroups = hostGroups;
                $scope.cluster.activeGroup = $scope.cluster.hostGroups[0].name;
            }
        }

        $scope.isUndefined = function(variable) {
            return angular.isUndefined(variable) || variable === null;
        }

        $scope.changeRecipeRun = function(recipeId, hostGroupName, model) {
            var recipe = $filter('filter')($rootScope.recipes, {
                id: recipeId
            }, true)[0];
            if (model === true) {
                $filter('filter')($scope.cluster.hostGroups, {
                    name: hostGroupName
                }, true)[0].recipeIds.push(recipe.id);
            } else {
                var recipeList = $filter('filter')($scope.cluster.hostGroups, {
                    name: hostGroupName
                }, true)[0];
                var index = recipeList.recipeIds.indexOf(recipe.id);
                $filter('filter')($scope.cluster.hostGroups, {
                    name: hostGroupName
                }, true)[0].recipeIds.splice(index, 1);
            }
        }

        $scope.isVisibleServiceValue = function(element) {
            return element.indexOf("null") !== 0
        }

        $scope.isEmptyObj = function(obj) {
            var prop;
            for (prop in obj) {
                if (obj.hasOwnProperty(prop)) {
                    return false
                }
            }
            return true
        }

        $scope.toggleAmbariStackDetailsVerify = function() {
            if ($scope.isUndefined($scope.cluster.ambariStackDetails)) {
                $scope.cluster.ambariStackDetails = {};
            }
            if ($scope.isUndefined($scope.cluster.ambariStackDetails.verify) || $scope.cluster.ambariStackDetails.verify == false) {
                $scope.cluster.ambariStackDetails.verify = true;
            } else {
                delete $scope.cluster.ambariStackDetails.verify;
            }
        }

        $scope.createCluster = function() {
            var blueprint = $filter('filter')($rootScope.blueprints, {
                id: $scope.cluster.blueprintId
            }, true)[0];
            var tmpNodeCount = 0;
            angular.forEach($scope.cluster.hostGroups, function(hg) {
                if ($scope.cluster.instanceGroups) {
                    angular.forEach($scope.cluster.instanceGroups, function(ig) {
                        if (ig.group === hg.name) {
                            hg.constraint.hostCount = ig.nodeCount;
                        }
                    });
                }
                tmpNodeCount += hg.constraint.hostCount;
            });

            if (blueprint.hostGroupCount > tmpNodeCount) {
                $scope.showErrorMessage($rootScope.msg.hostgroup_invalid_node_count);
                return;
            }
            if (!$scope.isUndefined($scope.cluster.ambariStackDetails)) {
                for (var item in $scope.cluster.ambariStackDetails) {
                    if ($scope.cluster.ambariStackDetails[item] === "" || $scope.cluster.ambariStackDetails[item] === undefined) {
                        delete $scope.cluster.ambariStackDetails[item];
                    }
                }
            }
            if (!$scope.isUndefined($scope.cluster.fileSystem) && $scope.cluster.fileSystem.type == "LOCAL") {
                delete $scope.cluster.fileSystem;
            } else if (!$scope.isUndefined($scope.cluster.fileSystem) && $scope.cluster.fileSystem.type != "LOCAL") {
{'fraction_non_alphanumeric': 0.11231456657730116, 'fraction_numerical': 0.003610366398570152, 'mean_word_length': 1.5516234950747902, 'pattern_counts': {'":': 72, '<': 3, '<?xml version=': 0, '>': 7, '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': '670527', 'n_tokens_mistral': 7286, 'n_tokens_neox': 6995, 'n_words': 1087}