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
18d0850c
Commit
18d0850c
authored
Oct 08, 2018
by
Ash McKenzie
Committed by
Phil Hughes
Oct 08, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Geo: Allow nodes to be editable in more scenarios
parent
67d06dcf
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
45 deletions
+24
-45
ee/app/assets/javascripts/geo_nodes/components/app.vue
ee/app/assets/javascripts/geo_nodes/components/app.vue
+9
-13
ee/app/assets/javascripts/geo_nodes/components/geo_node_item.vue
...assets/javascripts/geo_nodes/components/geo_node_item.vue
+0
-9
ee/changelogs/unreleased/ashmckenzie-7708-allow-geo-node-removal.yml
...gs/unreleased/ashmckenzie-7708-allow-geo-node-removal.yml
+5
-0
ee/spec/javascripts/geo_nodes/components/app_spec.js
ee/spec/javascripts/geo_nodes/components/app_spec.js
+10
-11
ee/spec/javascripts/geo_nodes/components/geo_node_item_spec.js
...ec/javascripts/geo_nodes/components/geo_node_item_spec.js
+0
-12
No files found.
ee/app/assets/javascripts/geo_nodes/components/app.vue
View file @
18d0850c
...
@@ -108,19 +108,15 @@ export default {
...
@@ -108,19 +108,15 @@ export default {
eventHub
.
$emit
(
'
nodeDetailsLoaded
'
,
this
.
store
.
getNodeDetails
(
nodeId
));
eventHub
.
$emit
(
'
nodeDetailsLoaded
'
,
this
.
store
.
getNodeDetails
(
nodeId
));
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
if
(
err
.
response
&&
err
.
response
.
data
)
{
this
.
store
.
setNodeDetails
(
nodeId
,
{
this
.
store
.
setNodeDetails
(
nodeId
,
{
geo_node_id
:
nodeId
,
geo_node_id
:
nodeId
,
health
:
err
.
message
,
health
:
err
.
message
,
health_status
:
'
Unknown
'
,
health_status
:
'
Unknown
'
,
missing_oauth_application
:
false
,
missing_oauth_application
:
null
,
sync_status_unavailable
:
true
,
sync_status_unavailable
:
true
,
storage_shards_match
:
null
,
storage_shards_match
:
null
,
});
});
eventHub
.
$emit
(
'
nodeDetailsLoaded
'
,
this
.
store
.
getNodeDetails
(
nodeId
));
eventHub
.
$emit
(
'
nodeDetailsLoaded
'
,
this
.
store
.
getNodeDetails
(
nodeId
));
}
else
{
eventHub
.
$emit
(
'
nodeDetailsLoadFailed
'
,
nodeId
,
err
);
}
});
});
},
},
repairNode
(
targetNode
)
{
repairNode
(
targetNode
)
{
...
...
ee/app/assets/javascripts/geo_nodes/components/geo_node_item.vue
View file @
18d0850c
...
@@ -46,14 +46,12 @@ export default {
...
@@ -46,14 +46,12 @@ export default {
},
},
created
()
{
created
()
{
eventHub
.
$on
(
'
nodeDetailsLoaded
'
,
this
.
handleNodeDetails
);
eventHub
.
$on
(
'
nodeDetailsLoaded
'
,
this
.
handleNodeDetails
);
eventHub
.
$on
(
'
nodeDetailsLoadFailed
'
,
this
.
handleNodeDetailsFailure
);
},
},
mounted
()
{
mounted
()
{
this
.
handleMounted
();
this
.
handleMounted
();
},
},
beforeDestroy
()
{
beforeDestroy
()
{
eventHub
.
$off
(
'
nodeDetailsLoaded
'
,
this
.
handleNodeDetails
);
eventHub
.
$off
(
'
nodeDetailsLoaded
'
,
this
.
handleNodeDetails
);
eventHub
.
$off
(
'
nodeDetailsLoadFailed
'
,
this
.
handleNodeDetailsFailure
);
},
},
methods
:
{
methods
:
{
handleNodeDetails
(
nodeDetails
)
{
handleNodeDetails
(
nodeDetails
)
{
...
@@ -65,13 +63,6 @@ export default {
...
@@ -65,13 +63,6 @@ export default {
this
.
nodeHealthStatus
=
nodeDetails
.
health
;
this
.
nodeHealthStatus
=
nodeDetails
.
health
;
}
}
},
},
handleNodeDetailsFailure
(
nodeId
,
err
)
{
if
(
this
.
node
.
id
===
nodeId
)
{
this
.
isNodeDetailsLoading
=
false
;
this
.
isNodeDetailsFailed
=
true
;
this
.
errorMessage
=
err
.
message
;
}
},
handleMounted
()
{
handleMounted
()
{
eventHub
.
$emit
(
'
pollNodeDetails
'
,
this
.
node
);
eventHub
.
$emit
(
'
pollNodeDetails
'
,
this
.
node
);
},
},
...
...
ee/changelogs/unreleased/ashmckenzie-7708-allow-geo-node-removal.yml
0 → 100644
View file @
18d0850c
---
title
:
'
Geo:
Allow
nodes
to
be
editable
in
more
scenarios'
merge_request
:
7832
author
:
type
:
changed
ee/spec/javascripts/geo_nodes/components/app_spec.js
View file @
18d0850c
...
@@ -156,9 +156,9 @@ describe('AppComponent', () => {
...
@@ -156,9 +156,9 @@ describe('AppComponent', () => {
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
it
(
'
emits `nodeDetailsLoaded` event with fake nodeDetails object
on 500 failure
'
,
done
=>
{
it
(
'
emits `nodeDetailsLoaded` event with fake nodeDetails object
when a network error occurs
'
,
done
=>
{
spyOn
(
eventHub
,
'
$emit
'
);
spyOn
(
eventHub
,
'
$emit
'
);
mock
.
onGet
(
mockNode
.
statusPath
).
reply
(
500
,
{}
);
mock
.
onGet
(
mockNode
.
statusPath
).
networkError
(
);
spyOn
(
vm
.
service
,
'
getGeoNodeDetails
'
).
and
.
callThrough
();
spyOn
(
vm
.
service
,
'
getGeoNodeDetails
'
).
and
.
callThrough
();
vm
vm
...
@@ -168,26 +168,25 @@ describe('AppComponent', () => {
...
@@ -168,26 +168,25 @@ describe('AppComponent', () => {
const
nodeDetails
=
vm
.
store
.
state
.
nodeDetails
[
'
1
'
];
const
nodeDetails
=
vm
.
store
.
state
.
nodeDetails
[
'
1
'
];
expect
(
nodeDetails
).
toBeDefined
();
expect
(
nodeDetails
).
toBeDefined
();
expect
(
nodeDetails
.
syncStatusUnavailable
).
toBe
(
true
);
expect
(
nodeDetails
.
syncStatusUnavailable
).
toBe
(
true
);
expect
(
nodeDetails
.
health
).
toBe
(
'
Request failed with status code 500
'
);
expect
(
nodeDetails
.
health
).
toBe
(
'
Network Error
'
);
})
})
.
then
(
done
)
.
then
(
done
)
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
it
(
'
emits `nodeDetailsLoad
Failed` event on failure when there is no response
'
,
done
=>
{
it
(
'
emits `nodeDetailsLoad
ed` event with fake nodeDetails object when a timeout occurs
'
,
done
=>
{
spyOn
(
eventHub
,
'
$emit
'
);
spyOn
(
eventHub
,
'
$emit
'
);
mock
.
onGet
(
mockNode
.
statusPath
).
reply
(
500
,
null
);
mock
.
onGet
(
mockNode
.
statusPath
).
timeout
(
);
spyOn
(
vm
.
service
,
'
getGeoNodeDetails
'
).
and
.
callThrough
();
spyOn
(
vm
.
service
,
'
getGeoNodeDetails
'
).
and
.
callThrough
();
vm
vm
.
fetchNodeDetails
(
mockNode
)
.
fetchNodeDetails
(
mockNode
)
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
nodeDetailsLoaded
'
,
jasmine
.
any
(
Object
));
'
nodeDetailsLoadFailed
'
,
const
nodeDetails
=
vm
.
store
.
state
.
nodeDetails
[
'
1
'
];
mockNode
.
id
,
expect
(
nodeDetails
).
toBeDefined
();
jasmine
.
any
(
Object
),
expect
(
nodeDetails
.
syncStatusUnavailable
).
toBe
(
true
);
);
expect
(
nodeDetails
.
health
).
toBe
(
'
timeout of 0ms exceeded
'
);
done
();
})
})
.
then
(
done
)
.
then
(
done
)
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
...
...
ee/spec/javascripts/geo_nodes/components/geo_node_item_spec.js
View file @
18d0850c
...
@@ -99,16 +99,6 @@ describe('GeoNodeItemComponent', () => {
...
@@ -99,16 +99,6 @@ describe('GeoNodeItemComponent', () => {
});
});
});
});
describe
(
'
handleNodeDetailsFailure
'
,
()
=>
{
it
(
'
initializes props for Node details failure
'
,
()
=>
{
const
err
=
'
Something went wrong
'
;
vm
.
handleNodeDetailsFailure
(
1
,
{
message
:
err
});
expect
(
vm
.
isNodeDetailsLoading
).
toBeFalsy
();
expect
(
vm
.
isNodeDetailsFailed
).
toBeTruthy
();
expect
(
vm
.
errorMessage
).
toBe
(
err
);
});
});
describe
(
'
handleMounted
'
,
()
=>
{
describe
(
'
handleMounted
'
,
()
=>
{
it
(
'
emits `pollNodeDetails` event and passes node ID
'
,
()
=>
{
it
(
'
emits `pollNodeDetails` event and passes node ID
'
,
()
=>
{
spyOn
(
eventHub
,
'
$emit
'
);
spyOn
(
eventHub
,
'
$emit
'
);
...
@@ -125,7 +115,6 @@ describe('GeoNodeItemComponent', () => {
...
@@ -125,7 +115,6 @@ describe('GeoNodeItemComponent', () => {
const
vmX
=
createComponent
();
const
vmX
=
createComponent
();
expect
(
eventHub
.
$on
).
toHaveBeenCalledWith
(
'
nodeDetailsLoaded
'
,
jasmine
.
any
(
Function
));
expect
(
eventHub
.
$on
).
toHaveBeenCalledWith
(
'
nodeDetailsLoaded
'
,
jasmine
.
any
(
Function
));
expect
(
eventHub
.
$on
).
toHaveBeenCalledWith
(
'
nodeDetailsLoadFailed
'
,
jasmine
.
any
(
Function
));
vmX
.
$destroy
();
vmX
.
$destroy
();
});
});
});
});
...
@@ -137,7 +126,6 @@ describe('GeoNodeItemComponent', () => {
...
@@ -137,7 +126,6 @@ describe('GeoNodeItemComponent', () => {
const
vmX
=
createComponent
();
const
vmX
=
createComponent
();
vmX
.
$destroy
();
vmX
.
$destroy
();
expect
(
eventHub
.
$off
).
toHaveBeenCalledWith
(
'
nodeDetailsLoaded
'
,
jasmine
.
any
(
Function
));
expect
(
eventHub
.
$off
).
toHaveBeenCalledWith
(
'
nodeDetailsLoaded
'
,
jasmine
.
any
(
Function
));
expect
(
eventHub
.
$off
).
toHaveBeenCalledWith
(
'
nodeDetailsLoadFailed
'
,
jasmine
.
any
(
Function
));
});
});
});
});
...
...
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