Commit ac86cb86 authored by Phil Hughes's avatar Phil Hughes

Merge branch '8112-geo-add-more-warnings-to-the-remove-geo-node-confirmation-modal' into 'master'

Geo: Add more warnings to the Remove Geo node confirmation modal

Closes #8112

See merge request gitlab-org/gitlab-ee!9442
parents 09583c66 837f2b0a
...@@ -46,12 +46,25 @@ export default { ...@@ -46,12 +46,25 @@ export default {
modalActionLabel: this.nodeToggleLabel, modalActionLabel: this.nodeToggleLabel,
}); });
}, },
onRemoveNode() { onRemoveSecondaryNode() {
eventHub.$emit('showNodeActionModal', { eventHub.$emit('showNodeActionModal', {
actionType: NODE_ACTIONS.REMOVE, actionType: NODE_ACTIONS.REMOVE,
node: this.node, node: this.node,
modalKind: 'danger', modalKind: 'danger',
modalMessage: s__('GeoNodes|Removing a node stops the sync process. Are you sure?'), modalMessage: s__(
'GeoNodes|Removing a secondary node stops the sync process. It is not currently possible to add back the same node without losing some data. We only recommend setting up a new secondary node in this case. Are you sure?',
),
modalActionLabel: __('Remove'),
});
},
onRemovePrimaryNode() {
eventHub.$emit('showNodeActionModal', {
actionType: NODE_ACTIONS.REMOVE,
node: this.node,
modalKind: 'danger',
modalMessage: s__(
'GeoNodes|Removing a primary node stops the sync process for all nodes. Syncing cannot be resumed without losing some data on all secondaries. In this case we would recommend setting up all nodes from scratch. Are you sure?',
),
modalActionLabel: __('Remove'), modalActionLabel: __('Remove'),
}); });
}, },
...@@ -92,7 +105,20 @@ export default { ...@@ -92,7 +105,20 @@ export default {
<a :href="node.editPath" class="btn btn-sm btn-node-action"> {{ __('Edit') }} </a> <a :href="node.editPath" class="btn btn-sm btn-node-action"> {{ __('Edit') }} </a>
</div> </div>
<div class="node-action-container"> <div class="node-action-container">
<button type="button" class="btn btn-sm btn-node-action btn-danger" @click="onRemoveNode"> <button
v-if="isSecondaryNode"
type="button"
class="btn btn-sm btn-node-action btn-danger"
@click="onRemoveSecondaryNode"
>
{{ __('Remove') }}
</button>
<button
v-else
type="button"
class="btn btn-sm btn-node-action btn-danger"
@click="onRemovePrimaryNode"
>
{{ __('Remove') }} {{ __('Remove') }}
</button> </button>
</div> </div>
......
...@@ -80,16 +80,33 @@ describe('GeoNodeActionsComponent', () => { ...@@ -80,16 +80,33 @@ describe('GeoNodeActionsComponent', () => {
}); });
}); });
describe('onRemoveNode', () => { describe('onRemovePrimaryNode', () => {
it('emits showNodeActionModal with actionType `remove`, node reference, modalKind, modalMessage and modalActionLabel', () => { it('emits showNodeActionModal with actionType `remove`, node reference, modalKind, modalMessage and modalActionLabel', () => {
spyOn(eventHub, '$emit'); spyOn(eventHub, '$emit');
vm.onRemoveNode(); vm.onRemovePrimaryNode();
expect(eventHub.$emit).toHaveBeenCalledWith('showNodeActionModal', { expect(eventHub.$emit).toHaveBeenCalledWith('showNodeActionModal', {
actionType: NODE_ACTIONS.REMOVE, actionType: NODE_ACTIONS.REMOVE,
node: vm.node, node: vm.node,
modalKind: 'danger', modalKind: 'danger',
modalMessage: 'Removing a node stops the sync process. Are you sure?', modalMessage:
'Removing a primary node stops the sync process for all nodes. Syncing cannot be resumed without losing some data on all secondaries. In this case we would recommend setting up all nodes from scratch. Are you sure?',
modalActionLabel: 'Remove',
});
});
});
describe('onRemoveSecondaryNode', () => {
it('emits showNodeActionModal with actionType `remove`, node reference, modalKind, modalMessage and modalActionLabel', () => {
spyOn(eventHub, '$emit');
vm.onRemoveSecondaryNode();
expect(eventHub.$emit).toHaveBeenCalledWith('showNodeActionModal', {
actionType: NODE_ACTIONS.REMOVE,
node: vm.node,
modalKind: 'danger',
modalMessage:
'Removing a secondary node stops the sync process. It is not currently possible to add back the same node without losing some data. We only recommend setting up a new secondary node in this case. Are you sure?',
modalActionLabel: 'Remove', modalActionLabel: 'Remove',
}); });
}); });
......
...@@ -4310,7 +4310,10 @@ msgstr "" ...@@ -4310,7 +4310,10 @@ msgstr ""
msgid "GeoNodes|Out of sync" msgid "GeoNodes|Out of sync"
msgstr "" msgstr ""
msgid "GeoNodes|Removing a node stops the sync process. Are you sure?" msgid "GeoNodes|Removing a primary node stops the sync process for all nodes. Syncing cannot be resumed without losing some data on all secondaries. In this case we would recommend setting up all nodes from scratch. Are you sure?"
msgstr ""
msgid "GeoNodes|Removing a secondary node stops the sync process. It is not currently possible to add back the same node without losing some data. We only recommend setting up a new secondary node in this case. Are you sure?"
msgstr "" msgstr ""
msgid "GeoNodes|Replication slot WAL" msgid "GeoNodes|Replication slot WAL"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment