-
Notifications
You must be signed in to change notification settings - Fork 0
Roadmap P4.19: painel de estatísticas (+ recolhe P7/P8 que ficaram fora da main) #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3d3d714
Permite abrir o painel de detalhes abaixo da lista
afernandes 32abc80
Adiciona visao em tabela (OmniDataGrid) com colunas derivadas do log
afernandes 24638a8
CI roda em PR para qualquer branch, nao so para a main
afernandes 938b2c1
Unifica a versao numa fonte unica e limpa residuos (roadmap P4.21/P4.23)
afernandes 1259ae5
Virtualiza a lista e corrige a paginacao off-by-one (roadmap P4.18)
afernandes a4e1b79
Melhora a acessibilidade dos elementos proprios (roadmap P4.20)
afernandes 068cb26
Atualiza status do P4 no roadmap
afernandes 344ec49
Merge pull request #8 from afernandes/feat/roadmap-p4
afernandes c946ed7
Adiciona painel de estatisticas do conjunto filtrado (roadmap P4.19)
afernandes 17fe0fe
Merge da base (PR #8 mergeado) na branch do painel de estatisticas
afernandes 0d2f98a
Atende ao review do PR #9 (Copilot)
afernandes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| <Project> | ||
|
|
||
| <!-- | ||
| Fonte única da versão do produto. | ||
|
|
||
| Antes o número vivia solto no ClefExplorer.csproj e ficou em 1.0.0 enquanto a Store | ||
| já estava em 1.0.2 — o título da janela, que lê a versão do assembly, mostrava um | ||
| número diferente do publicado. | ||
|
|
||
| Quem consome: | ||
| - ClefExplorer.csproj → Version/FileVersion/AssemblyVersion (título da janela); | ||
| - publish-store-package.ps1 → padrão quando -Version não é informado; | ||
| - .github/workflows/release.yml → sobrescreve com a versão da tag (a tag manda no release). | ||
|
|
||
| A <Identity Version> do Package.appxmanifest NÃO é lida daqui: é XML carimbado em | ||
| tempo de empacotamento pelo script e pelo workflow, ambos a partir deste valor. | ||
| --> | ||
| <PropertyGroup> | ||
| <ClefVersion>1.1.0</ClefVersion> | ||
|
|
||
| <!-- Ignorado quando a build recebe /p:Version=... (propriedade global vence), que é | ||
| como o release aplica a versão da tag. --> | ||
| <Version>$(ClefVersion)</Version> | ||
|
|
||
| <!-- Derivam de $(Version), e NÃO de $(ClefVersion): senão um /p:Version=2.0.0 mudaria | ||
| só o pacote e o assembly continuaria na versão do arquivo — exatamente a | ||
| divergência que esta fonte única existe para evitar. | ||
| A Store reserva a 4ª parte (revisão) e só aceita 0. --> | ||
| <FileVersion>$(Version).0</FileVersion> | ||
| <AssemblyVersion>$(Version).0</AssemblyVersion> | ||
| </PropertyGroup> | ||
|
|
||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,177 @@ | ||
| @using ClefExplorer.Models | ||
| @using ClefExplorer.Helpers | ||
|
|
||
| @* Visão em tabela dos eventos: ordenar, agrupar (arrastando a coluna para a faixa | ||
| acima), filtrar por coluna e redimensionar. | ||
|
|
||
| Além das colunas fixas, as colunas de propriedade são DESCOBERTAS a partir do | ||
| conteúdo dos logs carregados — cada aplicação emite um conjunto próprio | ||
| (SourceContext, RequestId, MachineName…), então fixá-las na mão não funcionaria. | ||
|
|
||
| O seletor de colunas é NOSSO, e não o embutido (AllowColumnVisibility): a coluna | ||
| aplica a visibilidade no próprio OnInitialized, então toda vez que o grid é | ||
| recriado — o que acontece ao abrir/fechar o painel de detalhes, já que o layout | ||
| troca de splitter — as escolhas do menu interno se perdiam. Mantendo o conjunto | ||
| aqui, ele sobrevive à recriação e ainda é persistido entre execuções. *@ | ||
|
|
||
| <div class="clef-grid"> | ||
| <OmniDataGrid TItem="ClefEvent" | ||
| Data="@Eventos" | ||
| Virtualize="true" | ||
| Height="100%" | ||
| AllowSorting="true" | ||
| AllowGrouping="true" | ||
| AllowColumnResize="true" | ||
| AllowColumnVisibility="false" | ||
| AllowColumnFilter="true" | ||
| HideGroupedColumn="true" | ||
| GroupPanelText="Arraste uma coluna aqui para agrupar" | ||
| EmptyText="Nenhum registro encontrado" | ||
| RowClass="@LinhaCss" | ||
| OnRowClick="OnSelect"> | ||
| <ToolbarContent> | ||
| <OmniPopover Open="_colunasOpen" OpenChanged="@(v => _colunasOpen = v)" ShowArrow="false" Offset="4" Width="240px"> | ||
| <Trigger> | ||
| <OmniButton Text="Colunas" Icon="sliders" Size="ComponentSize.Sm" Variant="ButtonVariant.Ghost" /> | ||
| </Trigger> | ||
| <ChildContent> | ||
| <div class="clef-col-chooser"> | ||
| @foreach (var col in TodasAsColunas) | ||
| { | ||
| var c = col; | ||
| <label class="clef-col-item"> | ||
| <input type="checkbox" | ||
| checked="@VisibleColumns.Contains(c.Key)" | ||
| @onchange="@(e => Alternar(c.Key, (bool?)e.Value == true))" /> | ||
| <span>@c.Title</span> | ||
| </label> | ||
| } | ||
| </div> | ||
| </ChildContent> | ||
| </OmniPopover> | ||
| </ToolbarContent> | ||
|
|
||
| <Columns> | ||
| <OmniDataGridColumn TItem="ClefEvent" | ||
| Title="Data/hora" | ||
| PropertyName="Timestamp" | ||
| Property="@(e => e.Timestamp ?? default)" | ||
| TextSelector="@(e => e.Timestamp?.ToString("dd/MM/yyyy HH:mm:ss.fff") ?? "")" | ||
| FilterType="ColumnFilterType.Date" | ||
| Filterable="true" | ||
| Visible="@VisibleColumns.Contains(LogGridColumns.Timestamp)" | ||
| Width="165px" /> | ||
|
|
||
| <OmniDataGridColumn TItem="ClefEvent" | ||
| Title="Nível" | ||
| PropertyName="Level" | ||
| Property="@(e => e.Level ?? "")" | ||
| Groupable="true" | ||
| Filterable="true" | ||
| Visible="@VisibleColumns.Contains(LogGridColumns.Level)" | ||
| Width="120px"> | ||
| <Template Context="ev"> | ||
| <OmniBadge Variant="@LogLevelStyles.Variant(ev.Level)" Text="@ev.Level" Size="ComponentSize.Sm" /> | ||
| </Template> | ||
| </OmniDataGridColumn> | ||
|
|
||
| <OmniDataGridColumn TItem="ClefEvent" | ||
| Title="Mensagem" | ||
| PropertyName="Message" | ||
| Property="@(e => e.Message ?? "")" | ||
| Filterable="true" | ||
| Visible="@VisibleColumns.Contains(LogGridColumns.Message)" /> | ||
|
|
||
| @* Só o nome do arquivo na célula; o caminho completo fica no title. *@ | ||
| <OmniDataGridColumn TItem="ClefEvent" | ||
| Title="Arquivo" | ||
| PropertyName="SourceFile" | ||
| Property="@(e => NomeArquivo(e))" | ||
| Groupable="true" | ||
| Filterable="true" | ||
| Visible="@VisibleColumns.Contains(LogGridColumns.SourceFile)" | ||
| Width="180px"> | ||
| <Template Context="ev"> | ||
| <span title="@ev.SourceFile">@NomeArquivo(ev)</span> | ||
| </Template> | ||
| </OmniDataGridColumn> | ||
|
|
||
| <OmniDataGridColumn TItem="ClefEvent" | ||
| Title="Exceção" | ||
| PropertyName="Exception" | ||
| Property="@(e => string.IsNullOrEmpty(e.Exception) ? "" : "sim")" | ||
| Groupable="true" | ||
| Visible="@VisibleColumns.Contains(LogGridColumns.Exception)" | ||
| Width="90px"> | ||
| <Template Context="ev"> | ||
| @if (!string.IsNullOrEmpty(ev.Exception)) | ||
| { | ||
| <OmniIcon Name="zap" Size="ComponentSize.Sm" Class="clef-grid-exc" /> | ||
| } | ||
| </Template> | ||
| </OmniDataGridColumn> | ||
|
|
||
| @* Colunas derivadas do conteúdo dos logs carregados. *@ | ||
| @foreach (var coluna in Colunas) | ||
| { | ||
| var c = coluna; | ||
| <OmniDataGridColumn TItem="ClefEvent" | ||
| Title="@c.Title" | ||
| PropertyName="@c.Key" | ||
| Property="@(e => LogColumnDiscovery.FormatValue(e, c.Key))" | ||
| Groupable="true" | ||
| Filterable="true" | ||
| Visible="@VisibleColumns.Contains(c.Key)" | ||
| Width="160px" /> | ||
| } | ||
| </Columns> | ||
| </OmniDataGrid> | ||
| </div> | ||
|
|
||
| @code { | ||
| [Parameter] public IReadOnlyList<ClefEvent> Eventos { get; set; } = Array.Empty<ClefEvent>(); | ||
| [Parameter] public ClefEvent? SelectedEvent { get; set; } | ||
| [Parameter] public EventCallback<ClefEvent> OnSelect { get; set; } | ||
|
|
||
| /// <summary>Colunas descobertas no conteúdo dos logs carregados.</summary> | ||
| [Parameter] public IReadOnlyList<DiscoveredColumn> Colunas { get; set; } = Array.Empty<DiscoveredColumn>(); | ||
|
|
||
| /// <summary>Chaves das colunas visíveis (fixas e descobertas).</summary> | ||
| [Parameter] public HashSet<string> VisibleColumns { get; set; } = new(StringComparer.OrdinalIgnoreCase); | ||
|
|
||
| [Parameter] public EventCallback<HashSet<string>> VisibleColumnsChanged { get; set; } | ||
|
|
||
| private bool _colunasOpen; | ||
|
|
||
| /// <summary>Fixas primeiro, depois as descobertas — a mesma ordem da tabela.</summary> | ||
| private IEnumerable<(string Key, string Title)> TodasAsColunas => | ||
| LogGridColumns.Fixed.Concat(Colunas.Select(c => (c.Key, c.Title))); | ||
|
|
||
| private async Task Alternar(string key, bool visivel) | ||
| { | ||
| var novo = new HashSet<string>(VisibleColumns, StringComparer.OrdinalIgnoreCase); | ||
| if (visivel) novo.Add(key); else novo.Remove(key); | ||
|
|
||
| VisibleColumns = novo; | ||
| await VisibleColumnsChanged.InvokeAsync(novo); | ||
| } | ||
|
|
||
| private static string NomeArquivo(ClefEvent e) => | ||
| string.IsNullOrEmpty(e.SourceFile) ? string.Empty : Path.GetFileName(e.SourceFile); | ||
|
|
||
| /// <summary>Destaca a linha selecionada e as de erro, como na lista.</summary> | ||
| private string LinhaCss(ClefEvent e) | ||
| { | ||
| var classes = new List<string>(2); | ||
|
|
||
| if (ReferenceEquals(e, SelectedEvent)) classes.Add("is-selected"); | ||
|
|
||
| if (string.Equals(e.Level, "Error", StringComparison.OrdinalIgnoreCase) | ||
| || string.Equals(e.Level, "Fatal", StringComparison.OrdinalIgnoreCase)) | ||
| { | ||
| classes.Add("clef-grid-row-error"); | ||
| } | ||
|
|
||
| return string.Join(' ', classes); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.