mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-17 22:14:28 +01:00
Implement UI Disable Feature During Benchmark Run
Added a state variable isBenchmarkRunning in SkillTreeViewModel to track the status of benchmark execution. This state variable is used to conditionally disable specific UI components: - The "Initiate test suite" button in TaskQueueView is disabled during the benchmark. - All IconButtons in SideBarView are disabled during the benchmark. - Node selection in SkillTreeView is disabled during the benchmark. This ensures that the user cannot interact with these components while a benchmark test is running, thereby improving UX and preventing potential issues.
This commit is contained in:
@@ -9,11 +9,15 @@ import 'package:flutter/services.dart';
|
||||
import 'package:graphview/GraphView.dart';
|
||||
|
||||
class SkillTreeViewModel extends ChangeNotifier {
|
||||
// TODO: Potentially move to task queue view model when we create one
|
||||
final BenchmarkService benchmarkService;
|
||||
// TODO: Potentially move to task queue view model when we create one
|
||||
bool isBenchmarkRunning = false;
|
||||
|
||||
List<SkillTreeNode> _skillTreeNodes = [];
|
||||
List<SkillTreeEdge> _skillTreeEdges = [];
|
||||
SkillTreeNode? _selectedNode;
|
||||
// TODO: Potentially move to task queue view model when we create one
|
||||
List<SkillTreeNode>? _selectedNodeHierarchy;
|
||||
|
||||
SkillTreeNode? get selectedNode => _selectedNode;
|
||||
@@ -69,6 +73,7 @@ class SkillTreeViewModel extends ChangeNotifier {
|
||||
}
|
||||
|
||||
void toggleNodeSelection(String nodeId) {
|
||||
if (isBenchmarkRunning) return;
|
||||
if (_selectedNode?.id == nodeId) {
|
||||
// Unselect the node if it's already selected
|
||||
_selectedNode = null;
|
||||
@@ -127,6 +132,9 @@ class SkillTreeViewModel extends ChangeNotifier {
|
||||
|
||||
// TODO: Update to actual implementation
|
||||
Future<void> runBenchmark(ReportRequestBody reportRequestBody) async {
|
||||
isBenchmarkRunning = true;
|
||||
notifyListeners();
|
||||
|
||||
try {
|
||||
final result = await benchmarkService.generateReport(reportRequestBody);
|
||||
// Pretty-print the JSON result
|
||||
@@ -135,6 +143,9 @@ class SkillTreeViewModel extends ChangeNotifier {
|
||||
} catch (e) {
|
||||
print("Failed to generate report: $e");
|
||||
}
|
||||
|
||||
isBenchmarkRunning = false;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
// TODO: Update to actual implementation
|
||||
|
||||
Reference in New Issue
Block a user