diff --git a/CHANGELOG.md b/CHANGELOG.md index bea6aff3..1a4aac8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ None - Fix cannot delete backup on page 2 ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/382)) ### Tweaks - Rework server list on status page display for use on small screens ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/383)) +- Add clone server confirmation ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/384))

## --- [4.0.4-hotfix2] - 2022/06/21 diff --git a/app/frontend/templates/panel/dashboard.html b/app/frontend/templates/panel/dashboard.html index bd71128f..00aee7e1 100644 --- a/app/frontend/templates/panel/dashboard.html +++ b/app/frontend/templates/panel/dashboard.html @@ -849,19 +849,41 @@ $(".clone_button").click(function () { server_id = $(this).attr("data-id"); - send_command(server_id, 'clone_server'); - bootbox.dialog({ - backdrop: true, - title: '{% raw translate("dashboard", "sendingCommand", data["lang"]) %}', - message: '
  {% raw translate("dashboard", "bePatientClone", data["lang"]) %}
', - closeButton: false, + bootbox.confirm({ + message: "{{ translate('dashboard', 'cloneConfirm' , data['lang']) }}", + buttons: { + confirm: { + label: "{{ translate('dashboard', 'clone' , data['lang']) }}", + className: 'btn-outline-warning' + }, + cancel: { + label: '{% raw translate("panelConfig", "cancel", data["lang"]) %}', + className: 'btn-secondary' + } + }, + callback: function (result) { + if (result) { + cloneServer(server_id); + } + + } }); - setTimeout(function () { - location.reload(); - }, 5000) }); }); + + function cloneServer(server_id) { + send_command(server_id, 'clone_server'); + bootbox.dialog({ + backdrop: true, + title: '{% raw translate("dashboard", "sendingCommand", data["lang"]) %}', + message: '
  {% raw translate("dashboard", "bePatientClone", data["lang"]) %}
', + closeButton: false, + }); + setTimeout(function () { + location.reload(); + }, 5000) + } diff --git a/app/translations/en_EN.json b/app/translations/en_EN.json index dcaca2a8..4ac03483 100644 --- a/app/translations/en_EN.json +++ b/app/translations/en_EN.json @@ -66,6 +66,7 @@ "cannotSeeOnMobile": "Not seeing everything on mobile?", "cannotSeeOnMobile2": "Try scrolling the table sideways.", "clone": "Clone", + "cloneConfirm": "Are you sure you would like to clone this server? This process may take a while.", "cpuCores": "CPU Cores", "cpuCurFreq": "CPU Current Clock", "cpuMaxFreq": "CPU Maximum Clock",