Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #25

Merged
merged 27 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e163c8a
修改和增加属性。
Codespilot Feb 5, 2024
66f0cf4
增加领域模型方法。
Codespilot Feb 5, 2024
5e19b92
团队repository增加成员权限检查接口。
Codespilot Feb 5, 2024
b0099c7
权限检查返回类型使用枚举。
Codespilot Feb 5, 2024
54e40e5
配置业务对象。
Codespilot Feb 5, 2024
0cd089b
增加CommandObjectBase
Codespilot Feb 5, 2024
15ea233
[WIP]接口重构
Codespilot Feb 16, 2024
a72d92b
WebApi重构
Codespilot Feb 18, 2024
81a206a
删除AppInfo相关文件。
Codespilot Feb 18, 2024
eec81fb
增加配置管理接口。
Codespilot Feb 18, 2024
0946585
重构配置相关事件
Codespilot Feb 18, 2024
f0cffd9
更新接口定义。
Codespilot Feb 18, 2024
6edaa23
更新依赖包
Codespilot Feb 19, 2024
6aa7550
修改批量更新配置项接口。
Codespilot Feb 19, 2024
c3e5a66
修改批量更新配置项接口
Codespilot Feb 19, 2024
d87b5bf
重构配置项修改。
Codespilot Feb 19, 2024
7d001a2
重置访问密钥页面。
Codespilot Feb 19, 2024
16499a6
同步到redis页面
Codespilot Feb 19, 2024
1233153
配置发布dialog
Codespilot Feb 19, 2024
5fe4931
删除app相关dto
Codespilot Feb 19, 2024
8d81f8f
资源文件
Codespilot Feb 20, 2024
ece998b
删除文件
Codespilot Feb 20, 2024
ac16d2f
修复接口bug
Codespilot Feb 20, 2024
0f93bd8
页面重构。
Codespilot Feb 20, 2024
ec8d7cd
用例相关类访问修饰符改为internal
Codespilot Feb 21, 2024
0862d13
修改Client参数。
Codespilot Feb 21, 2024
648a366
Merge pull request #24 from NerosoftDev/refectoring/configuration
Codespilot Feb 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<EnablePackageVersionOverride>true</EnablePackageVersionOverride>
<EuoniaPackageVersion>8.1.21</EuoniaPackageVersion>
<EuoniaPackageVersion>8.1.22</EuoniaPackageVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Blazored.LocalStorage" Version="4.4.0" />
<PackageVersion Include="Blazored.LocalStorage" Version="4.5.0" />
<PackageVersion Include="BlazorMonaco" Version="3.1.0" />
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageVersion Include="Dapper" Version="2.1.28" />
Expand All @@ -29,37 +29,37 @@
<PackageVersion Include="Euonia.Pipeline" Version="$(EuoniaPackageVersion)" />
<PackageVersion Include="Euonia.Validation" Version="$(EuoniaPackageVersion)" />
<PackageVersion Include="Euonia.Repository.EfCore" Version="$(EuoniaPackageVersion)" />
<PackageVersion Include="Google.Api.CommonProtos" Version="2.13.0" />
<PackageVersion Include="Google.Protobuf" Version="3.25.2" />
<PackageVersion Include="Google.Api.CommonProtos" Version="2.14.0" />
<PackageVersion Include="Google.Protobuf" Version="3.25.3" />
<PackageVersion Include="Grpc.Net.Client" Version="2.60.0" />
<PackageVersion Include="Grpc.Tools" Version="2.60.0" />
<PackageVersion Include="Grpc.Tools" Version="2.61.0" />
<PackageVersion Include="IdentityModel" Version="6.2.0" />
<PackageVersion Include="Microsoft.AspNetCore.Components.Authorization" Version="8.0.1" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.1" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.1" />
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="8.0.1" />
<PackageVersion Include="Microsoft.AspNetCore.Components.Authorization" Version="8.0.2" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.2" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.2" />
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Http.Polly" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Http.Polly" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageVersion Include="Microsoft.FeatureManagement.AspNetCore" Version="3.1.1" />
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components" Version="4.3.1" />
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.Emoji" Version="4.3.1" />
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.Icons" Version="4.3.1" />
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components" Version="4.4.1" />
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.Emoji" Version="4.4.0" />
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.Icons" Version="4.4.0" />
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
<PackageVersion Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.11" />
<PackageVersion Include="Refit" Version="7.0.0" />
<PackageVersion Include="Refit.HttpClientFactory" Version="7.0.0" />
<PackageVersion Include="Refit.Newtonsoft.Json" Version="7.0.0" />
<PackageVersion Include="StackExchange.Redis" Version="2.7.17" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="7.3.0" />
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="7.3.1" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.1" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.1" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.1" />
<PackageVersion Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.0-beta.2" />
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.2" />
<PackageVersion Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.0" />
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
<PackageVersion Include="MongoDB.EntityFrameworkCore" Version="7.0.0-preview.1" />
</ItemGroup>
<ItemGroup>
Expand All @@ -72,7 +72,7 @@
</PackageVersion>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<PackageVersion Include="System.Text.Json" Version="8.0.1" />
<PackageVersion Include="System.Text.Json" Version="8.0.2" />
</ItemGroup>
<ItemGroup Condition=" $(TargetFrameworkVersion.Equals('v5.0')) ">
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
Expand Down Expand Up @@ -102,9 +102,9 @@
<!-- Tests -->
<ItemGroup>
<PackageVersion Include="BenchmarkDotNet" Version="0.13.4" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="xunit" Version="2.6.6" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.6">
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="xunit" Version="2.7.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
Expand Down
10 changes: 4 additions & 6 deletions Source/Starfish.Client/Clients/HttpConfigurationClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@ internal class HttpConfigurationClient : IConfigurationClient
{
private readonly HttpClient _httpClient = new();

private readonly string _app;
private readonly string _id;
private readonly string _secret;
private readonly string _env;

public HttpConfigurationClient(Uri host, string app, string secret, string env)
public HttpConfigurationClient(Uri host, string id, string secret)
{
_httpClient.BaseAddress = host;
_app = app;
_id = id;
_secret = secret;
_env = env;

// _httpClient.DefaultRequestHeaders.Add(Constants.RequestHeaders.Team, team);
// _httpClient.DefaultRequestHeaders.Add(Constants.RequestHeaders.App, app);
Expand All @@ -28,7 +26,7 @@ public async Task GetConfigurationAsync(Action<byte[], int> dataAction, Cancella
try
{
attempts++;
using var request = new HttpRequestMessage(HttpMethod.Get, $"es?app={_app}&secret={_secret}&env={_env}");
using var request = new HttpRequestMessage(HttpMethod.Get, $"es?id={_id}&secret={_secret}");

var response = await _httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken);

Expand Down
4 changes: 2 additions & 2 deletions Source/Starfish.Client/Clients/SocketConfigurationClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ internal class SocketConfigurationClient : IConfigurationClient
private readonly ClientWebSocket _client = new();
private readonly Uri _uri;

public SocketConfigurationClient(Uri host, string app, string secret, string env)
public SocketConfigurationClient(Uri host, string id, string secret)
{
_uri = new Uri($"{host.AbsoluteUri}ws?app={app}&secret={secret}&env={env}");
_uri = new Uri($"{host.AbsoluteUri}ws?app={id}&secret={secret}");
// _client.Options.SetRequestHeader(Constants.RequestHeaders.Team, team);
// _client.Options.SetRequestHeader(Constants.RequestHeaders.App, app);
// _client.Options.SetRequestHeader(Constants.RequestHeaders.Secret, secret);
Expand Down
14 changes: 4 additions & 10 deletions Source/Starfish.Client/ConfigurationClientOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ public class ConfigurationClientOptions
/// <summary>
/// 应用Id
/// </summary>
public string App { get; set; }

/// <summary>
/// 应用环境
/// </summary>
public string Env { get; set; }
public string Id { get; set; }

/// <summary>
/// 密钥
Expand Down Expand Up @@ -67,9 +62,9 @@ public static ConfigurationClientOptions Load(IConfiguration configuration)
throw new InvalidOperationException(Resources.IDS_ERROR_STARFISH_SECTION_NOT_FOUND);
}

var app = section[nameof(App)];
var id = section[nameof(Id)];

if (string.IsNullOrWhiteSpace(app))
if (string.IsNullOrWhiteSpace(id))
{
throw new InvalidOperationException(Resources.IDS_ERROR_APP_SECTION_NOT_FOUND);
}
Expand All @@ -83,8 +78,7 @@ public static ConfigurationClientOptions Load(IConfiguration configuration)
var options = new ConfigurationClientOptions
{
Host = host,
App = app,
Env = section[nameof(Env)] ?? Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"),
Id = id,
Secret = section[nameof(Secret)],
CacheDirectory = section[nameof(CacheDirectory)] ?? AppDomain.CurrentDomain.BaseDirectory
};
Expand Down
6 changes: 3 additions & 3 deletions Source/Starfish.Client/StarfishConfigurationProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal class StarfishConfigurationProvider : ConfigurationProvider, IDisposabl
public StarfishConfigurationProvider(ConfigurationClientOptions options)
{
_options = options;
_cacheFile = Path.Combine(_options.CacheDirectory, $"{_options.App}.starfish.{_options.Env}.cache");
_cacheFile = Path.Combine(_options.CacheDirectory, $"{_options.Id}.starfish.cache");
HostChanged += OnHostChanged;
ConnectionLost += (_, _) =>
{
Expand Down Expand Up @@ -58,8 +58,8 @@ private async void OnHostChanged(object sender, HostChangedEventArgs args)
var uri = new Uri(args.Host);
IConfigurationClient client = uri.Scheme switch
{
"http" or "https" => new HttpConfigurationClient(uri, _options.App, _options.Secret, _options.Env),
"ws" or "wss" => new SocketConfigurationClient(uri, _options.App, _options.Secret, _options.Env),
"http" or "https" => new HttpConfigurationClient(uri, _options.Id, _options.Secret),
"ws" or "wss" => new SocketConfigurationClient(uri, _options.Id, _options.Secret),
_ => throw new NotSupportedException(string.Format(Resources.IDS_ERROR_SCHEMA_NOT_SUPPORTED, uri.Scheme)),
};
try
Expand Down
8 changes: 8 additions & 0 deletions Source/Starfish.Common/PermissionState.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Nerosoft.Starfish.Common;

public enum PermissionState
{
None = 0,
Read = 1,
Edit = 2
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public override void AheadConfigureServices(ServiceConfigurationContext context)
{
options.AddProfile<IdentityMappingProfile>();
options.AddProfile<LogsMappingProfile>();
options.AddProfile<AppsMappingProfile>();
options.AddProfile<ConfigurationMappingProfile>();
});
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
namespace Nerosoft.Starfish.Application;
using Nerosoft.Euonia.Domain;

public class ConfigurationCreateCommand : ConfigurationAbstractCommand
namespace Nerosoft.Starfish.Application;

public class ConfigurationCreateCommand : Command
{
public ConfigurationCreateCommand(string appId, string environment)
: base(appId, environment)
public ConfigurationCreateCommand(string teamId)
{
TeamId = teamId;
}

/// <summary>
/// 描述
/// </summary>

public string TeamId { get; set; }

public string Name { get; set; }

public string Description { get; set; }

/// <summary>
/// 配置项内容
/// </summary>
public IDictionary<string, string> Data { get; set; }
public string Secret { get; set; }
}
Loading
Loading