Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into system.text.json
Browse files Browse the repository at this point in the history
  • Loading branch information
exyi committed Oct 3, 2024
2 parents 6f01776 + 2bbf954 commit 6020b0a
Show file tree
Hide file tree
Showing 156 changed files with 4,960 additions and 907 deletions.
1 change: 0 additions & 1 deletion .github/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ runs:
dotnet-version: |
8.0.x
6.0.x
3.1.x
- if: ${{ runner.os == 'Windows' }}
uses: microsoft/[email protected]

Expand Down
2 changes: 2 additions & 0 deletions .github/uitest/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ runs:
shell: bash
env:
DOTVVM_SAMPLES_CONFIG_PROFILE: ${{ inputs.samples-config }}
GITHUB_TOKEN: ${{ inputs.github-token }}

- if: ${{ runner.os == 'Windows' }}
run: choco install dotnet-aspnetcoremodule-v2 -y
Expand All @@ -53,6 +54,7 @@ runs:
shell: pwsh
env:
DOTVVM_SAMPLES_CONFIG_PROFILE: ${{ inputs.samples-config }}
GITHUB_TOKEN: ${{ inputs.github-token }}

# publish the result to github
- uses: ./.github/test-report
Expand Down
29 changes: 22 additions & 7 deletions .github/uitest/uitest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,16 @@ function Start-Sample {
[int][parameter(Position = 2)]$port
)
Invoke-RequiredCmds "Start sample '$sampleName'" {
Reset-IISServerManager -Confirm:$false

Remove-IISSite -Confirm:$false -Name $sampleName -ErrorAction SilentlyContinue

icacls "$root\artifacts\" /grant "IIS_IUSRS:(OI)(CI)F"

New-IISSite -Name "$sampleName" `
-PhysicalPath "$path" `
-BindingInformation "*:${port}:"

# ensure IIS created the site
while ($true) {
$state = (Get-IISSite -Name $sampleName).State
Expand All @@ -131,6 +133,15 @@ function Start-Sample {
throw "Site '${sampleName}' could not be started. State: '${state}'."
}
}

# add or update environment variable to the application pool
$existingEnvVar = c:\windows\system32\inetsrv\appcmd.exe list config -section:system.applicationHost/applicationPools `
| out-string `
| select-xml -XPath "//add[@name='DefaultAppPool']/environmentVariables/add[@name='GITHUB_TOKEN']"
if ($existingEnvVar -ne $null) {
c:\windows\system32\inetsrv\appcmd.exe set config -section:system.applicationHost/applicationPools /-"[name='DefaultAppPool'].environmentVariables.[name='GITHUB_TOKEN']" /commit:apphost
}
c:\windows\system32\inetsrv\appcmd.exe set config -section:system.applicationHost/applicationPools /+"[name='DefaultAppPool'].environmentVariables.[name='GITHUB_TOKEN',value='$env:GITHUB_TOKEN']" /commit:apphost
}
}

Expand Down Expand Up @@ -171,13 +182,17 @@ function Test-Sample {
write-host $log
get-content $log | write-host
}
foreach ($log in dir c:\inetpub\logs\logfiles\*\*.log) {
write-host $log
get-content $log | write-host
if (test-path c:\inetpub\logs\logfiles) {
foreach ($log in dir c:\inetpub\logs\logfiles\*\*.log) {
write-host $log
get-content $log | write-host
}
}
foreach ($log in dir $root\artifacts\**\*.log) {
write-host $log
get-content $log | write-host
if (test-path $root\artifacts) {
foreach ($log in dir $root\artifacts\**\*.log) {
write-host $log
get-content $log | write-host
}
}
throw "The sample '${sampleName}' failed to start."
}
Expand Down
141 changes: 141 additions & 0 deletions src/Framework/Core/Controls/GenericGridViewDataSet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;

namespace DotVVM.Framework.Controls
{
public class GenericGridViewDataSet<
T,
TFilteringOptions,
TSortingOptions,
TPagingOptions,
TRowInsertOptions,
TRowEditOptions>
: IGridViewDataSet<T>,
IFilterableGridViewDataSet<TFilteringOptions>,
ISortableGridViewDataSet<TSortingOptions>,
IPageableGridViewDataSet<TPagingOptions>,
IRowInsertGridViewDataSet<TRowInsertOptions>,
IRowEditGridViewDataSet<TRowEditOptions>
where TFilteringOptions : IFilteringOptions
where TSortingOptions : ISortingOptions
where TPagingOptions : IPagingOptions
where TRowInsertOptions : IRowInsertOptions
where TRowEditOptions : IRowEditOptions
{

/// <summary>
/// Gets or sets the items for the current page.
/// </summary>
public IList<T> Items { get; set; } = new List<T>();

/// <summary>
/// Gets or sets whether the data should be refreshed. This property is set to true automatically
/// when paging, sorting or other options change.
/// </summary>
public bool IsRefreshRequired { get; set; } = true;

/// <summary>
/// Gets or sets the settings for filtering.
/// </summary>
public TFilteringOptions FilteringOptions { get; set; }

/// <summary>
/// Gets or sets the settings for sorting.
/// </summary>
public TSortingOptions SortingOptions { get; set; }

/// <summary>
/// Gets or sets the settings for paging.
/// </summary>
public TPagingOptions PagingOptions { get; set; }

/// <summary>
/// Gets or sets the settings for row (item) insert feature.
/// </summary>
public TRowInsertOptions RowInsertOptions { get; set; }

/// <summary>
/// Gets or sets the settings for row (item) edit feature.
/// </summary>
public TRowEditOptions RowEditOptions { get; set; }


IList IBaseGridViewDataSet.Items => Items is IList list ? list : new ReadOnlyCollection<T>(Items);

IFilteringOptions IFilterableGridViewDataSet.FilteringOptions => this.FilteringOptions;

ISortingOptions ISortableGridViewDataSet.SortingOptions => this.SortingOptions;

IPagingOptions IPageableGridViewDataSet.PagingOptions => this.PagingOptions;

IRowInsertOptions IRowInsertGridViewDataSet.RowInsertOptions => this.RowInsertOptions;

IRowEditOptions IRowEditGridViewDataSet.RowEditOptions => this.RowEditOptions;



public GenericGridViewDataSet(TFilteringOptions filteringOptions, TSortingOptions sortingOptions, TPagingOptions pagingOptions, TRowInsertOptions rowInsertOptions, TRowEditOptions rowEditOptions)
{
FilteringOptions = filteringOptions;
SortingOptions = sortingOptions;
PagingOptions = pagingOptions;
RowInsertOptions = rowInsertOptions;
RowEditOptions = rowEditOptions;
}


/// <summary>
/// Requests to reload data into the <see cref="GridViewDataSet{T}" />.
/// </summary>
public void RequestRefresh()
{
IsRefreshRequired = true;
}

/// <summary>
/// Applies the options from the specified <see cref="GridViewDataSetOptions{TFilteringOptions, TSortingOptions, TPagingOptions}" /> to this instance.
/// </summary>
public void ApplyOptions(GridViewDataSetOptions<TFilteringOptions, TSortingOptions, TPagingOptions> options)
{
if (options.FilteringOptions != null)
{
FilteringOptions = options.FilteringOptions;
}

if (options.SortingOptions != null)
{
SortingOptions = options.SortingOptions;
}

if (options.PagingOptions != null)
{
PagingOptions = options.PagingOptions;
}
}

public GridViewDataSetOptions<TFilteringOptions, TSortingOptions, TPagingOptions> GetOptions()
{
return new()
{
FilteringOptions = FilteringOptions,
SortingOptions = SortingOptions,
PagingOptions = PagingOptions
};
}

/// <summary> Sets new items + filtering, sorting, paging options. </summary>
public void ApplyResult(GridViewDataSetResult<T, TFilteringOptions, TSortingOptions, TPagingOptions> result)
{
Items = result.Items.ToList();
if (result.FilteringOptions is {})
FilteringOptions = result.FilteringOptions;
if (result.SortingOptions is {})
SortingOptions = result.SortingOptions;
if (result.PagingOptions is {})
PagingOptions = result.PagingOptions;
}
}
}
Loading

0 comments on commit 6020b0a

Please sign in to comment.