Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
8305be7e
Commit
8305be7e
authored
May 10, 2021
by
Zack Cuddy
Committed by
Nicolò Maria Mezzopera
May 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Geo 2.0 Regression - Multiple Secondaries
parent
90f66f74
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
42 deletions
+47
-42
ee/app/assets/javascripts/geo_nodes_beta/components/app.vue
ee/app/assets/javascripts/geo_nodes_beta/components/app.vue
+27
-4
ee/app/assets/javascripts/geo_nodes_beta/components/geo_nodes.vue
...ssets/javascripts/geo_nodes_beta/components/geo_nodes.vue
+1
-12
ee/spec/frontend/geo_nodes_beta/components/app_spec.js
ee/spec/frontend/geo_nodes_beta/components/app_spec.js
+19
-10
ee/spec/frontend/geo_nodes_beta/components/geo_nodes_spec.js
ee/spec/frontend/geo_nodes_beta/components/geo_nodes_spec.js
+0
-16
No files found.
ee/app/assets/javascripts/geo_nodes_beta/components/app.vue
View file @
8305be7e
...
...
@@ -18,6 +18,8 @@ export default {
modalBody
:
s__
(
'
Geo|Removing a Geo secondary node stops the synchronization to that node. Are you sure?
'
,
),
primarySite
:
s__
(
'
Geo|Primary site
'
),
secondarySite
:
s__
(
'
Geo|Secondary site
'
),
},
components
:
{
GlLink
,
...
...
@@ -43,6 +45,12 @@ export default {
noNodes
()
{
return
!
this
.
nodes
||
this
.
nodes
.
length
===
0
;
},
primaryNodes
()
{
return
this
.
nodes
.
filter
((
n
)
=>
n
.
primary
);
},
secondaryNodes
()
{
return
this
.
nodes
.
filter
((
n
)
=>
!
n
.
primary
);
},
},
created
()
{
this
.
fetchNodes
();
...
...
@@ -89,10 +97,25 @@ export default {
</gl-button>
</div>
<gl-loading-icon
v-if=
"isLoading"
size=
"xl"
class=
"gl-mt-5"
/>
<div
v-if=
"!isLoading"
>
<geo-nodes
v-for=
"node in nodes"
:key=
"node.id"
:node=
"node"
/>
<geo-nodes-empty-state
v-if=
"noNodes"
:svg-path=
"geoNodesEmptyStateSvg"
/>
</div>
<
template
v-if=
"!isLoading"
>
<div
v-if=
"!noNodes"
>
<h4
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"
/>
<h4
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"
/>
</div>
<geo-nodes-empty-state
v-else
:svg-path=
"geoNodesEmptyStateSvg"
/>
</
template
>
<gl-modal
:modal-id=
"$options.REMOVE_NODE_MODAL_ID"
:title=
"$options.i18n.modalTitle"
...
...
ee/app/assets/javascripts/geo_nodes_beta/components/geo_nodes.vue
View file @
8305be7e
<
script
>
import
{
s__
}
from
'
~/locale
'
;
import
GeoNodeDetails
from
'
./details/geo_node_details.vue
'
;
import
GeoNodeHeader
from
'
./header/geo_node_header.vue
'
;
export
default
{
name
:
'
GeoNodes
'
,
i18n
:
{
primarySite
:
s__
(
'
Geo|Primary site
'
),
secondarySite
:
s__
(
'
Geo|Secondary site
'
),
},
components
:
{
GeoNodeHeader
,
GeoNodeDetails
,
...
...
@@ -25,11 +20,6 @@ export default {
collapsed
:
false
,
};
},
computed
:
{
siteTitle
()
{
return
this
.
node
.
primary
?
this
.
$options
.
i18n
.
primarySite
:
this
.
$options
.
i18n
.
secondarySite
;
},
},
methods
:
{
toggleCollapse
()
{
this
.
collapsed
=
!
this
.
collapsed
;
...
...
@@ -39,8 +29,7 @@ export default {
</
script
>
<
template
>
<div>
<h4
class=
"gl-font-lg gl-my-5"
>
{{
siteTitle
}}
</h4>
<div
class=
"gl-mb-4"
>
<geo-node-header
:node=
"node"
:collapsed=
"collapsed"
@
collapse=
"toggleCollapse"
/>
<geo-node-details
v-if=
"!collapsed"
:node=
"node"
/>
</div>
...
...
ee/spec/frontend/geo_nodes_beta/components/app_spec.js
View file @
8305be7e
...
...
@@ -6,6 +6,7 @@ import GeoNodesBetaApp from 'ee/geo_nodes_beta/components/app.vue';
import
GeoNodes
from
'
ee/geo_nodes_beta/components/geo_nodes.vue
'
;
import
GeoNodesEmptyState
from
'
ee/geo_nodes_beta/components/geo_nodes_empty_state.vue
'
;
import
{
GEO_INFO_URL
}
from
'
ee/geo_nodes_beta/constants
'
;
import
{
extendedWrapper
}
from
'
helpers/vue_test_utils_helper
'
;
import
{
MOCK_NODES
,
MOCK_NEW_NODE_URL
,
MOCK_EMPTY_STATE_SVG
}
from
'
../mock_data
'
;
Vue
.
use
(
Vuex
);
...
...
@@ -32,14 +33,16 @@ describe('GeoNodesBetaApp', () => {
actions
:
actionSpies
,
});
wrapper
=
shallowMount
(
GeoNodesBetaApp
,
{
store
,
propsData
:
{
...
defaultProps
,
...
props
,
},
stubs
:
{
GlSprintf
},
});
wrapper
=
extendedWrapper
(
shallowMount
(
GeoNodesBetaApp
,
{
store
,
propsData
:
{
...
defaultProps
,
...
props
,
},
stubs
:
{
GlSprintf
},
}),
);
};
afterEach
(()
=>
{
...
...
@@ -52,6 +55,8 @@ describe('GeoNodesBetaApp', () => {
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
findGlModal
=
()
=>
wrapper
.
findComponent
(
GlModal
);
describe
(
'
template
'
,
()
=>
{
...
...
@@ -108,12 +113,16 @@ describe('GeoNodesBetaApp', () => {
);
describe
(
'
with Geo Nodes
'
,
()
=>
{
const
primaryNodes
=
MOCK_NODES
.
filter
((
n
)
=>
n
.
primary
);
const
secondaryNodes
=
MOCK_NODES
.
filter
((
n
)
=>
!
n
.
primary
);
beforeEach
(()
=>
{
createComponent
({
nodes
:
MOCK_NODES
});
});
it
(
'
renders a Geo Node component for each node
'
,
()
=>
{
expect
(
findGeoNodes
()).
toHaveLength
(
MOCK_NODES
.
length
);
it
(
'
renders the correct Geo Node component for each node
'
,
()
=>
{
expect
(
findPrimaryGeoNodes
()).
toHaveLength
(
primaryNodes
.
length
);
expect
(
findSecondaryGeoNodes
()).
toHaveLength
(
secondaryNodes
.
length
);
});
});
});
...
...
ee/spec/frontend/geo_nodes_beta/components/geo_nodes_spec.js
View file @
8305be7e
...
...
@@ -25,7 +25,6 @@ describe('GeoNodes', () => {
});
const
findGeoNodesContainer
=
()
=>
wrapper
.
find
(
'
div
'
);
const
findGeoSiteTitle
=
()
=>
wrapper
.
find
(
'
h4
'
);
const
findGeoNodeHeader
=
()
=>
wrapper
.
findComponent
(
GeoNodeHeader
);
const
findGeoNodeDetails
=
()
=>
wrapper
.
findComponent
(
GeoNodeDetails
);
...
...
@@ -56,19 +55,4 @@ describe('GeoNodes', () => {
});
});
});
describe
.
each
`
node | siteTitle
${
MOCK_NODES
[
0
]}
|
${
'
Primary site
'
}
${
MOCK_NODES
[
1
]}
|
${
'
Secondary site
'
}
`
(
`Site Title`
,
({
node
,
siteTitle
})
=>
{
beforeEach
(()
=>
{
createComponent
({
node
});
});
it
(
`is
${
siteTitle
}
when primary is
${
node
.
primary
}
`
,
()
=>
{
expect
(
findGeoSiteTitle
().
exists
()).
toBe
(
true
);
expect
(
findGeoSiteTitle
().
text
()).
toBe
(
siteTitle
);
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment