2021-02-22 17:27:13 +05:30
|
|
|
import Vue from 'vue';
|
|
|
|
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
|
|
|
|
import AdminUsersApp from './components/app.vue';
|
2021-03-11 19:13:27 +05:30
|
|
|
import UsagePingDisabled from './components/usage_ping_disabled.vue';
|
2021-02-22 17:27:13 +05:30
|
|
|
|
2021-03-11 19:13:27 +05:30
|
|
|
export const initAdminUsersApp = (el = document.querySelector('#js-admin-users-app')) => {
|
2021-02-22 17:27:13 +05:30
|
|
|
if (!el) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const { users, paths } = el.dataset;
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
2021-03-08 18:12:59 +05:30
|
|
|
render: (createElement) =>
|
2021-02-22 17:27:13 +05:30
|
|
|
createElement(AdminUsersApp, {
|
|
|
|
props: {
|
|
|
|
users: convertObjectPropsToCamelCase(JSON.parse(users), { deep: true }),
|
|
|
|
paths: convertObjectPropsToCamelCase(JSON.parse(paths)),
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
});
|
2021-03-11 19:13:27 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
export const initCohortsEmptyState = (el = document.querySelector('#js-cohorts-empty-state')) => {
|
|
|
|
if (!el) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const { emptyStateSvgPath, enableUsagePingLink, docsLink } = el.dataset;
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
|
|
|
provide: {
|
|
|
|
svgPath: emptyStateSvgPath,
|
|
|
|
primaryButtonPath: enableUsagePingLink,
|
|
|
|
docsLink,
|
|
|
|
},
|
|
|
|
render(h) {
|
|
|
|
return h(UsagePingDisabled);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|