summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ml/experiment_tracking/components/ml_candidate.vue
blob: d0c42905ee28f6d5712506cee614188b81d80137 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<script>
import { GlLink } from '@gitlab/ui';
import { __ } from '~/locale';
import { FEATURE_NAME, FEATURE_FEEDBACK_ISSUE } from '~/ml/experiment_tracking/constants';
import IncubationAlert from '~/vue_shared/components/incubation/incubation_alert.vue';

export default {
  name: 'MlCandidate',
  components: {
    IncubationAlert,
    GlLink,
  },
  props: {
    candidate: {
      type: Object,
      required: true,
    },
  },
  i18n: {
    titleLabel: __('Model candidate details'),
    infoLabel: __('Info'),
    idLabel: __('ID'),
    statusLabel: __('Status'),
    experimentLabel: __('Experiment'),
    artifactsLabel: __('Artifacts'),
    parametersLabel: __('Parameters'),
    metricsLabel: __('Metrics'),
    metadataLabel: __('Metadata'),
  },
  computed: {
    sections() {
      return [
        {
          sectionName: this.$options.i18n.parametersLabel,
          sectionValues: this.candidate.params,
        },
        {
          sectionName: this.$options.i18n.metricsLabel,
          sectionValues: this.candidate.metrics,
        },
        {
          sectionName: this.$options.i18n.metadataLabel,
          sectionValues: this.candidate.metadata,
        },
      ];
    },
  },
  FEATURE_NAME,
  FEATURE_FEEDBACK_ISSUE,
};
</script>

<template>
  <div>
    <incubation-alert
      :feature-name="$options.FEATURE_NAME"
      :link-to-feedback-issue="$options.FEATURE_FEEDBACK_ISSUE"
    />

    <h3>
      {{ $options.i18n.titleLabel }}
    </h3>

    <table class="candidate-details">
      <tbody>
        <tr class="divider"></tr>

        <tr>
          <td class="gl-text-secondary gl-font-weight-bold">{{ $options.i18n.infoLabel }}</td>
          <td class="gl-font-weight-bold">{{ $options.i18n.idLabel }}</td>
          <td>{{ candidate.info.iid }}</td>
        </tr>

        <tr>
          <td></td>
          <td class="gl-font-weight-bold">{{ $options.i18n.statusLabel }}</td>
          <td>{{ candidate.info.status }}</td>
        </tr>

        <tr>
          <td></td>
          <td class="gl-font-weight-bold">{{ $options.i18n.experimentLabel }}</td>
          <td>
            <gl-link :href="candidate.info.path_to_experiment">{{
              candidate.info.experiment_name
            }}</gl-link>
          </td>
        </tr>

        <tr v-if="candidate.info.path_to_artifact">
          <td></td>
          <td class="gl-font-weight-bold">{{ $options.i18n.artifactsLabel }}</td>
          <td>
            <gl-link :href="candidate.info.path_to_artifact">{{
              $options.i18n.artifactsLabel
            }}</gl-link>
          </td>
        </tr>

        <template v-for="{ sectionName, sectionValues } in sections">
          <tr :key="sectionName" class="divider"></tr>

          <tr v-for="(item, index) in sectionValues" :key="item.name">
            <td v-if="index === 0" class="gl-text-secondary gl-font-weight-bold">
              {{ sectionName }}
            </td>
            <td v-else></td>
            <td class="gl-font-weight-bold">{{ item.name }}</td>
            <td>{{ item.value }}</td>
          </tr>
        </template>
      </tbody>
    </table>
  </div>
</template>