Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3eff5b6dfa | |||
| e63b80fe47 | |||
| 7d892c2f6a | |||
| 5d83eb4e05 | |||
| 0a2c5f913b | |||
| 933cdb1094 | |||
| f2316eafe4 | |||
| c4712a00ac | |||
| 52c8965704 | |||
| 6d8d681046 | |||
| aed6258fb3 | |||
| e6d1d833ec | |||
| c0c7bb3ac5 | |||
| d0fe99492d | |||
| d38f50584c | |||
| 1c67d7798a | |||
| ea7414dc7f | |||
| a450d9a001 | |||
| 60c91438ec | |||
| 1d8f34ae6c | |||
| bdea2e8aef | |||
| e541aec115 | |||
| 743403e4d4 | |||
| 44fd5f29d9 | |||
| fac3d2c85e | |||
| 51c20116a7 | |||
| 4454b8dd3a | |||
| 2bbb1ba4c7 | |||
| 978475360c | |||
| 230453e491 |
@@ -1,46 +0,0 @@
|
||||
|
||||
name: Push nuget and docker image Actions Workflow
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- stage-new
|
||||
jobs:
|
||||
Deploy:
|
||||
runs-on: windows
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://git.afrino.co/actions/checkout@v3
|
||||
- name: Setup dotnet
|
||||
uses: https://git.afrino.co/actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 7.0.x
|
||||
|
||||
- name: Remove Package Source
|
||||
run: dotnet nuget remove source FourSat
|
||||
continue-on-error: true
|
||||
- name: Add Package Source
|
||||
run: dotnet nuget add source --name FourSat --username systemuser --password sZSA7PTiv3pUSQZ https://git.afrino.co/api/packages/FourSat/nuget/index.json --store-password-in-clear-text
|
||||
|
||||
- name: Install dependencies
|
||||
run: dotnet restore ".\src\BackOffice\BackOffice.csproj"
|
||||
- name: Build
|
||||
run: dotnet build ".\src\BackOffice\BackOffice.csproj" --configuration Release --no-restore
|
||||
- name: Test
|
||||
run: dotnet test ".\src\BackOffice\BackOffice.csproj" --no-restore --verbosity normal
|
||||
- name: Recycle Apppool
|
||||
run: |
|
||||
& "C:\Windows\System32\inetsrv\appcmd.exe" recycle apppool /apppool.name:admin.kbs1.ir
|
||||
shell: powershell
|
||||
- name: Stop Website
|
||||
run: |
|
||||
& "C:\Windows\System32\inetsrv\appcmd.exe" stop site /site.name:admin.kbs1.ir
|
||||
shell: powershell
|
||||
- name: Publish
|
||||
run: dotnet publish ".\src\BackOffice\BackOffice.csproj" -c Release -o publish
|
||||
- name: Copy Publish To IIS Directory
|
||||
run: Get-ChildItem -Path "publish\*" | Copy-Item -Destination "E:\kbs1.ir\admin.kbs1.ir\" -Recurse -Force
|
||||
- name: Start Website
|
||||
run: |
|
||||
& "C:\Windows\System32\inetsrv\appcmd.exe" start site /site.name:admin.kbs1.ir
|
||||
shell: powershell
|
||||
@@ -40,7 +40,7 @@ jobs:
|
||||
done
|
||||
|
||||
if ! docker info >/dev/null 2>&1; then
|
||||
echo "❌ Docker daemon failed to start after 3 minutes"
|
||||
echo "❌ Docker daemon failed to start"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -56,9 +56,10 @@ jobs:
|
||||
- name: Build Docker Image
|
||||
run: |
|
||||
cd src
|
||||
DOCKER_BUILDKIT=0 docker build --network host -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} \
|
||||
DOCKER_BUILDKIT=0 docker build --network host -f BackOffice/Dockerfile \
|
||||
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} \
|
||||
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:prod \
|
||||
-f BackOffice/Dockerfile .
|
||||
.
|
||||
|
||||
- name: Push to Registry
|
||||
run: |
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
|
||||
@@ -143,7 +143,7 @@
|
||||
<ProjectReference Include="../../../CMS/src/CMSMicroservice.Protobuf/CMSMicroservice.Protobuf.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="!Exists('../../../CMS/src/CMSMicroservice.Protobuf/CMSMicroservice.Protobuf.csproj')">
|
||||
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.209" />
|
||||
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.208" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- ============================================================ -->
|
||||
|
||||
@@ -32,7 +32,7 @@ RUN chmod +x /docker-entrypoint.sh
|
||||
# Default Blazor environment (override via K8s env var BLAZOR_ENVIRONMENT)
|
||||
ENV BLAZOR_ENVIRONMENT=Staging
|
||||
# Default gateway URL for gRPC calls (injected into appsettings at startup)
|
||||
ENV GW_URL=https://cms.se.kbs1.ir
|
||||
ENV GW_URL=https://cms.kbs2.ir
|
||||
|
||||
EXPOSE 80
|
||||
CMD ["/docker-entrypoint.sh"]
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<clear />
|
||||
<!-- Local packages (dev builds) -->
|
||||
<!-- <add key="Local" value="/home/masoud/Apps/project/FourSat/nupkg" /> -->
|
||||
<!-- Nexus (hosts FourSat packages + proxies nuget.org) -->
|
||||
<add key="Nexus" value="http://194.5.195.53:32081/repository/nuget-all/index.json" allowInsecureConnections="true" />
|
||||
</packageSources>
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
<col />
|
||||
<col />
|
||||
<col />
|
||||
<col style="min-width: 180px;" />
|
||||
<col />
|
||||
<col style="width: 58px;" />
|
||||
</ColGroup>
|
||||
<ToolBarContent>
|
||||
@@ -48,21 +46,8 @@
|
||||
</CellTemplate>
|
||||
</PropertyColumn>
|
||||
<PropertyColumn Property="x => x.NationalCode" Title="کدملی" />
|
||||
<TemplateColumn Title="آدرس پیشفرض">
|
||||
<CellTemplate>
|
||||
<MudText Typo="Typo.caption" Style="max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"
|
||||
Title="@(context.Item.DefaultAddress ?? "")">
|
||||
@(string.IsNullOrWhiteSpace(context.Item.DefaultAddress) ? "-" : context.Item.DefaultAddress)
|
||||
</MudText>
|
||||
</CellTemplate>
|
||||
</TemplateColumn>
|
||||
<TemplateColumn Title="کدپستی پیشفرض">
|
||||
<CellTemplate>
|
||||
<MudText Typo="Typo.caption">
|
||||
@(string.IsNullOrWhiteSpace(context.Item.DefaultPostalCode) ? "-" : context.Item.DefaultPostalCode)
|
||||
</MudText>
|
||||
</CellTemplate>
|
||||
</TemplateColumn>
|
||||
|
||||
|
||||
|
||||
<TemplateColumn StickyLeft="true" Title="عملیات" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;">
|
||||
<CellTemplate>
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using CMSMicroservice.Protobuf.Protos.User;
|
||||
using BackOffice.Common.BaseComponents;
|
||||
using BackOffice.Common.Utilities;
|
||||
using BackOffice.Pages.User.Components;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MudBlazor;
|
||||
using System.Text;
|
||||
using DateTimeConverterCL;
|
||||
using DataModel = CMSMicroservice.Protobuf.Protos.User.GetAllUserByFilterResponseModel;
|
||||
|
||||
namespace BackOffice.Pages.User;
|
||||
@@ -83,63 +84,51 @@ public partial class UserMainPage
|
||||
{
|
||||
try
|
||||
{
|
||||
var filter = _request.Filter?.Clone() ?? new();
|
||||
var all = new List<DataModel>();
|
||||
const int pageSize = 200;
|
||||
var page = 1;
|
||||
|
||||
while (page <= 500)
|
||||
var exportRequest = new GetAllUserByFilterRequest
|
||||
{
|
||||
var result = await UserContract.GetAllUserByFilterAsync(new GetAllUserByFilterRequest
|
||||
{
|
||||
Filter = filter,
|
||||
PaginationState = new() { PageNumber = page, PageSize = pageSize }
|
||||
});
|
||||
Filter = _request.Filter?.Clone() ?? new(),
|
||||
PaginationState = new() { PageNumber = 1, PageSize = 1000 }
|
||||
};
|
||||
|
||||
var batch = result?.Models?.ToList() ?? new();
|
||||
if (batch.Count == 0)
|
||||
break;
|
||||
var result = await UserContract.GetAllUserByFilterAsync(exportRequest);
|
||||
|
||||
all.AddRange(batch);
|
||||
|
||||
var hasNext = result?.MetaData?.HasNext == true;
|
||||
if (!hasNext || batch.Count < pageSize)
|
||||
break;
|
||||
|
||||
page++;
|
||||
}
|
||||
|
||||
if (all.Count == 0)
|
||||
if (result?.Models == null || !result.Models.Any())
|
||||
{
|
||||
Snackbar.Add("دادهای برای خروجی وجود ندارد.", Severity.Info);
|
||||
return;
|
||||
}
|
||||
|
||||
var headers = new[]
|
||||
{
|
||||
"شناسه", "موبایل", "نام", "نام خانوادگی", "کدملی",
|
||||
"آدرس پیشفرض", "کدپستی پیشفرض"
|
||||
};
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine("شناسه,موبایل,نام,نام خانوادگی,کدملی");
|
||||
|
||||
var rows = all.Select(u => new object?[]
|
||||
foreach (var u in result.Models)
|
||||
{
|
||||
u.Id,
|
||||
u.Mobile,
|
||||
u.FirstName,
|
||||
u.LastName,
|
||||
u.NationalCode,
|
||||
u.DefaultAddress,
|
||||
u.DefaultPostalCode
|
||||
});
|
||||
sb.AppendLine(string.Join(",",
|
||||
u.Id,
|
||||
EscapeCsv(u.Mobile),
|
||||
EscapeCsv(u.FirstName),
|
||||
EscapeCsv(u.LastName),
|
||||
EscapeCsv(u.NationalCode)));
|
||||
}
|
||||
|
||||
var filename = $"users-{DateTime.Now:yyyyMMddHHmmss}.xls";
|
||||
await JsRuntime.InvokeVoidAsync("jsSaveAsFile", filename,
|
||||
CsvExportHelper.ToExcelXmlBase64("کاربران", headers, rows));
|
||||
Snackbar.Add($"خروجی Excel آماده شد ({all.Count} کاربر).", Severity.Success);
|
||||
var bytes = Encoding.UTF8.GetPreamble().Concat(Encoding.UTF8.GetBytes(sb.ToString())).ToArray();
|
||||
var base64 = Convert.ToBase64String(bytes);
|
||||
var filename = $"users-{DateTime.Now:yyyyMMddHHmmss}.csv";
|
||||
|
||||
await JsRuntime.InvokeVoidAsync("jsSaveAsFile", filename, base64);
|
||||
Snackbar.Add("خروجی Excel (CSV) آماده شد.", Severity.Success);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Snackbar.Add($"خطا در خروجی Excel: {ex.Message}", Severity.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private static string EscapeCsv(string value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value)) return "";
|
||||
if (value.Contains(',') || value.Contains('"') || value.Contains('\n'))
|
||||
return $"\"{value.Replace("\"", "\"\"")}\"";
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"GwUrl": "https://cms.kbs1.ir",
|
||||
"GwUrl": "https://cms.kbs2.ir",
|
||||
"Authentication": {
|
||||
"Authority": "https://ids.afrino.co/",
|
||||
"ClientId": "client_backoffice_spa"
|
||||
|
||||
Reference in New Issue
Block a user