Skip to content

Commit

Permalink
Merge pull request #116 from RevealBi/data-source/rest
Browse files Browse the repository at this point in the history
Move UpdateResourceItemDataSource method to base DataSourceItem Class
  • Loading branch information
hainv-ohio authored Dec 2, 2024
2 parents 13fda76 + 002a027 commit e3f13eb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
8 changes: 8 additions & 0 deletions src/Reveal.Sdk.Dom/Data/DataSourceItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
9 changes: 0 additions & 9 deletions src/Reveal.Sdk.Dom/Data/DataSourceItems/RestDataSourceItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,6 @@ protected override void OnFieldsPropertyChanged(List<IField> 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<string, object> BuildConfig(IEnumerable<IField> fields)
{
Dictionary<string, object> config = new Dictionary<string, object>();
Expand Down

0 comments on commit e3f13eb

Please sign in to comment.