2022-03-30 15:09:00 +00:00
|
|
|
import { GlToast } from '@gitlab/ui';
|
|
|
|
import Vue from 'vue';
|
|
|
|
import { parseBoolean } from '~/lib/utils/common_utils';
|
|
|
|
import PerformancePlugin from '~/performance/vue_performance_plugin';
|
|
|
|
import Translate from '~/vue_shared/translate';
|
2022-09-01 18:09:55 +00:00
|
|
|
import RegistryBreadcrumb from '~/packages_and_registries/harbor_registry/components/harbor_registry_breadcrumb.vue';
|
2022-03-30 15:09:00 +00:00
|
|
|
import { renderBreadcrumb } from '~/packages_and_registries/shared/utils';
|
|
|
|
import createRouter from './router';
|
|
|
|
import HarborRegistryExplorer from './pages/index.vue';
|
|
|
|
|
|
|
|
Vue.use(Translate);
|
|
|
|
Vue.use(GlToast);
|
|
|
|
|
|
|
|
Vue.use(PerformancePlugin, {
|
|
|
|
components: [
|
|
|
|
'RegistryListPage',
|
|
|
|
'ListHeader',
|
|
|
|
'ImageListRow',
|
|
|
|
'RegistryDetailsPage',
|
|
|
|
'DetailsHeader',
|
|
|
|
'TagsList',
|
|
|
|
],
|
|
|
|
});
|
|
|
|
|
|
|
|
export default (id) => {
|
|
|
|
const el = document.getElementById(id);
|
|
|
|
|
|
|
|
if (!el) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2022-09-01 18:09:55 +00:00
|
|
|
const {
|
|
|
|
endpoint,
|
|
|
|
connectionError,
|
|
|
|
invalidPathError,
|
|
|
|
isGroupPage,
|
|
|
|
noContainersImage,
|
|
|
|
containersErrorImage,
|
|
|
|
repositoryUrl,
|
|
|
|
harborIntegrationProjectName,
|
|
|
|
projectName,
|
|
|
|
} = el.dataset;
|
2022-03-30 15:09:00 +00:00
|
|
|
|
|
|
|
const breadCrumbState = Vue.observable({
|
|
|
|
name: '',
|
2022-09-01 18:09:55 +00:00
|
|
|
href: '',
|
2022-03-30 15:09:00 +00:00
|
|
|
updateName(value) {
|
|
|
|
this.name = value;
|
|
|
|
},
|
2022-09-01 18:09:55 +00:00
|
|
|
updateHref(value) {
|
|
|
|
this.href = value;
|
|
|
|
},
|
2022-03-30 15:09:00 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
const router = createRouter(endpoint, breadCrumbState);
|
|
|
|
|
|
|
|
const attachMainComponent = () => {
|
|
|
|
return new Vue({
|
|
|
|
el,
|
|
|
|
router,
|
|
|
|
provide() {
|
|
|
|
return {
|
|
|
|
breadCrumbState,
|
2022-09-01 18:09:55 +00:00
|
|
|
endpoint,
|
|
|
|
connectionError: parseBoolean(connectionError),
|
|
|
|
invalidPathError: parseBoolean(invalidPathError),
|
|
|
|
isGroupPage: parseBoolean(isGroupPage),
|
|
|
|
repositoryUrl,
|
|
|
|
harborIntegrationProjectName,
|
|
|
|
projectName,
|
|
|
|
containersErrorImage,
|
|
|
|
noContainersImage,
|
2022-03-30 15:09:00 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
render(createElement) {
|
|
|
|
return createElement(HarborRegistryExplorer);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
return {
|
|
|
|
attachBreadcrumb: renderBreadcrumb(router, null, RegistryBreadcrumb),
|
|
|
|
attachMainComponent,
|
|
|
|
};
|
|
|
|
};
|