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

index.js « state_filter « search « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2c12885c40b014a2ac5e9a49399580e75306f0c0 (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
import Vue from 'vue';
import Translate from '~/vue_shared/translate';
import DropdownFilter from '../components/dropdown_filter.vue';
import {
  FILTER_HEADER,
  FILTER_PARAM,
  FILTER_STATES_BY_SCOPE,
  FILTER_STATES,
  SCOPES,
} from './constants';

Vue.use(Translate);

export default () => {
  const el = document.getElementById('js-search-filter-by-state');

  if (!el) return false;

  return new Vue({
    el,
    data() {
      return { ...el.dataset };
    },

    render(createElement) {
      return createElement(DropdownFilter, {
        props: {
          initialFilter: this.filter,
          filtersArray: FILTER_STATES_BY_SCOPE[this.scope],
          filters: FILTER_STATES,
          header: FILTER_HEADER,
          param: FILTER_PARAM,
          scope: this.scope,
          supportedScopes: Object.values(SCOPES),
        },
      });
    },
  });
};