Skip to content

Commit 2c7ec35

Browse files
erickasCopilot
andcommitted
wip
Co-authored-by: Copilot <copilot@github.com>
1 parent 68fdb70 commit 2c7ec35

27 files changed

Lines changed: 486 additions & 314 deletions

docs/INDEX.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ A documentação ativa está dividida em dois níveis:
1818
- **[CODE_CONVENTIONS.md](CODE_CONVENTIONS.md)** — Convenções de código, naming e estrutura geral
1919
- **[EXCEPTION_HANDLING_STRATEGY.md](EXCEPTION_HANDLING_STRATEGY.md)** — Estratégia de tratamento de erros e falhas
2020
- **[SEARCH_FILTERING_GUIDELINE.md](SEARCH_FILTERING_GUIDELINE.md)** — Padrão de busca textual centralizada (fuzzy vs estrito) para UI
21+
- **[OBSERVABILITY_BASELINE_TEMPLATE.md](OBSERVABILITY_BASELINE_TEMPLATE.md)** - Template operacional de baseline semanal para Onda 0 (OBS-01/OBS-02/OBS-03)
2122
- **[LIST_RENDERING_PERFORMANCE_GUIDELINE.md](LIST_RENDERING_PERFORMANCE_GUIDELINE.md)** — Regras normativas para listas/listagens performáticas (virtualização, cache, debounce e invalidação)
2223
- **[MODAL_LAYOUT_GUIDELINE.md](MODAL_LAYOUT_GUIDELINE.md)** — Guideline normativa para estrutura de modais (header + body rolável + footer fixo)
2324
- **[MODAL_ADOPTION_MAP.md](MODAL_ADOPTION_MAP.md)** — Inventário de modais e status de adoção da guideline

src/AkkornStudio.UI/AkkornStudio.UI.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<AvaloniaResource Include="Assets\Syntax\*.xshd" />
3636
<EmbeddedResource Include="Assets\ReportFrontend\dist\report-app.css" />
3737
<EmbeddedResource Include="Assets\ReportFrontend\dist\report-app.js" />
38+
<AvaloniaResource Include="Assets\Images\**" />
3839
<None Update="Assets\Localization\*.json">
3940
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
4041
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>

src/AkkornStudio.UI/App.axaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
xmlns:mi="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
44
xmlns:sqlcomp="using:AkkornStudio.UI.Services.SqlEditor"
55
x:Class="AkkornStudio.UI.App"
6-
RequestedThemeVariant="Dark">
6+
RequestedThemeVariant="Dark"
7+
>
78

89
<Application.Resources>
910
<ResourceDictionary>
1011
<ResourceDictionary.MergedDictionaries>
11-
<!-- Design tokens first -->
1212
<ResourceInclude Source="avares://AkkornStudio.UI/Assets/Themes/DesignTokens.axaml"/>
1313
</ResourceDictionary.MergedDictionaries>
1414
</ResourceDictionary>
3.93 KB
Binary file not shown.

src/AkkornStudio.UI/Assets/Themes/AppStyles.axaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,14 +645,23 @@
645645
</Style>
646646

647647
<Style Selector="Expander.app-accordion">
648-
<Setter Property="Background" Value="{StaticResource Bg1Brush}"/>
648+
<Setter Property="Background" Value="{StaticResource Bg2Brush}"/>
649649
<Setter Property="BorderBrush" Value="{StaticResource BorderSubtleBrush}"/>
650650
<Setter Property="BorderThickness" Value="1"/>
651651
<Setter Property="CornerRadius" Value="{StaticResource RadiusMD}"/>
652652
<Setter Property="Padding" Value="0"/>
653653
<Setter Property="HorizontalAlignment" Value="Stretch"/>
654654
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
655655
</Style>
656+
<Style Selector="Expander.app-accordion /template/ ToggleButton">
657+
<Setter Property="Background" Value="{StaticResource Bg2Brush}"/>
658+
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}"/>
659+
<Setter Property="BorderBrush" Value="{StaticResource BorderSubtleBrush}"/>
660+
</Style>
661+
<Style Selector="Expander.app-accordion /template/ ContentPresenter">
662+
<Setter Property="Background" Value="{StaticResource Bg1Brush}"/>
663+
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}"/>
664+
</Style>
656665
<Style Selector="Expander.app-accordion:pointerover">
657666
<Setter Property="BorderBrush" Value="{StaticResource BorderFocusBrush}"/>
658667
</Style>

src/AkkornStudio.UI/Controls/SidebarLeft/SidebarControl.axaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@
2323
<Button x:Name="NodesTabButton"
2424
Classes="panel-tab"
2525
Classes.active="{Binding ShowNodes}"
26+
Command="{Binding SelectNodesCommand}"
2627
Content="{Binding [sidebar.tab.nodes], Source={x:Static loc:LocalizationService.Instance}}"/>
2728

2829
<!-- Connection Tab -->
2930
<Button x:Name="ConnectionTabButton"
3031
Classes="panel-tab"
3132
Classes.active="{Binding ShowConnection}"
33+
Command="{Binding SelectConnectionCommand}"
3234
Content="{Binding [sidebar.tab.connection], Source={x:Static loc:LocalizationService.Instance}}"/>
3335

3436
</StackPanel>
@@ -38,12 +40,14 @@
3840
<Grid Grid.Row="1" RowDefinitions="*">
3941
<!-- Nodes Tab -->
4042
<Grid IsVisible="{Binding ShowNodes}" Grid.Column="0">
41-
<ctrl:NodesListControl x:Name="NodesControl"/>
43+
<ctrl:NodesListControl x:Name="NodesControl"
44+
DataContext="{Binding NodesList}"/>
4245
</Grid>
4346

4447
<!-- Connection Tab -->
4548
<Grid IsVisible="{Binding ShowConnection}" Grid.Column="0" VerticalAlignment="Stretch">
4649
<ctrl:ConnectionTabControl x:Name="ConnectionControl"
50+
DataContext="{Binding ConnectionManager}"
4751
VerticalAlignment="Stretch"
4852
HorizontalAlignment="Stretch"/>
4953
</Grid>
Lines changed: 14 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,33 @@
11
using Avalonia;
22
using Avalonia.Controls;
33
using Avalonia.Threading;
4-
using System.ComponentModel;
54
using AkkornStudio.UI.ViewModels;
6-
using ESidebarTab = AkkornStudio.UI.ViewModels.SidebarTab;
75

86
namespace AkkornStudio.UI.Controls;
97

108
public partial class SidebarControl : UserControl
119
{
12-
private bool _buttonsWired = false;
1310
private SidebarViewModel? _subscribedVm;
14-
private bool _isAnimatingTab;
1511

1612
public SidebarControl()
1713
{
1814
InitializeComponent();
19-
20-
// Wire up button click handlers when loaded
21-
this.Loaded += (_, _) => WireUpButtons();
22-
}
23-
24-
private void WireUpButtons()
25-
{
26-
if (_buttonsWired || DataContext is not SidebarViewModel vm)
27-
return;
28-
29-
_buttonsWired = true;
30-
31-
var nodesButton = this.FindControl<Button>("NodesTabButton");
32-
var connectionButton = this.FindControl<Button>("ConnectionTabButton");
33-
var schemaButton = this.FindControl<Button>("SchemaTabButton");
34-
35-
if (nodesButton is not null)
36-
{
37-
nodesButton.Click += (_, _) => vm.ActiveTab = ESidebarTab.Nodes;
38-
}
39-
if (connectionButton is not null)
40-
{
41-
connectionButton.Click += (_, _) => vm.ActiveTab = ESidebarTab.Connection;
42-
}
43-
if (schemaButton is not null)
44-
{
45-
schemaButton.Click += (_, _) => vm.ActiveTab = ESidebarTab.Schema;
46-
}
47-
// Set child control DataContexts
48-
var nodesControl = this.FindControl<NodesListControl>("NodesControl");
49-
var connectionControl = this.FindControl<ConnectionTabControl>("ConnectionControl");
50-
var schemaControl = this.FindControl<SchemaControl>("SchemaControl");
51-
52-
if (nodesControl is not null)
53-
nodesControl.DataContext = vm.NodesList;
54-
if (connectionControl is not null)
55-
connectionControl.DataContext = vm.ConnectionManager;
56-
if (connectionControl is not null)
57-
connectionControl.DataContext = vm.EffectiveConnectionManager;
58-
if (schemaControl is not null)
59-
schemaControl.DataContext = vm.Schema;
60-
61-
AttachVmSubscriptions(vm);
62-
_ = AnimateActiveTabAsync(vm.ActiveTab);
15+
Loaded += (_, _) => AttachVmSubscriptions(DataContext as SidebarViewModel);
6316
}
6417

65-
private void AttachVmSubscriptions(SidebarViewModel vm)
18+
private void AttachVmSubscriptions(SidebarViewModel? vm)
6619
{
6720
if (ReferenceEquals(_subscribedVm, vm))
6821
return;
6922

7023
if (_subscribedVm is not null)
7124
{
72-
_subscribedVm.PropertyChanged -= OnSidebarPropertyChanged;
7325
_subscribedVm.AddNodeRequested -= OnAddNodeRequested;
7426
}
7527

7628
_subscribedVm = vm;
77-
_subscribedVm.PropertyChanged += OnSidebarPropertyChanged;
78-
_subscribedVm.AddNodeRequested += OnAddNodeRequested;
79-
}
80-
81-
private void OnSidebarPropertyChanged(object? sender, PropertyChangedEventArgs e)
82-
{
83-
if (_subscribedVm is null)
84-
return;
85-
86-
if (e.PropertyName == nameof(SidebarViewModel.EffectiveConnectionManager))
87-
{
88-
ConnectionTabControl? connectionControl = this.FindControl<ConnectionTabControl>("ConnectionControl");
89-
if (connectionControl is not null)
90-
connectionControl.DataContext = _subscribedVm.EffectiveConnectionManager;
91-
92-
SchemaControl? schemaControl = this.FindControl<SchemaControl>("SchemaControl");
93-
if (schemaControl is not null)
94-
schemaControl.DataContext = _subscribedVm.Schema;
95-
}
96-
97-
if (e.PropertyName != nameof(SidebarViewModel.ActiveTab))
98-
return;
99-
100-
_ = AnimateActiveTabAsync(_subscribedVm.ActiveTab);
29+
if (_subscribedVm is not null)
30+
_subscribedVm.AddNodeRequested += OnAddNodeRequested;
10131
}
10232

10333
private void OnAddNodeRequested()
@@ -109,47 +39,19 @@ private void OnAddNodeRequested()
10939
}, DispatcherPriority.Background);
11040
}
11141

112-
private async Task AnimateActiveTabAsync(SidebarTab tab)
42+
protected override void OnDataContextChanged(EventArgs e)
11343
{
114-
if (_isAnimatingTab)
115-
return;
116-
117-
Control? target = tab switch
118-
{
119-
SidebarTab.Nodes => this.FindControl<Control>("NodesControl"),
120-
SidebarTab.Connection => this.FindControl<Control>("ConnectionControl"),
121-
SidebarTab.Schema => this.FindControl<Control>("SchemaControl"),
122-
_ => null,
123-
};
124-
125-
if (target is null)
126-
return;
127-
128-
_isAnimatingTab = true;
129-
try
130-
{
131-
target.Opacity = 0;
132-
const int steps = 5;
133-
for (int i = 1; i <= steps; i++)
134-
{
135-
target.Opacity = i / (double)steps;
136-
await Task.Delay(18);
137-
}
138-
}
139-
finally
140-
{
141-
_isAnimatingTab = false;
142-
}
44+
base.OnDataContextChanged(e);
45+
AttachVmSubscriptions(DataContext as SidebarViewModel);
14346
}
14447

145-
protected override void OnDataContextChanged(EventArgs e)
48+
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
14649
{
147-
base.OnDataContextChanged(e);
148-
// Reset and re-wire if data context changes
149-
if (this.IsLoaded)
150-
{
151-
_buttonsWired = false;
152-
WireUpButtons();
153-
}
50+
base.OnDetachedFromVisualTree(e);
51+
if (_subscribedVm is null)
52+
return;
53+
54+
_subscribedVm.AddNodeRequested -= OnAddNodeRequested;
55+
_subscribedVm = null;
15456
}
15557
}

src/AkkornStudio.UI/Services/CommandPalette/CommandPaletteFactory.cs

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,18 @@ private List<PaletteCommandItem> CreateBasicCommands() =>
227227
},
228228
new()
229229
{
230+
ActionId = ShortcutActionIds.OpenConnectionManager,
230231
Name = LN("Manage Connections"),
231232
Description = LD("Open the connection manager to add, edit or switch database connections"),
232233
Shortcut = ShortcutText(ShortcutActionIds.OpenConnectionManager, "Ctrl+Shift+C"),
233234
Icon = MaterialIconKind.DatabaseSettings,
234235
Tags = LTg("connection database server host provider switch"),
235-
Execute = () => CurrentCanvas.ConnectionManager.Open(),
236+
Execute = () =>
237+
{
238+
ConnectionManagerViewModel manager = CurrentShell.ActiveConnectionManager
239+
?? CurrentShell.EnsureCanvas().ConnectionManager;
240+
manager.ConnectOrOpenManagerCommand.Execute(null);
241+
},
236242
},
237243
// ── File ──────────────────────────────────────────────────────────
238244
new()
@@ -430,20 +436,6 @@ private List<PaletteCommandItem> CreateBasicCommands() =>
430436
Tags = LTg("data results table panel"),
431437
Execute = OpenOutputPreviewModal,
432438
},
433-
new()
434-
{
435-
ActionId = ShortcutActionIds.RunPreview,
436-
Name = LN("Run Preview"),
437-
Description = LD("Execute the current query in preview"),
438-
Shortcut = ShortcutText(ShortcutActionIds.RunPreview, "F5"),
439-
Icon = MaterialIconKind.Play,
440-
Tags = LTg("execute run sql query results"),
441-
Execute = async () =>
442-
{
443-
if (!CurrentCanvas.HasErrors && !CurrentCanvas.LiveSql.IsMutatingCommand)
444-
await _preview.RunPreviewAsync();
445-
},
446-
},
447439
// ── Cleanup / Quality ─────────────────────────────────────────────
448440
new()
449441
{
@@ -632,17 +624,6 @@ private void OpenOutputPreviewModal()
632624

633625
switch (shell.ActivePreviewContract.Kind)
634626
{
635-
case WorkspaceDocumentPreviewKind.Query:
636-
{
637-
CanvasViewModel queryCanvas = shell.ActiveQueryCanvasDocument ?? shell.Canvas
638-
?? throw new InvalidOperationException("Preview SQL indisponivel para o canvas Query atual.");
639-
LiveSqlBarViewModel liveSql = queryCanvas.LiveSql
640-
?? throw new InvalidOperationException("Preview SQL indisponivel para o canvas Query atual.");
641-
liveSql.Recompile();
642-
shell.OutputPreview.OpenForQuery(queryCanvas, liveSql, liveSql.ProviderLabel);
643-
return;
644-
}
645-
646627
case WorkspaceDocumentPreviewKind.Ddl:
647628
{
648629
CanvasViewModel ddlCanvas = shell.EnsureDdlCanvas();

src/AkkornStudio.UI/Services/Input/KeyboardInputHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ private bool ExecuteRegisteredShortcut(
522522
case ShortcutActionIds.RunPreview:
523523
if (isTextInputFocused || isCanvasInteractionBlocked)
524524
return false;
525-
return TryExecuteCommandPaletteShortcut(ShortcutActionIds.RunPreview, "F5");
525+
return false;
526526

527527
case ShortcutActionIds.ExplainPlan:
528528
if (isTextInputFocused || isCanvasInteractionBlocked)

src/AkkornStudio.UI/Services/Input/ShortcutRegistry/DefaultShortcutCatalog.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ static void Noop() { }
4343
Def(ShortcutActionIds.SendToBack, "Send to Back", "Send selection to back", "Canvas and Navigation", ShortcutContext.Canvas, "layer", "arrange", "Ctrl+Shift+PgDown"),
4444

4545
Def(ShortcutActionIds.TogglePreview, "Toggle Preview", "Toggle preview panel", "Preview and Inspection", ShortcutContext.Canvas, "preview", "data", "F3"),
46-
Def(ShortcutActionIds.RunPreview, "Run Preview", "Run preview query", "Preview and Inspection", ShortcutContext.Canvas, "preview", "execute", "F5"),
4746
Def(ShortcutActionIds.ExplainPlan, "Explain Plan", "Open explain plan", "Preview and Inspection", ShortcutContext.Canvas, "explain", "plan", "F4"),
4847

4948
Def(ShortcutActionIds.ZoomIn, "Zoom In", "Increase zoom", "Zoom, pan and precision", ShortcutContext.Canvas, "zoom", "canvas", "Ctrl++"),

0 commit comments

Comments
 (0)