summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ml/experiment_tracking/components/ml_experiment.vue
blob: f8e269d3b579db925a27a497956bfcfd07f34a45 (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
<script>
import { GlTable, GlLink } from '@gitlab/ui';
import { __ } from '~/locale';
import IncubationAlert from './incubation_alert.vue';

export default {
  name: 'MlExperiment',
  components: {
    GlTable,
    GlLink,
    IncubationAlert,
  },
  inject: ['candidates', 'metricNames', 'paramNames'],
  computed: {
    fields() {
      return [
        ...this.paramNames,
        ...this.metricNames,
        { key: 'details', label: '' },
        { key: 'artifact', label: '' },
      ];
    },
  },
  i18n: {
    titleLabel: __('Experiment candidates'),
    emptyStateLabel: __('This experiment has no logged candidates'),
    artifactsLabel: __('Artifacts'),
    detailsLabel: __('Details'),
  },
};
</script>

<template>
  <div>
    <incubation-alert />

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

    <gl-table
      :fields="fields"
      :items="candidates"
      :empty-text="$options.i18n.emptyStateLabel"
      show-empty
      class="gl-mt-0!"
    >
      <template #cell(artifact)="data">
        <gl-link v-if="data.value" :href="data.value" target="_blank">{{
          $options.i18n.artifactsLabel
        }}</gl-link>
      </template>

      <template #cell(details)="data">
        <gl-link :href="data.value">{{ $options.i18n.detailsLabel }}</gl-link>
      </template>
    </gl-table>
  </div>
</template>