summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/whats_new/index.js
blob: ed0258c399283670bcf6beba2c474d685217db29 (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
import Vue from 'vue';
import { mapState } from 'vuex';
import App from './components/app.vue';
import store from './store';
import { getStorageKey, setNotification } from './utils/notification';

let whatsNewApp;

export default el => {
  if (whatsNewApp) {
    store.dispatch('openDrawer');
  } else {
    whatsNewApp = new Vue({
      el,
      store,
      components: {
        App,
      },
      computed: {
        ...mapState(['open']),
      },
      watch: {
        open() {
          setNotification(el);
        },
      },
      render(createElement) {
        return createElement('app', {
          props: {
            storageKey: getStorageKey(el),
            versions: JSON.parse(el.getAttribute('data-versions')),
            gitlabDotCom: el.getAttribute('data-gitlab-dot-com'),
          },
        });
      },
    });
  }
};