Agent class description, visible in UI
This commit is contained in:
1 parent
e9ebb1378a
commit
6530ff0a24
4 files changed
+49
-1
No files matched your search
@@ -25,14 +25,36 @@ class AgentScreen extends StatefulWidget {
|
||||
class _AgentScreenState extends State<AgentScreen> {
|
||||
String? _title;
|
||||
final TextEditingController nameController = TextEditingController();
|
||||
String description = "";
|
||||
List<ConfigField> configFields = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_loadAgentInfo();
|
||||
_loadConfigFields();
|
||||
}
|
||||
|
||||
void _loadAgentInfo() async {
|
||||
final agentsResponse = await Backend.sendAction('get-agents', {});
|
||||
var agentEntry = null;
|
||||
for (var entry in agentsResponse['agents']) {
|
||||
if (entry['id'] == widget.agentId) {
|
||||
agentEntry = entry;
|
||||
}
|
||||
}
|
||||
|
||||
if (agentEntry == null) {
|
||||
print("Agent ${widget.agentId} not found in agents list");
|
||||
return;
|
||||
}
|
||||
|
||||
final kindResponse = await Backend.sendAction('get-agent-kind-info', {'kind': agentEntry['kind']});
|
||||
setState(() {
|
||||
description = kindResponse['info']['description'];
|
||||
});
|
||||
}
|
||||
|
||||
void _loadConfigFields() async {
|
||||
final response = await Backend.sendAction('get-agent-config-fields', {'agentId': widget.agentId});
|
||||
setState(() {
|
||||
@@ -77,6 +99,13 @@ class _AgentScreenState extends State<AgentScreen> {
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8.0),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(description),
|
||||
)
|
||||
),
|
||||
ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: configFields.length,
|
||||
|
||||
Reference in new issue
Block a user