Remove fake/sample data from 6 UI pages
Replace constructor-injected sample data with empty/loading states across Usage, Sessions, Nodes, Channels, Skills, and Cron pages. Skills and Cron APIs were already wired; this removes stale warnings and misleading placeholder data.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
fb1b766f73
commit
f0704907f8
@ -17,14 +17,6 @@ public sealed partial class ChannelsPage : Page
|
||||
public ChannelsPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// Sample data for design-time preview
|
||||
var samples = new List<ChannelViewModel>
|
||||
{
|
||||
new() { Name = "Telegram", Status = "connected", StatusColor = "Green", IsRunning = true, ProbeInfo = "Bot: @myclaw_bot · 45ms" },
|
||||
new() { Name = "WhatsApp", Status = "disconnected", StatusColor = "Red", IsRunning = false, ProbeInfo = null },
|
||||
};
|
||||
RenderChannels(samples);
|
||||
}
|
||||
|
||||
public void Initialize(HubWindow hub)
|
||||
|
||||
@ -9,13 +9,6 @@
|
||||
|
||||
<TextBlock x:Uid="CronPage_TextBlock_10" Text="⏱️ Cron Jobs" Style="{StaticResource TitleTextBlockStyle}"/>
|
||||
|
||||
<!-- Not-wired InfoBar -->
|
||||
<InfoBar x:Uid="NotWiredInfoBar" x:Name="NotWiredInfoBar"
|
||||
IsOpen="True" IsClosable="False"
|
||||
Severity="Warning"
|
||||
Title="Cron API not yet wired"
|
||||
Message="Showing sample data. Cron management methods are not yet available in OpenClawGatewayClient."/>
|
||||
|
||||
<!-- Scheduler Status Card -->
|
||||
<Border Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
|
||||
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
|
||||
@ -29,11 +22,11 @@
|
||||
<TextBlock x:Uid="CronPage_TextBlock_29" Text="Scheduler Status" Style="{StaticResource BodyStrongTextBlockStyle}"/>
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
<Ellipse x:Name="SchedulerStatusIndicator" Width="10" Height="10"
|
||||
Fill="LimeGreen" VerticalAlignment="Center"/>
|
||||
<TextBlock x:Uid="SchedulerStatusText" x:Name="SchedulerStatusText" Text="Enabled"
|
||||
Fill="Gray" VerticalAlignment="Center"/>
|
||||
<TextBlock x:Uid="SchedulerStatusText" x:Name="SchedulerStatusText" Text="—"
|
||||
VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<TextBlock x:Uid="StorePathText" x:Name="StorePathText" Text="Store: ~/.openclaw/cron.db"
|
||||
<TextBlock x:Uid="StorePathText" x:Name="StorePathText" Text="Store: —"
|
||||
Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>
|
||||
<TextBlock x:Uid="NextWakeText" x:Name="NextWakeText" Text="Next wake: —"
|
||||
@ -41,7 +34,7 @@
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>
|
||||
</StackPanel>
|
||||
<ToggleSwitch x:Name="SchedulerToggle" Grid.Column="1"
|
||||
IsOn="True" VerticalAlignment="Center"
|
||||
IsOn="False" VerticalAlignment="Center"
|
||||
IsEnabled="False"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
@ -116,7 +109,7 @@
|
||||
</ListView>
|
||||
|
||||
<!-- Empty State -->
|
||||
<StackPanel x:Name="EmptyState" Visibility="Collapsed"
|
||||
<StackPanel x:Name="EmptyState" Visibility="Visible"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Center" Spacing="8"
|
||||
Margin="0,32,0,0">
|
||||
<TextBlock Text="⏱️" FontSize="48" HorizontalAlignment="Center"/>
|
||||
|
||||
@ -12,7 +12,6 @@ namespace OpenClawTray.Pages;
|
||||
public sealed partial class CronPage : Page
|
||||
{
|
||||
private HubWindow? _hub;
|
||||
private bool _hasLiveData;
|
||||
|
||||
public CronPage()
|
||||
{
|
||||
@ -24,57 +23,9 @@ public sealed partial class CronPage : Page
|
||||
_hub = hub;
|
||||
if (hub.GatewayClient != null)
|
||||
{
|
||||
NotWiredInfoBar.IsOpen = false;
|
||||
_ = hub.GatewayClient.RequestCronListAsync();
|
||||
_ = hub.GatewayClient.RequestCronStatusAsync();
|
||||
}
|
||||
LoadSampleJobs();
|
||||
}
|
||||
|
||||
private void LoadSampleJobs()
|
||||
{
|
||||
if (_hasLiveData) return;
|
||||
|
||||
var jobs = new List<CronJobViewModel>
|
||||
{
|
||||
new()
|
||||
{
|
||||
Id = "sample-1",
|
||||
Name = "Daily email summary",
|
||||
Schedule = "0 9 * * *",
|
||||
IsEnabled = true,
|
||||
LastRunTime = DateTime.Now.AddHours(-3).ToString("yyyy-MM-dd HH:mm"),
|
||||
LastResult = "success",
|
||||
ResultBadgeBackground = new SolidColorBrush(Colors.Green),
|
||||
NextRunTime = DateTime.Now.AddHours(21).ToString("yyyy-MM-dd HH:mm"),
|
||||
},
|
||||
new()
|
||||
{
|
||||
Id = "sample-2",
|
||||
Name = "Backup config",
|
||||
Schedule = "0 0 * * 0",
|
||||
IsEnabled = true,
|
||||
LastRunTime = DateTime.Now.AddDays(-3).ToString("yyyy-MM-dd HH:mm"),
|
||||
LastResult = "success",
|
||||
ResultBadgeBackground = new SolidColorBrush(Colors.Green),
|
||||
NextRunTime = DateTime.Now.AddDays(4).ToString("yyyy-MM-dd HH:mm"),
|
||||
},
|
||||
new()
|
||||
{
|
||||
Id = "sample-3",
|
||||
Name = "Health check",
|
||||
Schedule = "*/15 * * * *",
|
||||
IsEnabled = true,
|
||||
LastRunTime = DateTime.Now.AddMinutes(-7).ToString("yyyy-MM-dd HH:mm"),
|
||||
LastResult = "fail",
|
||||
ResultBadgeBackground = new SolidColorBrush(Colors.Red),
|
||||
NextRunTime = DateTime.Now.AddMinutes(8).ToString("yyyy-MM-dd HH:mm"),
|
||||
},
|
||||
};
|
||||
|
||||
JobsList.ItemsSource = jobs;
|
||||
JobsList.Visibility = Visibility.Visible;
|
||||
EmptyState.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
private void OnRunNowClick(object sender, RoutedEventArgs e)
|
||||
@ -167,9 +118,6 @@ public sealed partial class CronPage : Page
|
||||
|
||||
DispatcherQueue?.TryEnqueue(() =>
|
||||
{
|
||||
_hasLiveData = true;
|
||||
NotWiredInfoBar.IsOpen = false;
|
||||
|
||||
if (jobs.Count > 0)
|
||||
{
|
||||
JobsList.ItemsSource = jobs;
|
||||
@ -205,7 +153,6 @@ public sealed partial class CronPage : Page
|
||||
|
||||
DispatcherQueue?.TryEnqueue(() =>
|
||||
{
|
||||
NotWiredInfoBar.IsOpen = false;
|
||||
SchedulerToggle.IsOn = enabled;
|
||||
SchedulerStatusText.Text = enabled ? "Enabled" : "Disabled";
|
||||
SchedulerStatusIndicator.Fill = new SolidColorBrush(enabled ? Colors.LimeGreen : Colors.Gray);
|
||||
|
||||
@ -19,26 +19,6 @@ public sealed partial class NodesPage : Page
|
||||
public NodesPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// Sample data
|
||||
var samples = new List<NodeViewModel>
|
||||
{
|
||||
new()
|
||||
{
|
||||
Name = "Desktop-PC", DeviceId = "a1b2c3d4e5f6g7h8i9j0",
|
||||
Platform = "windows", IsOnline = true,
|
||||
Capabilities = new[] { "canvas", "camera", "screen", "system", "clipboard", "browser" },
|
||||
Commands = new[] { "screenshot", "open-url", "run-command", "read-clipboard", "write-clipboard" },
|
||||
},
|
||||
new()
|
||||
{
|
||||
Name = "MacBook-Pro", DeviceId = "z9y8x7w6v5u4t3s2r1q0",
|
||||
Platform = "macos", IsOnline = false,
|
||||
Capabilities = new[] { "canvas", "screen", "system" },
|
||||
Commands = new[] { "screenshot", "open-url" },
|
||||
},
|
||||
};
|
||||
RenderNodes(samples);
|
||||
}
|
||||
|
||||
public void Initialize(HubWindow hub)
|
||||
|
||||
@ -15,16 +15,6 @@ public sealed partial class SessionsPage : Page
|
||||
public SessionsPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// Sample data for design-time preview
|
||||
var samples = new List<SessionViewModel>
|
||||
{
|
||||
new() { Key = "agent:main", Preview = "Help me refactor the authentication module to use JWT tokens...", TimeAgo = "2m ago", ThinkingLevel = "medium", VerboseLevel = null, IsActive = true },
|
||||
new() { Key = "agent:cron:daily-summary", Preview = "Generated daily summary for 3 channels with 47 messages.", TimeAgo = "1h ago", ThinkingLevel = null, VerboseLevel = "detailed", IsActive = false },
|
||||
new() { Key = "telegram:user:12345", Preview = "Remind me to check the deployment status at 5pm today.", TimeAgo = "15m ago", ThinkingLevel = null, VerboseLevel = null, IsActive = true },
|
||||
};
|
||||
SessionListView.ItemsSource = samples;
|
||||
EmptyState.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
public void Initialize(HubWindow hub)
|
||||
|
||||
@ -15,13 +15,6 @@
|
||||
<ComboBoxItem x:Uid="SkillsPage_ComboBoxItem_15" Content="All Agents" Tag="" IsSelected="True"/>
|
||||
</ComboBox>
|
||||
|
||||
<!-- Not-wired InfoBar -->
|
||||
<InfoBar x:Uid="NotWiredInfoBar" x:Name="NotWiredInfoBar"
|
||||
IsOpen="True" IsClosable="False"
|
||||
Severity="Warning"
|
||||
Title="Skills API not yet wired"
|
||||
Message="Showing sample data. Skills management methods are not yet available in OpenClawGatewayClient."/>
|
||||
|
||||
<!-- Skills List -->
|
||||
<ListView x:Name="SkillsList" SelectionMode="None">
|
||||
<ListView.ItemTemplate>
|
||||
@ -74,7 +67,7 @@
|
||||
</ListView>
|
||||
|
||||
<!-- Empty State -->
|
||||
<StackPanel x:Name="EmptyState" Visibility="Collapsed"
|
||||
<StackPanel x:Name="EmptyState" Visibility="Visible"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Center" Spacing="8"
|
||||
Margin="0,32,0,0">
|
||||
<TextBlock Text="🧩" FontSize="48" HorizontalAlignment="Center"/>
|
||||
|
||||
@ -11,7 +11,6 @@ namespace OpenClawTray.Pages;
|
||||
public sealed partial class SkillsPage : Page
|
||||
{
|
||||
private HubWindow? _hub;
|
||||
private bool _hasLiveData;
|
||||
|
||||
public SkillsPage()
|
||||
{
|
||||
@ -24,10 +23,8 @@ public sealed partial class SkillsPage : Page
|
||||
PopulateAgentFilter(hub);
|
||||
if (hub.GatewayClient != null)
|
||||
{
|
||||
NotWiredInfoBar.IsOpen = false;
|
||||
_ = hub.GatewayClient.RequestSkillsStatusAsync(GetSelectedAgentId());
|
||||
}
|
||||
LoadSampleSkills();
|
||||
}
|
||||
|
||||
private void PopulateAgentFilter(HubWindow hub)
|
||||
@ -58,49 +55,6 @@ public sealed partial class SkillsPage : Page
|
||||
_ = client.RequestSkillsStatusAsync(GetSelectedAgentId());
|
||||
}
|
||||
|
||||
private void LoadSampleSkills()
|
||||
{
|
||||
if (_hasLiveData) return;
|
||||
|
||||
var skills = new List<SkillViewModel>
|
||||
{
|
||||
new()
|
||||
{
|
||||
Id = "github",
|
||||
Name = "GitHub Integration",
|
||||
Version = "v2.1",
|
||||
Description = "Connect OpenClaw to GitHub for issue tracking, PR reviews, and repository management.",
|
||||
StatusText = "Active",
|
||||
StatusBackground = new SolidColorBrush(Colors.Green),
|
||||
ActionLabel = "Update",
|
||||
},
|
||||
new()
|
||||
{
|
||||
Id = "email",
|
||||
Name = "Email Digest",
|
||||
Version = "v1.3",
|
||||
Description = "Automatically summarize and send email digests of daily activity and session outcomes.",
|
||||
StatusText = "Active",
|
||||
StatusBackground = new SolidColorBrush(Colors.Green),
|
||||
ActionLabel = "Update",
|
||||
},
|
||||
new()
|
||||
{
|
||||
Id = "calendar",
|
||||
Name = "Calendar Sync",
|
||||
Version = "v0.9",
|
||||
Description = "Sync scheduled tasks and cron jobs with your calendar provider for visibility.",
|
||||
StatusText = "Inactive",
|
||||
StatusBackground = new SolidColorBrush(Colors.Gray),
|
||||
ActionLabel = "Enable",
|
||||
},
|
||||
};
|
||||
|
||||
SkillsList.ItemsSource = skills;
|
||||
SkillsList.Visibility = Visibility.Visible;
|
||||
EmptyState.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
private void OnSkillActionClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var skillId = (sender as Button)?.Tag as string;
|
||||
@ -165,9 +119,6 @@ public sealed partial class SkillsPage : Page
|
||||
|
||||
DispatcherQueue?.TryEnqueue(() =>
|
||||
{
|
||||
_hasLiveData = true;
|
||||
NotWiredInfoBar.IsOpen = false;
|
||||
|
||||
if (skills.Count > 0)
|
||||
{
|
||||
SkillsList.ItemsSource = skills;
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<TextBlock x:Uid="UsagePage_TextBlock_21" Text="Total Cost" Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
HorizontalAlignment="Center"/>
|
||||
<TextBlock x:Name="TotalCostText" Text="$2.41" FontSize="28" FontWeight="SemiBold"
|
||||
<TextBlock x:Name="TotalCostText" Text="—" FontSize="28" FontWeight="SemiBold"
|
||||
HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
@ -34,7 +34,7 @@
|
||||
<StackPanel Spacing="4">
|
||||
<TextBlock x:Uid="UsagePage_TextBlock_35" Text="Requests" Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>
|
||||
<TextBlock x:Name="RequestCountText" Text="142" FontSize="28" FontWeight="SemiBold"/>
|
||||
<TextBlock x:Name="RequestCountText" Text="—" FontSize="28" FontWeight="SemiBold"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
<StackPanel Spacing="4">
|
||||
<TextBlock x:Uid="UsagePage_TextBlock_45" Text="Tokens" Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>
|
||||
<TextBlock x:Uid="TokenCountText" x:Name="TokenCountText" Text="284.5K" FontSize="28" FontWeight="SemiBold"/>
|
||||
<TextBlock x:Uid="TokenCountText" x:Name="TokenCountText" Text="—" FontSize="28" FontWeight="SemiBold"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
@ -54,7 +54,7 @@
|
||||
<StackPanel Spacing="4">
|
||||
<TextBlock x:Uid="UsagePage_TextBlock_55" Text="Providers" Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>
|
||||
<TextBlock x:Name="ProviderCountText" Text="3" FontSize="28" FontWeight="SemiBold"/>
|
||||
<TextBlock x:Name="ProviderCountText" Text="—" FontSize="28" FontWeight="SemiBold"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
||||
@ -16,21 +16,6 @@ public sealed partial class UsagePage : Page
|
||||
public UsagePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// Sample data
|
||||
ProviderListView.ItemsSource = new List<ProviderRow>
|
||||
{
|
||||
new() { Name = "OpenAI", Requests = "87 req", Tokens = "182.3K tok", Cost = "$1.24" },
|
||||
new() { Name = "Anthropic", Requests = "41 req", Tokens = "78.1K tok", Cost = "$0.89" },
|
||||
new() { Name = "Google", Requests = "14 req", Tokens = "24.1K tok", Cost = "$0.28" },
|
||||
};
|
||||
|
||||
var today = DateTime.Today;
|
||||
DailyListView.ItemsSource = Enumerable.Range(0, 7).Select(i => new DailyRow
|
||||
{
|
||||
Date = today.AddDays(-i).ToString("ddd, MMM d"),
|
||||
Cost = $"${(0.15 + i * 0.12 + (i % 3) * 0.18):F2}",
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public void Initialize(HubWindow hub)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user