Skip to content

Commit ca234f6

Browse files
authored
Release/4.3.0
Release 4.3.0
2 parents 7fdba58 + 5d88744 commit ca234f6

File tree

229 files changed

+8970
-1349
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

229 files changed

+8970
-1349
lines changed

.github/workflows/dotnet-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ jobs:
2626
run: dotnet build '${{ vars.BUILD_SOLUTION }}' -c ${{ matrix.config }}
2727
- name: Test solution with ${{ matrix.config }} configuration
2828
run: |
29-
dotnet test '${{ vars.BUILD_SOLUTION }}' --no-build -c ${{ matrix.config }} --verbosity normal --logger trx --results-directory "TestResults-${{ matrix.os }}-${{ matrix.config }}" -- RunConfiguration.TestSessionTimeout=${{ vars.MIGRATIONSDK_TEST_CANCELLATION_TIMEOUT_MILLISECONDS }}
29+
dotnet test '${{ vars.BUILD_SOLUTION }}' --no-build -c ${{ matrix.config }} --verbosity normal --logger junit --results-directory "TestResults-${{ matrix.os }}-${{ matrix.config }}" -- RunConfiguration.TestSessionTimeout=${{ vars.MIGRATIONSDK_TEST_CANCELLATION_TIMEOUT_MILLISECONDS }}
3030
- name: Upload test results
3131
# Use always() to always run this step to publish test results when there are test failures
3232
if: ${{ always() }}
3333
uses: actions/upload-artifact@v4
3434
with:
3535
name: dotnet-results-${{ matrix.os }}-${{ matrix.config }}
3636
path: TestResults-${{ matrix.os }}-${{ matrix.config }}
37-
if-no-files-found: error
37+
if-no-files-found: error

.gitignore

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ instance/
8080
# Scrapy stuff:
8181
.scrapy
8282

83-
# Sphinx documentation
84-
docs/_build/
8583

8684
# PyBuilder
8785
.pybuilder/
@@ -179,14 +177,6 @@ launchSettings.json
179177
UpgradeLog.htm
180178
*.*.ini
181179
*.*.json
182-
/src/Python/Documentation/_build
183-
/src/Python/Documentation/_static
184-
/src/Python/Python.pyproj.user
185-
/src/Documentation/_python
186-
/src/Python/Documentation/generated
187-
/tests/Python.TestApplication/manifest.json
188-
/.git2gus
189-
/src/Python/scripts/publish-package.ps1
190180

191181
# Public repo ignores
192182
.github/pull_request_template.md

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<Nullable>enable</Nullable>
55
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
66
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
7-
<Version>4.2.0</Version>
7+
<Version>4.3.0</Version>
88
<Authors>Salesforce, Inc.</Authors>
99
<Company>Salesforce, Inc.</Company>
1010
<Copyright>Copyright (c) 2024, Salesforce, Inc. and its licensors</Copyright>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
using Microsoft.Extensions.Logging;
3+
using Tableau.Migration.Api.Rest.Models;
4+
using Tableau.Migration.Content;
5+
using Tableau.Migration.Engine;
6+
using Tableau.Migration.Engine.Hooks.Filters;
7+
using Tableau.Migration.Resources;
8+
9+
namespace Csharp.ExampleApplication.Hooks.Filters
10+
{
11+
#region class
12+
public class SharedCustomViewFilter : ContentFilterBase<ICustomView>
13+
{
14+
public SharedCustomViewFilter(
15+
ISharedResourcesLocalizer localizer,
16+
ILogger<IContentFilter<ICustomView>> logger)
17+
: base(localizer, logger) { }
18+
19+
public override bool ShouldMigrate(ContentMigrationItem<ICustomView> item)
20+
{
21+
return !item.SourceItem.Shared;
22+
}
23+
}
24+
#endregion
25+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading;
5+
using System.Threading.Tasks;
6+
using Microsoft.Extensions.Logging;
7+
using Tableau.Migration;
8+
using Tableau.Migration.Content;
9+
using Tableau.Migration.Engine.Hooks.Transformers;
10+
using Tableau.Migration.Resources;
11+
12+
namespace Csharp.ExampleApplication.Hooks.Transformers
13+
{
14+
#region class
15+
public class CustomViewExcludeDefaultUserTransformer(
16+
ISharedResourcesLocalizer localizer,
17+
ILogger<CustomViewExcludeDefaultUserTransformer> logger)
18+
: ContentTransformerBase<IPublishableCustomView>(localizer, logger)
19+
{
20+
public IList<string> ExcludeUsernames { get; } = new List<string>() {"User1", "User2"};
21+
22+
23+
private readonly ILogger<CustomViewExcludeDefaultUserTransformer>? _logger = logger;
24+
25+
public override async Task<IPublishableCustomView?> TransformAsync(IPublishableCustomView itemToTransform, CancellationToken cancel)
26+
{
27+
var newDefaultUsers = itemToTransform.DefaultUsers.Where(user => !ExcludeUsernames.Contains(user.Name)).ToList();
28+
29+
itemToTransform.DefaultUsers = newDefaultUsers;
30+
31+
_logger?.LogInformation(
32+
@"Excluding default users {newDefaultUsers}",
33+
newDefaultUsers);
34+
35+
return await Task.FromResult(itemToTransform);
36+
}
37+
}
38+
#endregion
39+
}

examples/Csharp.ExampleApplication/MyMigrationApplication.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ public async Task StartAsync(CancellationToken cancel)
113113
#region UnlicensedUsersFilter-Registration
114114
_planBuilder.Filters.Add<UnlicensedUsersFilter, IUser>();
115115
#endregion
116+
117+
#region SharedCustomViewFilter-Registration
118+
_planBuilder.Filters.Add<SharedCustomViewFilter, ICustomView>();
119+
#endregion
116120

117121
// Add post-publish hooks
118122
#region UpdatePermissionsHook-Registration
@@ -138,6 +142,10 @@ public async Task StartAsync(CancellationToken cancel)
138142
#region StartAtTransformer-Registration
139143
_planBuilder.Transformers.Add<SimpleScheduleStartAtTransformer<ICloudExtractRefreshTask>, ICloudExtractRefreshTask>();
140144
#endregion
145+
146+
#region CustomViewDefaultUsersTransformer-Registration
147+
_planBuilder.Transformers.Add<CustomViewExcludeDefaultUserTransformer, IPublishableCustomView>();
148+
#endregion
141149

142150
// Add migration action completed hooks
143151
#region LogMigrationActionsHook-Registration

examples/Csharp.ExampleApplication/Program.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ public static IServiceCollection AddCustomizations(this IServiceCollection servi
6868
#region UnlicensedUsersFilter-DI
6969
services.AddScoped<UnlicensedUsersFilter>();
7070
#endregion
71+
72+
#region SharedCustomViewFilter-DI
73+
services.AddScoped<SharedCustomViewFilter>();
74+
#endregion
7175

7276
#region UpdatePermissionsHook-DI
7377
services.AddScoped(typeof(UpdatePermissionsHook<,>));
@@ -90,6 +94,10 @@ public static IServiceCollection AddCustomizations(this IServiceCollection servi
9094
#region StartAtTransformer-DI
9195
services.AddScoped(typeof(SimpleScheduleStartAtTransformer<>));
9296
#endregion
97+
98+
#region CustomViewDefaultUsersTransformer-DI
99+
services.AddScoped<CustomViewExcludeDefaultUserTransformer>();
100+
#endregion
93101

94102
#region LogMigrationActionsHook-DI
95103
services.AddScoped<LogMigrationActionsHook>();
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from tableau_migration import (
2+
ICustomView,
3+
ContentMigrationItem,
4+
ContentFilterBase)
5+
6+
7+
class SharedCustomViewFilter(ContentFilterBase[ICustomView]):
8+
def should_migrate(self, item: ContentMigrationItem[ICustomView]) -> bool:
9+
if item.source_item.shared == True:
10+
return False
11+
return True

examples/Python.ExampleApplication/Hooks/mappings/project_rename_mapping.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ def map(self, ctx: ContentMappingContext[IProject]) -> ContentMappingContext[IPr
1111

1212
new_location = ctx.content_item.location.rename("Production")
1313

14-
ctx.map_to(new_location)
14+
ctx = ctx.map_to(new_location)
1515

1616
return ctx
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from tableau_migration import (
2+
ContentTransformerBase,
3+
IContentReference,
4+
IPublishableCustomView
5+
)
6+
7+
class CustomViewDefaultUsersTransformer(ContentTransformerBase[IPublishableCustomView]):
8+
9+
#Pass in list of users retrieved from Users API
10+
default_users = []
11+
12+
def transform(self, itemToTransform: IPublishableCustomView) -> IPublishableCustomView:
13+
itemToTransform.default_users = self.default_users
14+
return itemToTransform

0 commit comments

Comments
 (0)