<commit_before>attr = App.attr;
// Information about user (welcome screen)
App.User = DS.Model.extend({
	token : attr('string'), 			// okeanos token
	user_id : attr('number'), 			// user_id in backend database
	user_name : attr('string'),         // user name or email
	user_theme : attr('string'),        // user's theme in backend database
	cluster : attr(), // number of user active clusters
	vrenum : attr(), // number of user active VREs
	dslnum : attr(), // number of user DSLs
	escience_token : attr(),
    master_vm_password: attr('string'),
    error_message: attr('string'),
    clusters : DS.hasMany('usercluster', {
        async : true,
        inverse : 'user'
    }),                           // user cluster records
    vreservers : DS.hasMany('uservreserver', {
        async : true,
        inverse : 'user'
    }),                           // user VRE server records
    dsls : DS.hasMany('dsl', {
        async : true,
        inverse : 'user'
    })
});

// Information about user's DSLs
App.Dsl = DS.Model.extend({
    dsl_name : attr('string'),
    action_date : attr('isodate'),
    dsl_status : attr('string'),
    cluster_id : attr('number'),
    pithos_path : attr('string'),
    task_id : attr(), 
    state : attr(),
    dsl_data : attr(),
    // user that created the VRE
    user : DS.belongsTo('user', {
        inverse : 'dsls'
    }),
    // computed properties
    dsl_data_safe : function(){
        var dsl_data = this.get('dsl_data');
        return Ember.String.htmlSafe('<pre class="prettyprint lang-yaml">%@</pre>'.fmt(dsl_data));
    }.property('dsl_data'),
    dsl_data_json : function(){
        var yaml = this.get('dsl_data');
        data_json = YAML.parse(yaml);
        return data_json;
    }.property('dsl_data'),
    class_dsl_status : function (){
        var status = this.get('dsl_status');
        switch (status) {
        case "0":  //at rest
            return "glyphicon glyphicon-ok text-success";
        case "1":  //replaying
            return "glyphicon glyphicon-time text-warning";
        default:   //unknown
            return "glyphicon glyphicon-question-sign text-muted";
        }
    }.property('dsl_status'),
    description_dsl_status : function(){
        var status = this.get('dsl_status');
        switch (status) {
        case "0":
            return "AT REST";
        case "1":
            return "REPLAYING";
        default:
            return "UNKNOWN";
        }
    }.property('dsl_status'),
    resorted_status : function(){
        // replaying > at rest
        // 0 < 1(replaying), 1 < 0 (at rest)
        var priority = {"0":"1","1":"0"};
        return priority[this.get('dsl_status')];
    }.property('dsl_status'),    
    class_button_dsl_destroy : function(){
        return !Ember.isEmpty(this.get('pithos_path')) ? "glyphicon glyphicon-trash text-danger" : "";
    }.property('pithos_path'),
    class_button_dsl_replay : function(){
        return !Ember.isEmpty(this.get('pithos_path')) ? "glyphicon glyphicon-repeat text-success" : "";
    }.property('pithos_path'),
    message_dsl_status_replay : function(){
        var status = this.get('dsl_status');
        if (status == '1'){ // replaying
            return this.get('state') || 'Executing...'; // message from celery if set
        }else{
            return '';
        }
    }.property('server_status'),
    action_dsl_confirm : function(key, value){
        this.set('confirm_action', value);
        return this.get('confirm_action');
    }.property(),
    description_action_dsl_confirm : function(key, value){
        var confirm_action = this.get('action_dsl_confirm');
        switch(confirm_action){
        case 'dsl_delete':
            return 'Delete Experiment';
        case 'dsl_replay':
            return 'Replay Experiment';
        default:
            return 'Confirm';
        }
    }.property('action_dsl_confirm'),
    id_dsl_name : function(key){
        return '%@%@'.fmt(key,this.get('dsl_name'));
    }.property('dsl_name'),
    id_pithos_path : function(key){
        return '%@%@'.fmt(key,this.get('dsl_name'));
    }.property('dsl_name'),<commit_msg>[WIP] Small fix to last, typo on userExperiments part of userWelcome controller, fixes refresh of experiment status while replaying.<commit_after>attr = App.attr;
// Information about user (welcome screen)
App.User = DS.Model.extend({
	token : attr('string'), 			// okeanos token
	user_id : attr('number'), 			// user_id in backend database
	user_name : attr('string'),         // user name or email
	user_theme : attr('string'),        // user's theme in backend database
	cluster : attr(), // number of user active clusters
	vrenum : attr(), // number of user active VREs
	dslnum : attr(), // number of user DSLs
	escience_token : attr(),
    master_vm_password: attr('string'),
    error_message: attr('string'),
    clusters : DS.hasMany('usercluster', {
        async : true,
        inverse : 'user'
    }),                           // user cluster records
    vreservers : DS.hasMany('uservreserver', {
        async : true,
        inverse : 'user'
    }),                           // user VRE server records
    dsls : DS.hasMany('dsl', {
        async : true,
        inverse : 'user'
    })
});

// Information about user's DSLs
App.Dsl = DS.Model.extend({
    dsl_name : attr('string'),
    action_date : attr('isodate'),
    dsl_status : attr('string'),
    cluster_id : attr('number'),
    pithos_path : attr('string'),
    task_id : attr(), 
    state : attr(),
    dsl_data : attr(),
    // user that created the VRE
    user : DS.belongsTo('user', {
        inverse : 'dsls'
    }),
    // computed properties
    dsl_data_safe : function(){
        var dsl_data = this.get('dsl_data');
        return Ember.String.htmlSafe('<pre class="prettyprint lang-yaml">%@</pre>'.fmt(dsl_data));
    }.property('dsl_data'),
    dsl_data_json : function(){
        var yaml = this.get('dsl_data');
        data_json = YAML.parse(yaml);
        return data_json;
    }.property('dsl_data'),
    class_dsl_status : function (){
        var status = this.get('dsl_status');
        switch (status) {
        case "0":  //at rest
            return "glyphicon glyphicon-ok text-success";
        case "1":  //replaying
            return "glyphicon glyphicon-time text-warning";
        default:   //unknown
            return "glyphicon glyphicon-question-sign text-muted";
        }
    }.property('dsl_status'),
    description_dsl_status : function(){
        var status = this.get('dsl_status');
        switch (status) {
        case "0":
            return "AT REST";
        case "1":
            return "REPLAYING";
        default:
            return "UNKNOWN";
        }
    }.property('dsl_status'),
    resorted_status : function(){
        // replaying > at rest
        // 0 < 1(replaying), 1 < 0 (at rest)
        var priority = {"0":"1","1":"0"};
        return priority[this.get('dsl_status')];
    }.property('dsl_status'),    
    class_button_dsl_destroy : function(){
        return !Ember.isEmpty(this.get('pithos_path')) ? "glyphicon glyphicon-trash text-danger" : "";
    }.property('pithos_path'),
    class_button_dsl_replay : function(){
        return !Ember.isEmpty(this.get('pithos_path')) ? "glyphicon glyphicon-repeat text-success" : "";
    }.property('pithos_path'),
    message_dsl_status_replay : function(){
        var status = this.get('dsl_status');
        if (status == '1'){ // replaying
            return this.get('state') || 'Executing...'; // message from celery if set
        }else{
            return '';
        }
    }.property('dsl_status','state'),
    action_dsl_confirm : function(key, value){
        this.set('confirm_action', value);
        return this.get('confirm_action');
    }.property(),
    description_action_dsl_confirm : function(key, value){
        var confirm_action = this.get('action_dsl_confirm');
        switch(confirm_action){
        case 'dsl_delete':
            return 'Delete Experiment';
        case 'dsl_replay':
            return 'Replay Experiment';
        default:
            return 'Confirm';
        }
    }.property('action_dsl_confirm'),
    id_dsl_name : function(key){
        return '%@%@'.fmt(key,this.get('dsl_name'));
    }.property('dsl_name'),
    id_pithos_path : function(key){
        return '%@%@'.fmt(key,this.get('dsl_name'));
    }.property('dsl_name'),
{'fraction_non_alphanumeric': 0.1487642585551331, 'fraction_numerical': 0.0030893536121673003, 'mean_word_length': 2.413219789132198, 'pattern_counts': {'":': 12, '<': 11, '<?xml version=': 0, '>': 9, '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': '6325946', 'n_tokens_mistral': 2651, 'n_tokens_neox': 2550, 'n_words': 571}