<commit_before>// Embedded records
DS.RESTAdapter.map('App.Vm', {
  name: {key: 'vm_name'},
  status: {embedded: 'always'},
  mac: {embedded: 'always'},
  utilization: {embedded: 'always'},
  capabilities: {embedded: 'always'},
  floatingIps: {embedded: 'always'},
  fixedIps: {embedded: 'always'},
  contention: {embedded: 'always'}
});

DS.RESTAdapter.map('App.VmContention', {
  threads: {embedded: 'always'},
  system: {embedded: 'always'}
});

DS.RESTAdapter.map('App.VmContentionThread', {
  llc: { embedded: 'always' }
});

DS.RESTAdapter.map('App.VmContentionSystem', {
  llc: { embedded: 'always' }
});

// Embedded models
App.VmStatus = DS.Model.extend({
  locked: DS.attr('boolean'),
  health: DS.attr('number'),
  short_message: DS.attr('string'),
  long_message: DS.attr('string'),
  healthMessage: function () {
    if (App.isEmpty(this.get('short_message')) && App.isEmpty(this.get('long_message'))) {
      // If both short and long messages are empty, show health as message
      return '<strong>Health</strong>: ' + App.priorityToType(this.get('health')).capitalize();
    } else if (App.isEmpty(this.get('long_message'))) {  // Short message only
      return this.get('short_message').capitalize();
    } else {  // Default to long message
      return this.get('long_message').capitalize();
    }
  }.property('health', 'long_message', 'short_message'),
  operational: DS.attr('number'),
  operationalMessage: function () {
    return '<strong>State</strong>: ' + App.codeToOperational(this.get('operational')).capitalize();
  }.property('operational'),
  trust: DS.attr('boolean'),
  trust_message: DS.attr('string'),
  trustMessage: function () {
    if (App.isEmpty(this.get('trust_message'))) {
      return 'Trusted: ' + App.priorityToType(this.get('trust')).capitalize();
    } else {
      return '<strong>Trust:</strong> ' + this.get('trust_message').capitalize();
    }
  }.property('trust', 'trust_message'),
  sla_status: DS.attr('number'),
  slaViolated: function () {
    return this.get('sla_status') === 1;
  }.property('sla_status'),
  slaNotViolated: function () {
    return this.get('sla_status') === 0;
  }.property('sla_status'),
  slaUnknown: function () {
    return Ember.isEmpty(this.get('sla_status'));
  }.property('sla_status'),
  sla_messages: DS.attr('array'),
  slaMessage: function () {
    if (App.isEmpty(this.get('sla_messages'))) {
      var slaStatus = '';
      if (this.get('sla_status') === 0) {
        slaStatus = 'Not violated';
      } else if (this.get('sla_status') === 1) {
        slaStatus = 'Violated';
      } else {
        slaStatus = 'Unknown';
      }
      return 'SLA Status: ' + slaStatus;
    } else {
      var messages = this.get('sla_messages').map(function (item, index, enumerable) {
        if (item.slice(-1) === '.') item = item.slice(0, -1);
        return item.capitalize();
      });
      return messages.join('; ');
    }
  }.property('sla_status', 'sla_message')
});
App.VmUtilization = DS.Model.extend({
  ipc: DS.attr('number'),
  uptime: DS.attr('number'),
  //network: DS.attr('string'),     // empty for beta
  //io: DS.attr('string'),          // empty for beta
  memory: DS.attr('string'),
  cpu: DS.attr('number'),
  gips_current: DS.attr('number')
});

App.VmCapabilities = DS.Model.extend({
  cores: DS.attr('number'),
  memory_size: DS.attr('string'),
  gips_allocated: DS.attr('number')
});

App.VmContention = DS.Model.extend({
  threads: DS.hasMany('App.VmContentionThread'),
  system: DS.belongsTo('App.VmContentionSystem')
});

App.VmContentionSystem = DS.Model.extend({
  llc: DS.belongsTo('App.VmContentionSystemLlc')
});

App.VmContentionSystemLlc = DS.Model.extend({
  value: DS.attr('number'),<commit_msg>New Trust message for trust details with integer mapping instead of old string on VM model.<commit_after>// Embedded records
DS.RESTAdapter.map('App.Vm', {
  name: {key: 'vm_name'},
  status: {embedded: 'always'},
  mac: {embedded: 'always'},
  utilization: {embedded: 'always'},
  capabilities: {embedded: 'always'},
  floatingIps: {embedded: 'always'},
  fixedIps: {embedded: 'always'},
  contention: {embedded: 'always'}
});

DS.RESTAdapter.map('App.VmStatus', {
  trust_details: {embedded: 'always'}
});

DS.RESTAdapter.map('App.VmContention', {
  threads: {embedded: 'always'},
  system: {embedded: 'always'}
});

DS.RESTAdapter.map('App.VmContentionThread', {
  llc: { embedded: 'always' }
});

DS.RESTAdapter.map('App.VmContentionSystem', {
  llc: { embedded: 'always' }
});

// Embedded models
App.VmStatus = DS.Model.extend({
  locked: DS.attr('boolean'),
  health: DS.attr('number'),
  short_message: DS.attr('string'),
  long_message: DS.attr('string'),
  healthMessage: function () {
    if (App.isEmpty(this.get('short_message')) && App.isEmpty(this.get('long_message'))) {
      // If both short and long messages are empty, show health as message
      return '<strong>Health</strong>: ' + App.priorityToType(this.get('health')).capitalize();
    } else if (App.isEmpty(this.get('long_message'))) {  // Short message only
      return this.get('short_message').capitalize();
    } else {  // Default to long message
      return this.get('long_message').capitalize();
    }
  }.property('health', 'long_message', 'short_message'),
  operational: DS.attr('number'),
  operationalMessage: function () {
    return '<strong>State</strong>: ' + App.codeToOperational(this.get('operational')).capitalize();
  }.property('operational'),
  trust: DS.attr('boolean'),
  trust_details: DS.belongsTo('App.VmStatusTrustDetails'),
  trustMessage: function () {
    var message = '';
    if (this.get('trust') === 0) {
      message = 'Trust Status: Unknown.';
    } else if (this.get('trust') === 1) {
      message = 'Trust Status: Not Trusted';
    } else if (this.get('trust') === 2) {
      message = 'Trust Status: Trusted';
    }
    message += '<br>' + 'BIOS: ' + App.trustDetailsToString(this.get('trust_details.bios'));
    message += '<br>' + 'VMM: ' + App.trustDetailsToString(this.get('trust_details.vmm'));
    return message;
  }.property('trust'),
  sla_status: DS.attr('number'),
  slaViolated: function () {
    return this.get('sla_status') === 1;
  }.property('sla_status'),
  slaNotViolated: function () {
    return this.get('sla_status') === 0;
  }.property('sla_status'),
  slaUnknown: function () {
    return Ember.isEmpty(this.get('sla_status'));
  }.property('sla_status'),
  sla_messages: DS.attr('array'),
  slaMessage: function () {
    if (App.isEmpty(this.get('sla_messages'))) {
      var slaStatus = '';
      if (this.get('sla_status') === 0) {
        slaStatus = 'Not violated';
      } else if (this.get('sla_status') === 1) {
        slaStatus = 'Violated';
      } else {
        slaStatus = 'Unknown';
      }
      return 'SLA Status: ' + slaStatus;
    } else {
      var messages = this.get('sla_messages').map(function (item, index, enumerable) {
        if (item.slice(-1) === '.') item = item.slice(0, -1);
        return item.capitalize();
      });
      return messages.join('; ');
    }
  }.property('sla_status', 'sla_message')
});
App.VmStatusTrustDetails = DS.Model.extend({
  bios: DS.attr('string'),
  vmm: DS.attr('string')
});
App.VmUtilization = DS.Model.extend({
  ipc: DS.attr('number'),
  uptime: DS.attr('number'),
  //network: DS.attr('string'),     // empty for beta
  //io: DS.attr('string'),          // empty for beta
  memory: DS.attr('string'),
  cpu: DS.attr('number'),
  gips_current: DS.attr('number')
});

App.VmCapabilities = DS.Model.extend({
  cores: DS.attr('number'),
  memory_size: DS.attr('string'),
  gips_allocated: DS.attr('number')
});

App.VmContention = DS.Model.extend({
  threads: DS.hasMany('App.VmContentionThread'),
  system: DS.belongsTo('App.VmContentionSystem')
});

App.VmContentionSystem = DS.Model.extend({
  llc: DS.belongsTo('App.VmContentionSystemLlc')
});

App.VmContentionSystemLlc = DS.Model.extend({
  value: DS.attr('number'),
{'fraction_non_alphanumeric': 0.19293614881850177, 'fraction_numerical': 0.002136752136752137, 'mean_word_length': 3.9514623522090853, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '4908187', 'n_tokens_mistral': 2742, 'n_tokens_neox': 2687, 'n_words': 502}