class CreateLogsCluster extends ControllerBase { // Конструктор constructor() { super("logs_clusters"); } // Отправка запроса на сервер async SendRequest(name, description, recommendation) { let cluster = { "id": window.get_logs_clusters.clusters.length, "name": name, "description": description, "recommendation": recommendation }; await super.Any(cluster, 'post'); let row = window.logs_cluters_table.insertRow(); this.FillClusterRow(row, cluster); window.get_logs_clusters.clusters.push(cluster); window.get_logs_clusters.AddCluster(window.select_cluster, cluster); } // Обработка ответа от сервера // respone -- ответ сервера ProcessResponse(response) {} FillClusterRow(row, cluster) { let cell = row.insertCell(0); cell.innerHTML = String(cluster["id"]); cell = row.insertCell(1); cell.innerHTML = cluster["name"]; cell = row.insertCell(2); cell.innerHTML = cluster["description"]; cell = row.insertCell(3); cell.innerHTML = cluster["recommendation"]; } } async function CreateCluster() { const name = document.getElementById("cluster-name").value; if (name.length == 0) { alert("Название кластера не может быть пустым"); return; } const description = document.getElementById("cluster-description").value; const recommendation = document.getElementById("cluster-recommendation").value; await window.create_logs_cluster.SendRequest(name, description, recommendation); } function UpdateClusterSelector(selector) { for (let index = selector.options.length; index < window.select_cluster.options.length; index++) { let option = window.select_cluster.options[index]; selector.add(option.cloneNode(true)); } }