From 002a0270f0d7324109dcbe4eeec11fd0a1698a1b Mon Sep 17 00:00:00 2001 From: Viktor Date: Mon, 2 Dec 2024 16:34:43 +0700 Subject: [PATCH] Move UpdateResourceItemDataSource method to base DataSourceItem Class --- src/Reveal.Sdk.Dom/Data/DataSourceItem.cs | 8 ++++++++ .../Data/DataSourceItems/RestDataSourceItem.cs | 9 --------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Reveal.Sdk.Dom/Data/DataSourceItem.cs b/src/Reveal.Sdk.Dom/Data/DataSourceItem.cs index 50e7678c..e078bf2e 100644 --- a/src/Reveal.Sdk.Dom/Data/DataSourceItem.cs +++ b/src/Reveal.Sdk.Dom/Data/DataSourceItem.cs @@ -253,5 +253,13 @@ private string ValidateRightFieldName(string fieldName, string alias) throw new ArgumentException($"Invalid right field name format: {fieldName}"); } + + protected void UpdateResourceItemDataSource(DataSource dataSource) + { + ResourceItemDataSource.Id = dataSource.Id; + ResourceItemDataSource.Title = dataSource.Title ?? ResourceItem.Title; + ResourceItemDataSource.Subtitle = dataSource.Subtitle ?? ResourceItem.Subtitle; + ResourceItem.DataSourceId = ResourceItemDataSource.Id; + } } } diff --git a/src/Reveal.Sdk.Dom/Data/DataSourceItems/RestDataSourceItem.cs b/src/Reveal.Sdk.Dom/Data/DataSourceItems/RestDataSourceItem.cs index 028cedee..f1855c93 100644 --- a/src/Reveal.Sdk.Dom/Data/DataSourceItems/RestDataSourceItem.cs +++ b/src/Reveal.Sdk.Dom/Data/DataSourceItems/RestDataSourceItem.cs @@ -105,15 +105,6 @@ protected override void OnFieldsPropertyChanged(List fields) Parameters.Add("config", BuildConfig(fields)); } - //todo: this may need to go on the base class. wait until more data source items are created - private void UpdateResourceItemDataSource(DataSource dataSource) - { - ResourceItemDataSource.Id = dataSource.Id; - ResourceItemDataSource.Title = dataSource.Title ?? ResourceItem.Title; - ResourceItemDataSource.Subtitle = dataSource.Subtitle ?? ResourceItem.Subtitle; - ResourceItem.DataSourceId = ResourceItemDataSource.Id; - } - private Dictionary BuildConfig(IEnumerable fields) { Dictionary config = new Dictionary();