MCPcopy Create free account
hub / github.com/chrxh/alien / processForLeaf

Method processForLeaf

source/Gui/EditSimulationDialog.cpp:53–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53void EditSimulationDialog::processForLeaf()
54{
55 auto& rawTO = _treeTO->getLeaf().rawTO;
56 std::string resourceTypeString = rawTO->resourceType == NetworkResourceType_Simulation ? "simulation" : "genome";
57
58 AlienImGui::InputText(AlienImGui::InputTextParameters().textWidth(0).hint("Name"), _newName);
59
60 AlienImGui::Separator();
61
62 ImGui::PushID("description");
63 AlienImGui::InputTextMultiline(
64 AlienImGui::InputTextMultilineParameters()
65 .hint("Description (optional)")
66 .textWidth(0)
67 .height(ImGui::GetContentRegionAvail().y - scale(50.0f)),
68 _newDescription);
69 ImGui::PopID();
70
71 AlienImGui::Separator();
72
73 ImGui::BeginDisabled(_newName.empty());
74 if (AlienImGui::Button("OK")) {
75 if (NetworkValidationService::get().isStringValidForDatabase(_newName) && NetworkValidationService::get().isStringValidForDatabase(_newDescription)) {
76 EditNetworkResourceRequestData::Entry entry{.resourceId = rawTO->id, .newName = _newName, .newDescription = _newDescription};
77 NetworkTransferController::get().onEdit(EditNetworkResourceRequestData{.entries = std::vector{entry}});
78 close();
79 } else {
80 showMessage("Error", Const::NotAllowedCharacters);
81 }
82 }
83 ImGui::EndDisabled();
84 ImGui::SetItemDefaultFocus();
85
86 ImGui::SameLine();
87 if (AlienImGui::Button("Cancel")) {
88 close();
89 }
90}
91
92void EditSimulationDialog::processForFolder()
93{

Callers

nothing calls this directly

Calls 6

InputTextParametersClass · 0.85
scaleFunction · 0.85
showMessageFunction · 0.85
onEditMethod · 0.80

Tested by

no test coverage detected