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

work_items_list_app.vue « components « list « work_items « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fe7cb719bbbc91ac5523a072c10c783f7a52320a (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
<script>
import * as Sentry from '@sentry/browser';
import { STATUS_OPEN } from '~/issues/constants';
import { __, s__ } from '~/locale';
import IssuableList from '~/vue_shared/issuable/list/components/issuable_list_root.vue';
import { issuableListTabs } from '~/vue_shared/issuable/list/constants';
import { STATE_CLOSED } from '../../constants';
import getWorkItemsQuery from '../queries/get_work_items.query.graphql';

export default {
  i18n: {
    searchPlaceholder: __('Search or filter results...'),
  },
  issuableListTabs,
  components: {
    IssuableList,
  },
  inject: ['fullPath'],
  data() {
    return {
      error: undefined,
      searchTokens: [],
      sortOptions: [],
      state: STATUS_OPEN,
      workItems: [],
    };
  },
  apollo: {
    workItems: {
      query: getWorkItemsQuery,
      variables() {
        return {
          fullPath: this.fullPath,
        };
      },
      update(data) {
        return data.group.workItems.nodes ?? [];
      },
      error(error) {
        this.error = s__(
          'WorkItem|Something went wrong when fetching work items. Please try again.',
        );
        Sentry.captureException(error);
      },
    },
  },
  methods: {
    getStatus(issue) {
      return issue.state === STATE_CLOSED ? __('Closed') : undefined;
    },
  },
};
</script>

<template>
  <issuable-list
    :current-tab="state"
    :error="error"
    :issuables="workItems"
    namespace="work-items"
    recent-searches-storage-key="issues"
    :search-input-placeholder="$options.i18n.searchPlaceholder"
    :search-tokens="searchTokens"
    show-work-item-type-icon
    :sort-options="sortOptions"
    :tabs="$options.issuableListTabs"
    @dismiss-alert="error = undefined"
  >
    <template #status="{ issuable }">
      {{ getStatus(issuable) }}
    </template>
  </issuable-list>
</template>