Commit 837f2b0a authored by Valery Sizov's avatar Valery Sizov

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

parent 681d537f
......@@ -46,12 +46,25 @@ export default {
modalActionLabel: this.nodeToggleLabel,
});
},
onRemoveNode() {
onRemoveSecondaryNode() {
eventHub.$emit('showNodeActionModal', {
actionType: NODE_ACTIONS.REMOVE,
node: this.node,
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'),
});
},
......@@ -92,7 +105,20 @@ export default {
<a :href="node.editPath" class="btn btn-sm btn-node-action"> {{ __('Edit') }} </a>
</div>
<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') }}
</button>
</div>
......
......@@ -80,16 +80,33 @@ describe('GeoNodeActionsComponent', () => {
});
});
describe('onRemoveNode', () => {
describe('onRemovePrimaryNode', () => {
it('emits showNodeActionModal with actionType `remove`, node reference, modalKind, modalMessage and modalActionLabel', () => {
spyOn(eventHub, '$emit');
vm.onRemoveNode();
vm.onRemovePrimaryNode();
expect(eventHub.$emit).toHaveBeenCalledWith('showNodeActionModal', {
actionType: NODE_ACTIONS.REMOVE,
node: vm.node,
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',
});
});
......
......@@ -4223,7 +4223,10 @@ msgstr ""
msgid "GeoNodes|Out of sync"
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 ""
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