41 references to InstrumentViewModel
Aspire.Dashboard (30)
Components\Controls\Chart\ChartBase.cs (24)
83InstrumentViewModel.AddDataUpdateSubscription(OnInstrumentDataUpdate); 89InstrumentViewModel.Instrument is null || 90InstrumentViewModel.MatchedDimensions is null || 107var dimensionAttributes = InstrumentViewModel.MatchedDimensions.Select(d => d.Attributes).ToList(); 108if (_renderedInstrument is null || _renderedInstrument != InstrumentViewModel.Instrument.GetKey() || 110_renderedTheme != InstrumentViewModel.Theme || 111_renderedShowCount != InstrumentViewModel.ShowCount) 114_renderedInstrument = InstrumentViewModel.Instrument.GetKey(); 116_renderedTheme = InstrumentViewModel.Theme; 117_renderedShowCount = InstrumentViewModel.ShowCount; 148return $"<b>{HttpUtility.HtmlEncode(InstrumentViewModel.Instrument?.Name)}</b><br />{HttpUtility.HtmlEncode(name)}: {FormatHelpers.FormatNumberWithOptionalDecimalPlaces(yValue, maxDecimalPlaces: 6, CultureInfo.CurrentCulture)}<br />Time: {FormatHelpers.FormatTime(TimeProvider, TimeProvider.ToLocal(xValue))}"; 157Debug.Assert(InstrumentViewModel.MatchedDimensions != null); 158Debug.Assert(InstrumentViewModel.Instrument != null); 160var unit = !InstrumentViewModel.ShowCount 161? GetDisplayedUnit(InstrumentViewModel.Instrument) 167if (InstrumentViewModel.Instrument?.Type != OtlpInstrumentType.Histogram || InstrumentViewModel.ShowCount) 169data = calculator.CalculateChartValues(InstrumentViewModel.MatchedDimensions, _currentDataStartTime, TimeProvider.ToLocalDateTimeOffset, unit); 176data = calculator.CalculateHistogramValues(InstrumentViewModel.MatchedDimensions, _currentDataStartTime, TimeProvider.ToLocalDateTimeOffset, unit); 179var instrumentChanged = InstrumentViewModel.HasIncompatibleHistogramBounds != data.HasIncompatibleHistogramBounds || 180_renderedHasOverflow != InstrumentViewModel.HasOverflow; 181InstrumentViewModel.HasIncompatibleHistogramBounds = data.HasIncompatibleHistogramBounds; 182_renderedHasOverflow = InstrumentViewModel.HasOverflow; 299InstrumentViewModel.RemoveDataUpdateSubscription(OnInstrumentDataUpdate);
Components\Controls\Chart\MetricTable.razor.cs (5)
50if (!Equals(_instrument?.Name, InstrumentViewModel.Instrument?.Name) || _showCount != InstrumentViewModel.ShowCount) 57_instrument = InstrumentViewModel.Instrument; 58_showCount = InstrumentViewModel.ShowCount; 105Instrument = InstrumentViewModel.Instrument!
Components\Controls\Chart\PlotlyChart.razor.cs (1)
47if (InstrumentViewModel?.Instrument is { } instrument)
Aspire.Dashboard.Components.Tests (11)
Controls\PlotlyChartTests.cs (3)
58builder.Add(p => p.InstrumentViewModel, model); 94builder.Add(p => p.InstrumentViewModel, model); 149builder.Add(p => p.InstrumentViewModel, model);
Pages\MetricsTests.cs (8)
132? cut.FindComponent<PlotlyChart>().Instance.InstrumentViewModel 133: cut.FindComponent<MetricTable>().Instance.InstrumentViewModel; 146Assert.True(cut.FindComponent<PlotlyChart>().Instance.InstrumentViewModel.ShowCount); 154Assert.True(cut.FindComponent<MetricTable>().Instance.InstrumentViewModel.ShowCount); 255var instrumentViewModel = table.Instance.InstrumentViewModel; 465var dimensions = chart.Instance.InstrumentViewModel.MatchedDimensions!; 522Assert.Equal("instrument-2", updatedTable.Instance.InstrumentViewModel.Instrument?.Name); 523Assert.NotEmpty(updatedTable.Instance.InstrumentViewModel.MatchedDimensions!);