diff --git a/ydb/core/mind/hive/hive_statics.cpp b/ydb/core/mind/hive/hive_statics.cpp index 242f7a1d5de8..8256f59b25d1 100644 --- a/ydb/core/mind/hive/hive_statics.cpp +++ b/ydb/core/mind/hive/hive_statics.cpp @@ -453,12 +453,12 @@ TString GetTypesHtml(const std::set& typesToShow, const std auto longTypeName = TTabletTypes::TypeToStr(type); if (it == tabletLimits.end() || it->second.GetMaxCount() > 0) { str << ""; + << "' onclick='changeDefaultTabletLimit(this, \"" << shortTypeName + << ":0\", \"" << longTypeName << "\")'>"; } else { str << ""; + << "' onclick='changeDefaultTabletLimit(this, \"" << shortTypeName + << ":" << TNodeInfo::MAX_TABLET_COUNT_DEFAULT_VALUE << "\", \"" << longTypeName << "\")'>"; } str << shortTypeName; str << ""; diff --git a/ydb/core/mind/hive/monitoring.cpp b/ydb/core/mind/hive/monitoring.cpp index 91fe1caf80d8..1e72b715c142 100644 --- a/ydb/core/mind/hive/monitoring.cpp +++ b/ydb/core/mind/hive/monitoring.cpp @@ -2015,6 +2015,40 @@ function clearAlert() { $('#alert-placeholder').removeClass('glyphicon-refresh'); } + +function showConfirmationModal(message, onConfirm, onDismiss) { + var modal = $(''); + + $('.modal').remove(); + $('body').append(modal); + modal.modal('show'); + + modal.find('.confirm-btn').click(function () { + if (onConfirm) onConfirm(); + modal.modal('hide').remove(); + }); + + modal.on('hidden.bs.modal', function () { + if (onDismiss) onDismiss(); + modal.remove(); + }); +} + + function enableType(element, node, type) { $(element).css('color', 'gray'); $.ajax({url:'?TabletID=' + hiveId + '&node=' + node + '&page=TabletAvailability&resettype=' + type}); @@ -2025,14 +2059,33 @@ function disableType(element, node, type) { $.ajax({url:'?TabletID=' + hiveId + '&node=' + node + '&page=TabletAvailability&maxcount=0&changetype=' + type}); } -function applySetting(button, name, val) { - $(button).css('color', 'gray'); - if (name == "DefaultTabletLimit") { - should_refresh_types = true; +function changeDefaultTabletLimit(button, val, tabletTypeName) { + let text = ''; + if (val.split(':')[1] == '0') { + text = 'Prohibit starting tablets of type ' + tabletTypeName + ' on every node'; + } else { + text = 'Allow starting tablets of type ' + tabletTypeName + ' on every node'; } - $.ajax({ - url: document.URL + '&page=Settings&' + name + '=' + val, - }); + applySetting(button, 'DefaultTabletLimit', val, text); +} + +function applySetting(button, name, val, text) { + $(button).css('color', 'gray'); + + showConfirmationModal( + 'Are you sure you want to proceed? ' + text, + function () { + if (name == "DefaultTabletLimit") { + should_refresh_types = true; + } + $.ajax({ + url: document.URL + '&page=Settings&' + name + '=' + val, + }); + }, + function () { + $(button).css('color', ''); + } + ); } var Empty = true;