<commit_before>define([
  'knockout',
  'session',
  'router',
  'request',
  'dom',
  'timestamp'
], function (ko, session, router, request, dom, timestamp) {

  var view = {

    // Set page title
    pageTitle: 'Build Profile',

    // Create observables
    id: ko.observable(),
    commit: ko.observable(),
    config: ko.observable(),
    start: ko.observable(),
    end: ko.observable(),
    status: ko.observable(),

    // Check if session exists
    before: function (fn) {
      session(function (res) {
        if (!res) {
          // No session, show login
          router.go('/');
        } else {
          fn(true);
        }
      });
    },

    load: function (project, id) {
      var self = this;
      self.id(id);
      var req = request({
        url: '/api/build/'+id
      });
      
      req.done(function (build) {
        var startObj = timestamp.format(build.data.start);
        var endFormat;
        if (build.data.hasOwnProperty('end')) {
          var endObj = timestamp.format(build.data.end);
          endFormat = endObj.month + ' ' + endObj.date + ' at ' + endObj.hour + ':' + endObj.min + ':' + endObj.sec + endObj.ampm;
        } else {
          endFormat = "N/A";
        }
        self.commit(build.data.commit);
        self.config(JSON.stringify(build.data.config, null, 4));
        self.start(startObj.month + ' ' + startObj.date + ' at ' + startObj.hour + ':' + startObj.min + ':' + startObj.sec + startObj.ampm);
        self.end(endFormat);
        self.status(self.getStatus(build.data.status));
      });
    },
    
    getStatus: function (status) {
      var obj = { 0: 'Pass', 1: 'Fail', 2: 'Pending' };
      return obj[status];
    }
  };

  return view;
});<commit_msg>Adding log endpoint request and observable to build view<commit_after>define([
  'knockout',
  'session',
  'router',
  'request',
  'dom',
  'timestamp'
], function (ko, session, router, request, dom, timestamp) {

  var view = {

    // Set page title
    pageTitle: 'Build Profile',

    // Create observables
    id: ko.observable(),
    commit: ko.observable(),
    config: ko.observable(),
    start: ko.observable(),
    end: ko.observable(),
    status: ko.observable(),
    log: ko.observable('Loading...'),

    // Check if session exists
    before: function (fn) {
      session(function (res) {
        if (!res) {
          // No session, show login
          router.go('/');
        } else {
          fn(true);
        }
      });
    },

    load: function (project, id) {
      var self = this;
      self.id(id);
      
      // Request build data
      var req = request({
        url: '/api/build/'+id
      });

      req.done(function (build) {
        var startObj = timestamp.format(build.data.start);
        var endFormat;
        if (build.data.hasOwnProperty('end')) {
          var endObj = timestamp.format(build.data.end);
          endFormat = endObj.month + ' ' + endObj.date + ' at ' + endObj.hour + ':' + endObj.min + ':' + endObj.sec + endObj.ampm;
        } else {
          endFormat = "N/A";
        }
        self.commit(build.data.commit);
        self.config(JSON.stringify(build.data.config, null, 4));
        self.start(startObj.month + ' ' + startObj.date + ' at ' + startObj.hour + ':' + startObj.min + ':' + startObj.sec + startObj.ampm);
        self.end(endFormat);
        self.status(self.getStatus(build.data.status));
      });
      
      var reqLog = request({
        url: '/api/build/log/'+id
      });
      
      reqLog.done(function (log) {
        self.log(log.data);
      });
      
      reqLog.fail(function () {
        self.log('ERROR');
      });
    },

    getStatus: function (status) {
      var obj = { 0: 'Pass', 1: 'Fail', 2: 'Pending' };
      return obj[status];
    }
  };

  return view;
});
{'fraction_non_alphanumeric': 0.1652653704676826, 'fraction_numerical': 0.0021019442984760903, 'mean_word_length': 1.9765441751368256, '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': '1069095', 'n_tokens_mistral': 1233, 'n_tokens_neox': 1210, 'n_words': 259}