Skip to content

Commit

Permalink
Added Sources page into TgDownloaderBlazor
Browse files Browse the repository at this point in the history
  • Loading branch information
DamianMorozov committed Mar 3, 2024
1 parent 6fa8568 commit d886de9
Show file tree
Hide file tree
Showing 114 changed files with 2,503 additions and 974 deletions.
30 changes: 30 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
!**/.gitignore
!.git/HEAD
!.git/config
!.git/packed-refs
!.git/refs/heads/**
1 change: 1 addition & 0 deletions .github/workflows/branch_main_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ jobs:
dotnet test Tests/TgAssertCoreTests/TgAssertCoreTests.csproj --no-restore --verbosity quiet -property:Configuration=Release -property:Platform="Any CPU"
dotnet test Tests/TgDownloaderConsoleTest/TgDownloaderConsoleTest.csproj --no-restore --verbosity quiet -property:Configuration=Release -property:Platform="Any CPU"
dotnet test Tests/TgDownloaderTest/TgDownloaderTest.csproj --no-restore --verbosity quiet -property:Configuration=Release -property:Platform="Any CPU"
dotnet test Tests/TgEfCoreTests/TgEfCoreTests.csproj --no-restore --verbosity quiet -property:Configuration=Release -property:Platform="Any CPU"
1 change: 1 addition & 0 deletions .github/workflows/branch_preview_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ jobs:
dotnet test Tests/TgAssertCoreTests/TgAssertCoreTests.csproj --no-restore --verbosity quiet -property:Configuration=Release -property:Platform="Any CPU"
dotnet test Tests/TgDownloaderConsoleTest/TgDownloaderConsoleTest.csproj --no-restore --verbosity quiet -property:Configuration=Release -property:Platform="Any CPU"
dotnet test Tests/TgDownloaderTest/TgDownloaderTest.csproj --no-restore --verbosity quiet -property:Configuration=Release -property:Platform="Any CPU"
dotnet test Tests/TgEfCoreTests/TgEfCoreTests.csproj --no-restore --verbosity quiet -property:Configuration=Release -property:Platform="Any CPU"
12 changes: 12 additions & 0 deletions Clients/TgDownloaderBlazor/App.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
13 changes: 13 additions & 0 deletions Clients/TgDownloaderBlazor/Common/TgLayoutComponentBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com

namespace TgDownloaderBlazor.Common;

public class TgLayoutComponentBase : LayoutComponentBase
{
#region Public and private fields, properties, constructor

[Inject] protected NavigationManager UriHelper { get; set; } = default!;

#endregion
}
10 changes: 0 additions & 10 deletions Clients/TgDownloaderBlazor/Common/TgPageComponent.cs

This file was deleted.

22 changes: 22 additions & 0 deletions Clients/TgDownloaderBlazor/Common/TgPageComponentBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com

namespace TgDownloaderBlazor.Common;

public abstract class TgPageComponentBase : ComponentBase
{
#region Public and private fields, properties, constructor

[Inject] protected IJSRuntime JsRuntime { get; set; } = default!;
[Inject] protected NavigationManager UriHelper { get; set; } = default!;
[Inject] protected DialogService DialogService { get; set; } = default!;
[Inject] protected TooltipService TooltipService { get; set; } = default!;
[Inject] protected ContextMenuService ContextMenuService { get; set; } = default!;
[Inject] protected NotificationService NotificationService { get; set; } = default!;
[Inject] public IDbContextFactory<TgEfContext> DbFactory { get; set; } = default!;

protected virtual TgLocaleHelper TgLocale => TgLocaleHelper.Instance;
protected virtual bool IsLoading { get; set; } = true;

#endregion
}
23 changes: 23 additions & 0 deletions Clients/TgDownloaderBlazor/Common/TgPageComponentEnumerable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com

namespace TgDownloaderBlazor.Common;

public abstract class TgPageComponentEnumerable<TEntity> : TgPageComponentBase where TEntity : TgEfEntityBase, new()
{
#region Public and private fields, properties, constructor

protected RadzenDataGrid<TEntity> Grid { get; set; } = new();
protected string SearchString { get; set; } = string.Empty;
protected IEnumerable<TEntity> Items { get; set; } = new List<TEntity>();
protected int ItemsCount { get; set; }
protected string ItemsSummaryString => $"{TgLocale.FoundRows}: {ItemsCount}";

#endregion

#region Public and private methods

//

#endregion
}
21 changes: 21 additions & 0 deletions Clients/TgDownloaderBlazor/Common/TgPageComponentItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com

namespace TgDownloaderBlazor.Common;

public abstract class TgPageComponentItem<TEntity> : TgPageComponentBase where TEntity : TgEfEntityBase, new()
{
#region Public and private fields, properties, constructor

[Parameter] public string Uid { get; set; } = string.Empty;
protected TEntity Item { get; set; } = new();
protected string ItemSummaryString => Item.ToDebugString();

#endregion

#region Public and private methods

//

#endregion
}
24 changes: 24 additions & 0 deletions Clients/TgDownloaderBlazor/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["Clients/TgDownloaderBlazor/TgDownloaderBlazor.csproj", "Clients/TgDownloaderBlazor/"]
RUN dotnet restore "./Clients/TgDownloaderBlazor/TgDownloaderBlazor.csproj"
COPY . .
WORKDIR "/src/Clients/TgDownloaderBlazor"
RUN dotnet build "./TgDownloaderBlazor.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./TgDownloaderBlazor.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "TgDownloaderBlazor.dll"]
21 changes: 0 additions & 21 deletions Clients/TgDownloaderBlazor/Features/AppComponent.razor

This file was deleted.

63 changes: 63 additions & 0 deletions Clients/TgDownloaderBlazor/Features/Apps/AppComponent.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
@page "/apps"
@inherits TgPageComponentEnumerable<TgEfAppEntity>

<PageTitle>@TgLocale.MenuMainApps</PageTitle>

@if (IsLoading)
{
<p><em>Loading...</em></p>
}
else
{
<RadzenStack>
<RadzenRow AlignItems="AlignItems.Center">
<RadzenColumn Size="12" SizeMD="6">
<RadzenText Text="@TgLocale.MenuMainApps" TextStyle="TextStyle.H4" TagName="TagName.H1" style="margin: 0" />
</RadzenColumn>
@*
<RadzenColumn Size="12" SizeMD="6">
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" JustifyContent="JustifyContent.End" Gap="0.5rem">
<RadzenSplitButton Icon="get_app" Text="Export" Click="@ExportClick" Variant="Variant.Flat" Shade="Shade.Lighter">
<RadzenSplitButtonItem Text="Excel" Value="xlsx" />
<RadzenSplitButtonItem Text="CSV" Value="csv" />
</RadzenSplitButton>
<RadzenButton Icon="add_circle_outline" Text="Add" Click="@AddButtonClick" Variant="Variant.Flat" />
</RadzenStack>
</RadzenColumn>
*@
</RadzenRow>
<RadzenRow>
<RadzenLabel Text="@ItemsSummaryString"></RadzenLabel>
</RadzenRow>
@* <RadzenTextBox Placeholder="Search ..." style="display: block; width: 100%" @oninput="@SearchString" /> *@
@*
<RadzenDataGrid @ref="Grid" ColumnWidth="200px"
Data="@Items" TItem="TgEfAppEntity" LoadData="@GridLoadData" Count="@ItemsCount"
AllowFiltering="true" FilterMode="FilterMode.Advanced" AllowPaging="true" AllowSorting="true"
ShowPagingSummary="true" PageSizeOptions=@(new int[]{5, 10, 20, 30})
RowDoubleClick="@EditRow"
>
*@
<RadzenRow>
<RadzenColumn SizeMD=12>
<RadzenDataGrid @ref="Grid" ColumnWidth="200px"
Data="@Items" TItem="TgEfAppEntity" LoadData="@GridLoadData" Count="@ItemsCount" >
<Columns>
<RadzenDataGridColumn TItem="TgEfAppEntity" Property=@nameof(TgEfAppEntity.ApiHash) Title="@TgLocale.MenuClientApiHash" />
<RadzenDataGridColumn TItem="TgEfAppEntity" Property=@nameof(TgEfAppEntity.ApiId) Title="@TgLocale.MenuClientApiId" />
<RadzenDataGridColumn TItem="TgEfAppEntity" Property=@nameof(TgEfAppEntity.PhoneNumber) Title="@TgLocale.MenuClientPhoneNumber" />
<RadzenDataGridColumn TItem="TgEfAppEntity" Property="Proxy.HostName" Title="@TgLocale.MenuClientProxy" />
@* <RadzenDataGridColumn TItem="TgEfAppEntity" Filterable="false" Sortable="false" Width="70px" TextAlign="TextAlign.Center">
<Template Context="app">
<RadzenButton ButtonStyle="ButtonStyle.Danger" Icon="delete" Size="ButtonSize.Medium"
Shade="Shade.Lighter" Variant="Variant.Flat"
Click=@(args => GridDeleteButtonClick(args, app)) @onclick:stopPropagation="true" />
</Template>
</RadzenDataGridColumn> *@
</Columns>
</RadzenDataGrid>
</RadzenColumn>
</RadzenRow>
</RadzenStack>
}
Loading

0 comments on commit d886de9

Please sign in to comment.