<commit_before>// VRE Server Create controller
App.VreserverCreateController = Ember.Controller.extend({
	needs : ['userWelcome', 'vreserverManagement'],
	// populated with VRE image component info from controllers.application
	vreImages : [],
	/*
	 * Static Data
	 */
	// client-side only, eventually add data structure to the backend
	vreCategoryLabels : ['Portal/Cms','Wiki','Project Management','Digital Repository'],
	vreCategoryData : {
	    'Portal/Cms' : ['Drupal-7.3.7'],
	    'Wiki' : ['Mediawiki-1.2.4'],
	    'Project Management': ['Redmine-3.0.4'],
	    'Digital Repository': ['DSpace-5.3']
	},
	// client-side only, eventually move to backend
	vreFlavorLabels : ['Small', 'Medium', 'Large'],
	vreFlavorData : [
	   {cpu:2,ram:2048,disk:5}, //Small
	   {cpu:2,ram:4096,disk:10},//Medium
	   {cpu:4,ram:6144,disk:20} //Large
	],
	vreResourceMin : {
	    'DSpace-5.3':{ram:2048},
	    'Drupal-7.3.7':{ram:1024},
        'Mediawiki-1.2.4':{ram:1024},
        'Redmine-3.0.4':{ram:1024}
	},
	vreImageExtraProperties : {
	    // controller_show_field : [image,...] / '*' = all images
	    'show_admin_pass_input' : ['*'],
	    'show_admin_email_input': ['DSpace-5.3']
	},
	vreImageExtraFields : {
	   // image : [extra_field,...] / '*' = all images
	   '*' : ['admin_password'],
	   'DSpace-5.3' : ['admin_email']
	},
	reverse_storage_lookup : {'ext_vlmc': 'Archipelago','drbd': 'Standard'},
	// mapping of uservreserver model properties to controller computed properties
	model_to_controller_map : {
        project_name: 'selected_project_name', 
        server_name: 'vre_server_name',
        cpu: 'selected_cpu_value', 
        ram: 'selected_ram_value',
        disk: 'selected_disk_value', 
        disk_template: 'selected_storage_description',
        os_image: 'selected_image',
        ssh_key_selection: 'selected_sshkey',
        admin_password: '<PASSWORD>',
        admin_email: 'vre_admin_email'
	},
	/*
	 * Project selection:
	 */
	// anything not available without project 
	// should observe this or a chained observer
	boolean_no_project : function(){
	    return Ember.isEmpty(this.get('selected_project_id'));
	}.property('selected_project_id'),
	selected_project_description : function(){
	    return !this.get('boolean_no_project') ? this.get('content').objectAt(this.get('selected_project_id')-1).get('project_name_clean') : '';
	}.property('selected_project_id'),
	selected_project_name : function(){
	    return !this.get('boolean_no_project') ? this.get('content').objectAt(this.get('selected_project_id')-1).get('project_name') : '';
	}.property('selected_project_id'),
	// vm  get the last item of the array of available VMs
    selected_project_available_vm : function(){
        return !this.get('boolean_no_project') ? Number(this.get('content').objectAt(this.get('selected_project_id')-1).get('vms_av').get("lastObject")) || 0 : 0;
    }.property('selected_project_id'),
    // floating ip
    selected_project_available_ip : function(){
        return !this.get('boolean_no_project') ? Number(this.get('content').objectAt(this.get('selected_project_id')-1).get('floatip_av')) : 0;
    }.property('selected_project_id'),
    selected_project_changed : function(){
        this.send('clear_cached');
    }.observes('selected_project_id'),
    /*
     * VRE Categories
     */
    // wrap categories to a project selection check
    vre_categories : function(){
        return !this.get('boolean_no_project') ? this.get('vreCategoryLabels') : [];
    }.property('selected_project_id'),
    selected_category_static : null, // need this one-way bound property to workaround ember #select bug
    selected_category : function(key,value){
        if (arguments.length>1){// setter
            this.set('selected_category_id_static',value);
            this.set('selected_image',null);
        }
        return this.get('selected_category_id_static'); // getter
    }.property('selected_category_id_static','selected_project_id'),
    /*
     * VRE Images
     */
	selected_project_images : function(){
	    //TODO:  model data, not used at moment until we implement dynamic filtering on image category
	    var arr_images = !this.get('boolean_no_project') ? this.get('content').objectAt(this.get('selected_project_id')-1).get('vre_choices') : [];
	    // return based on static data defined at top of controller, verify with model data
	    var arr_filtered_by_category = !Ember.isEmpty(this.get('selected_category')) ? this.get('vreCategoryData')[this.get('selected_category')] : [];
	    var arr_verified = arr_filtered_by_category.filter(function(item,index,self){// remove any statics not on model
	        return arr_images.contains(item) ? true : false;
	    });<commit_msg>Fixed typo in vreserver create controller<commit_after>// VRE Server Create controller
App.VreserverCreateController = Ember.Controller.extend({
	needs : ['userWelcome', 'vreserverManagement'],
	// populated with VRE image component info from controllers.application
	vreImages : [],
	/*
	 * Static Data
	 */
	// client-side only, eventually add data structure to the backend
	vreCategoryLabels : ['Portal/Cms','Wiki','Project Management','Digital Repository'],
	vreCategoryData : {
	    'Portal/Cms' : ['Drupal-7.3.7'],
	    'Wiki' : ['Mediawiki-1.2.4'],
	    'Project Management': ['Redmine-3.0.4'],
	    'Digital Repository': ['DSpace-5.3']
	},
	// client-side only, eventually move to backend
	vreFlavorLabels : ['Small', 'Medium', 'Large'],
	vreFlavorData : [
	   {cpu:2,ram:2048,disk:5}, //Small
	   {cpu:2,ram:4096,disk:10},//Medium
	   {cpu:4,ram:6144,disk:20} //Large
	],
	vreResourceMin : {
	    'DSpace-5.3':{ram:2048},
	    'Drupal-7.3.7':{ram:1024},
        'Mediawiki-1.2.4':{ram:1024},
        'Redmine-3.0.4':{ram:1024}
	},
	vreImageExtraProperties : {
	    // controller_show_field : [image,...] / '*' = all images
	    'show_admin_pass_input' : ['*'],
	    'show_admin_email_input': ['DSpace-5.3']
	},
	vreImageExtraFields : {
	   // image : [extra_field,...] / '*' = all images
	   '*' : ['admin_password'],
	   'DSpace-5.3' : ['admin_email']
	},
	reverse_storage_lookup : {'ext_vlmc': 'Archipelago','drbd': 'Standard'},
	// mapping of uservreserver model properties to controller computed properties
	model_to_controller_map : {
        project_name: 'selected_project_name', 
        server_name: 'vre_server_name',
        cpu: 'selected_cpu_value', 
        ram: 'selected_ram_value',
        disk: 'selected_disk_value', 
        disk_template: 'selected_storage_description',
        os_image: 'selected_image',
        ssh_key_selection: 'selected_sshkey',
        admin_password: '<PASSWORD>',
        admin_email: 'vre_admin_email'
	},
	/*
	 * Project selection:
	 */
	// anything not available without project 
	// should observe this or a chained observer
	boolean_no_project : function(){
	    return Ember.isEmpty(this.get('selected_project_id'));
	}.property('selected_project_id'),
	selected_project_description : function(){
	    return !this.get('boolean_no_project') ? this.get('content').objectAt(this.get('selected_project_id')-1).get('project_name_clean') : '';
	}.property('selected_project_id'),
	selected_project_name : function(){
	    return !this.get('boolean_no_project') ? this.get('content').objectAt(this.get('selected_project_id')-1).get('project_name') : '';
	}.property('selected_project_id'),
	// vm  get the last item of the array of available VMs
    selected_project_available_vm : function(){
        return !this.get('boolean_no_project') ? Number(this.get('content').objectAt(this.get('selected_project_id')-1).get('vms_av').get("lastObject")) || 0 : 0;
    }.property('selected_project_id'),
    // floating ip
    selected_project_available_ip : function(){
        return !this.get('boolean_no_project') ? Number(this.get('content').objectAt(this.get('selected_project_id')-1).get('floatip_av')) : 0;
    }.property('selected_project_id'),
    selected_project_changed : function(){
        this.send('clear_cached');
    }.observes('selected_project_id'),
    /*
     * VRE Categories
     */
    // wrap categories to a project selection check
    vre_categories : function(){
        return !this.get('boolean_no_project') ? this.get('vreCategoryLabels') : [];
    }.property('selected_project_id'),
    selected_category_static : null, // need this one-way bound property to workaround ember #select bug
    selected_category : function(key,value){
        if (arguments.length>1){// setter
            this.set('selected_category_static',value);
            this.set('selected_image',null);
        }
        return this.get('selected_category_static'); // getter
    }.property('selected_category_static','selected_project_id'),
    /*
     * VRE Images
     */
	selected_project_images : function(){
	    //TODO:  model data, not used at moment until we implement dynamic filtering on image category
	    var arr_images = !this.get('boolean_no_project') ? this.get('content').objectAt(this.get('selected_project_id')-1).get('vre_choices') : [];
	    // return based on static data defined at top of controller, verify with model data
	    var arr_filtered_by_category = !Ember.isEmpty(this.get('selected_category')) ? this.get('vreCategoryData')[this.get('selected_category')] : [];
	    var arr_verified = arr_filtered_by_category.filter(function(item,index,self){// remove any statics not on model
	        return arr_images.contains(item) ? true : false;
	    });
{'fraction_non_alphanumeric': 0.15317888501004973, 'fraction_numerical': 0.015021686237173384, 'mean_word_length': 3.9810326659641726, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4258790', 'n_tokens_mistral': 3080, 'n_tokens_neox': 2914, 'n_words': 547}