Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ml_experiments_index.vue « components « index « experiments « routes « experiment_tracking « ml « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4f2b8db3c00700744d1678531f46942a9c502406 (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
<script>
import { GlTableLite, GlEmptyState, GlLink } from '@gitlab/ui';
import IncubationAlert from '~/vue_shared/components/incubation/incubation_alert.vue';
import Pagination from '~/vue_shared/components/incubation/pagination.vue';
import {
  FEATURE_NAME,
  FEATURE_FEEDBACK_ISSUE,
  EMPTY_STATE_SVG,
} from '~/ml/experiment_tracking/constants';
import * as constants from '~/ml/experiment_tracking/routes/experiments/index/constants';
import * as translations from '~/ml/experiment_tracking/routes/experiments/index/translations';

export default {
  name: 'MlExperimentsIndexApp',
  components: {
    Pagination,
    IncubationAlert,
    GlTableLite,
    GlEmptyState,
    GlLink,
  },
  props: {
    experiments: {
      type: Array,
      required: true,
    },
    pageInfo: {
      type: Object,
      required: true,
    },
  },
  tableFields: constants.EXPERIMENTS_TABLE_FIELDS,
  i18n: translations,
  computed: {
    hasExperiments() {
      return this.experiments.length > 0;
    },
    tableItems() {
      return this.experiments.map((exp) => ({
        nameColumn: { name: exp.name, path: exp.path },
        candidateCountColumn: exp.candidate_count,
      }));
    },
  },
  constants: {
    FEATURE_NAME,
    FEATURE_FEEDBACK_ISSUE,
    EMPTY_STATE_SVG,
    ...constants,
  },
};
</script>

<template>
  <div v-if="hasExperiments">
    <h1 class="page-title gl-font-size-h-display">
      {{ $options.i18n.TITLE_LABEL }}
    </h1>

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

    <gl-table-lite :items="tableItems" :fields="$options.tableFields">
      <template #cell(nameColumn)="data">
        <gl-link :href="data.value.path">
          {{ data.value.name }}
        </gl-link>
      </template>
    </gl-table-lite>

    <pagination v-if="hasExperiments" v-bind="pageInfo" />
  </div>

  <gl-empty-state
    v-else
    :title="$options.i18n.EMPTY_STATE_TITLE_LABEL"
    :primary-button-text="$options.i18n.CREATE_NEW_LABEL"
    :primary-button-link="$options.constants.CREATE_EXPERIMENT_HELP_PATH"
    :svg-path="$options.constants.EMPTY_STATE_SVG"
    :description="$options.i18n.EMPTY_STATE_DESCRIPTION_LABEL"
    class="gl-py-8"
  />
</template>