-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
229 changed files
with
8,970 additions
and
1,349 deletions.
There are no files selected for viewing
This file contains 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 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 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
25 changes: 25 additions & 0 deletions
25
examples/Csharp.ExampleApplication/Hooks/Filters/SharedCustomViewFilter.cs
This file contains 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,25 @@ | ||
using System; | ||
using Microsoft.Extensions.Logging; | ||
using Tableau.Migration.Api.Rest.Models; | ||
using Tableau.Migration.Content; | ||
using Tableau.Migration.Engine; | ||
using Tableau.Migration.Engine.Hooks.Filters; | ||
using Tableau.Migration.Resources; | ||
|
||
namespace Csharp.ExampleApplication.Hooks.Filters | ||
{ | ||
#region class | ||
public class SharedCustomViewFilter : ContentFilterBase<ICustomView> | ||
{ | ||
public SharedCustomViewFilter( | ||
ISharedResourcesLocalizer localizer, | ||
ILogger<IContentFilter<ICustomView>> logger) | ||
: base(localizer, logger) { } | ||
|
||
public override bool ShouldMigrate(ContentMigrationItem<ICustomView> item) | ||
{ | ||
return !item.SourceItem.Shared; | ||
} | ||
} | ||
#endregion | ||
} |
39 changes: 39 additions & 0 deletions
39
examples/Csharp.ExampleApplication/Hooks/Transformers/CustomViewDefaultUsersTransformer.cs
This file contains 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,39 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Microsoft.Extensions.Logging; | ||
using Tableau.Migration; | ||
using Tableau.Migration.Content; | ||
using Tableau.Migration.Engine.Hooks.Transformers; | ||
using Tableau.Migration.Resources; | ||
|
||
namespace Csharp.ExampleApplication.Hooks.Transformers | ||
{ | ||
#region class | ||
public class CustomViewExcludeDefaultUserTransformer( | ||
ISharedResourcesLocalizer localizer, | ||
ILogger<CustomViewExcludeDefaultUserTransformer> logger) | ||
: ContentTransformerBase<IPublishableCustomView>(localizer, logger) | ||
{ | ||
public IList<string> ExcludeUsernames { get; } = new List<string>() {"User1", "User2"}; | ||
|
||
|
||
private readonly ILogger<CustomViewExcludeDefaultUserTransformer>? _logger = logger; | ||
|
||
public override async Task<IPublishableCustomView?> TransformAsync(IPublishableCustomView itemToTransform, CancellationToken cancel) | ||
{ | ||
var newDefaultUsers = itemToTransform.DefaultUsers.Where(user => !ExcludeUsernames.Contains(user.Name)).ToList(); | ||
|
||
itemToTransform.DefaultUsers = newDefaultUsers; | ||
|
||
_logger?.LogInformation( | ||
@"Excluding default users {newDefaultUsers}", | ||
newDefaultUsers); | ||
|
||
return await Task.FromResult(itemToTransform); | ||
} | ||
} | ||
#endregion | ||
} |
This file contains 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 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
11 changes: 11 additions & 0 deletions
11
examples/Python.ExampleApplication/Hooks/Filters/shared_custom_view_filter.py
This file contains 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,11 @@ | ||
from tableau_migration import ( | ||
ICustomView, | ||
ContentMigrationItem, | ||
ContentFilterBase) | ||
|
||
|
||
class SharedCustomViewFilter(ContentFilterBase[ICustomView]): | ||
def should_migrate(self, item: ContentMigrationItem[ICustomView]) -> bool: | ||
if item.source_item.shared == True: | ||
return False | ||
return True |
This file contains 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
14 changes: 14 additions & 0 deletions
14
...les/Python.ExampleApplication/Hooks/transformers/custom_view_default_users_transformer.py
This file contains 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,14 @@ | ||
from tableau_migration import ( | ||
ContentTransformerBase, | ||
IContentReference, | ||
IPublishableCustomView | ||
) | ||
|
||
class CustomViewDefaultUsersTransformer(ContentTransformerBase[IPublishableCustomView]): | ||
|
||
#Pass in list of users retrieved from Users API | ||
default_users = [] | ||
|
||
def transform(self, itemToTransform: IPublishableCustomView) -> IPublishableCustomView: | ||
itemToTransform.default_users = self.default_users | ||
return itemToTransform |
This file contains 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 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 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 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 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 |
---|---|---|
@@ -1,8 +1,3 @@ | ||
setuptools==70.1.1 | ||
configparser==7.0.0 | ||
tableau_migration | ||
cffi==1.16.0 | ||
pycparser==2.22 | ||
pythonnet==3.0.3 | ||
typing_extensions==4.12.2 | ||
python-dotenv==1.0.1 |
This file contains 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 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 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.