diff --git a/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor b/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor index aac0d088..e72d4595 100644 --- a/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor +++ b/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor @@ -20,5 +20,5 @@ // limitations under the License. -------------------------------------------------------------------------------> - + diff --git a/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor.cs b/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor.cs index 6a4a5aa6..66b8d4c5 100644 --- a/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor.cs +++ b/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor.cs @@ -59,6 +59,12 @@ public partial class DynamicApplicationBase [Parameter] public Thing CurrentThing { get; set; } + /// + /// Gets or sets the component's id + /// + [Parameter] + public object Id { get; set; } + /// /// Gets the of parameters that have to be passed to the /// diff --git a/COMETwebapp/Components/ParameterEditor/ParameterTable.razor.cs b/COMETwebapp/Components/ParameterEditor/ParameterTable.razor.cs index 5936b05e..ec7597ba 100644 --- a/COMETwebapp/Components/ParameterEditor/ParameterTable.razor.cs +++ b/COMETwebapp/Components/ParameterEditor/ParameterTable.razor.cs @@ -65,11 +65,6 @@ public partial class ParameterTable [Parameter] public IParameterTableViewModel ViewModel { get; set; } - /// - /// Gets the current view model hash code to compare with new ones - /// - public int ViewModelHashCode { get; set; } - /// /// Gets or sets the grid control that is being customized. /// @@ -86,35 +81,13 @@ protected override void OnInitialized() this.Disposables.Add(this.WhenAnyValue(x => x.ViewModel.IsOnEditMode) .SubscribeAsync(_ => this.InvokeAsync(this.StateHasChanged))); - this.closeEditor = new EventCallbackFactory().Create(this, () => { this.ViewModel.IsOnEditMode = false; }); - } - - /// - /// Method invoked when the component has received parameters from its parent in - /// the render tree, and the incoming values have been assigned to properties. - /// - protected override void OnParametersSet() - { - base.OnParametersSet(); - - if (this.ViewModel.GetHashCode() == this.ViewModelHashCode) - { - return; - } - - if (this.ViewModelHashCode != 0) - { - var latestViewModelRowsSubscription = this.Disposables.Last(); - latestViewModelRowsSubscription.Dispose(); - this.Disposables.Remove(latestViewModelRowsSubscription); - } - this.Disposables.Add(this.ViewModel.Rows.Connect() + .AutoRefresh() .Sort(this.comparer) .Bind(out this.sortedCollection) .Subscribe(_ => this.InvokeAsync(this.StateHasChanged))); - this.ViewModelHashCode = this.ViewModel.GetHashCode(); + this.closeEditor = new EventCallbackFactory().Create(this, () => { this.ViewModel.IsOnEditMode = false; }); } /// diff --git a/COMETwebapp/Components/Tabs/TabsPanelComponent.razor b/COMETwebapp/Components/Tabs/TabsPanelComponent.razor index c80771de..c9ffc4a0 100644 --- a/COMETwebapp/Components/Tabs/TabsPanelComponent.razor +++ b/COMETwebapp/Components/Tabs/TabsPanelComponent.razor @@ -70,7 +70,8 @@
+ CurrentThing="this.Panel.CurrentTab.ObjectOfInterest as Thing" + Id="@(this.Panel.CurrentTab.Id)"/>
} diff --git a/COMETwebapp/Model/TabbedApplicationInformation.cs b/COMETwebapp/Model/TabbedApplicationInformation.cs index c80f172d..0179bec0 100644 --- a/COMETwebapp/Model/TabbedApplicationInformation.cs +++ b/COMETwebapp/Model/TabbedApplicationInformation.cs @@ -42,6 +42,7 @@ public TabbedApplicationInformation(IApplicationBaseViewModel applicationBaseVie this.ApplicationBaseViewModel = applicationBaseViewModel; this.ComponentType = componentType; this.ObjectOfInterest = objectOfInterest; + this.Id = Guid.NewGuid(); } /// @@ -58,5 +59,10 @@ public TabbedApplicationInformation(IApplicationBaseViewModel applicationBaseVie /// Gets the object of interest /// public object ObjectOfInterest { get; } + + /// + /// Gets the tab's id + /// + public Guid Id { get; } } }