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

index.js « edit « integrations « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a2ba581d4293221ae8f43a4933a11d79e4ceba55 (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
import Vue from 'vue';
import { parseBoolean } from '~/lib/utils/common_utils';
import ActiveToggle from './components/active_toggle.vue';

export default el => {
  if (!el) {
    return null;
  }

  const { showActive: showActiveStr, activated: activatedStr, disabled: disabledStr } = el.dataset;
  const showActive = parseBoolean(showActiveStr);
  const activated = parseBoolean(activatedStr);
  const disabled = parseBoolean(disabledStr);

  if (!showActive) {
    return null;
  }

  return new Vue({
    el,
    render(createElement) {
      return createElement(ActiveToggle, {
        props: {
          initialActivated: activated,
          disabled,
        },
      });
    },
  });
};