<commit_before>define(['uiRouter', 'angularTable', 'angularDragDrop', 'angularTouch', 'ngSpinner', 'angularAnimate'], function() {
    var wizardModule = angular.module('compass.wizard', [
        'ui.router',
        'ui.bootstrap',
        'ngTable',
        //'compass.charts',
        //'compass.findservers',
        'ngDragDrop',
        'ngTouch',
        'angularSpinner',
        'ngAnimate'
    ]);

    function isEmpty(obj) {
        for (var prop in obj) {
            if (obj.hasOwnProperty(prop))
                return false;
        }
        return true;
    }

    wizardModule.config(function config($stateProvider) {
        $stateProvider
            .state('wizard', {
                url: '/wizard/{id}?config',
                controller: 'wizardCtrl',
                templateUrl: 'src/app/wizard/wizard.tpl.html',
                authenticate: true,
                resolve: {
                    clusterData: function($stateParams, $q, dataService) {
                        var clusterId = $stateParams.id;
                        var deferred = $q.defer();
                        dataService.getClusterById(clusterId).success(function(data) {
                            deferred.resolve(data);
                        });
                        return deferred.promise;
                    },
                    machinesHostsData: function($q, dataService, clusterData) {
                        var deferred = $q.defer();
                        dataService.getAllMachineHosts().success(function(data) {
                            deferred.resolve(data);
                        });
                        return deferred.promise;
                    },
                    wizardStepsData: function($q, dataService) { // get the create-cluster-wizard steps
                        var deferred = $q.defer();
                        dataService.getWizardSteps().success(function(data) {
                            deferred.resolve(data);
                        });
                        return deferred.promise;
                    },
                    clusterConfigData: function($stateParams, $q, dataService) {
                        var clusterId = $stateParams.id;
                        var deferred = $q.defer();
                        dataService.getClusterConfig(clusterId).success(function(data) {
                            deferred.resolve(data);
                        });
                        return deferred.promise;
                    },
                    adaptersData: function($q, dataService) {
                        var deferred = $q.defer();
                        dataService.getAdapters().success(function(data) {
                            deferred.resolve(data);
                        });
                        return deferred.promise;
                    }
                }
            });
    });

    wizardModule.controller('wizardCtrl', function($scope, dataService, wizardFactory, $stateParams, $state, $modal, clusterData, adaptersData, machinesHostsData, wizardStepsData, clusterConfigData) {
        $scope.loading = false;
        $scope.clusterId = $stateParams.id;
        $scope.cluster = clusterData;
        wizardFactory.setClusterInfo($scope.cluster);
        wizardFactory.setAllMachinesHost(machinesHostsData);

        $scope.adapters = adaptersData;

        $scope.currentAdapterName = $scope.cluster.adapter_name;
        $scope.currentFlavor = $scope.cluster.flavor.name;

        // angular.forEach($scope.adapters, function(adapter) {
        //     if (adapter.id == $scope.cluster.adapter_id) {
        //         // console.log("hi");
        //         // console.log(adapter);
        //         // console.log($scope.cluster.adapter_name);
        //         $scope.currentAdapterName = adapter.name;
        //         // if(adapter.flavors!=null)
        //         $scope.currentFlavor = adapter.flavors.name;
        //     }
        // });

        // $scope.currentAdapterName = $scope.cluster.adapter_name;
        // $scope.currentFlavor = $scope.cluster.flavor.name;

        // get pre-config data for wizard and set wizard steps based on different adapters
        var oldConfig = clusterConfigData;

        $scope.steps = [];
        if ($stateParams.config == "true") {
            dataService.getWizardPreConfig().success(function(data) {
                var preConfigData = {};
                switch ($scope.currentAdapterName) {<commit_msg>fixed os_only flavor bug<commit_after>define(['uiRouter', 'angularTable', 'angularDragDrop', 'angularTouch', 'ngSpinner', 'angularAnimate'], function() {
    var wizardModule = angular.module('compass.wizard', [
        'ui.router',
        'ui.bootstrap',
        'ngTable',
        //'compass.charts',
        //'compass.findservers',
        'ngDragDrop',
        'ngTouch',
        'angularSpinner',
        'ngAnimate'
    ]);

    function isEmpty(obj) {
        for (var prop in obj) {
            if (obj.hasOwnProperty(prop))
                return false;
        }
        return true;
    }

    wizardModule.config(function config($stateProvider) {
        $stateProvider
            .state('wizard', {
                url: '/wizard/{id}?config',
                controller: 'wizardCtrl',
                templateUrl: 'src/app/wizard/wizard.tpl.html',
                authenticate: true,
                resolve: {
                    clusterData: function($stateParams, $q, dataService) {
                        var clusterId = $stateParams.id;
                        var deferred = $q.defer();
                        dataService.getClusterById(clusterId).success(function(data) {
                            deferred.resolve(data);
                        });
                        return deferred.promise;
                    },
                    machinesHostsData: function($q, dataService, clusterData) {
                        var deferred = $q.defer();
                        dataService.getAllMachineHosts().success(function(data) {
                            deferred.resolve(data);
                        });
                        return deferred.promise;
                    },
                    wizardStepsData: function($q, dataService) { // get the create-cluster-wizard steps
                        var deferred = $q.defer();
                        dataService.getWizardSteps().success(function(data) {
                            deferred.resolve(data);
                        });
                        return deferred.promise;
                    },
                    clusterConfigData: function($stateParams, $q, dataService) {
                        var clusterId = $stateParams.id;
                        var deferred = $q.defer();
                        dataService.getClusterConfig(clusterId).success(function(data) {
                            deferred.resolve(data);
                        });
                        return deferred.promise;
                    },
                    adaptersData: function($q, dataService) {
                        var deferred = $q.defer();
                        dataService.getAdapters().success(function(data) {
                            deferred.resolve(data);
                        });
                        return deferred.promise;
                    }
                }
            });
    });

    wizardModule.controller('wizardCtrl', function($scope, dataService, wizardFactory, $stateParams, $state, $modal, clusterData, adaptersData, machinesHostsData, wizardStepsData, clusterConfigData) {
        $scope.loading = false;
        $scope.clusterId = $stateParams.id;
        $scope.cluster = clusterData;
        wizardFactory.setClusterInfo($scope.cluster);
        wizardFactory.setAllMachinesHost(machinesHostsData);

        $scope.adapters = adaptersData;

        $scope.currentAdapterName = $scope.cluster.adapter_name;
        if($scope.currentAdapterName != "os_only"){
                $scope.currentFlavor = $scope.cluster.flavor.name;
        }
        // angular.forEach($scope.adapters, function(adapter) {
        //     if (adapter.id == $scope.cluster.adapter_id) {
        //         // console.log("hi");
        //         // console.log(adapter);
        //         // console.log($scope.cluster.adapter_name);
        //         $scope.currentAdapterName = adapter.name;
        //         // if(adapter.flavors!=null)
        //         $scope.currentFlavor = adapter.flavors.name;
        //     }
        // });

        // $scope.currentAdapterName = $scope.cluster.adapter_name;
        // $scope.currentFlavor = $scope.cluster.flavor.name;

        // get pre-config data for wizard and set wizard steps based on different adapters
        var oldConfig = clusterConfigData;

        $scope.steps = [];
        if ($stateParams.config == "true") {
            dataService.getWizardPreConfig().success(function(data) {
                var preConfigData = {};
                switch ($scope.currentAdapterName) {
{'fraction_non_alphanumeric': 0.1133244798583444, 'fraction_numerical': 0.0, 'mean_word_length': 1.4371628910463863, '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': '3192619', 'n_tokens_mistral': 2307, 'n_tokens_neox': 2159, 'n_words': 357}