debian-mirror-gitlab/app/assets/javascripts/admin/background_migrations/index.js
2022-07-16 19:58:13 +02:00

38 lines
846 B
JavaScript

import Vue from 'vue';
import * as Sentry from '@sentry/browser';
import Translate from '~/vue_shared/translate';
import BackgroundMigrationsDatabaseListbox from './components/database_listbox.vue';
Vue.use(Translate);
export const initBackgroundMigrationsApp = () => {
const el = document.getElementById('js-database-listbox');
if (!el) {
return false;
}
const { selectedDatabase } = el.dataset;
let { databases } = el.dataset;
try {
databases = JSON.parse(databases).map((database) => ({
value: database,
text: database,
}));
} catch (e) {
Sentry.captureException(e);
}
return new Vue({
el,
render(createElement) {
return createElement(BackgroundMigrationsDatabaseListbox, {
props: {
databases,
selectedDatabase,
},
});
},
});
};