<commit_before>/// <reference path="../../includes.ts"/>
module Developer {

  export function enrichWorkspaces(projects) {
    angular.forEach(projects, (project) => {
      enrichWorkspace(project);
    });
    return projects;
  }

  export function enrichWorkspace(build) {
    if (build) {
      var name = Kubernetes.getName(build);
      build.$name = name;
      build.$sortOrder = 0 - build.number;

      var nameArray = name.split("-");
      var nameArrayLength = nameArray.length;
      build.$shortName = (nameArrayLength > 4) ? nameArray.slice(0, nameArrayLength - 4).join("-") : name.substring(0, 30);

      var labels = Kubernetes.getLabels(build);
      build.$creationDate = asDate(Kubernetes.getCreationTimestamp(build));
      build.$labelsText = Kubernetes.labelsToString(labels);

      if (name) {
        build.$projectsLink = UrlHelpers.join("workspaces", name);
        build.$runtimeLink = UrlHelpers.join("kubernetes/namespace/", name, "/apps");
        build.$viewLink = build.$projectsLink;
      }
    }
    return build;
  }

  export function asDate(value) {
    return value ? new Date(value) : null;
  }

  export function enrichJenkinsJobs(jobsData, projectId, jobName) {
    if (jobsData) {
      angular.forEach(jobsData.jobs, (job) => {
        enrichJenkinsJob(job, projectId, jobName);
      });
    }
    return jobsData;
  }

  export function enrichJenkinsJob(job, projectId, jobName) {
    if (job) {
      jobName = jobName || job.name || projectId;
      job.$jobId = jobName;
      job.$project = projectId || jobName;
      var lastBuild = job.lastBuild;
      var lastBuildResult = lastBuild ? lastBuild.result : "NOT_STARTED";<commit_msg>for runtime environments lets link directly to the runtime page by default from the projects page<commit_after>/// <reference path="../../includes.ts"/>
module Developer {

  export function enrichWorkspaces(projects) {
    angular.forEach(projects, (project) => {
      enrichWorkspace(project);
    });
    return projects;
  }

  export function enrichWorkspace(project) {
    if (project) {
      var name = Kubernetes.getName(project);
      project.$name = name;
      project.$sortOrder = 0 - project.number;

      var nameArray = name.split("-");
      var nameArrayLength = nameArray.length;
      project.$shortName = (nameArrayLength > 4) ? nameArray.slice(0, nameArrayLength - 4).join("-") : name.substring(0, 30);

      var labels = Kubernetes.getLabels(project);
      project.$creationDate = asDate(Kubernetes.getCreationTimestamp(project));
      project.$labelsText = Kubernetes.labelsToString(labels);

      var team = labels["team"] || labels["project"];
      if (name) {
        if (team) {
          project.$projectsLink = UrlHelpers.join("workspaces", team, "/namespace", name);
          project.$runtimeLink = UrlHelpers.join("workspaces", team, "/namespace", name, "/apps");
        } else {
          project.$projectsLink = UrlHelpers.join("workspaces", name);
          project.$runtimeLink = UrlHelpers.join("kubernetes/namespace/", name, "/apps");
        }
        project.$viewLink = project.$projectsLink;
      }
    }
    return project;
  }

  export function asDate(value) {
    return value ? new Date(value) : null;
  }

  export function enrichJenkinsJobs(jobsData, projectId, jobName) {
    if (jobsData) {
      angular.forEach(jobsData.jobs, (job) => {
        enrichJenkinsJob(job, projectId, jobName);
      });
    }
    return jobsData;
  }

  export function enrichJenkinsJob(job, projectId, jobName) {
    if (job) {
      jobName = jobName || job.name || projectId;
      job.$jobId = jobName;
      job.$project = projectId || jobName;
      var lastBuild = job.lastBuild;
      var lastBuildResult = lastBuild ? lastBuild.result : "NOT_STARTED";
{'fraction_non_alphanumeric': 0.13340363828104404, 'fraction_numerical': 0.003691009754811495, 'mean_word_length': 3.0233297985153764, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '401603', 'n_tokens_mistral': 1140, 'n_tokens_neox': 1087, 'n_words': 244}