diff --git a/app/assets/stylesheets/page_bundles/admin/geo_nodes.scss b/app/assets/stylesheets/page_bundles/admin/geo_sites.scss similarity index 76% rename from app/assets/stylesheets/page_bundles/admin/geo_nodes.scss rename to app/assets/stylesheets/page_bundles/admin/geo_sites.scss index b0aaa48569a137bda51b576021b120a09b61c30d..37bc2394d585c2464e567f8f85e9e3b5905d53e2 100644 --- a/app/assets/stylesheets/page_bundles/admin/geo_nodes.scss +++ b/app/assets/stylesheets/page_bundles/admin/geo_sites.scss @@ -1,6 +1,6 @@ @import '../mixins_and_variables_and_functions'; -.geo-node-header-grid-columns { +.geo-site-header-grid-columns { grid-template-columns: 1fr auto; grid-gap: $gl-spacing-scale-5; @@ -9,7 +9,7 @@ } } -.geo-node-details-grid-columns { +.geo-site-details-grid-columns { grid-gap: $gl-spacing-scale-5; @include media-breakpoint-up(lg) { @@ -17,12 +17,12 @@ } } -.geo-node-core-details-grid-columns { +.geo-site-core-details-grid-columns { grid-template-columns: 1fr 1fr; grid-gap: $gl-spacing-scale-5; } -.geo-node-replication-details-grid-columns { +.geo-site-replication-details-grid-columns { grid-template-columns: 1fr 1fr; grid-gap: 1rem; @@ -31,7 +31,7 @@ } } -.geo-node-filter-grid-columns { +.geo-site-filter-grid-columns { grid-template-columns: 1fr; @include media-breakpoint-up(md) { @@ -39,7 +39,7 @@ } } -.geo-node-replication-counts-grid { +.geo-site-replication-counts-grid { grid-template-columns: 2fr 1fr 1fr; grid-gap: 1rem; } diff --git a/config/application.rb b/config/application.rb index 8dded7bed4edc26c48a2953343b8f79f6227bc22..96ae34d430d48bee63f2bae859fafcecae7bdfc8 100644 --- a/config/application.rb +++ b/config/application.rb @@ -258,7 +258,7 @@ class Application < Rails::Application config.assets.precompile << "page_bundles/_mixins_and_variables_and_functions.css" config.assets.precompile << "page_bundles/admin/application_settings_metrics_and_profiling.css" config.assets.precompile << "page_bundles/admin/elasticsearch_form.css" - config.assets.precompile << "page_bundles/admin/geo_nodes.css" + config.assets.precompile << "page_bundles/admin/geo_sites.css" config.assets.precompile << "page_bundles/admin/geo_replicable.css" config.assets.precompile << "page_bundles/admin/jobs_index.css" config.assets.precompile << "page_bundles/alert_management_details.css" diff --git a/ee/app/assets/javascripts/geo_nodes/components/details/geo_node_details.vue b/ee/app/assets/javascripts/geo_nodes/components/details/geo_node_details.vue deleted file mode 100644 index ca4eed83fa9e1ef7c6a7b0ccd0184824b94456ad..0000000000000000000000000000000000000000 --- a/ee/app/assets/javascripts/geo_nodes/components/details/geo_node_details.vue +++ /dev/null @@ -1,54 +0,0 @@ -<script> -import GeoNodeCoreDetails from './geo_node_core_details.vue'; -import GeoNodePrimaryOtherInfo from './primary_node/geo_node_primary_other_info.vue'; -import GeoNodeVerificationInfo from './primary_node/geo_node_verification_info.vue'; -import GeoNodeReplicationDetails from './secondary_node/geo_node_replication_details.vue'; -import GeoNodeReplicationSummary from './secondary_node/geo_node_replication_summary.vue'; -import GeoNodeSecondaryOtherInfo from './secondary_node/geo_node_secondary_other_info.vue'; - -export default { - name: 'GeoNodeDetails', - components: { - GeoNodeCoreDetails, - GeoNodePrimaryOtherInfo, - GeoNodeVerificationInfo, - GeoNodeReplicationSummary, - GeoNodeSecondaryOtherInfo, - GeoNodeReplicationDetails, - }, - props: { - node: { - type: Object, - required: true, - }, - }, -}; -</script> - -<template> - <div class="gl-display-grid geo-node-details-grid-columns gl-p-5"> - <geo-node-core-details :node="node" /> - <div - v-if="node.primary" - class="gl-display-flex gl-sm-flex-direction-column gl-align-items-flex-start gl-h-full gl-w-full" - > - <geo-node-verification-info - class="gl-flex-grow-1 gl-mb-5 gl-md-mb-0 gl-md-mr-5 gl-h-full gl-w-full" - :node="node" - /> - <geo-node-primary-other-info class="gl-flex-grow-1 gl-h-full gl-w-full" :node="node" /> - </div> - <div v-else class="gl-display-flex gl-flex-direction-column gl-h-full gl-w-full"> - <div - class="gl-display-flex gl-sm-flex-direction-column gl-align-items-flex-start gl-h-full gl-w-full gl-mb-5" - > - <geo-node-replication-summary - class="gl-flex-grow-1 gl-mb-5 gl-md-mb-0 gl-md-mr-5 gl-h-full gl-w-full" - :node="node" - /> - <geo-node-secondary-other-info class="gl-flex-grow-1 gl-h-full gl-w-full" :node="node" /> - </div> - <geo-node-replication-details :node="node" /> - </div> - </div> -</template> diff --git a/ee/app/assets/javascripts/geo_nodes/components/header/geo_node_actions.vue b/ee/app/assets/javascripts/geo_nodes/components/header/geo_node_actions.vue deleted file mode 100644 index 84c061d0cf2662a380f97494fa27b621cc36b0a3..0000000000000000000000000000000000000000 --- a/ee/app/assets/javascripts/geo_nodes/components/header/geo_node_actions.vue +++ /dev/null @@ -1,39 +0,0 @@ -<script> -import { mapActions } from 'vuex'; -import { REMOVE_NODE_MODAL_ID } from 'ee/geo_nodes/constants'; -import { BV_SHOW_MODAL } from '~/lib/utils/constants'; -import GeoNodeActionsDesktop from './geo_node_actions_desktop.vue'; -import GeoNodeActionsMobile from './geo_node_actions_mobile.vue'; - -export default { - name: 'GeoNodeActions', - components: { - GeoNodeActionsMobile, - GeoNodeActionsDesktop, - }, - props: { - node: { - type: Object, - required: true, - }, - }, - methods: { - ...mapActions(['prepSiteRemoval']), - async warnNodeRemoval() { - await this.prepSiteRemoval(this.node.id); - this.$root.$emit(BV_SHOW_MODAL, REMOVE_NODE_MODAL_ID); - }, - }, -}; -</script> - -<template> - <div> - <geo-node-actions-mobile class="gl-lg-display-none" :node="node" @remove="warnNodeRemoval" /> - <geo-node-actions-desktop - class="gl-display-none gl-lg-display-flex" - :node="node" - @remove="warnNodeRemoval" - /> - </div> -</template> diff --git a/ee/app/assets/javascripts/geo_nodes/components/app.vue b/ee/app/assets/javascripts/geo_sites/components/app.vue similarity index 78% rename from ee/app/assets/javascripts/geo_nodes/components/app.vue rename to ee/app/assets/javascripts/geo_sites/components/app.vue index 36cf730569021012028d0a86e725bb252970da68..39149793f660adab8b7cf557fdd6929d376576a1 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/app.vue +++ b/ee/app/assets/javascripts/geo_sites/components/app.vue @@ -2,13 +2,13 @@ import { GlButton, GlLoadingIcon, GlModal } from '@gitlab/ui'; import { mapActions, mapState, mapGetters } from 'vuex'; import { s__, __ } from '~/locale'; -import { REMOVE_NODE_MODAL_ID } from '../constants'; -import GeoNodesFilters from './geo_nodes_filters.vue'; -import GeoNodes from './geo_nodes.vue'; -import GeoNodesEmptyState from './geo_nodes_empty_state.vue'; +import { REMOVE_SITE_MODAL_ID } from '../constants'; +import GeoSitesFilters from './geo_sites_filters.vue'; +import GeoSites from './geo_sites.vue'; +import GeoSitesEmptyState from './geo_sites_empty_state.vue'; export default { - name: 'GeoNodesApp', + name: 'GeoSitesApp', i18n: { geoSites: s__('Geo|Geo sites'), helpText: s__( @@ -31,13 +31,13 @@ export default { components: { GlButton, GlLoadingIcon, - GeoNodesFilters, - GeoNodes, - GeoNodesEmptyState, + GeoSitesFilters, + GeoSites, + GeoSitesEmptyState, GlModal, }, props: { - newNodeUrl: { + newSiteUrl: { type: String, required: true, }, @@ -45,21 +45,21 @@ export default { computed: { ...mapState(['sites', 'isLoading']), ...mapGetters(['filteredSites']), - hasNodes() { + hasSites() { return this.sites && this.sites.length > 0; }, hasEmptyState() { return Object.keys(this.emptyState).length; }, - primaryNodes() { + primarySites() { return this.filteredSites.filter((n) => n.primary); }, - secondaryNodes() { + secondarySites() { return this.filteredSites.filter((n) => !n.primary); }, emptyState() { // Geo isn't configured - if (!this.hasNodes) { + if (!this.hasSites) { return { title: this.$options.i18n.notConfiguredTitle, description: this.$options.i18n.notConfiguredDescription, @@ -93,7 +93,7 @@ export default { MODAL_CANCEL_ACTION: { text: __('Cancel'), }, - REMOVE_NODE_MODAL_ID, + REMOVE_SITE_MODAL_ID, }; </script> @@ -105,10 +105,10 @@ export default { > <p class="gl-mr-5 gl-mb-0">{{ $options.i18n.helpText }}</p> <gl-button - v-if="hasNodes" + v-if="hasSites" class="gl-w-full gl-md-w-auto gl-ml-auto gl-mr-5 gl-mt-5 gl-md-mt-0" variant="confirm" - :href="newNodeUrl" + :href="newSiteUrl" target="_blank" data-qa-selector="add_site_button" >{{ $options.i18n.addSite }} @@ -116,28 +116,28 @@ export default { </div> <gl-loading-icon v-if="isLoading" size="xl" class="gl-mt-5" /> <template v-if="!isLoading"> - <div v-if="hasNodes"> - <geo-nodes-filters :total-nodes="sites.length" /> - <h4 v-if="primaryNodes.length" class="gl-font-lg gl-my-5"> + <div v-if="hasSites"> + <geo-sites-filters :total-sites="sites.length" /> + <h4 v-if="primarySites.length" class="gl-font-lg gl-my-5"> {{ $options.i18n.primarySite }} </h4> - <geo-nodes - v-for="node in primaryNodes" - :key="node.id" - :node="node" - data-testid="primary-nodes" + <geo-sites + v-for="site in primarySites" + :key="site.id" + :site="site" + data-testid="primary-sites" /> - <h4 v-if="secondaryNodes.length" class="gl-font-lg gl-my-5"> + <h4 v-if="secondarySites.length" class="gl-font-lg gl-my-5"> {{ $options.i18n.secondarySite }} </h4> - <geo-nodes - v-for="node in secondaryNodes" - :key="node.id" - :node="node" - data-testid="secondary-nodes" + <geo-sites + v-for="site in secondarySites" + :key="site.id" + :site="site" + data-testid="secondary-sites" /> </div> - <geo-nodes-empty-state + <geo-sites-empty-state v-if="hasEmptyState" :title="emptyState.title" :description="emptyState.description" @@ -145,7 +145,7 @@ export default { /> </template> <gl-modal - :modal-id="$options.REMOVE_NODE_MODAL_ID" + :modal-id="$options.REMOVE_SITE_MODAL_ID" :title="$options.i18n.modalTitle" :action-primary="$options.MODAL_PRIMARY_ACTION" :action-cancel="$options.MODAL_CANCEL_ACTION" diff --git a/ee/app/assets/javascripts/geo_nodes/components/details/geo_node_core_details.vue b/ee/app/assets/javascripts/geo_sites/components/details/geo_site_core_details.vue similarity index 74% rename from ee/app/assets/javascripts/geo_nodes/components/details/geo_node_core_details.vue rename to ee/app/assets/javascripts/geo_sites/components/details/geo_site_core_details.vue index fd8ff71750dba449d91487daf2bbb3ec946a99d3..0de75b7d1e43009d14e73880fcc76434a744edab 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/details/geo_node_core_details.vue +++ b/ee/app/assets/javascripts/geo_sites/components/details/geo_site_core_details.vue @@ -4,7 +4,7 @@ import { mapGetters } from 'vuex'; import { __, s__ } from '~/locale'; export default { - name: 'GeoNodeCoreDetails', + name: 'GeoSiteCoreDetails', i18n: { url: s__('Geo|External URL'), internalUrl: s__('Geo|Internal URL'), @@ -16,44 +16,44 @@ export default { GlIcon, }, props: { - node: { + site: { type: Object, required: true, }, }, computed: { ...mapGetters(['siteHasVersionMismatch']), - nodeVersion() { - if (!this.node.version || !this.node.revision) { + siteVersion() { + if (!this.site.version || !this.site.revision) { return this.$options.i18n.unknown; } - return `${this.node.version} (${this.node.revision})`; + return `${this.site.version} (${this.site.revision})`; }, hasMismatchVersion() { - return this.siteHasVersionMismatch(this.node.id); + return this.siteHasVersionMismatch(this.site.id); }, }, }; </script> <template> - <div class="gl-display-grid gl-lg-display-block! geo-node-core-details-grid-columns"> + <div class="gl-display-grid gl-lg-display-block! geo-site-core-details-grid-columns"> <div class="gl-display-flex gl-flex-direction-column gl-lg-mb-5"> <span>{{ $options.i18n.url }}</span> <gl-link class="gl-text-gray-900 gl-font-weight-bold gl-text-decoration-underline" - :href="node.url" + :href="site.url" target="_blank" rel="noopener noreferrer" > - {{ node.url }} + {{ site.url }} <gl-icon name="external-link" class="gl-ml-1" /> </gl-link> </div> <div class="gl-display-flex gl-flex-direction-column gl-lg-my-5"> <span>{{ $options.i18n.internalUrl }}</span> - <span class="gl-font-weight-bold" data-testid="node-internal-url">{{ - node.internalUrl + <span class="gl-font-weight-bold" data-testid="site-internal-url">{{ + site.internalUrl }}</span> </div> <div class="gl-display-flex gl-flex-direction-column gl-lg-mt-5"> @@ -61,9 +61,9 @@ export default { <span :class="{ 'gl-text-red-500': hasMismatchVersion }" class="gl-font-weight-bold" - data-testid="node-version" + data-testid="site-version" > - {{ nodeVersion }} + {{ siteVersion }} </span> </div> </div> diff --git a/ee/app/assets/javascripts/geo_sites/components/details/geo_site_details.vue b/ee/app/assets/javascripts/geo_sites/components/details/geo_site_details.vue new file mode 100644 index 0000000000000000000000000000000000000000..2e9e09f8b52952edc7840362e0f17f7aad231834 --- /dev/null +++ b/ee/app/assets/javascripts/geo_sites/components/details/geo_site_details.vue @@ -0,0 +1,54 @@ +<script> +import GeoSiteCoreDetails from './geo_site_core_details.vue'; +import GeoSitePrimaryOtherInfo from './primary_site/geo_site_primary_other_info.vue'; +import GeoSiteVerificationInfo from './primary_site/geo_site_verification_info.vue'; +import GeoSiteReplicationDetails from './secondary_site/geo_site_replication_details.vue'; +import GeoSiteReplicationSummary from './secondary_site/geo_site_replication_summary.vue'; +import GeoSiteSecondaryOtherInfo from './secondary_site/geo_site_secondary_other_info.vue'; + +export default { + name: 'GeoSiteDetails', + components: { + GeoSiteCoreDetails, + GeoSitePrimaryOtherInfo, + GeoSiteVerificationInfo, + GeoSiteReplicationSummary, + GeoSiteSecondaryOtherInfo, + GeoSiteReplicationDetails, + }, + props: { + site: { + type: Object, + required: true, + }, + }, +}; +</script> + +<template> + <div class="gl-display-grid geo-site-details-grid-columns gl-p-5"> + <geo-site-core-details :site="site" /> + <div + v-if="site.primary" + class="gl-display-flex gl-sm-flex-direction-column gl-align-items-flex-start gl-h-full gl-w-full" + > + <geo-site-verification-info + class="gl-flex-grow-1 gl-mb-5 gl-md-mb-0 gl-md-mr-5 gl-h-full gl-w-full" + :site="site" + /> + <geo-site-primary-other-info class="gl-flex-grow-1 gl-h-full gl-w-full" :site="site" /> + </div> + <div v-else class="gl-display-flex gl-flex-direction-column gl-h-full gl-w-full"> + <div + class="gl-display-flex gl-sm-flex-direction-column gl-align-items-flex-start gl-h-full gl-w-full gl-mb-5" + > + <geo-site-replication-summary + class="gl-flex-grow-1 gl-mb-5 gl-md-mb-0 gl-md-mr-5 gl-h-full gl-w-full" + :site="site" + /> + <geo-site-secondary-other-info class="gl-flex-grow-1 gl-h-full gl-w-full" :site="site" /> + </div> + <geo-site-replication-details :site="site" /> + </div> + </div> +</template> diff --git a/ee/app/assets/javascripts/geo_nodes/components/details/geo_node_progress_bar.vue b/ee/app/assets/javascripts/geo_sites/components/details/geo_site_progress_bar.vue similarity index 99% rename from ee/app/assets/javascripts/geo_nodes/components/details/geo_node_progress_bar.vue rename to ee/app/assets/javascripts/geo_sites/components/details/geo_site_progress_bar.vue index 0aa8b2b20b89d79216dd20820578264ac40127a7..52591bd6d089d56aa6e80f289e7fdeef75eecd68 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/details/geo_node_progress_bar.vue +++ b/ee/app/assets/javascripts/geo_sites/components/details/geo_site_progress_bar.vue @@ -5,7 +5,7 @@ import { __, s__ } from '~/locale'; import StackedProgressBar from '~/vue_shared/components/stacked_progress_bar.vue'; export default { - name: 'GeoNodeSyncProgress', + name: 'GeoSiteSyncProgress', i18n: { total: __('Total'), }, diff --git a/ee/app/assets/javascripts/geo_nodes/components/details/primary_node/geo_node_primary_other_info.vue b/ee/app/assets/javascripts/geo_sites/components/details/primary_site/geo_site_primary_other_info.vue similarity index 77% rename from ee/app/assets/javascripts/geo_nodes/components/details/primary_node/geo_node_primary_other_info.vue rename to ee/app/assets/javascripts/geo_sites/components/details/primary_site/geo_site_primary_other_info.vue index 1811bb167bd9c73391f288133b5215996ad40231..d6002e5fb63a23f29573fef4cb0bed4ecdc2a5e7 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/details/primary_node/geo_node_primary_other_info.vue +++ b/ee/app/assets/javascripts/geo_sites/components/details/primary_site/geo_site_primary_other_info.vue @@ -2,10 +2,10 @@ import { GlCard } from '@gitlab/ui'; import { numberToHumanSize } from '~/lib/utils/number_utils'; import { __, s__ } from '~/locale'; -import GeoNodeProgressBar from '../geo_node_progress_bar.vue'; +import GeoSiteProgressBar from '../geo_site_progress_bar.vue'; export default { - name: 'GeoNodePrimaryOtherInfo', + name: 'GeoSitePrimaryOtherInfo', i18n: { otherInformation: __('Other information'), replicationSlotWAL: s__('Geo|Replication slot WAL'), @@ -17,27 +17,27 @@ export default { }, components: { GlCard, - GeoNodeProgressBar, + GeoSiteProgressBar, }, props: { - node: { + site: { type: Object, required: true, }, }, computed: { replicationSlotWAL() { - return this.node.replicationSlotsMaxRetainedWalBytes || - this.node.replicationSlotsMaxRetainedWalBytes === 0 - ? numberToHumanSize(this.node.replicationSlotsMaxRetainedWalBytes) + return this.site.replicationSlotsMaxRetainedWalBytes || + this.site.replicationSlotsMaxRetainedWalBytes === 0 + ? numberToHumanSize(this.site.replicationSlotsMaxRetainedWalBytes) : this.$options.i18n.unknown; }, replicationSlots() { return { title: this.$options.i18n.replicationSlots, values: { - total: this.node.replicationSlotsCount || 0, - success: this.node.replicationSlotsUsedCount || 0, + total: this.site.replicationSlotsCount || 0, + success: this.site.replicationSlotsUsedCount || 0, }, }; }, @@ -52,7 +52,7 @@ export default { </template> <div class="gl-mb-5"> <span>{{ replicationSlots.title }}</span> - <geo-node-progress-bar + <geo-site-progress-bar class="gl-mt-3" :title="replicationSlots.title" :values="replicationSlots.values" diff --git a/ee/app/assets/javascripts/geo_nodes/components/details/primary_node/geo_node_verification_info.vue b/ee/app/assets/javascripts/geo_sites/components/details/primary_site/geo_site_verification_info.vue similarity index 89% rename from ee/app/assets/javascripts/geo_nodes/components/details/primary_node/geo_node_verification_info.vue rename to ee/app/assets/javascripts/geo_sites/components/details/primary_site/geo_site_verification_info.vue index 15cdcc8441b17294ad096e77e7b981a82d9ca79f..bd3cf68704ce9ae1013499d73b968c0e9a19930c 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/details/primary_node/geo_node_verification_info.vue +++ b/ee/app/assets/javascripts/geo_sites/components/details/primary_site/geo_site_verification_info.vue @@ -1,12 +1,12 @@ <script> import { GlCard, GlIcon, GlPopover, GlLink } from '@gitlab/ui'; import { mapGetters } from 'vuex'; -import { HELP_INFO_URL } from 'ee/geo_nodes/constants'; +import { HELP_INFO_URL } from 'ee/geo_sites/constants'; import { s__, __ } from '~/locale'; -import GeoNodeProgressBar from '../geo_node_progress_bar.vue'; +import GeoSiteProgressBar from '../geo_site_progress_bar.vue'; export default { - name: 'GeoNodeVerificationInfo', + name: 'GeoSiteVerificationInfo', i18n: { verificationInfo: s__('Geo|Verification information'), replicationHelpText: s__( @@ -22,10 +22,10 @@ export default { GlIcon, GlPopover, GlLink, - GeoNodeProgressBar, + GeoSiteProgressBar, }, props: { - node: { + site: { type: Object, required: true, }, @@ -33,7 +33,7 @@ export default { computed: { ...mapGetters(['verificationInfo']), verificationInfoBars() { - return this.verificationInfo(this.node.id); + return this.verificationInfo(this.site.id); }, }, HELP_INFO_URL, @@ -66,7 +66,7 @@ export default { <span data-testid="verification-bar-title">{{ sprintf($options.i18n.progressBarTitle, { title: bar.title }) }}</span> - <geo-node-progress-bar + <geo-site-progress-bar class="gl-mt-3" :title=" /* eslint-disable @gitlab/vue-no-new-non-primitive-in-template */ diff --git a/ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_replication_counts.vue b/ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_replication_counts.vue similarity index 67% rename from ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_replication_counts.vue rename to ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_replication_counts.vue index 5ddf33ba51f20831f8cd783a4f1a1d83ec8dcf45..8b7b8bdca936e6013796b11fd2a36c498ebb93a7 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_replication_counts.vue +++ b/ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_replication_counts.vue @@ -1,20 +1,20 @@ <script> import { mapGetters } from 'vuex'; import { s__ } from '~/locale'; -import GeoNodeReplicationSyncPercentage from './geo_node_replication_sync_percentage.vue'; +import GeoSiteReplicationSyncPercentage from './geo_site_replication_sync_percentage.vue'; export default { - name: 'GeoNodeReplicationCounts', + name: 'GeoSiteReplicationCounts', i18n: { dataType: s__('Geo|Data type'), synchronization: s__('Geo|Synchronization'), verification: s__('Geo|Verification'), }, components: { - GeoNodeReplicationSyncPercentage, + GeoSiteReplicationSyncPercentage, }, props: { - nodeId: { + siteId: { type: Number, required: true, }, @@ -22,7 +22,7 @@ export default { computed: { ...mapGetters(['replicationCountsByDataTypeForSite']), replicationOverview() { - return this.replicationCountsByDataTypeForSite(this.nodeId); + return this.replicationCountsByDataTypeForSite(this.siteId); }, }, }; @@ -30,7 +30,7 @@ export default { <template> <div> - <div class="gl-display-grid geo-node-replication-counts-grid gl-align-items-center gl-mb-3"> + <div class="gl-display-grid geo-site-replication-counts-grid gl-align-items-center gl-mb-3"> <span>{{ $options.i18n.dataType }}</span> <span class="gl-text-right">{{ $options.i18n.synchronization }}</span> <span class="gl-text-right">{{ $options.i18n.verification }}</span> @@ -38,12 +38,12 @@ export default { <div v-for="type in replicationOverview" :key="type.title" - class="gl-display-grid geo-node-replication-counts-grid gl-align-items-center gl-mb-3" + class="gl-display-grid geo-site-replication-counts-grid gl-align-items-center gl-mb-3" data-testid="replication-type" > <span data-testid="replicable-title">{{ type.title }}</span> - <geo-node-replication-sync-percentage :values="type.sync" /> - <geo-node-replication-sync-percentage :values="type.verification" /> + <geo-site-replication-sync-percentage :values="type.sync" /> + <geo-site-replication-sync-percentage :values="type.verification" /> </div> </div> </template> diff --git a/ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_replication_details.vue b/ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_replication_details.vue similarity index 82% rename from ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_replication_details.vue rename to ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_replication_details.vue index 4542f2aa53bc219e1fc04093b5d136e728c8a442..93939880d2abf508ddc0ccd3b30c08c164a368ec 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_replication_details.vue +++ b/ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_replication_details.vue @@ -1,13 +1,13 @@ <script> import { GlLink, GlButton, GlSprintf } from '@gitlab/ui'; import { mapGetters, mapState } from 'vuex'; -import { GEO_REPLICATION_SUPPORTED_TYPES_URL } from 'ee/geo_nodes/constants'; +import { GEO_REPLICATION_SUPPORTED_TYPES_URL } from 'ee/geo_sites/constants'; import { s__ } from '~/locale'; -import GeoNodeReplicationDetailsResponsive from './geo_node_replication_details_responsive.vue'; -import GeoNodeReplicationStatusMobile from './geo_node_replication_status_mobile.vue'; +import GeoSiteReplicationDetailsResponsive from './geo_site_replication_details_responsive.vue'; +import GeoSiteReplicationStatusMobile from './geo_site_replication_status_mobile.vue'; export default { - name: 'GeoNodeReplicationDetails', + name: 'GeoSiteReplicationDetails', i18n: { replicationDetails: s__('Geo|Replication Details'), naVerificationHelpText: s__( @@ -18,11 +18,11 @@ export default { GlLink, GlButton, GlSprintf, - GeoNodeReplicationDetailsResponsive, - GeoNodeReplicationStatusMobile, + GeoSiteReplicationDetailsResponsive, + GeoSiteReplicationStatusMobile, }, props: { - node: { + site: { type: Object, required: true, }, @@ -36,8 +36,8 @@ export default { ...mapState(['replicableTypes']), ...mapGetters(['verificationInfo', 'syncInfo']), replicationItems() { - const syncInfoData = this.syncInfo(this.node.id); - const verificationInfoData = this.verificationInfo(this.node.id); + const syncInfoData = this.syncInfo(this.site.id); + const verificationInfoData = this.verificationInfo(this.site.id); return this.replicableTypes.map((replicable) => { const replicableSyncInfo = syncInfoData.find((r) => r.title === replicable.titlePlural); @@ -72,8 +72,8 @@ export default { } const path = replicable.customReplicationUrl - ? `${this.node.url}${replicable.customReplicationUrl}` - : `${this.node.url}admin/geo/sites/${this.node.id}/replication/${replicable.namePlural}`; + ? `${this.site.url}${replicable.customReplicationUrl}` + : `${this.site.url}admin/geo/sites/${this.site.id}/replication/${replicable.namePlural}`; return new URL(path).toString(); }, @@ -96,15 +96,15 @@ export default { </gl-button> </div> <div v-if="!collapsed"> - <geo-node-replication-details-responsive + <geo-site-replication-details-responsive class="gl-display-none gl-md-display-block" - :node-id="node.id" + :site-id="site.id" :replication-items="replicationItems" data-testid="geo-replication-details-desktop" /> - <geo-node-replication-details-responsive + <geo-site-replication-details-responsive class="gl-md-display-none!" - :node-id="node.id" + :site-id="site.id" :replication-items="replicationItems" data-testid="geo-replication-details-mobile" > @@ -119,9 +119,9 @@ export default { }}</gl-link> <span v-else>{{ item.component }}</span> </div> - <geo-node-replication-status-mobile :item="item" :translations="translations" /> + <geo-site-replication-status-mobile :item="item" :translations="translations" /> </template> - </geo-node-replication-details-responsive> + </geo-site-replication-details-responsive> <div v-if="hasNAVerificationType" class="gl-mt-4"> <gl-sprintf :message="$options.i18n.naVerificationHelpText"> <template #bold="{ content }"> diff --git a/ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_replication_details_responsive.vue b/ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_replication_details_responsive.vue similarity index 86% rename from ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_replication_details_responsive.vue rename to ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_replication_details_responsive.vue index add413ca579874b5bef7d3b913f9b657938c1fa8..f52a945183d9d46299a36461afec9b80206d1661 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_replication_details_responsive.vue +++ b/ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_replication_details_responsive.vue @@ -1,10 +1,10 @@ <script> import { GlLink } from '@gitlab/ui'; -import GeoNodeProgressBar from 'ee/geo_nodes/components/details/geo_node_progress_bar.vue'; +import GeoSiteProgressBar from 'ee/geo_sites/components/details/geo_site_progress_bar.vue'; import { s__, __ } from '~/locale'; export default { - name: 'GeoNodeReplicationDetailsResponsive', + name: 'GeoSiteReplicationDetailsResponsive', i18n: { dataType: __('Data type'), component: __('Component'), @@ -23,10 +23,10 @@ export default { }, components: { GlLink, - GeoNodeProgressBar, + GeoSiteProgressBar, }, props: { - nodeId: { + siteId: { type: Number, required: false, default: 0, @@ -43,7 +43,7 @@ export default { <template> <div> <div - class="gl-display-grid geo-node-replication-details-grid-columns gl-bg-gray-10 gl-p-5 gl-border-b-1 gl-border-b-solid gl-border-b-gray-100" + class="gl-display-grid geo-site-replication-details-grid-columns gl-bg-gray-10 gl-p-5 gl-border-b-1 gl-border-b-solid gl-border-b-gray-100" data-testid="replication-details-header" > <slot name="title" :translations="$options.i18n"> @@ -56,7 +56,7 @@ export default { <div v-for="item in replicationItems" :key="item.component" - class="gl-display-grid geo-node-replication-details-grid-columns gl-p-5 gl-border-b-1 gl-border-b-solid gl-border-b-gray-100" + class="gl-display-grid geo-site-replication-details-grid-columns gl-p-5 gl-border-b-1 gl-border-b-solid gl-border-b-gray-100" data-testid="replication-details-item" > <slot :item="item" :translations="$options.i18n"> @@ -68,7 +68,7 @@ export default { <span v-else>{{ item.component }}</span> </div> <div class="gl-mr-5" data-testid="sync-status"> - <geo-node-progress-bar + <geo-site-progress-bar v-if="item.syncValues" :title=" /* eslint-disable @gitlab/vue-no-new-non-primitive-in-template */ sprintf( @@ -76,13 +76,13 @@ export default { { component: item.component }, ) /* eslint-enable @gitlab/vue-no-new-non-primitive-in-template */ " - :target="`sync-progress-${nodeId}-${item.component}`" + :target="`sync-progress-${siteId}-${item.component}`" :values="item.syncValues" /> <span v-else class="gl-text-gray-400 gl-font-sm">{{ $options.i18n.nA }}</span> </div> <div data-testid="verification-status"> - <geo-node-progress-bar + <geo-site-progress-bar v-if="item.verificationValues" :title=" /* eslint-disable @gitlab/vue-no-new-non-primitive-in-template */ sprintf( @@ -90,7 +90,7 @@ export default { { component: item.component }, ) /* eslint-enable @gitlab/vue-no-new-non-primitive-in-template */ " - :target="`verification-progress-${nodeId}-${item.component}`" + :target="`verification-progress-${siteId}-${item.component}`" :values="item.verificationValues" :success-label="$options.i18n.verified" :unavailable-label="$options.i18n.nothingToVerify" diff --git a/ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_replication_status.vue b/ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_replication_status.vue similarity index 90% rename from ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_replication_status.vue rename to ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_replication_status.vue index b279a23f73cd1827c59feedccdcdd00603cc6066..fd2f4eb3f510cebfce1772607e80a4b0204e99ca 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_replication_status.vue +++ b/ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_replication_status.vue @@ -1,10 +1,10 @@ <script> import { GlIcon, GlPopover, GlLink } from '@gitlab/ui'; -import { REPLICATION_STATUS_UI, REPLICATION_PAUSE_URL } from 'ee/geo_nodes/constants'; +import { REPLICATION_STATUS_UI, REPLICATION_PAUSE_URL } from 'ee/geo_sites/constants'; import { __, s__ } from '~/locale'; export default { - name: 'GeoNodeReplicationStatus', + name: 'GeoSiteReplicationStatus', i18n: { pauseHelpText: s__('Geo|Geo sites are paused using a command run on the site'), learnMore: __('Learn more'), @@ -15,14 +15,14 @@ export default { GlLink, }, props: { - node: { + site: { type: Object, required: true, }, }, computed: { replicationStatusUi() { - return this.node.enabled ? REPLICATION_STATUS_UI.enabled : REPLICATION_STATUS_UI.disabled; + return this.site.enabled ? REPLICATION_STATUS_UI.enabled : REPLICATION_STATUS_UI.disabled; }, }, REPLICATION_PAUSE_URL, diff --git a/ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_replication_status_mobile.vue b/ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_replication_status_mobile.vue similarity index 88% rename from ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_replication_status_mobile.vue rename to ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_replication_status_mobile.vue index a016c635f0cae6e0da81c1f8fb6a81e68e2a8920..7b929d3e145dd07d7a0e24257033cfbb051cdf0f 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_replication_status_mobile.vue +++ b/ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_replication_status_mobile.vue @@ -1,10 +1,10 @@ <script> -import GeoNodeProgressBar from 'ee/geo_nodes/components/details/geo_node_progress_bar.vue'; +import GeoSiteProgressBar from 'ee/geo_sites/components/details/geo_site_progress_bar.vue'; export default { - name: 'GeoNodeReplicationStatusMobile', + name: 'GeoSiteReplicationStatusMobile', components: { - GeoNodeProgressBar, + GeoSiteProgressBar, }, props: { item: { @@ -23,7 +23,7 @@ export default { <div> <div class="gl-mb-5 gl-display-flex gl-flex-direction-column" data-testid="sync-status"> <span class="gl-font-sm gl-mb-3">{{ translations.syncStatus }}</span> - <geo-node-progress-bar + <geo-site-progress-bar v-if="item.syncValues" :title=" /* eslint-disable @gitlab/vue-no-new-non-primitive-in-template */ @@ -38,7 +38,7 @@ export default { </div> <div class="gl-display-flex gl-flex-direction-column" data-testid="verification-status"> <span class="gl-font-sm gl-mb-3">{{ translations.verifStatus }}</span> - <geo-node-progress-bar + <geo-site-progress-bar v-if="item.verificationValues" :title=" /* eslint-disable @gitlab/vue-no-new-non-primitive-in-template */ diff --git a/ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_replication_summary.vue b/ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_replication_summary.vue similarity index 67% rename from ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_replication_summary.vue rename to ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_replication_summary.vue index 698524408a5965aabb10894ebd455f306b002df3..bf88ad6a3a63ab2489cea22253e85e244cb60d86 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_replication_summary.vue +++ b/ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_replication_summary.vue @@ -1,12 +1,12 @@ <script> import { GlCard, GlButton } from '@gitlab/ui'; import { s__ } from '~/locale'; -import GeoNodeReplicationCounts from './geo_node_replication_counts.vue'; -import GeoNodeReplicationStatus from './geo_node_replication_status.vue'; -import GeoNodeSyncSettings from './geo_node_sync_settings.vue'; +import GeoSiteReplicationCounts from './geo_site_replication_counts.vue'; +import GeoSiteReplicationStatus from './geo_site_replication_status.vue'; +import GeoSiteSyncSettings from './geo_site_sync_settings.vue'; export default { - name: 'GeoNodeReplicationSummary', + name: 'GeoSiteReplicationSummary', i18n: { replicationSummary: s__('Geo|Replication summary'), replicationDetailsButton: s__('Geo|Full details'), @@ -16,12 +16,12 @@ export default { components: { GlCard, GlButton, - GeoNodeReplicationStatus, - GeoNodeSyncSettings, - GeoNodeReplicationCounts, + GeoSiteReplicationStatus, + GeoSiteSyncSettings, + GeoSiteReplicationCounts, }, props: { - node: { + site: { type: Object, required: true, }, @@ -38,19 +38,19 @@ export default { variant="confirm" icon="external-link" category="secondary" - :href="node.webGeoReplicationDetailsUrl" + :href="site.webGeoReplicationDetailsUrl" target="_blank" >{{ $options.i18n.replicationDetailsButton }}</gl-button > </template> <div class="gl-display-flex gl-flex-direction-column gl-mb-5"> <span>{{ $options.i18n.replicationStatus }}</span> - <geo-node-replication-status class="gl-mt-3" :node="node" /> + <geo-site-replication-status class="gl-mt-3" :site="site" /> </div> <div class="gl-display-flex gl-flex-direction-column gl-mb-5"> <span>{{ $options.i18n.syncSettings }}</span> - <geo-node-sync-settings class="gl-mt-2" :node="node" /> + <geo-site-sync-settings class="gl-mt-2" :site="site" /> </div> - <geo-node-replication-counts :node-id="node.id" class="gl-mb-5" /> + <geo-site-replication-counts :site-id="site.id" class="gl-mb-5" /> </gl-card> </template> diff --git a/ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_replication_sync_percentage.vue b/ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_replication_sync_percentage.vue similarity index 96% rename from ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_replication_sync_percentage.vue rename to ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_replication_sync_percentage.vue index 4d8547087ae1cb26c948786011c80a0d0bf1ba43..8f1d10a3e0fcf727489d242a060f7ff0bca55286 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_replication_sync_percentage.vue +++ b/ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_replication_sync_percentage.vue @@ -2,7 +2,7 @@ import { roundDownFloat } from '~/lib/utils/common_utils'; export default { - name: 'GeoNodeReplicationSyncPercentage', + name: 'GeoSiteReplicationSyncPercentage', props: { values: { type: Array, diff --git a/ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_secondary_other_info.vue b/ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_secondary_other_info.vue similarity index 83% rename from ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_secondary_other_info.vue rename to ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_secondary_other_info.vue index bb131423ede4adef7d36bfa985115916a7cdf959..d1a1238211bb5412390444eed597072095d35f66 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_secondary_other_info.vue +++ b/ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_secondary_other_info.vue @@ -5,7 +5,7 @@ import { __, s__ } from '~/locale'; import TimeAgo from '~/vue_shared/components/time_ago_tooltip.vue'; export default { - name: 'GeoNodeSecondaryOtherInfo', + name: 'GeoSiteSecondaryOtherInfo', i18n: { otherInfo: __('Other information'), dbReplicationLag: s__('Geo|Data replication lag'), @@ -22,24 +22,24 @@ export default { TimeAgo, }, props: { - node: { + site: { type: Object, required: true, }, }, computed: { storageShardsStatus() { - if (this.node.storageShardsMatch == null) { + if (this.site.storageShardsMatch == null) { return this.$options.i18n.unknown; } - return this.node.storageShardsMatch + return this.site.storageShardsMatch ? this.$options.i18n.ok : this.$options.i18n.shardsNotMatched; }, dbReplicationLag() { - if (parseInt(this.node.dbReplicationLagSeconds, 10) >= 0) { - const parsedTime = parseSeconds(this.node.dbReplicationLagSeconds, { + if (parseInt(this.site.dbReplicationLagSeconds, 10) >= 0) { + const parsedTime = parseSeconds(this.site.dbReplicationLagSeconds, { hoursPerDay: 24, daysPerWeek: 7, }); @@ -51,17 +51,17 @@ export default { }, lastEventTimestamp() { // Converting timestamp to ms - return this.node.lastEventTimestamp * 1000; + return this.site.lastEventTimestamp * 1000; }, lastCursorEventTimestamp() { // Converting timestamp to ms - return this.node.cursorLastEventTimestamp * 1000; + return this.site.cursorLastEventTimestamp * 1000; }, hasEventInfo() { - return this.node.lastEventId || this.lastEventTimestamp; + return this.site.lastEventId || this.lastEventTimestamp; }, hasCursorEventInfo() { - return this.node.cursorLastEventId || this.lastCursorEventTimestamp; + return this.site.cursorLastEventId || this.lastCursorEventTimestamp; }, }, }; @@ -82,7 +82,7 @@ export default { <span>{{ $options.i18n.lastEventId }}</span> <div class="gl-font-weight-bold gl-mt-2" data-testid="last-event"> <template v-if="hasEventInfo"> - <span v-if="node.lastEventId">{{ node.lastEventId }}</span> + <span v-if="site.lastEventId">{{ site.lastEventId }}</span> <span v-if="lastEventTimestamp" :class="$options.classTimestamp"> <time-ago :time="lastEventTimestamp" /> </span> @@ -94,7 +94,7 @@ export default { <span>{{ $options.i18n.lastCursorEventId }}</span> <div class="gl-font-weight-bold gl-mt-2" data-testid="last-cursor-event"> <template v-if="hasCursorEventInfo"> - <span v-if="node.cursorLastEventId">{{ node.cursorLastEventId }}</span> + <span v-if="site.cursorLastEventId">{{ site.cursorLastEventId }}</span> <span v-if="lastCursorEventTimestamp" :class="$options.classTimestamp"> <time-ago :time="lastCursorEventTimestamp" /> </span> diff --git a/ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_sync_settings.vue b/ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_sync_settings.vue similarity index 78% rename from ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_sync_settings.vue rename to ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_sync_settings.vue index 648b29743b0a33875a6b990f48f389d31d68b463..b2e912f47b4d37f1c80b9a1690035ec01c48c531 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/details/secondary_node/geo_node_sync_settings.vue +++ b/ee/app/assets/javascripts/geo_sites/components/details/secondary_site/geo_site_sync_settings.vue @@ -3,7 +3,7 @@ import { timeIntervalInWords } from '~/lib/utils/datetime_utility'; import { sprintf, __, s__ } from '~/locale'; export default { - name: 'GeoNodeSyncSettings', + name: 'GeoSiteSyncSettings', i18n: { full: __('Full'), groups: __('groups'), @@ -11,7 +11,7 @@ export default { pendingEvents: s__('Geo|%{timeAgoStr} (%{pendingEvents} events)'), }, props: { - node: { + site: { type: Object, required: true, }, @@ -19,27 +19,27 @@ export default { computed: { syncType() { - if (this.node.selectiveSyncType === null || this.node.selectiveSyncType === '') { + if (this.site.selectiveSyncType === null || this.site.selectiveSyncType === '') { return this.$options.i18n.full; } // Renaming namespaces to groups in the UI for Geo Selective Sync const syncLabel = - this.node.selectiveSyncType === 'namespaces' + this.site.selectiveSyncType === 'namespaces' ? this.$options.i18n.groups - : this.node.selectiveSyncType; + : this.site.selectiveSyncType; return sprintf(this.$options.i18n.syncLabel, { syncLabel }); }, eventTimestampEmpty() { - return !this.node.lastEventTimestamp || !this.node.cursorLastEventTimestamp; + return !this.site.lastEventTimestamp || !this.site.cursorLastEventTimestamp; }, syncLagInSeconds() { - return this.node.cursorLastEventTimestamp - this.node.lastEventTimestamp; + return this.site.cursorLastEventTimestamp - this.site.lastEventTimestamp; }, syncStatusEventInfo() { const timeAgoStr = timeIntervalInWords(this.syncLagInSeconds); - const pendingEvents = this.node.lastEventId - this.node.cursorLastEventId; + const pendingEvents = this.site.lastEventId - this.site.cursorLastEventId; return sprintf(this.$options.i18n.pendingEvents, { timeAgoStr, diff --git a/ee/app/assets/javascripts/geo_nodes/components/geo_nodes.vue b/ee/app/assets/javascripts/geo_sites/components/geo_sites.vue similarity index 58% rename from ee/app/assets/javascripts/geo_nodes/components/geo_nodes.vue rename to ee/app/assets/javascripts/geo_sites/components/geo_sites.vue index 5d9391996e2d04b47205a11be23f6b7c6ecc3293..bb5ab2ced6d2dd1b15c12e701c9b5d825be84a3e 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/geo_nodes.vue +++ b/ee/app/assets/javascripts/geo_sites/components/geo_sites.vue @@ -1,15 +1,15 @@ <script> -import GeoNodeDetails from './details/geo_node_details.vue'; -import GeoNodeHeader from './header/geo_node_header.vue'; +import GeoSiteDetails from './details/geo_site_details.vue'; +import GeoSiteHeader from './header/geo_site_header.vue'; export default { - name: 'GeoNodes', + name: 'GeoSites', components: { - GeoNodeHeader, - GeoNodeDetails, + GeoSiteHeader, + GeoSiteDetails, }, props: { - node: { + site: { type: Object, required: true, validator: (value) => ['id', 'name', 'url'].every((prop) => value[prop]), @@ -30,7 +30,7 @@ export default { <template> <div class="gl-mb-4"> - <geo-node-header :node="node" :collapsed="collapsed" @collapse="toggleCollapse" /> - <geo-node-details v-if="!collapsed" :node="node" /> + <geo-site-header :site="site" :collapsed="collapsed" @collapse="toggleCollapse" /> + <geo-site-details v-if="!collapsed" :site="site" /> </div> </template> diff --git a/ee/app/assets/javascripts/geo_nodes/components/geo_nodes_empty_state.vue b/ee/app/assets/javascripts/geo_sites/components/geo_sites_empty_state.vue similarity index 91% rename from ee/app/assets/javascripts/geo_nodes/components/geo_nodes_empty_state.vue rename to ee/app/assets/javascripts/geo_sites/components/geo_sites_empty_state.vue index df792ef35f7bd42a6a29b9f58fa4b128ef7e5c12..ed2dab6cba23e902eba3d5c763383a4372493976 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/geo_nodes_empty_state.vue +++ b/ee/app/assets/javascripts/geo_sites/components/geo_sites_empty_state.vue @@ -4,7 +4,7 @@ import { s__ } from '~/locale'; import { GEO_INFO_URL } from '../constants'; export default { - name: 'GeoNodesEmptyState', + name: 'GeoSitesEmptyState', i18n: { learnMoreButtonText: s__('Geo|Learn more about Geo'), }, @@ -12,7 +12,7 @@ export default { GlEmptyState, }, inject: { - geoNodesEmptyStateSvg: { + geoSitesEmptyStateSvg: { default: '', }, }, @@ -46,7 +46,7 @@ export default { <template> <gl-empty-state :title="title" - :svg-path="geoNodesEmptyStateSvg" + :svg-path="geoSitesEmptyStateSvg" :description="description" :primary-button-link="primaryButtonLink" :primary-button-text="primaryButtonText" diff --git a/ee/app/assets/javascripts/geo_nodes/components/geo_nodes_filters.vue b/ee/app/assets/javascripts/geo_sites/components/geo_sites_filters.vue similarity index 93% rename from ee/app/assets/javascripts/geo_nodes/components/geo_nodes_filters.vue rename to ee/app/assets/javascripts/geo_sites/components/geo_sites_filters.vue index 9e576d08d99a5793b4ca08e9a1c444fda538dbc4..481912383f05007fdd94f73406562ed14fa57fbc 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/geo_nodes_filters.vue +++ b/ee/app/assets/javascripts/geo_sites/components/geo_sites_filters.vue @@ -3,10 +3,10 @@ import { GlTabs, GlTab, GlBadge, GlSearchBoxByType } from '@gitlab/ui'; import { mapGetters, mapActions, mapState } from 'vuex'; import { setUrlParams, updateHistory } from '~/lib/utils/url_utility'; import { s__ } from '~/locale'; -import { HEALTH_STATUS_UI, STATUS_FILTER_QUERY_PARAM } from 'ee/geo_nodes/constants'; +import { HEALTH_STATUS_UI, STATUS_FILTER_QUERY_PARAM } from 'ee/geo_sites/constants'; export default { - name: 'GeoNodesFilters', + name: 'GeoSitesFilters', i18n: { allTab: s__('Geo|All'), searchPlaceholder: s__('Geo|Filter Geo sites'), @@ -18,7 +18,7 @@ export default { GlSearchBoxByType, }, props: { - totalNodes: { + totalSites: { type: Number, required: false, default: 0, @@ -36,7 +36,7 @@ export default { }, }, tabs() { - const ALL_TAB = { text: this.$options.i18n.allTab, count: this.totalNodes, status: null }; + const ALL_TAB = { text: this.$options.i18n.allTab, count: this.totalSites, status: null }; const tabs = [ALL_TAB]; Object.entries(HEALTH_STATUS_UI).forEach(([status, tab]) => { @@ -67,7 +67,7 @@ export default { <template> <gl-tabs - class="gl-display-grid geo-node-filter-grid-columns" + class="gl-display-grid geo-site-filter-grid-columns" sync-active-tab-with-query-params :query-param-name="$options.STATUS_FILTER_QUERY_PARAM" data-testid="geo-sites-filter" diff --git a/ee/app/assets/javascripts/geo_sites/components/header/geo_site_actions.vue b/ee/app/assets/javascripts/geo_sites/components/header/geo_site_actions.vue new file mode 100644 index 0000000000000000000000000000000000000000..fe6c0227ea1082d89fae29e9efdc77cceb72e3dd --- /dev/null +++ b/ee/app/assets/javascripts/geo_sites/components/header/geo_site_actions.vue @@ -0,0 +1,39 @@ +<script> +import { mapActions } from 'vuex'; +import { REMOVE_SITE_MODAL_ID } from 'ee/geo_sites/constants'; +import { BV_SHOW_MODAL } from '~/lib/utils/constants'; +import GeoSiteActionsDesktop from './geo_site_actions_desktop.vue'; +import GeoSiteActionsMobile from './geo_site_actions_mobile.vue'; + +export default { + name: 'GeoSiteActions', + components: { + GeoSiteActionsMobile, + GeoSiteActionsDesktop, + }, + props: { + site: { + type: Object, + required: true, + }, + }, + methods: { + ...mapActions(['prepSiteRemoval']), + async warnSiteRemoval() { + await this.prepSiteRemoval(this.site.id); + this.$root.$emit(BV_SHOW_MODAL, REMOVE_SITE_MODAL_ID); + }, + }, +}; +</script> + +<template> + <div> + <geo-site-actions-mobile class="gl-lg-display-none" :site="site" @remove="warnSiteRemoval" /> + <geo-site-actions-desktop + class="gl-display-none gl-lg-display-flex" + :site="site" + @remove="warnSiteRemoval" + /> + </div> +</template> diff --git a/ee/app/assets/javascripts/geo_nodes/components/header/geo_node_actions_desktop.vue b/ee/app/assets/javascripts/geo_sites/components/header/geo_site_actions_desktop.vue similarity index 79% rename from ee/app/assets/javascripts/geo_nodes/components/header/geo_node_actions_desktop.vue rename to ee/app/assets/javascripts/geo_sites/components/header/geo_site_actions_desktop.vue index 3d0966618ae34e9fce5b1f16388cd66c71b0cb88..3db3dcb816817d74d12f6f34265c3a95adb4a801 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/header/geo_node_actions_desktop.vue +++ b/ee/app/assets/javascripts/geo_sites/components/header/geo_site_actions_desktop.vue @@ -4,10 +4,10 @@ import { mapGetters } from 'vuex'; import { s__ } from '~/locale'; export default { - name: 'GeoNodeActionsDesktop', + name: 'GeoSiteActionsDesktop', i18n: { - editButtonTooltip: s__('Geo|Edit %{nodeType} site'), - removeButtonTooltip: s__('Geo|Remove %{nodeType} site'), + editButtonTooltip: s__('Geo|Edit %{siteType} site'), + removeButtonTooltip: s__('Geo|Remove %{siteType} site'), }, components: { GlButton, @@ -16,15 +16,15 @@ export default { GlTooltip: GlTooltipDirective, }, props: { - node: { + site: { type: Object, required: true, }, }, computed: { ...mapGetters(['canRemoveSite']), - nodeType() { - return this.node.primary ? s__('Geo|primary') : s__('Geo|secondary'); + siteType() { + return this.site.primary ? s__('Geo|primary') : s__('Geo|secondary'); }, }, }; @@ -37,36 +37,36 @@ export default { :title=" /* eslint-disable @gitlab/vue-no-new-non-primitive-in-template */ sprintf( $options.i18n.editButtonTooltip, - { nodeType }, + { siteType }, ) /* eslint-enable @gitlab/vue-no-new-non-primitive-in-template */ " :aria-label=" /* eslint-disable @gitlab/vue-no-new-non-primitive-in-template */ sprintf( $options.i18n.editButtonTooltip, - { nodeType }, + { siteType }, ) /* eslint-enable @gitlab/vue-no-new-non-primitive-in-template */ " icon="pencil" class="gl-mr-3" data-testid="geo-desktop-edit-action" - :href="node.webEditUrl" + :href="site.webEditUrl" /> <gl-button v-gl-tooltip :title=" /* eslint-disable @gitlab/vue-no-new-non-primitive-in-template */ sprintf( $options.i18n.removeButtonTooltip, - { nodeType }, + { siteType }, ) /* eslint-enable @gitlab/vue-no-new-non-primitive-in-template */ " :aria-label=" /* eslint-disable @gitlab/vue-no-new-non-primitive-in-template */ sprintf( $options.i18n.removeButtonTooltip, - { nodeType }, + { siteType }, ) /* eslint-enable @gitlab/vue-no-new-non-primitive-in-template */ " icon="remove" - :disabled="!canRemoveSite(node.id)" + :disabled="!canRemoveSite(site.id)" data-testid="geo-desktop-remove-action" @click="$emit('remove')" /> diff --git a/ee/app/assets/javascripts/geo_nodes/components/header/geo_node_actions_mobile.vue b/ee/app/assets/javascripts/geo_sites/components/header/geo_site_actions_mobile.vue similarity index 81% rename from ee/app/assets/javascripts/geo_nodes/components/header/geo_node_actions_mobile.vue rename to ee/app/assets/javascripts/geo_sites/components/header/geo_site_actions_mobile.vue index 6a4c5492e23871969310ba2b68a8e19302102e5e..d8c248c7239a496a3c533839db94480a49fad662 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/header/geo_node_actions_mobile.vue +++ b/ee/app/assets/javascripts/geo_sites/components/header/geo_site_actions_mobile.vue @@ -4,7 +4,7 @@ import { mapGetters } from 'vuex'; import { __ } from '~/locale'; export default { - name: 'GeoNodeActionsMobile', + name: 'GeoSiteActionsMobile', i18n: { editButtonLabel: __('Edit'), removeButtonLabel: __('Remove'), @@ -15,7 +15,7 @@ export default { GlIcon, }, props: { - node: { + site: { type: Object, required: true, }, @@ -23,7 +23,7 @@ export default { computed: { ...mapGetters(['canRemoveSite']), dropdownRemoveClass() { - return this.canRemoveSite(this.node.id) ? 'gl-text-red-500' : 'gl-text-gray-400'; + return this.canRemoveSite(this.site.id) ? 'gl-text-red-500' : 'gl-text-gray-400'; }, }, }; @@ -34,9 +34,9 @@ export default { <template #button-content> <gl-icon name="ellipsis_h" /> </template> - <gl-dropdown-item :href="node.webEditUrl">{{ $options.i18n.editButtonLabel }}</gl-dropdown-item> + <gl-dropdown-item :href="site.webEditUrl">{{ $options.i18n.editButtonLabel }}</gl-dropdown-item> <gl-dropdown-item - :disabled="!canRemoveSite(node.id)" + :disabled="!canRemoveSite(site.id)" data-testid="geo-mobile-remove-action" @click="$emit('remove')" > diff --git a/ee/app/assets/javascripts/geo_nodes/components/header/geo_node_header.vue b/ee/app/assets/javascripts/geo_sites/components/header/geo_site_header.vue similarity index 71% rename from ee/app/assets/javascripts/geo_nodes/components/header/geo_node_header.vue rename to ee/app/assets/javascripts/geo_sites/components/header/geo_site_header.vue index 82d402db012fc4e553051742dfa9bb32326d6182..c99ebec7036f7dea8bad5f207e1fc3e1be1e231e 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/header/geo_node_header.vue +++ b/ee/app/assets/javascripts/geo_sites/components/header/geo_site_header.vue @@ -1,24 +1,24 @@ <script> import { GlButton } from '@gitlab/ui'; import { __ } from '~/locale'; -import GeoNodeActions from './geo_node_actions.vue'; -import GeoNodeHealthStatus from './geo_node_health_status.vue'; -import GeoNodeLastUpdated from './geo_node_last_updated.vue'; +import GeoSiteActions from './geo_site_actions.vue'; +import GeoSiteHealthStatus from './geo_site_health_status.vue'; +import GeoSiteLastUpdated from './geo_site_last_updated.vue'; export default { - name: 'GeoNodeHeader', + name: 'GeoSiteHeader', i18n: { expand: __('Expand'), collapse: __('Collapse'), }, components: { GlButton, - GeoNodeHealthStatus, - GeoNodeLastUpdated, - GeoNodeActions, + GeoSiteHealthStatus, + GeoSiteLastUpdated, + GeoSiteActions, }, props: { - node: { + site: { type: Object, required: true, }, @@ -36,8 +36,8 @@ export default { return this.collapsed ? this.$options.i18n.expand : this.$options.i18n.collapse; }, statusCheckTimestamp() { - return this.node.lastSuccessfulStatusCheckTimestamp - ? this.node.lastSuccessfulStatusCheckTimestamp * 1000 // Converting timestamp to ms + return this.site.lastSuccessfulStatusCheckTimestamp + ? this.site.lastSuccessfulStatusCheckTimestamp * 1000 // Converting timestamp to ms : null; }, }, @@ -46,7 +46,7 @@ export default { <template> <div - class="gl-display-grid geo-node-header-grid-columns gl-bg-gray-10 gl-border-b-1 gl-border-b-solid gl-border-b-gray-100 gl-border-t-1 gl-border-t-solid gl-border-t-gray-100 gl-py-3 gl-px-5" + class="gl-display-grid geo-site-header-grid-columns gl-bg-gray-10 gl-border-b-1 gl-border-b-solid gl-border-b-gray-100 gl-border-t-1 gl-border-t-solid gl-border-t-gray-100 gl-py-3 gl-px-5" > <div class="gl-display-flex gl-align-items-center"> <gl-button @@ -61,21 +61,21 @@ export default { class="gl-display-flex gl-flex-direction-column gl-md-flex-direction-row gl-md-align-items-center gl-flex-grow-1" > <div class="gl-display-flex gl-align-items-center gl-flex-grow-1 gl-flex-basis-0"> - <h4 class="gl-font-lg">{{ node.name }}</h4> + <h4 class="gl-font-lg">{{ site.name }}</h4> </div> <div class="gl-display-flex gl-align-items-center gl-flex-grow-2 gl-flex-basis-0"> - <geo-node-health-status :status="node.healthStatus" /> - <geo-node-last-updated + <geo-site-health-status :status="site.healthStatus" /> + <geo-site-last-updated v-if="statusCheckTimestamp" class="gl-ml-2" :status-check-timestamp="statusCheckTimestamp" - :primary="node.primary" + :primary="site.primary" /> </div> </div> </div> <div class="gl-display-flex gl-align-items-center gl-justify-content-end"> - <geo-node-actions :node="node" /> + <geo-site-actions :site="site" /> </div> </div> </template> diff --git a/ee/app/assets/javascripts/geo_nodes/components/header/geo_node_health_status.vue b/ee/app/assets/javascripts/geo_sites/components/header/geo_site_health_status.vue similarity index 89% rename from ee/app/assets/javascripts/geo_nodes/components/header/geo_node_health_status.vue rename to ee/app/assets/javascripts/geo_sites/components/header/geo_site_health_status.vue index f60b54a3f5b8fab1248d382848e334ea05fb2407..0ab85578b5a7085366b6711e92b33de144e1d04d 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/header/geo_node_health_status.vue +++ b/ee/app/assets/javascripts/geo_sites/components/header/geo_site_health_status.vue @@ -1,6 +1,6 @@ <script> import { GlBadge } from '@gitlab/ui'; -import { HEALTH_STATUS_UI } from 'ee/geo_nodes/constants'; +import { HEALTH_STATUS_UI } from 'ee/geo_sites/constants'; export default { components: { diff --git a/ee/app/assets/javascripts/geo_nodes/components/header/geo_node_last_updated.vue b/ee/app/assets/javascripts/geo_sites/components/header/geo_site_last_updated.vue similarity index 95% rename from ee/app/assets/javascripts/geo_nodes/components/header/geo_node_last_updated.vue rename to ee/app/assets/javascripts/geo_sites/components/header/geo_site_last_updated.vue index eb21af49d35289f92004844ff96b72699fc3b5ee..4f5cb7b435d41988ccfe898800455ce23dcdd9de 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/header/geo_node_last_updated.vue +++ b/ee/app/assets/javascripts/geo_sites/components/header/geo_site_last_updated.vue @@ -1,15 +1,15 @@ <script> import { GlPopover, GlLink, GlIcon, GlSprintf } from '@gitlab/ui'; import { - HELP_NODE_HEALTH_URL, + HELP_SITE_HEALTH_URL, GEO_TROUBLESHOOTING_URL, STATUS_DELAY_THRESHOLD_MS, -} from 'ee/geo_nodes/constants'; +} from 'ee/geo_sites/constants'; import { s__ } from '~/locale'; import TimeAgo from '~/vue_shared/components/time_ago_tooltip.vue'; export default { - name: 'GeoNodeLastUpdated', + name: 'GeoSiteLastUpdated', i18n: { troubleshootText: s__('Geo|Consult Geo troubleshooting information'), learnMoreText: s__('Geo|Learn more about Geo site statuses'), @@ -49,7 +49,7 @@ export default { return { text: this.$options.i18n.learnMoreText, - link: HELP_NODE_HEALTH_URL, + link: HELP_SITE_HEALTH_URL, }; }, showPopover() { diff --git a/ee/app/assets/javascripts/geo_nodes/constants.js b/ee/app/assets/javascripts/geo_sites/constants.js similarity index 94% rename from ee/app/assets/javascripts/geo_nodes/constants.js rename to ee/app/assets/javascripts/geo_sites/constants.js index c72db0709711c425676bec3aa7137f75d7e16843..a3451565e4c67a4a3c9643789ed6aa9097fc1c1f 100644 --- a/ee/app/assets/javascripts/geo_nodes/constants.js +++ b/ee/app/assets/javascripts/geo_sites/constants.js @@ -3,7 +3,7 @@ import { __, s__ } from '~/locale'; export const GEO_INFO_URL = helpPagePath('administration/geo/index.md'); -export const HELP_NODE_HEALTH_URL = helpPagePath( +export const HELP_SITE_HEALTH_URL = helpPagePath( 'administration/geo/replication/troubleshooting.html', { anchor: 'check-the-health-of-the-secondary-site' }, ); @@ -67,6 +67,6 @@ export const REPLICATION_STATUS_UI = { export const STATUS_DELAY_THRESHOLD_MS = 600000; -export const REMOVE_NODE_MODAL_ID = 'remove-node-modal'; +export const REMOVE_SITE_MODAL_ID = 'remove-site-modal'; export const STATUS_FILTER_QUERY_PARAM = 'status'; diff --git a/ee/app/assets/javascripts/geo_nodes/index.js b/ee/app/assets/javascripts/geo_sites/index.js similarity index 55% rename from ee/app/assets/javascripts/geo_nodes/index.js rename to ee/app/assets/javascripts/geo_sites/index.js index ee2265ef6e4d1a3f9aa7fdd510445b70bce2e810..dde2e4a5dce3a07c50efe1c384b18f2e5e01eac6 100644 --- a/ee/app/assets/javascripts/geo_nodes/index.js +++ b/ee/app/assets/javascripts/geo_sites/index.js @@ -2,18 +2,21 @@ import Vue from 'vue'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { getParameterByName } from '~/lib/utils/url_utility'; import Translate from '~/vue_shared/translate'; -import GeoNodesApp from './components/app.vue'; +import GeoSitesApp from './components/app.vue'; import createStore from './store'; Vue.use(Translate); -export const initGeoNodes = () => { - const el = document.getElementById('js-geo-nodes'); +export const initGeoSites = () => { + // This file is set up to provide multi-version support in case the Rails bundle doesn't update. + // See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/113771#note_1306337644 + const el = document.getElementById('js-geo-sites') || document.getElementById('js-geo-nodes'); if (!el) { return false; } + const { newSiteUrl, geoSitesEmptyStateSvg } = el.dataset; const { newNodeUrl, geoNodesEmptyStateSvg } = el.dataset; const searchFilter = getParameterByName('search') || ''; let { replicableTypes } = el.dataset; @@ -24,12 +27,12 @@ export const initGeoNodes = () => { el, store: createStore({ replicableTypes, searchFilter }), provide: { - geoNodesEmptyStateSvg, + geoSitesEmptyStateSvg: geoSitesEmptyStateSvg || geoNodesEmptyStateSvg, }, render(createElement) { - return createElement(GeoNodesApp, { + return createElement(GeoSitesApp, { props: { - newNodeUrl, + newSiteUrl: newSiteUrl || newNodeUrl, }, }); }, diff --git a/ee/app/assets/javascripts/geo_nodes/store/actions.js b/ee/app/assets/javascripts/geo_sites/store/actions.js similarity index 100% rename from ee/app/assets/javascripts/geo_nodes/store/actions.js rename to ee/app/assets/javascripts/geo_sites/store/actions.js diff --git a/ee/app/assets/javascripts/geo_nodes/store/getters.js b/ee/app/assets/javascripts/geo_sites/store/getters.js similarity index 100% rename from ee/app/assets/javascripts/geo_nodes/store/getters.js rename to ee/app/assets/javascripts/geo_sites/store/getters.js diff --git a/ee/app/assets/javascripts/geo_nodes/store/index.js b/ee/app/assets/javascripts/geo_sites/store/index.js similarity index 100% rename from ee/app/assets/javascripts/geo_nodes/store/index.js rename to ee/app/assets/javascripts/geo_sites/store/index.js diff --git a/ee/app/assets/javascripts/geo_nodes/store/mutation_types.js b/ee/app/assets/javascripts/geo_sites/store/mutation_types.js similarity index 100% rename from ee/app/assets/javascripts/geo_nodes/store/mutation_types.js rename to ee/app/assets/javascripts/geo_sites/store/mutation_types.js diff --git a/ee/app/assets/javascripts/geo_nodes/store/mutations.js b/ee/app/assets/javascripts/geo_sites/store/mutations.js similarity index 100% rename from ee/app/assets/javascripts/geo_nodes/store/mutations.js rename to ee/app/assets/javascripts/geo_sites/store/mutations.js diff --git a/ee/app/assets/javascripts/geo_nodes/store/state.js b/ee/app/assets/javascripts/geo_sites/store/state.js similarity index 100% rename from ee/app/assets/javascripts/geo_nodes/store/state.js rename to ee/app/assets/javascripts/geo_sites/store/state.js diff --git a/ee/app/assets/javascripts/pages/admin/geo/nodes/index.js b/ee/app/assets/javascripts/pages/admin/geo/nodes/index.js index 3975a6711d310468f16176b0956d87cb48fbb39d..c6f1b2f3f4bbb0528aacba0593e5cacd4f41fc33 100644 --- a/ee/app/assets/javascripts/pages/admin/geo/nodes/index.js +++ b/ee/app/assets/javascripts/pages/admin/geo/nodes/index.js @@ -1,3 +1,3 @@ -import { initGeoNodes } from 'ee/geo_nodes'; +import { initGeoSites } from 'ee/geo_sites'; -initGeoNodes(); +initGeoSites(); diff --git a/ee/app/helpers/ee/geo_helper.rb b/ee/app/helpers/ee/geo_helper.rb index daf5de38a5032dc08af2091eb32ac47fddd156f0..2450121ff0f16991c7255ed8b4c8bab1105d1534 100644 --- a/ee/app/helpers/ee/geo_helper.rb +++ b/ee/app/helpers/ee/geo_helper.rb @@ -16,11 +16,11 @@ def self.current_node_human_status s_('Geo|misconfigured') end - def node_vue_list_properties + def geo_sites_vue_data { replicable_types: replicable_types.to_json, - new_node_url: new_admin_geo_node_path, - geo_nodes_empty_state_svg: image_path("illustrations/empty-state/geo-empty.svg") + new_site_url: new_admin_geo_node_path, + geo_sites_empty_state_svg: image_path("illustrations/empty-state/geo-empty.svg") } end diff --git a/ee/app/views/admin/geo/nodes/index.html.haml b/ee/app/views/admin/geo/nodes/index.html.haml index 91166afa6e3440a06519ea34466c2b237ebfc1f2..dc9f61b2ad149d6918d80e352e8ee64cf1f7ec4e 100644 --- a/ee/app/views/admin/geo/nodes/index.html.haml +++ b/ee/app/views/admin/geo/nodes/index.html.haml @@ -1,7 +1,7 @@ -- add_page_specific_style 'page_bundles/admin/geo_nodes' +- add_page_specific_style 'page_bundles/admin/geo_sites' - page_title _('Geo sites') = render partial: 'admin/geo/shared/hashed_storage_alerts' = render partial: 'admin/geo/shared/license_alert' -#js-geo-nodes{ data: node_vue_list_properties } +#js-geo-sites{ data: geo_sites_vue_data } diff --git a/ee/spec/features/admin/geo/admin_geo_nodes_spec.rb b/ee/spec/features/admin/geo/admin_geo_nodes_spec.rb index 7eb002715fceac9193a23103918e676651c498bc..95c3102b8d0d975d02c2971d3bc6b3d990ec7e41 100644 --- a/ee/spec/features/admin/geo/admin_geo_nodes_spec.rb +++ b/ee/spec/features/admin/geo/admin_geo_nodes_spec.rb @@ -40,7 +40,7 @@ def expect_breadcrumb(text) it 'shows all public Geo Sites and Add site link' do expect(page).to have_link('Add site', href: new_admin_geo_node_path) - page.within(find('.geo-node-core-details-grid-columns', match: :first)) do + page.within(find('.geo-site-core-details-grid-columns', match: :first)) do expect(page).to have_content(geo_site.url) end end @@ -155,7 +155,7 @@ def expect_breadcrumb(text) wait_for_requests expect(page).to have_current_path admin_geo_nodes_path, ignore_query: true - page.within(find('.geo-node-core-details-grid-columns', match: :first)) do + page.within(find('.geo-site-core-details-grid-columns', match: :first)) do expect(page).to have_content(geo_site.url) end end @@ -180,7 +180,7 @@ def expect_breadcrumb(text) wait_for_requests expect(page).to have_current_path admin_geo_nodes_path, ignore_query: true - page.within(find('.geo-node-core-details-grid-columns', match: :first)) do + page.within(find('.geo-site-core-details-grid-columns', match: :first)) do expect(page).to have_content('http://newsite.com') end end @@ -205,7 +205,7 @@ def expect_breadcrumb(text) expect(page).to have_current_path admin_geo_nodes_path, ignore_query: true wait_for_requests - expect(page).not_to have_css('.geo-node-core-details-grid-columns') + expect(page).not_to have_css('.geo-site-core-details-grid-columns') end end diff --git a/ee/spec/features/geo_node_spec.rb b/ee/spec/features/geo_node_spec.rb index 2230d658628c9bf1518e8eef46669c5d4069259e..d725c56961a168b34e66371801d27362aa4100ad 100644 --- a/ee/spec/features/geo_node_spec.rb +++ b/ee/spec/features/geo_node_spec.rb @@ -2,14 +2,14 @@ require 'spec_helper' -RSpec.describe 'GEO Nodes', :geo, feature_category: :geo_replication do +RSpec.describe 'Geo Sites', :geo, feature_category: :geo_replication do include ::EE::GeoHelpers let_it_be(:user) { create(:user) } let_it_be(:geo_primary) { create(:geo_node, :primary) } let_it_be(:geo_secondary) { create(:geo_node) } - context 'Geo Secondary Node' do + context 'Geo Secondary Site' do let(:project) { create(:project) } before do @@ -34,7 +34,7 @@ end end - context 'Primary Geo Node' do + context 'Primary Geo Site' do let(:admin_user) { create(:user, :admin) } before do @@ -45,8 +45,8 @@ gitlab_enable_admin_mode_sign_in(admin_user) end - describe 'Geo Nodes admin screen' do - it "has a 'Full details' button on listed secondary geo nodes pointing to correct URL", :js do + describe 'Geo Sites admin screen' do + it "has a 'Full details' button on listed secondary geo sites pointing to correct URL", :js do visit admin_geo_nodes_path expect(page).to have_content(geo_primary.url) @@ -56,14 +56,14 @@ expected_url = File.join(geo_secondary.url, "/admin/geo/sites/#{geo_secondary.id}/replication/lfs_objects") - expect(all('.geo-node-details-grid-columns').last).to have_link('Full details', href: expected_url) + expect(all('.geo-site-details-grid-columns').last).to have_link('Full details', href: expected_url) end - context 'Node Filters', :js do + context 'Site Filters', :js do it 'defaults to the All tab when a status query is not already set' do visit admin_geo_nodes_path tab_count = find('[data-testid="geo-sites-filter"] .active .badge').text.to_i - results_count = page.all('[data-testid="primary-nodes"]').length + page.all('[data-testid="secondary-nodes"]').length + results_count = page.all('[data-testid="primary-sites"]').length + page.all('[data-testid="secondary-sites"]').length expect(find('[data-testid="geo-sites-filter"] .active')).to have_content('All') expect(results_count).to be(tab_count) @@ -72,7 +72,7 @@ it 'sets the correct tab when a status query is already set' do visit admin_geo_nodes_path(status: 'unknown') tab_count = find('[data-testid="geo-sites-filter"] .active .badge').text.to_i - results_count = page.all('[data-testid="primary-nodes"]').length + page.all('[data-testid="secondary-nodes"]').length + results_count = page.all('[data-testid="primary-sites"]').length + page.all('[data-testid="secondary-sites"]').length expect(find('[data-testid="geo-sites-filter"] .active')).not_to have_content('All') expect(find('[data-testid="geo-sites-filter"] .active')).to have_content('Unknown') @@ -82,7 +82,7 @@ it 'properly updates the query and sets the tab when a new one is clicked' do visit admin_geo_nodes_path tab_count = find('[data-testid="geo-sites-filter"] .active .badge').text.to_i - results_count = page.all('[data-testid="primary-nodes"]').length + page.all('[data-testid="secondary-nodes"]').length + results_count = page.all('[data-testid="primary-sites"]').length + page.all('[data-testid="secondary-sites"]').length expect(find('[data-testid="geo-sites-filter"] .active')).to have_content('All') expect(results_count).to be(tab_count) @@ -91,7 +91,7 @@ wait_for_requests tab_count = find('[data-testid="geo-sites-filter"] .active .badge').text.to_i - results_count = page.all('[data-testid="primary-nodes"]').length + page.all('[data-testid="secondary-nodes"]').length + results_count = page.all('[data-testid="primary-sites"]').length + page.all('[data-testid="secondary-sites"]').length expect(find('[data-testid="geo-sites-filter"] .active')).not_to have_content('All') expect(find('[data-testid="geo-sites-filter"] .active')).to have_content('Unknown') @@ -99,13 +99,13 @@ expect(results_count).to be(tab_count) end - it 'properly updates the query and filters the nodes when a search is inputed' do + it 'properly updates the query and filters the sites when a search is inputed' do visit admin_geo_nodes_path fill_in 'Filter Geo sites', with: geo_secondary.name wait_for_requests - results_count = page.all('[data-testid="primary-nodes"]').length + page.all('[data-testid="secondary-nodes"]').length + results_count = page.all('[data-testid="primary-sites"]').length + page.all('[data-testid="secondary-sites"]').length expect(results_count).to be(1) expect(page).to have_current_path(admin_geo_nodes_path(search: geo_secondary.name)) @@ -114,7 +114,7 @@ it 'properly sets the search when a search query is already set' do visit admin_geo_nodes_path(search: geo_secondary.name) - results_count = page.all('[data-testid="primary-nodes"]').length + page.all('[data-testid="secondary-nodes"]').length + results_count = page.all('[data-testid="primary-sites"]').length + page.all('[data-testid="secondary-sites"]').length expect(find('input[placeholder="Filter Geo sites"]').value).to eq(geo_secondary.name) expect(results_count).to be(1) @@ -123,7 +123,7 @@ it 'properly handles both a status and search query' do visit admin_geo_nodes_path(status: 'unknown', search: geo_secondary.name) - results = page.all(:xpath, '//div[@data-testid="primary-nodes"] | //div[@data-testid="secondary-nodes"]') + results = page.all(:xpath, '//div[@data-testid="primary-sites"] | //div[@data-testid="secondary-sites"]') expect(find('[data-testid="geo-sites-filter"] .active')).to have_content('Unknown') expect(find("input[placeholder='Filter Geo sites']").value).to eq(geo_secondary.name) diff --git a/ee/spec/frontend/geo_nodes/components/details/geo_node_details_spec.js b/ee/spec/frontend/geo_nodes/components/details/geo_node_details_spec.js deleted file mode 100644 index 0afae0fb2388e2537a39f998beeef19328f4eeb8..0000000000000000000000000000000000000000 --- a/ee/spec/frontend/geo_nodes/components/details/geo_node_details_spec.js +++ /dev/null @@ -1,83 +0,0 @@ -import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; -import GeoNodeCoreDetails from 'ee/geo_nodes/components/details/geo_node_core_details.vue'; -import GeoNodeDetails from 'ee/geo_nodes/components/details/geo_node_details.vue'; -import GeoNodePrimaryOtherInfo from 'ee/geo_nodes/components/details/primary_node/geo_node_primary_other_info.vue'; -import GeoNodeVerificationInfo from 'ee/geo_nodes/components/details/primary_node/geo_node_verification_info.vue'; -import GeoNodeReplicationDetails from 'ee/geo_nodes/components/details/secondary_node/geo_node_replication_details.vue'; -import GeoNodeReplicationSummary from 'ee/geo_nodes/components/details/secondary_node/geo_node_replication_summary.vue'; -import GeoNodeSecondaryOtherInfo from 'ee/geo_nodes/components/details/secondary_node/geo_node_secondary_other_info.vue'; -import { MOCK_PRIMARY_SITE, MOCK_SECONDARY_SITE } from 'ee_jest/geo_nodes/mock_data'; - -describe('GeoNodeDetails', () => { - let wrapper; - - const defaultProps = { - node: MOCK_PRIMARY_SITE, - }; - - const createComponent = (props) => { - wrapper = shallowMountExtended(GeoNodeDetails, { - propsData: { - ...defaultProps, - ...props, - }, - }); - }; - - const findGeoNodeCoreDetails = () => wrapper.findComponent(GeoNodeCoreDetails); - const findGeoNodePrimaryOtherInfo = () => wrapper.findComponent(GeoNodePrimaryOtherInfo); - const findGeoNodeVerificationInfo = () => wrapper.findComponent(GeoNodeVerificationInfo); - const findGeoNodeSecondaryReplicationSummary = () => - wrapper.findComponent(GeoNodeReplicationSummary); - const findGeoNodeSecondaryOtherInfo = () => wrapper.findComponent(GeoNodeSecondaryOtherInfo); - const findGeoNodeSecondaryReplicationDetails = () => - wrapper.findComponent(GeoNodeReplicationDetails); - - describe('template', () => { - describe('always', () => { - beforeEach(() => { - createComponent(); - }); - - it('renders the Geo Nodes Core Details', () => { - expect(findGeoNodeCoreDetails().exists()).toBe(true); - }); - }); - - describe.each` - node | showPrimaryComponent | showSecondaryComponent - ${MOCK_PRIMARY_SITE} | ${true} | ${false} - ${MOCK_SECONDARY_SITE} | ${false} | ${true} - `(`conditionally`, ({ node, showPrimaryComponent, showSecondaryComponent }) => { - beforeEach(() => { - createComponent({ node }); - }); - - describe(`when primary is ${node.primary}`, () => { - it(`does ${showPrimaryComponent ? '' : 'not '}render GeoNodePrimaryOtherInfo`, () => { - expect(findGeoNodePrimaryOtherInfo().exists()).toBe(showPrimaryComponent); - }); - - it(`does ${showPrimaryComponent ? '' : 'not '}render GeoNodeVerificationInfo`, () => { - expect(findGeoNodeVerificationInfo().exists()).toBe(showPrimaryComponent); - }); - - it(`does ${ - showSecondaryComponent ? '' : 'not ' - }render GeoNodeSecondaryReplicationSummary`, () => { - expect(findGeoNodeSecondaryReplicationSummary().exists()).toBe(showSecondaryComponent); - }); - - it(`does ${showSecondaryComponent ? '' : 'not '}render GeoNodeSecondaryOtherInfo`, () => { - expect(findGeoNodeSecondaryOtherInfo().exists()).toBe(showSecondaryComponent); - }); - - it(`does ${ - showSecondaryComponent ? '' : 'not ' - }render GeoNodeSecondaryReplicationDetails`, () => { - expect(findGeoNodeSecondaryReplicationDetails().exists()).toBe(showSecondaryComponent); - }); - }); - }); - }); -}); diff --git a/ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_replication_summary_spec.js b/ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_replication_summary_spec.js deleted file mode 100644 index bb59a7a9acfc6a7136334f9530264e1cbeb517f6..0000000000000000000000000000000000000000 --- a/ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_replication_summary_spec.js +++ /dev/null @@ -1,55 +0,0 @@ -import { GlButton, GlCard } from '@gitlab/ui'; -import { shallowMount } from '@vue/test-utils'; -import GeoNodeReplicationCounts from 'ee/geo_nodes/components/details/secondary_node/geo_node_replication_counts.vue'; -import GeoNodeReplicationStatus from 'ee/geo_nodes/components/details/secondary_node/geo_node_replication_status.vue'; -import GeoNodeReplicationSummary from 'ee/geo_nodes/components/details/secondary_node/geo_node_replication_summary.vue'; -import GeoNodeSyncSettings from 'ee/geo_nodes/components/details/secondary_node/geo_node_sync_settings.vue'; -import { MOCK_SECONDARY_SITE } from 'ee_jest/geo_nodes/mock_data'; - -describe('GeoNodeReplicationSummary', () => { - let wrapper; - - const defaultProps = { - node: MOCK_SECONDARY_SITE, - }; - - const createComponent = (props) => { - wrapper = shallowMount(GeoNodeReplicationSummary, { - propsData: { - ...defaultProps, - ...props, - }, - stubs: { GlCard }, - }); - }; - - const findGlButton = () => wrapper.findComponent(GlButton); - const findGeoNodeReplicationStatus = () => wrapper.findComponent(GeoNodeReplicationStatus); - const findGeoNodeReplicationCounts = () => wrapper.findComponent(GeoNodeReplicationCounts); - const findGeoNodeSyncSettings = () => wrapper.findComponent(GeoNodeSyncSettings); - - describe('template', () => { - beforeEach(() => { - createComponent(); - }); - - it('renders the GlButton as a link', () => { - expect(findGlButton().exists()).toBe(true); - expect(findGlButton().attributes('href')).toBe( - MOCK_SECONDARY_SITE.webGeoReplicationDetailsUrl, - ); - }); - - it('renders the geo node replication status', () => { - expect(findGeoNodeReplicationStatus().exists()).toBe(true); - }); - - it('renders the geo node replication counts', () => { - expect(findGeoNodeReplicationCounts().exists()).toBe(true); - }); - - it('renders the geo node sync settings', () => { - expect(findGeoNodeSyncSettings().exists()).toBe(true); - }); - }); -}); diff --git a/ee/spec/frontend/geo_nodes/components/geo_nodes_spec.js b/ee/spec/frontend/geo_nodes/components/geo_nodes_spec.js deleted file mode 100644 index 399228d2c2fcb70b45398ebe1a078671583ef752..0000000000000000000000000000000000000000 --- a/ee/spec/frontend/geo_nodes/components/geo_nodes_spec.js +++ /dev/null @@ -1,49 +0,0 @@ -import { shallowMount } from '@vue/test-utils'; -import { nextTick } from 'vue'; -import GeoNodeDetails from 'ee/geo_nodes/components/details/geo_node_details.vue'; -import GeoNodes from 'ee/geo_nodes/components/geo_nodes.vue'; -import GeoNodeHeader from 'ee/geo_nodes/components/header/geo_node_header.vue'; -import { MOCK_PRIMARY_SITE } from '../mock_data'; - -describe('GeoNodes', () => { - let wrapper; - - const defaultProps = { - node: MOCK_PRIMARY_SITE, - }; - - const createComponent = (props) => { - wrapper = shallowMount(GeoNodes, { - propsData: { - ...defaultProps, - ...props, - }, - }); - }; - - const findGeoNodeHeader = () => wrapper.findComponent(GeoNodeHeader); - const findGeoNodeDetails = () => wrapper.findComponent(GeoNodeDetails); - - describe('template', () => { - beforeEach(() => { - createComponent(); - }); - - it('renders the Geo Node Header always', () => { - expect(findGeoNodeHeader().exists()).toBe(true); - }); - - describe('Node Details', () => { - it('renders by default', () => { - expect(findGeoNodeDetails().exists()).toBe(true); - }); - - it('is hidden when toggled', async () => { - findGeoNodeHeader().vm.$emit('collapse'); - - await nextTick(); - expect(findGeoNodeDetails().exists()).toBe(false); - }); - }); - }); -}); diff --git a/ee/spec/frontend/geo_nodes/components/app_spec.js b/ee/spec/frontend/geo_sites/components/app_spec.js similarity index 78% rename from ee/spec/frontend/geo_nodes/components/app_spec.js rename to ee/spec/frontend/geo_sites/components/app_spec.js index 0704224c32b06261424d9e861042eeb02f36c99d..364f60eb7d8a4f767d3e21346da7f22e5c2031de 100644 --- a/ee/spec/frontend/geo_nodes/components/app_spec.js +++ b/ee/spec/frontend/geo_sites/components/app_spec.js @@ -1,22 +1,22 @@ import { GlButton, GlLoadingIcon, GlModal, GlSprintf } from '@gitlab/ui'; import Vue from 'vue'; import Vuex from 'vuex'; -import GeoNodesApp from 'ee/geo_nodes/components/app.vue'; -import GeoNodes from 'ee/geo_nodes/components/geo_nodes.vue'; -import GeoNodesEmptyState from 'ee/geo_nodes/components/geo_nodes_empty_state.vue'; +import GeoSitesApp from 'ee/geo_sites/components/app.vue'; +import GeoSites from 'ee/geo_sites/components/geo_sites.vue'; +import GeoSitesEmptyState from 'ee/geo_sites/components/geo_sites_empty_state.vue'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import { MOCK_PRIMARY_SITE, MOCK_SECONDARY_SITE, MOCK_SITES, - MOCK_NEW_NODE_URL, + MOCK_NEW_SITE_URL, MOCK_NOT_CONFIGURED_EMPTY_STATE, MOCK_NO_RESULTS_EMPTY_STATE, } from '../mock_data'; Vue.use(Vuex); -describe('GeoNodesApp', () => { +describe('GeoSitesApp', () => { let wrapper; const actionSpies = { @@ -26,7 +26,7 @@ describe('GeoNodesApp', () => { }; const defaultProps = { - newNodeUrl: MOCK_NEW_NODE_URL, + newSiteUrl: MOCK_NEW_SITE_URL, }; const createComponent = (initialState, props, getters) => { @@ -41,7 +41,7 @@ describe('GeoNodesApp', () => { }, }); - wrapper = shallowMountExtended(GeoNodesApp, { + wrapper = shallowMountExtended(GeoSitesApp, { store, propsData: { ...defaultProps, @@ -53,10 +53,10 @@ describe('GeoNodesApp', () => { const findGeoAddSiteButton = () => wrapper.findComponent(GlButton); const findGlLoadingIcon = () => wrapper.findComponent(GlLoadingIcon); - const findGeoEmptyState = () => wrapper.findComponent(GeoNodesEmptyState); - const findGeoNodes = () => wrapper.findAllComponents(GeoNodes); - const findPrimaryGeoNodes = () => wrapper.findAllByTestId('primary-nodes'); - const findSecondaryGeoNodes = () => wrapper.findAllByTestId('secondary-nodes'); + const findGeoEmptyState = () => wrapper.findComponent(GeoSitesEmptyState); + const findGeoSites = () => wrapper.findAllComponents(GeoSites); + const findPrimaryGeoSites = () => wrapper.findAllByTestId('primary-sites'); + const findSecondaryGeoSites = () => wrapper.findAllByTestId('secondary-sites'); const findGlModal = () => wrapper.findComponent(GlModal); const findPrimarySiteTitle = () => wrapper.findByText('Primary site'); const findSecondarySiteTitle = () => wrapper.findByText('Secondary site'); @@ -73,14 +73,14 @@ describe('GeoNodesApp', () => { }); describe.each` - isLoading | sites | showLoadingIcon | showNodes | showEmptyState | showAddButton + isLoading | sites | showLoadingIcon | showSites | showEmptyState | showAddButton ${true} | ${[]} | ${true} | ${false} | ${false} | ${false} ${true} | ${MOCK_SITES} | ${true} | ${false} | ${false} | ${true} ${false} | ${[]} | ${false} | ${false} | ${true} | ${false} ${false} | ${MOCK_SITES} | ${false} | ${true} | ${false} | ${true} `( `conditionally`, - ({ isLoading, sites, showLoadingIcon, showNodes, showEmptyState, showAddButton }) => { + ({ isLoading, sites, showLoadingIcon, showSites, showEmptyState, showAddButton }) => { beforeEach(() => { createComponent({ isLoading, sites }, null, { filteredSites: () => sites }); }); @@ -90,8 +90,8 @@ describe('GeoNodesApp', () => { expect(findGlLoadingIcon().exists()).toBe(showLoadingIcon); }); - it(`does ${showNodes ? '' : 'not '}render GeoNodes`, () => { - expect(findGeoNodes().exists()).toBe(showNodes); + it(`does ${showSites ? '' : 'not '}render GeoSites`, () => { + expect(findGeoSites().exists()).toBe(showSites); }); it(`does ${showEmptyState ? '' : 'not '}render EmptyState`, () => { @@ -105,25 +105,25 @@ describe('GeoNodesApp', () => { }, ); - describe('with Geo Nodes', () => { + describe('with Geo Sites', () => { beforeEach(() => { createComponent({ sites: [MOCK_PRIMARY_SITE, MOCK_SECONDARY_SITE] }, null, { filteredSites: () => MOCK_SITES, }); }); - it('renders the correct Geo Node component for each node', () => { - expect(findPrimaryGeoNodes()).toHaveLength(1); - expect(findSecondaryGeoNodes()).toHaveLength(1); + it('renders the correct Geo Site component for each site', () => { + expect(findPrimaryGeoSites()).toHaveLength(1); + expect(findSecondaryGeoSites()).toHaveLength(1); }); }); describe.each` description | sites | primaryTitle | secondaryTitle - ${'with both primary and secondary nodes'} | ${MOCK_SITES} | ${true} | ${true} - ${'with only primary nodes'} | ${[MOCK_PRIMARY_SITE]} | ${true} | ${false} - ${'with only secondary nodes'} | ${[MOCK_SECONDARY_SITE]} | ${false} | ${true} - ${'with no nodes'} | ${[]} | ${false} | ${false} + ${'with both primary and secondary sites'} | ${MOCK_SITES} | ${true} | ${true} + ${'with only primary sites'} | ${[MOCK_PRIMARY_SITE]} | ${true} | ${false} + ${'with only secondary sites'} | ${[MOCK_SECONDARY_SITE]} | ${false} | ${true} + ${'with no sites'} | ${[]} | ${false} | ${false} `('Site Titles', ({ description, sites, primaryTitle, secondaryTitle }) => { describe(`${description}`, () => { beforeEach(() => { @@ -143,10 +143,10 @@ describe('GeoNodesApp', () => { describe('Empty state', () => { describe.each` description | sites | filteredSites | renderEmptyState | emptyStateProps - ${'with no nodes configured'} | ${[]} | ${[]} | ${true} | ${MOCK_NOT_CONFIGURED_EMPTY_STATE} - ${'with nodes configured and no user filter'} | ${MOCK_SITES} | ${MOCK_SITES} | ${false} | ${null} - ${'with nodes configured and user filters returning results'} | ${MOCK_SITES} | ${[MOCK_PRIMARY_SITE]} | ${false} | ${null} - ${'with nodes configured and user filters returning no results'} | ${MOCK_SITES} | ${[]} | ${true} | ${MOCK_NO_RESULTS_EMPTY_STATE} + ${'with no sites configured'} | ${[]} | ${[]} | ${true} | ${MOCK_NOT_CONFIGURED_EMPTY_STATE} + ${'with sites configured and no user filter'} | ${MOCK_SITES} | ${MOCK_SITES} | ${false} | ${null} + ${'with sites configured and user filters returning results'} | ${MOCK_SITES} | ${[MOCK_PRIMARY_SITE]} | ${false} | ${null} + ${'with sites configured and user filters returning no results'} | ${MOCK_SITES} | ${[]} | ${true} | ${MOCK_NO_RESULTS_EMPTY_STATE} `('$description', ({ sites, filteredSites, renderEmptyState, emptyStateProps }) => { beforeEach(() => { createComponent({ sites }, null, { filteredSites: () => filteredSites }); diff --git a/ee/spec/frontend/geo_nodes/components/details/geo_node_core_details_spec.js b/ee/spec/frontend/geo_sites/components/details/geo_site_core_details_spec.js similarity index 60% rename from ee/spec/frontend/geo_nodes/components/details/geo_node_core_details_spec.js rename to ee/spec/frontend/geo_sites/components/details/geo_site_core_details_spec.js index 8257f70b3df2c8bec8a7cff495c8437d776c5ba9..e037208144a85410178e84b248ffa7072c155bd6 100644 --- a/ee/spec/frontend/geo_nodes/components/details/geo_node_core_details_spec.js +++ b/ee/spec/frontend/geo_sites/components/details/geo_site_core_details_spec.js @@ -2,20 +2,20 @@ import { GlLink } from '@gitlab/ui'; import Vue from 'vue'; import Vuex from 'vuex'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; -import GeoNodeCoreDetails from 'ee/geo_nodes/components/details/geo_node_core_details.vue'; +import GeoSiteCoreDetails from 'ee/geo_sites/components/details/geo_site_core_details.vue'; import { MOCK_REPLICABLE_TYPES, MOCK_PRIMARY_SITE, MOCK_SECONDARY_SITE, -} from 'ee_jest/geo_nodes/mock_data'; +} from 'ee_jest/geo_sites/mock_data'; Vue.use(Vuex); -describe('GeoNodeCoreDetails', () => { +describe('GeoSiteCoreDetails', () => { let wrapper; const defaultProps = { - node: MOCK_PRIMARY_SITE, + site: MOCK_PRIMARY_SITE, }; const defaultGetters = { @@ -33,7 +33,7 @@ describe('GeoNodeCoreDetails', () => { }, }); - wrapper = shallowMountExtended(GeoNodeCoreDetails, { + wrapper = shallowMountExtended(GeoSiteCoreDetails, { store, propsData: { ...defaultProps, @@ -42,9 +42,9 @@ describe('GeoNodeCoreDetails', () => { }); }; - const findNodeUrl = () => wrapper.findComponent(GlLink); - const findNodeInternalUrl = () => wrapper.findByTestId('node-internal-url'); - const findNodeVersion = () => wrapper.findByTestId('node-version'); + const findSiteUrl = () => wrapper.findComponent(GlLink); + const findSiteInternalUrl = () => wrapper.findByTestId('site-internal-url'); + const findSiteVersion = () => wrapper.findByTestId('site-version'); describe('template', () => { describe('always', () => { @@ -52,56 +52,56 @@ describe('GeoNodeCoreDetails', () => { createComponent(); }); - it('renders the Node Url correctly', () => { - expect(findNodeUrl().exists()).toBe(true); - expect(findNodeUrl().attributes('href')).toBe(MOCK_PRIMARY_SITE.url); - expect(findNodeUrl().attributes('target')).toBe('_blank'); - expect(findNodeUrl().text()).toBe(MOCK_PRIMARY_SITE.url); + it('renders the Site Url correctly', () => { + expect(findSiteUrl().exists()).toBe(true); + expect(findSiteUrl().attributes('href')).toBe(MOCK_PRIMARY_SITE.url); + expect(findSiteUrl().attributes('target')).toBe('_blank'); + expect(findSiteUrl().text()).toBe(MOCK_PRIMARY_SITE.url); }); - it('renders the node version', () => { - expect(findNodeVersion().exists()).toBe(true); + it('renders the site version', () => { + expect(findSiteVersion().exists()).toBe(true); }); }); describe.each` - node + site ${MOCK_PRIMARY_SITE} ${MOCK_SECONDARY_SITE} - `('internal URL', ({ node }) => { + `('internal URL', ({ site }) => { beforeEach(() => { - createComponent({ node }); + createComponent({ site }); }); - describe(`when primary is ${node.primary}`, () => { - it(`does render node internal url`, () => { - expect(findNodeInternalUrl().exists()).toBe(true); + describe(`when primary is ${site.primary}`, () => { + it(`does render site internal url`, () => { + expect(findSiteInternalUrl().exists()).toBe(true); }); }); }); - describe('node version', () => { + describe('site version', () => { describe.each` - currentNode | versionText | versionMismatch + currentSite | versionText | versionMismatch ${{ version: MOCK_PRIMARY_SITE.version, revision: MOCK_PRIMARY_SITE.revision }} | ${`${MOCK_PRIMARY_SITE.version} (${MOCK_PRIMARY_SITE.revision})`} | ${false} ${{ version: 'asdf', revision: MOCK_PRIMARY_SITE.revision }} | ${`asdf (${MOCK_PRIMARY_SITE.revision})`} | ${true} ${{ version: MOCK_PRIMARY_SITE.version, revision: 'asdf' }} | ${`${MOCK_PRIMARY_SITE.version} (asdf)`} | ${true} ${{ version: null, revision: null }} | ${'Unknown'} | ${true} - `(`conditionally`, ({ currentNode, versionText, versionMismatch }) => { + `(`conditionally`, ({ currentSite, versionText, versionMismatch }) => { beforeEach(() => { createComponent( - { node: { ...MOCK_PRIMARY_SITE, ...currentNode } }, + { site: { ...MOCK_PRIMARY_SITE, ...currentSite } }, { siteHasVersionMismatch: () => () => versionMismatch }, ); }); - describe(`when version mismatch is ${versionMismatch} and current node version is ${versionText}`, () => { + describe(`when version mismatch is ${versionMismatch} and current site version is ${versionText}`, () => { it(`does ${versionMismatch ? '' : 'not '}render version with error color`, () => { - expect(findNodeVersion().classes('gl-text-red-500')).toBe(versionMismatch); + expect(findSiteVersion().classes('gl-text-red-500')).toBe(versionMismatch); }); it('does render version text correctly', () => { - expect(findNodeVersion().text()).toBe(versionText); + expect(findSiteVersion().text()).toBe(versionText); }); }); }); diff --git a/ee/spec/frontend/geo_sites/components/details/geo_site_details_spec.js b/ee/spec/frontend/geo_sites/components/details/geo_site_details_spec.js new file mode 100644 index 0000000000000000000000000000000000000000..96a3e6f3281c3ea52e9daad585818aee40f2bc00 --- /dev/null +++ b/ee/spec/frontend/geo_sites/components/details/geo_site_details_spec.js @@ -0,0 +1,83 @@ +import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; +import GeoSiteCoreDetails from 'ee/geo_sites/components/details/geo_site_core_details.vue'; +import GeoSiteDetails from 'ee/geo_sites/components/details/geo_site_details.vue'; +import GeoSitePrimaryOtherInfo from 'ee/geo_sites/components/details/primary_site/geo_site_primary_other_info.vue'; +import GeoSiteVerificationInfo from 'ee/geo_sites/components/details/primary_site/geo_site_verification_info.vue'; +import GeoSiteReplicationDetails from 'ee/geo_sites/components/details/secondary_site/geo_site_replication_details.vue'; +import GeoSiteReplicationSummary from 'ee/geo_sites/components/details/secondary_site/geo_site_replication_summary.vue'; +import GeoSiteSecondaryOtherInfo from 'ee/geo_sites/components/details/secondary_site/geo_site_secondary_other_info.vue'; +import { MOCK_PRIMARY_SITE, MOCK_SECONDARY_SITE } from 'ee_jest/geo_sites/mock_data'; + +describe('GeoSiteDetails', () => { + let wrapper; + + const defaultProps = { + site: MOCK_PRIMARY_SITE, + }; + + const createComponent = (props) => { + wrapper = shallowMountExtended(GeoSiteDetails, { + propsData: { + ...defaultProps, + ...props, + }, + }); + }; + + const findGeoSiteCoreDetails = () => wrapper.findComponent(GeoSiteCoreDetails); + const findGeoSitePrimaryOtherInfo = () => wrapper.findComponent(GeoSitePrimaryOtherInfo); + const findGeoSiteVerificationInfo = () => wrapper.findComponent(GeoSiteVerificationInfo); + const findGeoSiteSecondaryReplicationSummary = () => + wrapper.findComponent(GeoSiteReplicationSummary); + const findGeoSiteSecondaryOtherInfo = () => wrapper.findComponent(GeoSiteSecondaryOtherInfo); + const findGeoSiteSecondaryReplicationDetails = () => + wrapper.findComponent(GeoSiteReplicationDetails); + + describe('template', () => { + describe('always', () => { + beforeEach(() => { + createComponent(); + }); + + it('renders the Geo Sites Core Details', () => { + expect(findGeoSiteCoreDetails().exists()).toBe(true); + }); + }); + + describe.each` + site | showPrimaryComponent | showSecondaryComponent + ${MOCK_PRIMARY_SITE} | ${true} | ${false} + ${MOCK_SECONDARY_SITE} | ${false} | ${true} + `(`conditionally`, ({ site, showPrimaryComponent, showSecondaryComponent }) => { + beforeEach(() => { + createComponent({ site }); + }); + + describe(`when primary is ${site.primary}`, () => { + it(`does ${showPrimaryComponent ? '' : 'not '}render GeoSitePrimaryOtherInfo`, () => { + expect(findGeoSitePrimaryOtherInfo().exists()).toBe(showPrimaryComponent); + }); + + it(`does ${showPrimaryComponent ? '' : 'not '}render GeoSiteVerificationInfo`, () => { + expect(findGeoSiteVerificationInfo().exists()).toBe(showPrimaryComponent); + }); + + it(`does ${ + showSecondaryComponent ? '' : 'not ' + }render GeoSiteSecondaryReplicationSummary`, () => { + expect(findGeoSiteSecondaryReplicationSummary().exists()).toBe(showSecondaryComponent); + }); + + it(`does ${showSecondaryComponent ? '' : 'not '}render GeoSiteSecondaryOtherInfo`, () => { + expect(findGeoSiteSecondaryOtherInfo().exists()).toBe(showSecondaryComponent); + }); + + it(`does ${ + showSecondaryComponent ? '' : 'not ' + }render GeoSiteSecondaryReplicationDetails`, () => { + expect(findGeoSiteSecondaryReplicationDetails().exists()).toBe(showSecondaryComponent); + }); + }); + }); + }); +}); diff --git a/ee/spec/frontend/geo_nodes/components/details/geo_node_progress_bar_spec.js b/ee/spec/frontend/geo_sites/components/details/geo_site_progress_bar_spec.js similarity index 93% rename from ee/spec/frontend/geo_nodes/components/details/geo_node_progress_bar_spec.js rename to ee/spec/frontend/geo_sites/components/details/geo_site_progress_bar_spec.js index 1f85dd5e673d58653d0b812d411948883a41db35..576bb06ed5114c49af9d195a614317d9d4634bcf 100644 --- a/ee/spec/frontend/geo_nodes/components/details/geo_node_progress_bar_spec.js +++ b/ee/spec/frontend/geo_sites/components/details/geo_site_progress_bar_spec.js @@ -1,10 +1,10 @@ import { GlPopover } from '@gitlab/ui'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; -import GeoNodeProgressBar from 'ee/geo_nodes/components/details/geo_node_progress_bar.vue'; -import { MOCK_PRIMARY_VERIFICATION_INFO } from 'ee_jest/geo_nodes/mock_data'; +import GeoSiteProgressBar from 'ee/geo_sites/components/details/geo_site_progress_bar.vue'; +import { MOCK_PRIMARY_VERIFICATION_INFO } from 'ee_jest/geo_sites/mock_data'; import StackedProgressBar from '~/vue_shared/components/stacked_progress_bar.vue'; -describe('GeoNodeProgressBar', () => { +describe('GeoSiteProgressBar', () => { let wrapper; const defaultProps = { @@ -13,7 +13,7 @@ describe('GeoNodeProgressBar', () => { }; const createComponent = (props) => { - wrapper = shallowMountExtended(GeoNodeProgressBar, { + wrapper = shallowMountExtended(GeoSiteProgressBar, { propsData: { ...defaultProps, ...props, diff --git a/ee/spec/frontend/geo_nodes/components/details/primary_node/geo_node_primary_other_info_spec.js b/ee/spec/frontend/geo_sites/components/details/primary_site/geo_site_primary_other_info_spec.js similarity index 72% rename from ee/spec/frontend/geo_nodes/components/details/primary_node/geo_node_primary_other_info_spec.js rename to ee/spec/frontend/geo_sites/components/details/primary_site/geo_site_primary_other_info_spec.js index b54f8d992c9ee89ad874f4dcc9e35f04760d1a7a..025775c5c85cd9edb1c2de8d9d956ecbd63e3538 100644 --- a/ee/spec/frontend/geo_nodes/components/details/primary_node/geo_node_primary_other_info_spec.js +++ b/ee/spec/frontend/geo_sites/components/details/primary_site/geo_site_primary_other_info_spec.js @@ -1,19 +1,19 @@ import { GlCard } from '@gitlab/ui'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; -import GeoNodeProgressBar from 'ee/geo_nodes/components/details/geo_node_progress_bar.vue'; -import GeoNodePrimaryOtherInfo from 'ee/geo_nodes/components/details/primary_node/geo_node_primary_other_info.vue'; -import { MOCK_PRIMARY_SITE, MOCK_SECONDARY_SITE } from 'ee_jest/geo_nodes/mock_data'; +import GeoSiteProgressBar from 'ee/geo_sites/components/details/geo_site_progress_bar.vue'; +import GeoSitePrimaryOtherInfo from 'ee/geo_sites/components/details/primary_site/geo_site_primary_other_info.vue'; +import { MOCK_PRIMARY_SITE, MOCK_SECONDARY_SITE } from 'ee_jest/geo_sites/mock_data'; import { numberToHumanSize } from '~/lib/utils/number_utils'; -describe('GeoNodePrimaryOtherInfo', () => { +describe('GeoSitePrimaryOtherInfo', () => { let wrapper; const defaultProps = { - node: MOCK_PRIMARY_SITE, + site: MOCK_PRIMARY_SITE, }; const createComponent = (props) => { - wrapper = shallowMountExtended(GeoNodePrimaryOtherInfo, { + wrapper = shallowMountExtended(GeoSitePrimaryOtherInfo, { propsData: { ...defaultProps, ...props, @@ -22,7 +22,7 @@ describe('GeoNodePrimaryOtherInfo', () => { }; const findGlCard = () => wrapper.findComponent(GlCard); - const findGeoNodeProgressBar = () => wrapper.findComponent(GeoNodeProgressBar); + const findGeoSiteProgressBar = () => wrapper.findComponent(GeoSiteProgressBar); const findReplicationSlotWAL = () => wrapper.findByTestId('replication-slot-wal'); describe('template', () => { @@ -40,13 +40,13 @@ describe('GeoNodePrimaryOtherInfo', () => { }); it('renders the replicationSlots progress bar', () => { - expect(findGeoNodeProgressBar().exists()).toBe(true); + expect(findGeoSiteProgressBar().exists()).toBe(true); }); }); describe('when replicationSlotWAL exists', () => { beforeEach(() => { - createComponent({ node: MOCK_PRIMARY_SITE }); + createComponent({ site: MOCK_PRIMARY_SITE }); }); it('renders the replicationSlotWAL section correctly', () => { @@ -58,7 +58,7 @@ describe('GeoNodePrimaryOtherInfo', () => { describe('when replicationSlotWAL is 0', () => { beforeEach(() => { - createComponent({ node: { ...MOCK_PRIMARY_SITE, replicationSlotsMaxRetainedWalBytes: 0 } }); + createComponent({ site: { ...MOCK_PRIMARY_SITE, replicationSlotsMaxRetainedWalBytes: 0 } }); }); it('renders 0 bytes', () => { @@ -68,7 +68,7 @@ describe('GeoNodePrimaryOtherInfo', () => { describe('when replicationSlotWAL is null', () => { beforeEach(() => { - createComponent({ node: MOCK_SECONDARY_SITE }); + createComponent({ site: MOCK_SECONDARY_SITE }); }); it('renders Unknown', () => { diff --git a/ee/spec/frontend/geo_nodes/components/details/primary_node/geo_node_verification_info_spec.js b/ee/spec/frontend/geo_sites/components/details/primary_site/geo_site_verification_info_spec.js similarity index 73% rename from ee/spec/frontend/geo_nodes/components/details/primary_node/geo_node_verification_info_spec.js rename to ee/spec/frontend/geo_sites/components/details/primary_site/geo_site_verification_info_spec.js index 543e5e6f869c23e4cc1334a5b66aa0e5f7efea81..7885b0e0b5952c086cfa342c78d93bb52347ec07 100644 --- a/ee/spec/frontend/geo_nodes/components/details/primary_node/geo_node_verification_info_spec.js +++ b/ee/spec/frontend/geo_sites/components/details/primary_site/geo_site_verification_info_spec.js @@ -2,18 +2,18 @@ import { GlCard, GlIcon, GlPopover, GlLink } from '@gitlab/ui'; import Vue from 'vue'; import Vuex from 'vuex'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; -import GeoNodeProgressBar from 'ee/geo_nodes/components/details/geo_node_progress_bar.vue'; -import GeoNodeVerificationInfo from 'ee/geo_nodes/components/details/primary_node/geo_node_verification_info.vue'; -import { HELP_INFO_URL } from 'ee/geo_nodes/constants'; -import { MOCK_PRIMARY_SITE, MOCK_PRIMARY_VERIFICATION_INFO } from 'ee_jest/geo_nodes/mock_data'; +import GeoSiteProgressBar from 'ee/geo_sites/components/details/geo_site_progress_bar.vue'; +import GeoSiteVerificationInfo from 'ee/geo_sites/components/details/primary_site/geo_site_verification_info.vue'; +import { HELP_INFO_URL } from 'ee/geo_sites/constants'; +import { MOCK_PRIMARY_SITE, MOCK_PRIMARY_VERIFICATION_INFO } from 'ee_jest/geo_sites/mock_data'; Vue.use(Vuex); -describe('GeoNodeVerificationInfo', () => { +describe('GeoSiteVerificationInfo', () => { let wrapper; const defaultProps = { - node: MOCK_PRIMARY_SITE, + site: MOCK_PRIMARY_SITE, }; const createComponent = (props) => { @@ -23,7 +23,7 @@ describe('GeoNodeVerificationInfo', () => { }, }); - wrapper = shallowMountExtended(GeoNodeVerificationInfo, { + wrapper = shallowMountExtended(GeoSiteVerificationInfo, { store, propsData: { ...defaultProps, @@ -37,8 +37,8 @@ describe('GeoNodeVerificationInfo', () => { const findGlIcon = () => wrapper.findComponent(GlIcon); const findGlPopover = () => wrapper.findComponent(GlPopover); const findGlPopoverLink = () => findGlPopover().findComponent(GlLink); - const findGeoNodeProgressBarTitles = () => wrapper.findAllByTestId('verification-bar-title'); - const findGeoNodeProgressBars = () => wrapper.findAllComponents(GeoNodeProgressBar); + const findGeoSiteProgressBarTitles = () => wrapper.findAllByTestId('verification-bar-title'); + const findGeoSiteProgressBars = () => wrapper.findAllComponents(GeoSiteProgressBar); describe('template', () => { describe('always', () => { @@ -65,11 +65,11 @@ describe('GeoNodeVerificationInfo', () => { }); it('renders a progress bar for each verification replicable', () => { - expect(findGeoNodeProgressBars()).toHaveLength(MOCK_PRIMARY_VERIFICATION_INFO.length); + expect(findGeoSiteProgressBars()).toHaveLength(MOCK_PRIMARY_VERIFICATION_INFO.length); }); it('renders progress bar titles correctly', () => { - expect(findGeoNodeProgressBarTitles().wrappers.map((w) => w.text())).toStrictEqual( + expect(findGeoSiteProgressBarTitles().wrappers.map((w) => w.text())).toStrictEqual( MOCK_PRIMARY_VERIFICATION_INFO.map((vI) => `${vI.title} checksum progress`), ); }); diff --git a/ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_replication_counts_spec.js b/ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_replication_counts_spec.js similarity index 69% rename from ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_replication_counts_spec.js rename to ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_replication_counts_spec.js index bfb57f121efe0001f058fc681957744e953461cc..e8cc2f3a05d78f5f859713d1f000999ccea0e93e 100644 --- a/ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_replication_counts_spec.js +++ b/ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_replication_counts_spec.js @@ -1,17 +1,17 @@ import Vue from 'vue'; import Vuex from 'vuex'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; -import GeoNodeReplicationCounts from 'ee/geo_nodes/components/details/secondary_node/geo_node_replication_counts.vue'; -import GeoNodeReplicationSyncPercentage from 'ee/geo_nodes/components/details/secondary_node/geo_node_replication_sync_percentage.vue'; -import { MOCK_SECONDARY_SITE, MOCK_REPLICATION_COUNTS } from 'ee_jest/geo_nodes/mock_data'; +import GeoSiteReplicationCounts from 'ee/geo_sites/components/details/secondary_site/geo_site_replication_counts.vue'; +import GeoSiteReplicationSyncPercentage from 'ee/geo_sites/components/details/secondary_site/geo_site_replication_sync_percentage.vue'; +import { MOCK_SECONDARY_SITE, MOCK_REPLICATION_COUNTS } from 'ee_jest/geo_sites/mock_data'; Vue.use(Vuex); -describe('GeoNodeReplicationCounts', () => { +describe('GeoSiteReplicationCounts', () => { let wrapper; const defaultProps = { - nodeId: MOCK_SECONDARY_SITE.id, + siteId: MOCK_SECONDARY_SITE.id, }; const createComponent = (props, getters) => { @@ -22,7 +22,7 @@ describe('GeoNodeReplicationCounts', () => { }, }); - wrapper = shallowMountExtended(GeoNodeReplicationCounts, { + wrapper = shallowMountExtended(GeoSiteReplicationCounts, { store, propsData: { ...defaultProps, @@ -34,8 +34,8 @@ describe('GeoNodeReplicationCounts', () => { const findReplicationTypeSections = () => wrapper.findAllByTestId('replication-type'); const findReplicationTypeSectionTitles = () => findReplicationTypeSections().wrappers.map((w) => w.text()); - const findGeoNodeReplicationSyncPercentage = () => - wrapper.findAllComponents(GeoNodeReplicationSyncPercentage); + const findGeoSiteReplicationSyncPercentage = () => + wrapper.findAllComponents(GeoSiteReplicationSyncPercentage); describe('template', () => { beforeEach(() => { @@ -50,7 +50,7 @@ describe('GeoNodeReplicationCounts', () => { }); it('renders an individual sync and verification section for each entry in the replication counts array', () => { - expect(findGeoNodeReplicationSyncPercentage()).toHaveLength( + expect(findGeoSiteReplicationSyncPercentage()).toHaveLength( MOCK_REPLICATION_COUNTS.length * 2, ); }); diff --git a/ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_replication_details_responsive_spec.js b/ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_replication_details_responsive_spec.js similarity index 92% rename from ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_replication_details_responsive_spec.js rename to ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_replication_details_responsive_spec.js index 15ad165189fb6b86e82ba9d1f1cbd18538160301..6350a2fbf32e7a06e2a77a0c4b31ee83b5fa254e 100644 --- a/ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_replication_details_responsive_spec.js +++ b/ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_replication_details_responsive_spec.js @@ -1,18 +1,18 @@ import { GlLink } from '@gitlab/ui'; import { shallowMountExtended, extendedWrapper } from 'helpers/vue_test_utils_helper'; -import GeoNodeProgressBar from 'ee/geo_nodes/components/details/geo_node_progress_bar.vue'; -import GeoNodeReplicationDetailsResponsive from 'ee/geo_nodes/components/details/secondary_node/geo_node_replication_details_responsive.vue'; +import GeoSiteProgressBar from 'ee/geo_sites/components/details/geo_site_progress_bar.vue'; +import GeoSiteReplicationDetailsResponsive from 'ee/geo_sites/components/details/secondary_site/geo_site_replication_details_responsive.vue'; -describe('GeoNodeReplicationDetailsResponsive', () => { +describe('GeoSiteReplicationDetailsResponsive', () => { let wrapper; const defaultProps = { replicationItems: [], - nodeId: 0, + siteId: 0, }; const createComponent = (props, slots) => { - wrapper = shallowMountExtended(GeoNodeReplicationDetailsResponsive, { + wrapper = shallowMountExtended(GeoSiteReplicationDetailsResponsive, { propsData: { ...defaultProps, ...props, @@ -70,12 +70,12 @@ describe('GeoNodeReplicationDetailsResponsive', () => { ${'with all data'} | ${[{ dataTypeTitle: 'Test Title', component: 'Test Component', syncValues: { total: 100, success: 0 }, verificationValues: { total: 50, success: 50 } }]} | ${true} | ${true} `('$description', ({ replicationItems, renderSyncProgress, renderVerifProgress }) => { beforeEach(() => { - createComponent({ replicationItems, nodeId: 42 }); + createComponent({ replicationItems, siteId: 42 }); }); it('renders sync progress correctly', () => { expect( - findFirstReplicationDetailsItemSyncStatus().findComponent(GeoNodeProgressBar).exists(), + findFirstReplicationDetailsItemSyncStatus().findComponent(GeoSiteProgressBar).exists(), ).toBe(renderSyncProgress); expect( extendedWrapper(findFirstReplicationDetailsItemSyncStatus()) @@ -86,7 +86,7 @@ describe('GeoNodeReplicationDetailsResponsive', () => { if (renderSyncProgress) { expect( findFirstReplicationDetailsItemSyncStatus() - .findComponent(GeoNodeProgressBar) + .findComponent(GeoSiteProgressBar) .props('target'), ).toBe('sync-progress-42-Test Component'); } @@ -94,7 +94,7 @@ describe('GeoNodeReplicationDetailsResponsive', () => { it('renders verification progress correctly', () => { expect( - findFirstReplicationDetailsItemVerifStatus().findComponent(GeoNodeProgressBar).exists(), + findFirstReplicationDetailsItemVerifStatus().findComponent(GeoSiteProgressBar).exists(), ).toBe(renderVerifProgress); expect( extendedWrapper(findFirstReplicationDetailsItemVerifStatus()) @@ -105,7 +105,7 @@ describe('GeoNodeReplicationDetailsResponsive', () => { if (renderVerifProgress) { expect( findFirstReplicationDetailsItemVerifStatus() - .findComponent(GeoNodeProgressBar) + .findComponent(GeoSiteProgressBar) .props('target'), ).toBe('verification-progress-42-Test Component'); } diff --git a/ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_replication_details_spec.js b/ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_replication_details_spec.js similarity index 91% rename from ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_replication_details_spec.js rename to ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_replication_details_spec.js index 6f9ba401188def601cbf156bda0cccd60bfb9877..4d9c00f6dd6d1254c99417976b1453d0a2d42097 100644 --- a/ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_replication_details_spec.js +++ b/ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_replication_details_spec.js @@ -2,19 +2,19 @@ import { GlButton, GlSprintf, GlLink } from '@gitlab/ui'; import Vue from 'vue'; import Vuex from 'vuex'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; -import GeoNodeReplicationDetails from 'ee/geo_nodes/components/details/secondary_node/geo_node_replication_details.vue'; -import GeoNodeReplicationDetailsResponsive from 'ee/geo_nodes/components/details/secondary_node/geo_node_replication_details_responsive.vue'; -import GeoNodeReplicationStatusMobile from 'ee/geo_nodes/components/details/secondary_node/geo_node_replication_status_mobile.vue'; -import { GEO_REPLICATION_SUPPORTED_TYPES_URL } from 'ee/geo_nodes/constants'; -import { MOCK_SECONDARY_SITE, MOCK_REPLICABLE_TYPES } from 'ee_jest/geo_nodes/mock_data'; +import GeoSiteReplicationDetails from 'ee/geo_sites/components/details/secondary_site/geo_site_replication_details.vue'; +import GeoSiteReplicationDetailsResponsive from 'ee/geo_sites/components/details/secondary_site/geo_site_replication_details_responsive.vue'; +import GeoSiteReplicationStatusMobile from 'ee/geo_sites/components/details/secondary_site/geo_site_replication_status_mobile.vue'; +import { GEO_REPLICATION_SUPPORTED_TYPES_URL } from 'ee/geo_sites/constants'; +import { MOCK_SECONDARY_SITE, MOCK_REPLICABLE_TYPES } from 'ee_jest/geo_sites/mock_data'; Vue.use(Vuex); -describe('GeoNodeReplicationDetails', () => { +describe('GeoSiteReplicationDetails', () => { let wrapper; const defaultProps = { - node: MOCK_SECONDARY_SITE, + site: MOCK_SECONDARY_SITE, }; const createComponent = (initialState, props, getters) => { @@ -30,20 +30,20 @@ describe('GeoNodeReplicationDetails', () => { }, }); - wrapper = shallowMountExtended(GeoNodeReplicationDetails, { + wrapper = shallowMountExtended(GeoSiteReplicationDetails, { store, propsData: { ...defaultProps, ...props, }, - stubs: { GeoNodeReplicationDetailsResponsive, GlSprintf }, + stubs: { GeoSiteReplicationDetailsResponsive, GlSprintf }, }); }; const findGeoMobileReplicationDetails = () => wrapper.findByTestId('geo-replication-details-mobile'); const findGeoMobileReplicationStatus = () => - findGeoMobileReplicationDetails().findComponent(GeoNodeReplicationStatusMobile); + findGeoMobileReplicationDetails().findComponent(GeoSiteReplicationStatusMobile); const findGeoDesktopReplicationDetails = () => wrapper.findByTestId('geo-replication-details-desktop'); const findCollapseButton = () => wrapper.findComponent(GlButton); @@ -177,14 +177,14 @@ describe('GeoNodeReplicationDetails', () => { it('passes the correct props to the mobile replication details', () => { expect(findGeoMobileReplicationDetails().props()).toStrictEqual({ replicationItems: expectedProps, - nodeId: MOCK_SECONDARY_SITE.id, + siteId: MOCK_SECONDARY_SITE.id, }); }); it('passes the correct props to the desktop replication details', () => { expect(findGeoDesktopReplicationDetails().props()).toStrictEqual({ replicationItems: expectedProps, - nodeId: MOCK_SECONDARY_SITE.id, + siteId: MOCK_SECONDARY_SITE.id, }); }); diff --git a/ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_replication_status_mobile_spec.js b/ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_replication_status_mobile_spec.js similarity index 84% rename from ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_replication_status_mobile_spec.js rename to ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_replication_status_mobile_spec.js index addbd331fa0bc563838100ebe5515cb3b762e945..71911850bf0f4221344dd1156f43c906add087e6 100644 --- a/ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_replication_status_mobile_spec.js +++ b/ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_replication_status_mobile_spec.js @@ -1,8 +1,8 @@ import { shallowMountExtended, extendedWrapper } from 'helpers/vue_test_utils_helper'; -import GeoNodeProgressBar from 'ee/geo_nodes/components/details/geo_node_progress_bar.vue'; -import GeoNodeReplicationStatusMobile from 'ee/geo_nodes/components/details/secondary_node/geo_node_replication_status_mobile.vue'; +import GeoSiteProgressBar from 'ee/geo_sites/components/details/geo_site_progress_bar.vue'; +import GeoSiteReplicationStatusMobile from 'ee/geo_sites/components/details/secondary_site/geo_site_replication_status_mobile.vue'; -describe('GeoNodeReplicationStatusMobile', () => { +describe('GeoSiteReplicationStatusMobile', () => { let wrapper; const defaultProps = { @@ -19,7 +19,7 @@ describe('GeoNodeReplicationStatusMobile', () => { }; const createComponent = (props) => { - wrapper = shallowMountExtended(GeoNodeReplicationStatusMobile, { + wrapper = shallowMountExtended(GeoSiteReplicationStatusMobile, { propsData: { ...defaultProps, ...props, @@ -43,7 +43,7 @@ describe('GeoNodeReplicationStatusMobile', () => { }); it('renders sync progress correctly', () => { - expect(findItemSyncStatus().findComponent(GeoNodeProgressBar).exists()).toBe( + expect(findItemSyncStatus().findComponent(GeoSiteProgressBar).exists()).toBe( renderSyncProgress, ); expect(extendedWrapper(findItemSyncStatus()).findByText('Not applicable.').exists()).toBe( @@ -52,7 +52,7 @@ describe('GeoNodeReplicationStatusMobile', () => { }); it('renders verification progress correctly', () => { - expect(findItemVerificationStatus().findComponent(GeoNodeProgressBar).exists()).toBe( + expect(findItemVerificationStatus().findComponent(GeoSiteProgressBar).exists()).toBe( renderVerifProgress, ); expect( diff --git a/ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_replication_status_spec.js b/ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_replication_status_spec.js similarity index 83% rename from ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_replication_status_spec.js rename to ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_replication_status_spec.js index d36cb86bf511e409b4eaa2dc98b44bc9886d28af..02689a78964cabd3ace2ca44b9958b5f31666f40 100644 --- a/ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_replication_status_spec.js +++ b/ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_replication_status_spec.js @@ -1,18 +1,18 @@ import { GlPopover, GlLink } from '@gitlab/ui'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; -import GeoNodeReplicationStatus from 'ee/geo_nodes/components/details/secondary_node/geo_node_replication_status.vue'; -import { REPLICATION_STATUS_UI, REPLICATION_PAUSE_URL } from 'ee/geo_nodes/constants'; -import { MOCK_SECONDARY_SITE } from 'ee_jest/geo_nodes/mock_data'; +import GeoSiteReplicationStatus from 'ee/geo_sites/components/details/secondary_site/geo_site_replication_status.vue'; +import { REPLICATION_STATUS_UI, REPLICATION_PAUSE_URL } from 'ee/geo_sites/constants'; +import { MOCK_SECONDARY_SITE } from 'ee_jest/geo_sites/mock_data'; -describe('GeoNodeReplicationStatus', () => { +describe('GeoSiteReplicationStatus', () => { let wrapper; const defaultProps = { - node: MOCK_SECONDARY_SITE, + site: MOCK_SECONDARY_SITE, }; const createComponent = (props) => { - wrapper = shallowMountExtended(GeoNodeReplicationStatus, { + wrapper = shallowMountExtended(GeoSiteReplicationStatus, { propsData: { ...defaultProps, ...props, @@ -56,7 +56,7 @@ describe('GeoNodeReplicationStatus', () => { ${false} | ${REPLICATION_STATUS_UI.disabled} `(`conditionally`, ({ enabled, uiData }) => { beforeEach(() => { - createComponent({ node: { enabled } }); + createComponent({ site: { enabled } }); }); describe(`when enabled is ${enabled}`, () => { diff --git a/ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_replication_summary_spec.js b/ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_replication_summary_spec.js new file mode 100644 index 0000000000000000000000000000000000000000..95ead5467146d6bd08e2c79f00e29d0d0865248f --- /dev/null +++ b/ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_replication_summary_spec.js @@ -0,0 +1,55 @@ +import { GlButton, GlCard } from '@gitlab/ui'; +import { shallowMount } from '@vue/test-utils'; +import GeoSiteReplicationCounts from 'ee/geo_sites/components/details/secondary_site/geo_site_replication_counts.vue'; +import GeoSiteReplicationStatus from 'ee/geo_sites/components/details/secondary_site/geo_site_replication_status.vue'; +import GeoSiteReplicationSummary from 'ee/geo_sites/components/details/secondary_site/geo_site_replication_summary.vue'; +import GeoSiteSyncSettings from 'ee/geo_sites/components/details/secondary_site/geo_site_sync_settings.vue'; +import { MOCK_SECONDARY_SITE } from 'ee_jest/geo_sites/mock_data'; + +describe('GeoSiteReplicationSummary', () => { + let wrapper; + + const defaultProps = { + site: MOCK_SECONDARY_SITE, + }; + + const createComponent = (props) => { + wrapper = shallowMount(GeoSiteReplicationSummary, { + propsData: { + ...defaultProps, + ...props, + }, + stubs: { GlCard }, + }); + }; + + const findGlButton = () => wrapper.findComponent(GlButton); + const findGeoSiteReplicationStatus = () => wrapper.findComponent(GeoSiteReplicationStatus); + const findGeoSiteReplicationCounts = () => wrapper.findComponent(GeoSiteReplicationCounts); + const findGeoSiteSyncSettings = () => wrapper.findComponent(GeoSiteSyncSettings); + + describe('template', () => { + beforeEach(() => { + createComponent(); + }); + + it('renders the GlButton as a link', () => { + expect(findGlButton().exists()).toBe(true); + expect(findGlButton().attributes('href')).toBe( + MOCK_SECONDARY_SITE.webGeoReplicationDetailsUrl, + ); + }); + + it('renders the geo site replication status', () => { + expect(findGeoSiteReplicationStatus().exists()).toBe(true); + }); + + it('renders the geo site replication counts', () => { + expect(findGeoSiteReplicationCounts().exists()).toBe(true); + }); + + it('renders the geo site sync settings', () => { + expect(findGeoSiteSyncSettings().exists()).toBe(true); + }); + }); +}); diff --git a/ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_replication_sync_percentage_spec.js b/ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_replication_sync_percentage_spec.js similarity index 90% rename from ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_replication_sync_percentage_spec.js rename to ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_replication_sync_percentage_spec.js index 1bbd0c153d89b1c3c09c93fa711173f8aef7d9dc..3f12ac15a807c321ffcef0b4a46812cca9044cd6 100644 --- a/ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_replication_sync_percentage_spec.js +++ b/ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_replication_sync_percentage_spec.js @@ -1,7 +1,7 @@ import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; -import GeoNodeReplicationSyncPercentage from 'ee/geo_nodes/components/details/secondary_node/geo_node_replication_sync_percentage.vue'; +import GeoSiteReplicationSyncPercentage from 'ee/geo_sites/components/details/secondary_site/geo_site_replication_sync_percentage.vue'; -describe('GeoNodeReplicationSyncPercentage', () => { +describe('GeoSiteReplicationSyncPercentage', () => { let wrapper; const defaultProps = { @@ -9,7 +9,7 @@ describe('GeoNodeReplicationSyncPercentage', () => { }; const createComponent = (props) => { - wrapper = shallowMountExtended(GeoNodeReplicationSyncPercentage, { + wrapper = shallowMountExtended(GeoSiteReplicationSyncPercentage, { propsData: { ...defaultProps, ...props, diff --git a/ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_secondary_other_info_spec.js b/ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_secondary_other_info_spec.js similarity index 87% rename from ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_secondary_other_info_spec.js rename to ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_secondary_other_info_spec.js index b928f3f810b337478f543fd2c048a6c38239cfed..78e530ce607c165b30a84bb678f8398ef37ea58c 100644 --- a/ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_secondary_other_info_spec.js +++ b/ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_secondary_other_info_spec.js @@ -1,21 +1,21 @@ import { GlSprintf } from '@gitlab/ui'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; -import GeoNodeSecondaryOtherInfo from 'ee/geo_nodes/components/details/secondary_node/geo_node_secondary_other_info.vue'; -import { MOCK_SECONDARY_SITE } from 'ee_jest/geo_nodes/mock_data'; +import GeoSiteSecondaryOtherInfo from 'ee/geo_sites/components/details/secondary_site/geo_site_secondary_other_info.vue'; +import { MOCK_SECONDARY_SITE } from 'ee_jest/geo_sites/mock_data'; import TimeAgo from '~/vue_shared/components/time_ago_tooltip.vue'; // Dates come from the backend in seconds, we mimic that here. const MOCK_JUST_NOW = new Date().getTime() / 1000; -describe('GeoNodeSecondaryOtherInfo', () => { +describe('GeoSiteSecondaryOtherInfo', () => { let wrapper; const defaultProps = { - node: MOCK_SECONDARY_SITE, + site: MOCK_SECONDARY_SITE, }; const createComponent = (props) => { - wrapper = shallowMountExtended(GeoNodeSecondaryOtherInfo, { + wrapper = shallowMountExtended(GeoSiteSecondaryOtherInfo, { propsData: { ...defaultProps, ...props, @@ -59,7 +59,7 @@ describe('GeoNodeSecondaryOtherInfo', () => { ${null} | ${'Unknown'} `(`db replication lag`, ({ dbReplicationLagSeconds, text }) => { beforeEach(() => { - createComponent({ node: { dbReplicationLagSeconds } }); + createComponent({ site: { dbReplicationLagSeconds } }); }); it(`renders correctly when dbReplicationLagSeconds is ${dbReplicationLagSeconds}`, () => { @@ -74,7 +74,7 @@ describe('GeoNodeSecondaryOtherInfo', () => { ${null} | ${'Unknown'} `(`storage shards`, ({ storageShardsMatch, text }) => { beforeEach(() => { - createComponent({ node: { storageShardsMatch } }); + createComponent({ site: { storageShardsMatch } }); }); it(`renders correctly when storageShardsMatch is ${storageShardsMatch}`, () => { @@ -89,7 +89,7 @@ describe('GeoNodeSecondaryOtherInfo', () => { ${{ lastEventId: 1, lastEventTimestamp: MOCK_JUST_NOW }} | ${'1 just now'} `(`last event`, ({ lastEvent, text }) => { beforeEach(() => { - createComponent({ node: { ...lastEvent } }); + createComponent({ site: { ...lastEvent } }); }); it(`renders correctly when lastEventId is ${lastEvent.lastEventId} and lastEventTimestamp is ${lastEvent.lastEventTimestamp}`, () => { @@ -104,7 +104,7 @@ describe('GeoNodeSecondaryOtherInfo', () => { ${{ cursorLastEventId: 1, cursorLastEventTimestamp: MOCK_JUST_NOW }} | ${'1 just now'} `(`last cursor event`, ({ lastCursorEvent, text }) => { beforeEach(() => { - createComponent({ node: { ...lastCursorEvent } }); + createComponent({ site: { ...lastCursorEvent } }); }); it(`renders correctly when cursorLastEventId is ${lastCursorEvent.cursorLastEventId} and cursorLastEventTimestamp is ${lastCursorEvent.cursorLastEventTimestamp}`, () => { diff --git a/ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_sync_settings_spec.js b/ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_sync_settings_spec.js similarity index 81% rename from ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_sync_settings_spec.js rename to ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_sync_settings_spec.js index d569794f1bcbcff55325843ddc8b555823111f4b..a1001adea7a7b8dcbdc147cb0365659c1386f0ba 100644 --- a/ee/spec/frontend/geo_nodes/components/details/secondary_node/geo_node_sync_settings_spec.js +++ b/ee/spec/frontend/geo_sites/components/details/secondary_site/geo_site_sync_settings_spec.js @@ -1,16 +1,16 @@ import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; -import GeoNodeSyncSettings from 'ee/geo_nodes/components/details/secondary_node/geo_node_sync_settings.vue'; -import { MOCK_SECONDARY_SITE } from 'ee_jest/geo_nodes/mock_data'; +import GeoSiteSyncSettings from 'ee/geo_sites/components/details/secondary_site/geo_site_sync_settings.vue'; +import { MOCK_SECONDARY_SITE } from 'ee_jest/geo_sites/mock_data'; -describe('GeoNodeSyncSettings', () => { +describe('GeoSiteSyncSettings', () => { let wrapper; const defaultProps = { - node: MOCK_SECONDARY_SITE, + site: MOCK_SECONDARY_SITE, }; const createComponent = (props) => { - wrapper = shallowMountExtended(GeoNodeSyncSettings, { + wrapper = shallowMountExtended(GeoSiteSyncSettings, { propsData: { ...defaultProps, ...props, @@ -40,7 +40,7 @@ describe('GeoNodeSyncSettings', () => { ${'shards'} | ${'Selective (shards)'} `(`sync type`, ({ selectiveSyncType, text }) => { beforeEach(() => { - createComponent({ node: { selectiveSyncType } }); + createComponent({ site: { selectiveSyncType } }); }); it(`renders correctly when selectiveSyncType is ${selectiveSyncType}`, () => { @@ -50,7 +50,7 @@ describe('GeoNodeSyncSettings', () => { describe('with no timestamp info', () => { beforeEach(() => { - createComponent({ node: { lastEventTimestamp: null, cursorLastEventTimestamp: null } }); + createComponent({ site: { lastEventTimestamp: null, cursorLastEventTimestamp: null } }); }); it('does not render the sync status event info', () => { @@ -61,7 +61,7 @@ describe('GeoNodeSyncSettings', () => { describe('with timestamp info', () => { beforeEach(() => { createComponent({ - node: { + site: { lastEventTimestamp: 1511255300, lastEventId: 10, cursorLastEventTimestamp: 1511255200, diff --git a/ee/spec/frontend/geo_nodes/components/geo_nodes_empty_state_spec.js b/ee/spec/frontend/geo_sites/components/geo_sites_empty_state_spec.js similarity index 85% rename from ee/spec/frontend/geo_nodes/components/geo_nodes_empty_state_spec.js rename to ee/spec/frontend/geo_sites/components/geo_sites_empty_state_spec.js index 7499f400092808543b2ec83e515a36341823c0ce..eff8bbdc4532efaca2d974532453505ebcefce15 100644 --- a/ee/spec/frontend/geo_nodes/components/geo_nodes_empty_state_spec.js +++ b/ee/spec/frontend/geo_sites/components/geo_sites_empty_state_spec.js @@ -1,10 +1,10 @@ import { GlEmptyState } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; -import GeoNodesEmptyState from 'ee/geo_nodes/components/geo_nodes_empty_state.vue'; -import { GEO_INFO_URL } from 'ee/geo_nodes/constants'; +import GeoSitesEmptyState from 'ee/geo_sites/components/geo_sites_empty_state.vue'; +import { GEO_INFO_URL } from 'ee/geo_sites/constants'; import { MOCK_EMPTY_STATE_SVG } from '../mock_data'; -describe('GeoNodesEmptyState', () => { +describe('GeoSitesEmptyState', () => { let wrapper; const defaultProps = { @@ -13,13 +13,13 @@ describe('GeoNodesEmptyState', () => { }; const createComponent = (props) => { - wrapper = shallowMount(GeoNodesEmptyState, { + wrapper = shallowMount(GeoSitesEmptyState, { propsData: { ...defaultProps, ...props, }, provide: { - geoNodesEmptyStateSvg: MOCK_EMPTY_STATE_SVG, + geoSitesEmptyStateSvg: MOCK_EMPTY_STATE_SVG, }, }); }; @@ -53,7 +53,7 @@ describe('GeoNodesEmptyState', () => { it('renders the learn more button with the correct link', () => { expect(findGeoEmptyState().props('primaryButtonText')).toBe( - GeoNodesEmptyState.i18n.learnMoreButtonText, + GeoSitesEmptyState.i18n.learnMoreButtonText, ); expect(findGeoEmptyState().props('primaryButtonLink')).toBe(GEO_INFO_URL); }); diff --git a/ee/spec/frontend/geo_nodes/components/geo_nodes_filters_spec.js b/ee/spec/frontend/geo_sites/components/geo_sites_filters_spec.js similarity index 92% rename from ee/spec/frontend/geo_nodes/components/geo_nodes_filters_spec.js rename to ee/spec/frontend/geo_sites/components/geo_sites_filters_spec.js index 9cc53108b094db4b63a4483076cb5c9ca427f00b..0687d3e3e4e3876d12fa825fcfc0b66adb14463c 100644 --- a/ee/spec/frontend/geo_nodes/components/geo_nodes_filters_spec.js +++ b/ee/spec/frontend/geo_sites/components/geo_sites_filters_spec.js @@ -3,8 +3,8 @@ import Vue from 'vue'; import Vuex from 'vuex'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import { TEST_HOST } from 'helpers/test_constants'; -import GeoNodesFilters from 'ee/geo_nodes/components/geo_nodes_filters.vue'; -import { HEALTH_STATUS_UI, STATUS_FILTER_QUERY_PARAM } from 'ee/geo_nodes/constants'; +import GeoSitesFilters from 'ee/geo_sites/components/geo_sites_filters.vue'; +import { HEALTH_STATUS_UI, STATUS_FILTER_QUERY_PARAM } from 'ee/geo_sites/constants'; import * as urlUtils from '~/lib/utils/url_utility'; Vue.use(Vuex); @@ -12,11 +12,11 @@ Vue.use(Vuex); const MOCK_TAB_COUNT = 5; const MOCK_SEARCH = 'test search'; -describe('GeoNodesFilters', () => { +describe('GeoSitesFilters', () => { let wrapper; const defaultProps = { - totalNodes: MOCK_TAB_COUNT, + totalSites: MOCK_TAB_COUNT, }; const actionSpies = { @@ -36,7 +36,7 @@ describe('GeoNodesFilters', () => { }, }); - wrapper = shallowMountExtended(GeoNodesFilters, { + wrapper = shallowMountExtended(GeoSitesFilters, { store, propsData: { ...defaultProps, @@ -67,7 +67,7 @@ describe('GeoNodesFilters', () => { expect(findGlTabs().attributes('queryparamname')).toBe(STATUS_FILTER_QUERY_PARAM); }); - it('renders the All tab with the totalNodes count', () => { + it('renders the All tab with the totalSites count', () => { expect(findAllTab().exists()).toBe(true); expect(findAllTab().text()).toBe(`All ${MOCK_TAB_COUNT}`); }); @@ -82,7 +82,7 @@ describe('GeoNodesFilters', () => { beforeEach(() => { createComponent( null, - { totalNodes: MOCK_TAB_COUNT }, + { totalSites: MOCK_TAB_COUNT }, { countSitesForStatus: () => () => MOCK_TAB_COUNT }, ); }); @@ -109,7 +109,7 @@ describe('GeoNodesFilters', () => { beforeEach(() => { createComponent( null, - { totalNodes: MOCK_TAB_COUNT }, + { totalSites: MOCK_TAB_COUNT }, { countSitesForStatus: MOCK_COUNTER_GETTER }, ); }); @@ -139,7 +139,7 @@ describe('GeoNodesFilters', () => { beforeEach(() => { createComponent( null, - { totalNodes: MOCK_TAB_COUNT }, + { totalSites: MOCK_TAB_COUNT }, { countSitesForStatus: () => () => MOCK_TAB_COUNT }, ); }); diff --git a/ee/spec/frontend/geo_sites/components/geo_sites_spec.js b/ee/spec/frontend/geo_sites/components/geo_sites_spec.js new file mode 100644 index 0000000000000000000000000000000000000000..6ba7bb92446919753c623533428622bc30a826da --- /dev/null +++ b/ee/spec/frontend/geo_sites/components/geo_sites_spec.js @@ -0,0 +1,49 @@ +import { shallowMount } from '@vue/test-utils'; +import { nextTick } from 'vue'; +import GeoSiteDetails from 'ee/geo_sites/components/details/geo_site_details.vue'; +import GeoSites from 'ee/geo_sites/components/geo_sites.vue'; +import GeoSiteHeader from 'ee/geo_sites/components/header/geo_site_header.vue'; +import { MOCK_PRIMARY_SITE } from '../mock_data'; + +describe('GeoSites', () => { + let wrapper; + + const defaultProps = { + site: MOCK_PRIMARY_SITE, + }; + + const createComponent = (props) => { + wrapper = shallowMount(GeoSites, { + propsData: { + ...defaultProps, + ...props, + }, + }); + }; + + const findGeoSiteHeader = () => wrapper.findComponent(GeoSiteHeader); + const findGeoSiteDetails = () => wrapper.findComponent(GeoSiteDetails); + + describe('template', () => { + beforeEach(() => { + createComponent(); + }); + + it('renders the Geo Site Header always', () => { + expect(findGeoSiteHeader().exists()).toBe(true); + }); + + describe('Site Details', () => { + it('renders by default', () => { + expect(findGeoSiteDetails().exists()).toBe(true); + }); + + it('is hidden when toggled', async () => { + findGeoSiteHeader().vm.$emit('collapse'); + + await nextTick(); + expect(findGeoSiteDetails().exists()).toBe(false); + }); + }); + }); +}); diff --git a/ee/spec/frontend/geo_nodes/components/header/geo_node_actions_desktop_spec.js b/ee/spec/frontend/geo_sites/components/header/geo_site_actions_desktop_spec.js similarity index 87% rename from ee/spec/frontend/geo_nodes/components/header/geo_node_actions_desktop_spec.js rename to ee/spec/frontend/geo_sites/components/header/geo_site_actions_desktop_spec.js index 5dded066fb5ac7540f730be18a753833b48691ce..78687dac1f5c164becba7887963110e63e248c50 100644 --- a/ee/spec/frontend/geo_nodes/components/header/geo_node_actions_desktop_spec.js +++ b/ee/spec/frontend/geo_sites/components/header/geo_site_actions_desktop_spec.js @@ -2,16 +2,16 @@ import { GlButton } from '@gitlab/ui'; import Vue from 'vue'; import Vuex from 'vuex'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; -import GeoNodeActionsDesktop from 'ee/geo_nodes/components/header/geo_node_actions_desktop.vue'; -import { MOCK_PRIMARY_SITE } from 'ee_jest/geo_nodes/mock_data'; +import GeoSiteActionsDesktop from 'ee/geo_sites/components/header/geo_site_actions_desktop.vue'; +import { MOCK_PRIMARY_SITE } from 'ee_jest/geo_sites/mock_data'; Vue.use(Vuex); -describe('GeoNodeActionsDesktop', () => { +describe('GeoSiteActionsDesktop', () => { let wrapper; const defaultProps = { - node: MOCK_PRIMARY_SITE, + site: MOCK_PRIMARY_SITE, }; const createComponent = (props, getters) => { @@ -22,7 +22,7 @@ describe('GeoNodeActionsDesktop', () => { }, }); - wrapper = shallowMountExtended(GeoNodeActionsDesktop, { + wrapper = shallowMountExtended(GeoSiteActionsDesktop, { store, propsData: { ...defaultProps, @@ -81,9 +81,9 @@ describe('GeoNodeActionsDesktop', () => { ${false} | ${'Edit secondary site'} | ${'Remove secondary site'} ${true} | ${'Edit primary site'} | ${'Remove primary site'} `('action tooltips', ({ primary, editTooltip, removeTooltip }) => { - describe(`when node is ${primary ? '' : ' not'} a primary node`, () => { + describe(`when site is ${primary ? '' : ' not'} a primary site`, () => { beforeEach(() => { - createComponent({ node: { ...MOCK_PRIMARY_SITE, primary } }); + createComponent({ site: { ...MOCK_PRIMARY_SITE, primary } }); }); it(`sets edit tooltip to ${editTooltip}`, () => { diff --git a/ee/spec/frontend/geo_nodes/components/header/geo_node_actions_mobile_spec.js b/ee/spec/frontend/geo_sites/components/header/geo_site_actions_mobile_spec.js similarity index 89% rename from ee/spec/frontend/geo_nodes/components/header/geo_node_actions_mobile_spec.js rename to ee/spec/frontend/geo_sites/components/header/geo_site_actions_mobile_spec.js index aa488151ef8986a2bb93ef988316249c45edb568..2fb2d69a6bdf356452beb6b6c0ff0f5add4b57b6 100644 --- a/ee/spec/frontend/geo_nodes/components/header/geo_node_actions_mobile_spec.js +++ b/ee/spec/frontend/geo_sites/components/header/geo_site_actions_mobile_spec.js @@ -2,16 +2,16 @@ import { GlDropdown, GlDropdownItem } from '@gitlab/ui'; import Vue from 'vue'; import Vuex from 'vuex'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; -import GeoNodeActionsMobile from 'ee/geo_nodes/components/header/geo_node_actions_mobile.vue'; -import { MOCK_PRIMARY_SITE } from 'ee_jest/geo_nodes/mock_data'; +import GeoSiteActionsMobile from 'ee/geo_sites/components/header/geo_site_actions_mobile.vue'; +import { MOCK_PRIMARY_SITE } from 'ee_jest/geo_sites/mock_data'; Vue.use(Vuex); -describe('GeoNodeActionsMobile', () => { +describe('GeoSiteActionsMobile', () => { let wrapper; const defaultProps = { - node: MOCK_PRIMARY_SITE, + site: MOCK_PRIMARY_SITE, }; const createComponent = (props, getters) => { @@ -22,7 +22,7 @@ describe('GeoNodeActionsMobile', () => { }, }); - wrapper = shallowMountExtended(GeoNodeActionsMobile, { + wrapper = shallowMountExtended(GeoSiteActionsMobile, { store, propsData: { ...defaultProps, diff --git a/ee/spec/frontend/geo_nodes/components/header/geo_node_actions_spec.js b/ee/spec/frontend/geo_sites/components/header/geo_site_actions_spec.js similarity index 70% rename from ee/spec/frontend/geo_nodes/components/header/geo_node_actions_spec.js rename to ee/spec/frontend/geo_sites/components/header/geo_site_actions_spec.js index d2e5730521c48adcd3bd42e4a03fbf7a5ed35ba4..dae1d100d1f00afb7be0c720935974bf2900a3cd 100644 --- a/ee/spec/frontend/geo_nodes/components/header/geo_node_actions_spec.js +++ b/ee/spec/frontend/geo_sites/components/header/geo_site_actions_spec.js @@ -1,17 +1,17 @@ import { shallowMount } from '@vue/test-utils'; import Vue from 'vue'; import Vuex from 'vuex'; -import GeoNodeActions from 'ee/geo_nodes/components/header/geo_node_actions.vue'; -import GeoNodeActionsDesktop from 'ee/geo_nodes/components/header/geo_node_actions_desktop.vue'; -import GeoNodeActionsMobile from 'ee/geo_nodes/components/header/geo_node_actions_mobile.vue'; -import { REMOVE_NODE_MODAL_ID } from 'ee/geo_nodes/constants'; -import { MOCK_PRIMARY_SITE } from 'ee_jest/geo_nodes/mock_data'; +import GeoSiteActions from 'ee/geo_sites/components/header/geo_site_actions.vue'; +import GeoSiteActionsDesktop from 'ee/geo_sites/components/header/geo_site_actions_desktop.vue'; +import GeoSiteActionsMobile from 'ee/geo_sites/components/header/geo_site_actions_mobile.vue'; +import { REMOVE_SITE_MODAL_ID } from 'ee/geo_sites/constants'; +import { MOCK_PRIMARY_SITE } from 'ee_jest/geo_sites/mock_data'; import waitForPromises from 'helpers/wait_for_promises'; import { BV_SHOW_MODAL } from '~/lib/utils/constants'; Vue.use(Vuex); -describe('GeoNodeActions', () => { +describe('GeoSiteActions', () => { let wrapper; const actionSpies = { @@ -19,7 +19,7 @@ describe('GeoNodeActions', () => { }; const defaultProps = { - node: MOCK_PRIMARY_SITE, + site: MOCK_PRIMARY_SITE, }; const createComponent = (props) => { @@ -27,7 +27,7 @@ describe('GeoNodeActions', () => { actions: actionSpies, }); - wrapper = shallowMount(GeoNodeActions, { + wrapper = shallowMount(GeoSiteActions, { store, propsData: { ...defaultProps, @@ -36,8 +36,8 @@ describe('GeoNodeActions', () => { }); }; - const findGeoMobileActions = () => wrapper.findComponent(GeoNodeActionsMobile); - const findGeoDesktopActions = () => wrapper.findComponent(GeoNodeActionsDesktop); + const findGeoMobileActions = () => wrapper.findComponent(GeoSiteActionsMobile); + const findGeoDesktopActions = () => wrapper.findComponent(GeoSiteActionsDesktop); describe('template', () => { beforeEach(() => { @@ -65,7 +65,7 @@ describe('GeoNodeActions', () => { jest.spyOn(wrapper.vm.$root, '$emit'); }); - it('preps node for removal and opens model after promise returns on desktop', async () => { + it('preps site for removal and opens model after promise returns on desktop', async () => { findGeoDesktopActions().vm.$emit('remove'); expect(actionSpies.prepSiteRemoval).toHaveBeenCalledWith( @@ -75,15 +75,15 @@ describe('GeoNodeActions', () => { expect(wrapper.vm.$root.$emit).not.toHaveBeenCalledWith( BV_SHOW_MODAL, - REMOVE_NODE_MODAL_ID, + REMOVE_SITE_MODAL_ID, ); await waitForPromises(); - expect(wrapper.vm.$root.$emit).toHaveBeenCalledWith(BV_SHOW_MODAL, REMOVE_NODE_MODAL_ID); + expect(wrapper.vm.$root.$emit).toHaveBeenCalledWith(BV_SHOW_MODAL, REMOVE_SITE_MODAL_ID); }); - it('preps node for removal and opens model after promise returns on mobile', async () => { + it('preps site for removal and opens model after promise returns on mobile', async () => { findGeoMobileActions().vm.$emit('remove'); expect(actionSpies.prepSiteRemoval).toHaveBeenCalledWith( @@ -93,12 +93,12 @@ describe('GeoNodeActions', () => { expect(wrapper.vm.$root.$emit).not.toHaveBeenCalledWith( BV_SHOW_MODAL, - REMOVE_NODE_MODAL_ID, + REMOVE_SITE_MODAL_ID, ); await waitForPromises(); - expect(wrapper.vm.$root.$emit).toHaveBeenCalledWith(BV_SHOW_MODAL, REMOVE_NODE_MODAL_ID); + expect(wrapper.vm.$root.$emit).toHaveBeenCalledWith(BV_SHOW_MODAL, REMOVE_SITE_MODAL_ID); }); }); }); diff --git a/ee/spec/frontend/geo_nodes/components/header/geo_node_health_status_spec.js b/ee/spec/frontend/geo_sites/components/header/geo_site_health_status_spec.js similarity index 84% rename from ee/spec/frontend/geo_nodes/components/header/geo_node_health_status_spec.js rename to ee/spec/frontend/geo_sites/components/header/geo_site_health_status_spec.js index b8de2eefb8ae6f84ec36b7e7e0708dd983a9eee5..da3f775f244952a34b8164c3da054a77f34625a0 100644 --- a/ee/spec/frontend/geo_nodes/components/header/geo_node_health_status_spec.js +++ b/ee/spec/frontend/geo_sites/components/header/geo_site_health_status_spec.js @@ -1,9 +1,9 @@ import { GlBadge } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; -import GeoNodeHealthStatus from 'ee/geo_nodes/components/header/geo_node_health_status.vue'; -import { HEALTH_STATUS_UI } from 'ee/geo_nodes/constants'; +import GeoSiteHealthStatus from 'ee/geo_sites/components/header/geo_site_health_status.vue'; +import { HEALTH_STATUS_UI } from 'ee/geo_sites/constants'; -describe('GeoNodeHealthStatus', () => { +describe('GeoSiteHealthStatus', () => { let wrapper; const defaultProps = { @@ -11,7 +11,7 @@ describe('GeoNodeHealthStatus', () => { }; const createComponent = (props) => { - wrapper = shallowMount(GeoNodeHealthStatus, { + wrapper = shallowMount(GeoSiteHealthStatus, { propsData: { ...defaultProps, ...props, diff --git a/ee/spec/frontend/geo_nodes/components/header/geo_node_last_updated_spec.js b/ee/spec/frontend/geo_sites/components/header/geo_site_last_updated_spec.js similarity index 91% rename from ee/spec/frontend/geo_nodes/components/header/geo_node_last_updated_spec.js rename to ee/spec/frontend/geo_sites/components/header/geo_site_last_updated_spec.js index fa82518a28d7a1eeed42cc1e97ebe927a452ff09..cfa615eb14ff9bc44a53a68ebf751ccd56513b2c 100644 --- a/ee/spec/frontend/geo_nodes/components/header/geo_node_last_updated_spec.js +++ b/ee/spec/frontend/geo_sites/components/header/geo_site_last_updated_spec.js @@ -1,15 +1,15 @@ import { GlPopover, GlLink, GlIcon, GlSprintf } from '@gitlab/ui'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; -import GeoNodeLastUpdated from 'ee/geo_nodes/components/header/geo_node_last_updated.vue'; +import GeoSiteLastUpdated from 'ee/geo_sites/components/header/geo_site_last_updated.vue'; import { - HELP_NODE_HEALTH_URL, + HELP_SITE_HEALTH_URL, GEO_TROUBLESHOOTING_URL, STATUS_DELAY_THRESHOLD_MS, -} from 'ee/geo_nodes/constants'; +} from 'ee/geo_sites/constants'; import { differenceInMilliseconds } from '~/lib/utils/datetime_utility'; import TimeAgo from '~/vue_shared/components/time_ago_tooltip.vue'; -describe('GeoNodeLastUpdated', () => { +describe('GeoSiteLastUpdated', () => { let wrapper; // The threshold is inclusive so -1 to force stale @@ -22,7 +22,7 @@ describe('GeoNodeLastUpdated', () => { }; const createComponent = (props) => { - wrapper = shallowMountExtended(GeoNodeLastUpdated, { + wrapper = shallowMountExtended(GeoSiteLastUpdated, { propsData: { ...defaultProps, ...props, @@ -98,7 +98,7 @@ describe('GeoNodeLastUpdated', () => { createComponent({ statusCheckTimestamp: nonStaleStatusTime }); expect(findPopoverLink().text()).toBe('Learn more about Geo site statuses'); - expect(findPopoverLink().attributes('href')).toBe(HELP_NODE_HEALTH_URL); + expect(findPopoverLink().attributes('href')).toBe(HELP_SITE_HEALTH_URL); }); }); }); diff --git a/ee/spec/frontend/geo_nodes/components/header/geo_node_header_spec.js b/ee/spec/frontend/geo_sites/components/header/geo_sitee_header_spec.js similarity index 65% rename from ee/spec/frontend/geo_nodes/components/header/geo_node_header_spec.js rename to ee/spec/frontend/geo_sites/components/header/geo_sitee_header_spec.js index 5a1d32d4abdde918b6639ff4afdf61a523b8f0dc..e10ac4e0c9af244169cad6a1d08c5cd454c9450b 100644 --- a/ee/spec/frontend/geo_nodes/components/header/geo_node_header_spec.js +++ b/ee/spec/frontend/geo_sites/components/header/geo_sitee_header_spec.js @@ -1,21 +1,21 @@ import { GlButton } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; -import GeoNodeActions from 'ee/geo_nodes/components/header/geo_node_actions.vue'; -import GeoNodeHeader from 'ee/geo_nodes/components/header/geo_node_header.vue'; -import GeoNodeHealthStatus from 'ee/geo_nodes/components/header/geo_node_health_status.vue'; -import GeoNodeLastUpdated from 'ee/geo_nodes/components/header/geo_node_last_updated.vue'; -import { MOCK_PRIMARY_SITE, MOCK_SECONDARY_SITE } from 'ee_jest/geo_nodes/mock_data'; +import GeoSiteActions from 'ee/geo_sites/components/header/geo_site_actions.vue'; +import GeoSiteHeader from 'ee/geo_sites/components/header/geo_site_header.vue'; +import GeoSiteHealthStatus from 'ee/geo_sites/components/header/geo_site_health_status.vue'; +import GeoSiteLastUpdated from 'ee/geo_sites/components/header/geo_site_last_updated.vue'; +import { MOCK_PRIMARY_SITE, MOCK_SECONDARY_SITE } from 'ee_jest/geo_sites/mock_data'; -describe('GeoNodeHeader', () => { +describe('GeoSiteHeader', () => { let wrapper; const defaultProps = { - node: MOCK_PRIMARY_SITE, + site: MOCK_PRIMARY_SITE, collapsed: false, }; const createComponent = (props) => { - wrapper = shallowMount(GeoNodeHeader, { + wrapper = shallowMount(GeoSiteHeader, { propsData: { ...defaultProps, ...props, @@ -24,9 +24,9 @@ describe('GeoNodeHeader', () => { }; const findHeaderCollapseButton = () => wrapper.findComponent(GlButton); - const findGeoNodeHealthStatus = () => wrapper.findComponent(GeoNodeHealthStatus); - const findGeoNodeLastUpdated = () => wrapper.findComponent(GeoNodeLastUpdated); - const findGeoNodeActions = () => wrapper.findComponent(GeoNodeActions); + const findGeoSiteHealthStatus = () => wrapper.findComponent(GeoSiteHealthStatus); + const findGeoSiteLastUpdated = () => wrapper.findComponent(GeoSiteLastUpdated); + const findGeoSiteActions = () => wrapper.findComponent(GeoSiteActions); describe('template', () => { describe('always', () => { @@ -34,12 +34,12 @@ describe('GeoNodeHeader', () => { createComponent(); }); - it('renders the Geo Node Health Status', () => { - expect(findGeoNodeHealthStatus().exists()).toBe(true); + it('renders the Geo Site Health Status', () => { + expect(findGeoSiteHealthStatus().exists()).toBe(true); }); - it('renders the Geo Node Actions', () => { - expect(findGeoNodeActions().exists()).toBe(true); + it('renders the Geo Site Actions', () => { + expect(findGeoSiteActions().exists()).toBe(true); }); }); @@ -81,7 +81,7 @@ describe('GeoNodeHeader', () => { describe('when lastSuccessfulStatusCheckTimestamp exists', () => { beforeEach(() => { createComponent({ - node: { + site: { ...MOCK_SECONDARY_SITE, lastSuccessfulStatusCheckTimestamp: new Date().getTime(), }, @@ -89,7 +89,7 @@ describe('GeoNodeHeader', () => { }); it('renders', () => { - expect(findGeoNodeLastUpdated().exists()).toBe(true); + expect(findGeoSiteLastUpdated().exists()).toBe(true); }); }); @@ -99,7 +99,7 @@ describe('GeoNodeHeader', () => { }); it('renders', () => { - expect(findGeoNodeLastUpdated().exists()).toBe(false); + expect(findGeoSiteLastUpdated().exists()).toBe(false); }); }); }); diff --git a/ee/spec/frontend/geo_sites/index_spec.js b/ee/spec/frontend/geo_sites/index_spec.js new file mode 100644 index 0000000000000000000000000000000000000000..b0bb39dbfda567e0d2568961761062ec2e1e2449 --- /dev/null +++ b/ee/spec/frontend/geo_sites/index_spec.js @@ -0,0 +1,74 @@ +import MockAdapter from 'axios-mock-adapter'; +import { createWrapper } from '@vue/test-utils'; +import axios from '~/lib/utils/axios_utils'; +import { HTTP_STATUS_OK } from '~/lib/utils/http_status'; +import waitForPromises from 'helpers/wait_for_promises'; +import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures'; +import { initGeoSites } from 'ee/geo_sites'; +import { + GEO_NODE_W_DATA_FIXTURE, + GEO_SITE_W_DATA_FIXTURE, + MOCK_SITES_RES, + MOCK_SITE_STATUSES_RES, +} from './mock_data'; + +describe('initGeoSites', () => { + let wrapper; + let mock; + + const mockAPI = (apiMocks) => { + // geo_nodes API to be renamed geo_sites API => https://gitlab.com/gitlab-org/gitlab/-/issues/369140 + mock = new MockAdapter(axios); + mock.onGet(/api\/(.*)\/geo_nodes/).reply(HTTP_STATUS_OK, apiMocks.res); + mock.onGet(/api\/(.*)\/geo_nodes\/status/).reply(HTTP_STATUS_OK, apiMocks.statusRes); + }; + + const createAppWrapper = async (fixture, apiMocks) => { + mockAPI(apiMocks); + setHTMLFixture(fixture); + wrapper = createWrapper(initGeoSites()); + }; + + afterEach(() => { + resetHTMLFixture(); + mock.restore(); + }); + + describe.each` + description | fixture | link + ${'with no geo elements'} | ${'<div></div>'} | ${{ href: '', expected: undefined }} + ${'with #js-geo-nodes and valid data'} | ${GEO_NODE_W_DATA_FIXTURE} | ${{ href: 'admin/geo/nodes/new', expected: true }} + ${'with #js-geo-sites and valid data'} | ${GEO_SITE_W_DATA_FIXTURE} | ${{ href: 'admin/geo/sites/new', expected: true }} + ${'with both #js-geo-sites and #js-geo-nodes and valid data'} | ${`${GEO_NODE_W_DATA_FIXTURE} ${GEO_SITE_W_DATA_FIXTURE}`} | ${{ href: 'admin/geo/sites/new', expected: true }} + `('Add Site Link: $description', ({ fixture, link }) => { + beforeEach(() => { + createAppWrapper(fixture, { res: MOCK_SITES_RES, statusRes: MOCK_SITE_STATUSES_RES }); + }); + + it(`does${link.expected ? '' : ' not'} render with the correct URL`, async () => { + await waitForPromises(); + + expect(wrapper.vm && wrapper.find(`a[href="${link.href}"`).exists()).toBe(link.expected); + }); + }); + + describe.each` + description | fixture | emptyState + ${'with no geo elements'} | ${'<div></div>'} | ${{ src: '', expected: undefined }} + ${'with #js-geo-nodes and valid data'} | ${GEO_NODE_W_DATA_FIXTURE} | ${{ src: 'geo/nodes/empty-state.svg', expected: true }} + ${'with #js-geo-sites and valid data'} | ${GEO_SITE_W_DATA_FIXTURE} | ${{ src: 'geo/sites/empty-state.svg', expected: true }} + ${'with both #js-geo-sites and #js-geo-nodes and valid data'} | ${`${GEO_NODE_W_DATA_FIXTURE} ${GEO_SITE_W_DATA_FIXTURE}`} | ${{ src: 'geo/sites/empty-state.svg', expected: true }} + `('Empty State: $description', ({ fixture, emptyState }) => { + beforeEach(() => { + createAppWrapper(fixture, { res: [], statusRes: [] }); + }); + + it(`does${emptyState.expected ? '' : ' not'} render the correct empty state SVG`, async () => { + await waitForPromises(); + + expect(wrapper.vm && wrapper.find(`img[src="${emptyState.src}"`).exists()).toBe( + emptyState.expected, + ); + }); + }); +}); diff --git a/ee/spec/frontend/geo_nodes/mock_data.js b/ee/spec/frontend/geo_sites/mock_data.js similarity index 95% rename from ee/spec/frontend/geo_nodes/mock_data.js rename to ee/spec/frontend/geo_sites/mock_data.js index 97cac323fc3bcf3c8891d048a9d1c4f77b013265..dd9e5385577177c55c49da575ad3cb3702493e78 100644 --- a/ee/spec/frontend/geo_nodes/mock_data.js +++ b/ee/spec/frontend/geo_sites/mock_data.js @@ -1,4 +1,4 @@ -export const MOCK_NEW_NODE_URL = 'http://localhost:3000/admin/geo/sites/new'; +export const MOCK_NEW_SITE_URL = 'http://localhost:3000/admin/geo/sites/new'; export const MOCK_EMPTY_STATE_SVG = 'illustrations/empty-state/geo-empty.svg'; @@ -348,3 +348,6 @@ export const MOCK_REPLICATION_COUNTS = [ verification: [{ total: 100, success: 0 }], }, ]; + +export const GEO_NODE_W_DATA_FIXTURE = `<div id="js-geo-nodes" data-new-site-url="admin/geo/nodes/new" data-geo-nodes-empty-state-svg="geo/nodes/empty-state.svg" data-replicable-types="[]"></div>`; +export const GEO_SITE_W_DATA_FIXTURE = `<div id="js-geo-sites" data-new-site-url="admin/geo/sites/new" data-geo-sites-empty-state-svg="geo/sites/empty-state.svg" data-replicable-types="[]"></div>`; diff --git a/ee/spec/frontend/geo_nodes/store/actions_spec.js b/ee/spec/frontend/geo_sites/store/actions_spec.js similarity index 96% rename from ee/spec/frontend/geo_nodes/store/actions_spec.js rename to ee/spec/frontend/geo_sites/store/actions_spec.js index de79183a64b1ea9a60a044bd5b7104027dc1f78c..e91e40d4fbb26d885540c2821619da958c2350c0 100644 --- a/ee/spec/frontend/geo_nodes/store/actions_spec.js +++ b/ee/spec/frontend/geo_sites/store/actions_spec.js @@ -1,7 +1,7 @@ import MockAdapter from 'axios-mock-adapter'; -import * as actions from 'ee/geo_nodes/store/actions'; -import * as types from 'ee/geo_nodes/store/mutation_types'; -import createState from 'ee/geo_nodes/store/state'; +import * as actions from 'ee/geo_sites/store/actions'; +import * as types from 'ee/geo_sites/store/mutation_types'; +import createState from 'ee/geo_sites/store/state'; import testAction from 'helpers/vuex_action_helper'; import { createAlert } from '~/alert'; import axios from '~/lib/utils/axios_utils'; diff --git a/ee/spec/frontend/geo_nodes/store/getters_spec.js b/ee/spec/frontend/geo_sites/store/getters_spec.js similarity index 98% rename from ee/spec/frontend/geo_nodes/store/getters_spec.js rename to ee/spec/frontend/geo_sites/store/getters_spec.js index 1cc1ae7d0a11ccf2043f52c1a297225e9eeea409..87e47df7a14603d0f9af2f86bd50880907018b79 100644 --- a/ee/spec/frontend/geo_nodes/store/getters_spec.js +++ b/ee/spec/frontend/geo_sites/store/getters_spec.js @@ -1,5 +1,5 @@ -import * as getters from 'ee/geo_nodes/store/getters'; -import createState from 'ee/geo_nodes/store/state'; +import * as getters from 'ee/geo_sites/store/getters'; +import createState from 'ee/geo_sites/store/state'; import { MOCK_REPLICABLE_TYPES, MOCK_SITES, diff --git a/ee/spec/frontend/geo_nodes/store/mutations_spec.js b/ee/spec/frontend/geo_sites/store/mutations_spec.js similarity index 94% rename from ee/spec/frontend/geo_nodes/store/mutations_spec.js rename to ee/spec/frontend/geo_sites/store/mutations_spec.js index f04c75c1beda536f83bf31dcb9b1188a17132df1..fdcfffe32829eccd61c9b2d7e86ff38742d418b5 100644 --- a/ee/spec/frontend/geo_nodes/store/mutations_spec.js +++ b/ee/spec/frontend/geo_sites/store/mutations_spec.js @@ -1,6 +1,6 @@ -import * as types from 'ee/geo_nodes/store/mutation_types'; -import mutations from 'ee/geo_nodes/store/mutations'; -import createState from 'ee/geo_nodes/store/state'; +import * as types from 'ee/geo_sites/store/mutation_types'; +import mutations from 'ee/geo_sites/store/mutations'; +import createState from 'ee/geo_sites/store/state'; import { MOCK_REPLICABLE_TYPES, MOCK_SITES } from '../mock_data'; describe('GeoSites Store Mutations', () => { diff --git a/ee/spec/requests/admin/geo/nodes_controller_spec.rb b/ee/spec/requests/admin/geo/nodes_controller_spec.rb index d2104f73213c781d56c22f143c2cc58aa286f9a5..d9d15896d3d21ab34cf9e2ff5b0845c6a88b08c9 100644 --- a/ee/spec/requests/admin/geo/nodes_controller_spec.rb +++ b/ee/spec/requests/admin/geo/nodes_controller_spec.rb @@ -6,24 +6,24 @@ include AdminModeHelper let_it_be(:admin) { create(:admin) } - let_it_be(:geo_node) { create(:geo_node) } + let_it_be(:geo_site) { create(:geo_node) } before do enable_admin_mode!(admin) login_as(admin) end - describe 'GET /geo/nodes' do + describe 'GET /geo/sites' do context 'with a valid license' do before do stub_licensed_features(geo: true) end - it 'renders the Geo Nodes View', :aggregate_failures do + it 'renders the Geo Sites View', :aggregate_failures do get admin_geo_nodes_path expect(response).to render_template(:index) - expect(response.body).to include('js-geo-nodes') + expect(response.body).to include('js-geo-sites') end end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 3c5bd88a70248219eee3ac70ae8024ba61db0e28..6f5430383b5b6abdd2190a601de38ec7c3a059b0 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -18572,7 +18572,7 @@ msgstr "" msgid "Geo|Does not match the primary storage configuration" msgstr "" -msgid "Geo|Edit %{nodeType} site" +msgid "Geo|Edit %{siteType} site" msgstr "" msgid "Geo|Edit Geo Site" @@ -18755,7 +18755,7 @@ msgstr "" msgid "Geo|Remove" msgstr "" -msgid "Geo|Remove %{nodeType} site" +msgid "Geo|Remove %{siteType} site" msgstr "" msgid "Geo|Remove entry" diff --git a/qa/qa/ee/page/admin/geo/nodes/show.rb b/qa/qa/ee/page/admin/geo/nodes/show.rb index ea56aab502a98fca801189c3984b041b242c8f5d..50f0875f63dc3e085d380a2d72ffaa263fdfb01c 100644 --- a/qa/qa/ee/page/admin/geo/nodes/show.rb +++ b/qa/qa/ee/page/admin/geo/nodes/show.rb @@ -7,7 +7,7 @@ module Admin module Geo module Nodes class Show < QA::Page::Base - view 'ee/app/assets/javascripts/geo_nodes/components/app.vue' do + view 'ee/app/assets/javascripts/geo_sites/components/app.vue' do element :add_site_button end