debian-mirror-gitlab/app/assets/javascripts/whats_new/index.js

39 lines
851 B
JavaScript
Raw Normal View History

2020-10-24 23:57:45 +05:30
import Vue from 'vue';
2021-02-22 17:27:13 +05:30
import { mapState } from 'vuex';
2020-10-24 23:57:45 +05:30
import App from './components/app.vue';
import store from './store';
2021-02-22 17:27:13 +05:30
import { getStorageKey, setNotification } from './utils/notification';
2020-10-24 23:57:45 +05:30
2020-11-24 15:15:51 +05:30
let whatsNewApp;
2020-10-24 23:57:45 +05:30
2021-02-22 17:27:13 +05:30
export default el => {
2020-11-24 15:15:51 +05:30
if (whatsNewApp) {
store.dispatch('openDrawer');
} else {
whatsNewApp = new Vue({
2021-02-22 17:27:13 +05:30
el,
2020-11-24 15:15:51 +05:30
store,
components: {
App,
},
2021-02-22 17:27:13 +05:30
computed: {
...mapState(['open']),
},
watch: {
open() {
setNotification(el);
},
},
2020-11-24 15:15:51 +05:30
render(createElement) {
return createElement('app', {
props: {
2021-02-22 17:27:13 +05:30
storageKey: getStorageKey(el),
versions: JSON.parse(el.getAttribute('data-versions')),
gitlabDotCom: el.getAttribute('data-gitlab-dot-com'),
2020-11-24 15:15:51 +05:30
},
});
},
});
}
2020-10-24 23:57:45 +05:30
};