Commit 0a213fe7 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch 'extract-container-registry-common-components' into 'master'

Extract container registry page common components

See merge request gitlab-org/gitlab!77833
parents 8c2a10d4 d1394090
...@@ -7,6 +7,7 @@ import RegistryList from '~/packages_and_registries/shared/components/registry_l ...@@ -7,6 +7,7 @@ import RegistryList from '~/packages_and_registries/shared/components/registry_l
import PersistedSearch from '~/packages_and_registries/shared/components/persisted_search.vue'; import PersistedSearch from '~/packages_and_registries/shared/components/persisted_search.vue';
import { FILTERED_SEARCH_TERM } from '~/packages_and_registries/shared/constants'; import { FILTERED_SEARCH_TERM } from '~/packages_and_registries/shared/constants';
import TagsLoader from '~/packages_and_registries/shared/components/tags_loader.vue';
import { import {
REMOVE_TAGS_BUTTON_TITLE, REMOVE_TAGS_BUTTON_TITLE,
TAGS_LIST_TITLE, TAGS_LIST_TITLE,
...@@ -20,7 +21,6 @@ import { ...@@ -20,7 +21,6 @@ import {
} from '../../constants/index'; } from '../../constants/index';
import getContainerRepositoryTagsQuery from '../../graphql/queries/get_container_repository_tags.query.graphql'; import getContainerRepositoryTagsQuery from '../../graphql/queries/get_container_repository_tags.query.graphql';
import TagsListRow from './tags_list_row.vue'; import TagsListRow from './tags_list_row.vue';
import TagsLoader from './tags_loader.vue';
export default { export default {
name: 'TagsList', name: 'TagsList',
......
...@@ -5,6 +5,7 @@ import createFlash from '~/flash'; ...@@ -5,6 +5,7 @@ import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { joinPaths } from '~/lib/utils/url_utility'; import { joinPaths } from '~/lib/utils/url_utility';
import Tracking from '~/tracking'; import Tracking from '~/tracking';
import TagsLoader from '~/packages_and_registries/shared/components/tags_loader.vue';
import DeleteImage from '../components/delete_image.vue'; import DeleteImage from '../components/delete_image.vue';
import DeleteAlert from '../components/details_page/delete_alert.vue'; import DeleteAlert from '../components/details_page/delete_alert.vue';
import DeleteModal from '../components/details_page/delete_modal.vue'; import DeleteModal from '../components/details_page/delete_modal.vue';
...@@ -12,7 +13,6 @@ import DetailsHeader from '../components/details_page/details_header.vue'; ...@@ -12,7 +13,6 @@ import DetailsHeader from '../components/details_page/details_header.vue';
import PartialCleanupAlert from '../components/details_page/partial_cleanup_alert.vue'; import PartialCleanupAlert from '../components/details_page/partial_cleanup_alert.vue';
import StatusAlert from '../components/details_page/status_alert.vue'; import StatusAlert from '../components/details_page/status_alert.vue';
import TagsList from '../components/details_page/tags_list.vue'; import TagsList from '../components/details_page/tags_list.vue';
import TagsLoader from '../components/details_page/tags_loader.vue';
import { import {
ALERT_SUCCESS_TAG, ALERT_SUCCESS_TAG,
......
...@@ -52,7 +52,7 @@ export default { ...@@ -52,7 +52,7 @@ export default {
), ),
CliCommands: () => CliCommands: () =>
import( import(
/* webpackChunkName: 'container_registry_components' */ '../components/list_page/cli_commands.vue' /* webpackChunkName: 'container_registry_components' */ '~/packages_and_registries/shared/components/cli_commands.vue'
), ),
GlModal, GlModal,
GlSprintf, GlSprintf,
...@@ -68,7 +68,7 @@ export default { ...@@ -68,7 +68,7 @@ export default {
GlTooltip: GlTooltipDirective, GlTooltip: GlTooltipDirective,
}, },
mixins: [Tracking.mixin()], mixins: [Tracking.mixin()],
inject: ['config'], inject: ['config', 'dockerBuildCommand', 'dockerPushCommand', 'dockerLoginCommand'],
loader: { loader: {
repeat: 10, repeat: 10,
width: 1000, width: 1000,
...@@ -321,7 +321,12 @@ export default { ...@@ -321,7 +321,12 @@ export default {
:hide-expiration-policy-data="config.isGroupPage" :hide-expiration-policy-data="config.isGroupPage"
> >
<template #commands> <template #commands>
<cli-commands v-if="showCommands" /> <cli-commands
v-if="showCommands"
:docker-build-command="dockerBuildCommand"
:docker-push-command="dockerPushCommand"
:docker-login-command="dockerLoginCommand"
/>
</template> </template>
</registry-header> </registry-header>
......
...@@ -10,7 +10,7 @@ import { ...@@ -10,7 +10,7 @@ import {
COPY_BUILD_TITLE, COPY_BUILD_TITLE,
PUSH_COMMAND_LABEL, PUSH_COMMAND_LABEL,
COPY_PUSH_TITLE, COPY_PUSH_TITLE,
} from '../../constants/index'; } from '../constants';
const trackingLabel = 'quickstart_dropdown'; const trackingLabel = 'quickstart_dropdown';
...@@ -20,7 +20,20 @@ export default { ...@@ -20,7 +20,20 @@ export default {
CodeInstruction, CodeInstruction,
}, },
mixins: [Tracking.mixin({ label: trackingLabel })], mixins: [Tracking.mixin({ label: trackingLabel })],
inject: ['config', 'dockerBuildCommand', 'dockerPushCommand', 'dockerLoginCommand'], props: {
dockerBuildCommand: {
type: String,
required: true,
},
dockerPushCommand: {
type: String,
required: true,
},
dockerLoginCommand: {
type: String,
required: true,
},
},
trackingLabel, trackingLabel,
i18n: { i18n: {
QUICK_START, QUICK_START,
......
export * from './package_registry';
export * from './quick_start';
import { s__ } from '~/locale';
export const QUICK_START = s__('ContainerRegistry|CLI Commands');
export const LOGIN_COMMAND_LABEL = s__('ContainerRegistry|Login');
export const COPY_LOGIN_TITLE = s__('ContainerRegistry|Copy login command');
export const BUILD_COMMAND_LABEL = s__('ContainerRegistry|Build an image');
export const COPY_BUILD_TITLE = s__('ContainerRegistry|Copy build command');
export const PUSH_COMMAND_LABEL = s__('ContainerRegistry|Push an image');
export const COPY_PUSH_TITLE = s__('ContainerRegistry|Copy push command');
...@@ -8,7 +8,7 @@ import { stripTypenames } from 'helpers/graphql_helpers'; ...@@ -8,7 +8,7 @@ import { stripTypenames } from 'helpers/graphql_helpers';
import component from '~/packages_and_registries/container_registry/explorer/components/details_page/tags_list.vue'; import component from '~/packages_and_registries/container_registry/explorer/components/details_page/tags_list.vue';
import TagsListRow from '~/packages_and_registries/container_registry/explorer/components/details_page/tags_list_row.vue'; import TagsListRow from '~/packages_and_registries/container_registry/explorer/components/details_page/tags_list_row.vue';
import TagsLoader from '~/packages_and_registries/container_registry/explorer/components/details_page/tags_loader.vue'; import TagsLoader from '~/packages_and_registries/shared/components/tags_loader.vue';
import RegistryList from '~/packages_and_registries/shared/components/registry_list.vue'; import RegistryList from '~/packages_and_registries/shared/components/registry_list.vue';
import PersistedSearch from '~/packages_and_registries/shared/components/persisted_search.vue'; import PersistedSearch from '~/packages_and_registries/shared/components/persisted_search.vue';
import getContainerRepositoryTagsQuery from '~/packages_and_registries/container_registry/explorer/graphql/queries/get_container_repository_tags.query.graphql'; import getContainerRepositoryTagsQuery from '~/packages_and_registries/container_registry/explorer/graphql/queries/get_container_repository_tags.query.graphql';
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import component from '~/packages_and_registries/container_registry/explorer/components/details_page/tags_loader.vue'; import component from '~/packages_and_registries/shared/components/tags_loader.vue';
import { GlSkeletonLoader } from '../../stubs'; import { GlSkeletonLoader } from '../../stubs';
describe('TagsLoader component', () => { describe('TagsLoader component', () => {
......
import { GlDropdown } from '@gitlab/ui'; import { GlDropdown } from '@gitlab/ui';
import { mount, createLocalVue } from '@vue/test-utils'; import { mount, createLocalVue } from '@vue/test-utils';
import Vuex from 'vuex'; import Vuex from 'vuex';
import QuickstartDropdown from '~/packages_and_registries/container_registry/explorer/components/list_page/cli_commands.vue'; import QuickstartDropdown from '~/packages_and_registries/shared/components/cli_commands.vue';
import { import {
QUICK_START, QUICK_START,
LOGIN_COMMAND_LABEL, LOGIN_COMMAND_LABEL,
...@@ -22,22 +22,14 @@ localVue.use(Vuex); ...@@ -22,22 +22,14 @@ localVue.use(Vuex);
describe('cli_commands', () => { describe('cli_commands', () => {
let wrapper; let wrapper;
const config = {
repositoryUrl: 'foo',
registryHostUrlWithPort: 'bar',
};
const findDropdownButton = () => wrapper.find(GlDropdown); const findDropdownButton = () => wrapper.find(GlDropdown);
const findCodeInstruction = () => wrapper.findAll(CodeInstruction); const findCodeInstruction = () => wrapper.findAll(CodeInstruction);
const mountComponent = () => { const mountComponent = () => {
wrapper = mount(QuickstartDropdown, { wrapper = mount(QuickstartDropdown, {
localVue, localVue,
provide() { propsData: {
return { ...dockerCommands,
config,
...dockerCommands,
};
}, },
}); });
}; };
......
...@@ -11,7 +11,7 @@ import DetailsHeader from '~/packages_and_registries/container_registry/explorer ...@@ -11,7 +11,7 @@ import DetailsHeader from '~/packages_and_registries/container_registry/explorer
import PartialCleanupAlert from '~/packages_and_registries/container_registry/explorer/components/details_page/partial_cleanup_alert.vue'; import PartialCleanupAlert from '~/packages_and_registries/container_registry/explorer/components/details_page/partial_cleanup_alert.vue';
import StatusAlert from '~/packages_and_registries/container_registry/explorer/components/details_page/status_alert.vue'; import StatusAlert from '~/packages_and_registries/container_registry/explorer/components/details_page/status_alert.vue';
import TagsList from '~/packages_and_registries/container_registry/explorer/components/details_page/tags_list.vue'; import TagsList from '~/packages_and_registries/container_registry/explorer/components/details_page/tags_list.vue';
import TagsLoader from '~/packages_and_registries/container_registry/explorer/components/details_page/tags_loader.vue'; import TagsLoader from '~/packages_and_registries/shared/components/tags_loader.vue';
import { import {
UNFINISHED_STATUS, UNFINISHED_STATUS,
......
...@@ -8,7 +8,7 @@ import getContainerRepositoriesQuery from 'shared_queries/container_registry/get ...@@ -8,7 +8,7 @@ import getContainerRepositoriesQuery from 'shared_queries/container_registry/get
import CleanupPolicyEnabledAlert from '~/packages_and_registries/shared/components/cleanup_policy_enabled_alert.vue'; import CleanupPolicyEnabledAlert from '~/packages_and_registries/shared/components/cleanup_policy_enabled_alert.vue';
import { FILTERED_SEARCH_TERM } from '~/packages_and_registries/shared/constants'; import { FILTERED_SEARCH_TERM } from '~/packages_and_registries/shared/constants';
import DeleteImage from '~/packages_and_registries/container_registry/explorer/components/delete_image.vue'; import DeleteImage from '~/packages_and_registries/container_registry/explorer/components/delete_image.vue';
import CliCommands from '~/packages_and_registries/container_registry/explorer/components/list_page/cli_commands.vue'; import CliCommands from '~/packages_and_registries/shared/components/cli_commands.vue';
import GroupEmptyState from '~/packages_and_registries/container_registry/explorer/components/list_page/group_empty_state.vue'; import GroupEmptyState from '~/packages_and_registries/container_registry/explorer/components/list_page/group_empty_state.vue';
import ImageList from '~/packages_and_registries/container_registry/explorer/components/list_page/image_list.vue'; import ImageList from '~/packages_and_registries/container_registry/explorer/components/list_page/image_list.vue';
import ProjectEmptyState from '~/packages_and_registries/container_registry/explorer/components/list_page/project_empty_state.vue'; import ProjectEmptyState from '~/packages_and_registries/container_registry/explorer/components/list_page/project_empty_state.vue';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment