| 720 | } |
| 721 | |
| 722 | void DialogAgent::onButtonBuild() |
| 723 | { |
| 724 | if (buildWorker) { |
| 725 | stopBuild(); |
| 726 | return; |
| 727 | } |
| 728 | |
| 729 | QString agentName = agentCombobox->currentText(); |
| 730 | QString profileName = inputProfileName->text().trimmed(); |
| 731 | bool shouldSaveProfile = actionSaveProfile->isChecked() && !profileName.isEmpty(); |
| 732 | |
| 733 | auto configData = QString(); |
| 734 | if (ax_uis.contains(agentName) && ax_uis[agentName].container) |
| 735 | configData = ax_uis[agentName].container->toJson(); |
| 736 | |
| 737 | if (shouldSaveProfile) { |
| 738 | saveProfile(profileName, agentName, configData); |
| 739 | loadProfiles(); |
| 740 | } |
| 741 | |
| 742 | QStringList selectedListeners; |
| 743 | bool isMultiListeners = agentTypes.value(agentName, AgentTypeInfo{false, QStringList()}).multiListeners; |
| 744 | if (isMultiListeners) { |
| 745 | for (int i = 0; i < listenerListWidget->count(); ++i) { |
| 746 | auto *item = listenerListWidget->item(i); |
| 747 | if (item->checkState() == Qt::Checked) { |
| 748 | selectedListeners.append(item->data(Qt::UserRole).toString()); |
| 749 | } |
| 750 | } |
| 751 | if (selectedListeners.isEmpty()) { |
| 752 | MessageError("Please select at least one listener"); |
| 753 | return; |
| 754 | } |
| 755 | } else { |
| 756 | selectedListeners.append(listenerName); |
| 757 | } |
| 758 | |
| 759 | buildLogOutput->clear(); |
| 760 | buildLogPanel->setVisible(true); |
| 761 | buildLogOutput->setVisible(true); |
| 762 | collapseButton->setIcon(QIcon(":/icons/arrow_drop_down")); |
| 763 | |
| 764 | buildButton->setText("Stop"); |
| 765 | |
| 766 | QString urlTemplate = "wss://%1:%2%3/channel"; |
| 767 | QString sUrl = urlTemplate.arg(authProfile.GetHost()).arg(authProfile.GetPort()).arg(authProfile.GetEndpoint()); |
| 768 | |
| 769 | QJsonArray listenersArray; |
| 770 | for (const QString &listener : selectedListeners) |
| 771 | listenersArray.append(listener); |
| 772 | |
| 773 | QJsonObject otpData; |
| 774 | otpData["agent_name"] = agentName; |
| 775 | otpData["listeners_name"] = listenersArray; |
| 776 | |
| 777 | QString otp; |
| 778 | bool otpResult = HttpReqGetOTP("channel_agent_build", otpData, authProfile.GetURL(), authProfile.GetAccessToken(), &otp); |
| 779 | if (!otpResult) { |
nothing calls this directly
no test coverage detected