From 05adb16877f9af0966b3b59359430e0684f8658f Mon Sep 17 00:00:00 2001
From: Qinyouzeng <102203523+Qinyouzeng@users.noreply.github.com>
Date: Thu, 12 Sep 2024 18:06:41 +0800
Subject: [PATCH] fix: fix stack sdk inject way (#641)
* fix: update sdk client inject way; upgrade sdk package version
* chore: update using
* chore: update
---
Directory.Build.props | 2 +-
.../App/Services/ConfigObjectDomainService.cs | 5 ---
.../App/AppConfigEntityTypeConfiguration.cs | 2 --
.../App/AppPinEntityTypeConfiguration.cs | 2 --
.../App/AppSecretEntityTypeConfiguration.cs | 2 --
.../ConfigObjectEntityTypeConfiguration.cs | 2 --
...figObjectReleaseEntityTypeConfiguration.cs | 2 --
.../PublicConfigEntityTypeConfiguration.cs | 2 --
...blicConfigObjectEntityTypeConfiguration.cs | 2 --
.../Label/LabelEntityTypeConfiguration.cs | 2 --
src/Services/Masa.Dcc.Service/Program.cs | 4 +--
.../Properties/launchSettings.json | 8 ++---
.../Masa.Dcc.Service/Services/AppService.cs | 35 ++++++-------------
.../Services/BizConfigService.cs | 7 ++--
.../Services/ClusterService.cs | 19 +++++-----
.../Services/ConfigObjectService.cs | 8 ++---
.../Services/EnvironmentService.cs | 11 +++---
.../Services/ProjectService.cs | 27 +++++++-------
src/Services/Masa.Dcc.Service/_Imports.cs | 3 +-
.../Masa.Dcc.Web.Admin.Rcl.csproj | 3 +-
.../Masa.Dcc.Web.Admin.Server/Program.cs | 1 +
.../Properties/launchSettings.json | 6 ++--
.../Masa.Dcc.Web.Admin.WebAssembly/Program.cs | 2 +-
23 files changed, 57 insertions(+), 100 deletions(-)
diff --git a/Directory.Build.props b/Directory.Build.props
index 2ce178b0..51099439 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -1,6 +1,6 @@
1.2.0-preview.2
- 1.1.0-preview.2
+ 1.2.1-preview.4
\ No newline at end of file
diff --git a/src/Services/Masa.Dcc.Service/Domain/App/Services/ConfigObjectDomainService.cs b/src/Services/Masa.Dcc.Service/Domain/App/Services/ConfigObjectDomainService.cs
index c06e4f54..292f6439 100644
--- a/src/Services/Masa.Dcc.Service/Domain/App/Services/ConfigObjectDomainService.cs
+++ b/src/Services/Masa.Dcc.Service/Domain/App/Services/ConfigObjectDomainService.cs
@@ -1,11 +1,6 @@
// Copyright (c) MASA Stack All rights reserved.
// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
-using Masa.BuildingBlocks.Configuration;
-using Masa.BuildingBlocks.Data;
-using Masa.BuildingBlocks.StackSdks.Dcc.Contracts.Enum;
-using Masa.Dcc.Service.Admin.Domain.App.Aggregates;
-
namespace Masa.Dcc.Service.Admin.Domain.App.Services
{
public class ConfigObjectDomainService : DomainService
diff --git a/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/AppConfigEntityTypeConfiguration.cs b/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/AppConfigEntityTypeConfiguration.cs
index 69398faf..af2be3e5 100644
--- a/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/AppConfigEntityTypeConfiguration.cs
+++ b/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/AppConfigEntityTypeConfiguration.cs
@@ -1,8 +1,6 @@
// Copyright (c) MASA Stack All rights reserved.
// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
-using Microsoft.EntityFrameworkCore.Metadata.Builders;
-
namespace Masa.Dcc.Service.Admin.Infrastructure.EntityConfigurations.App
{
public class AppConfigEntityTypeConfiguration : IEntityTypeConfiguration
diff --git a/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/AppPinEntityTypeConfiguration.cs b/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/AppPinEntityTypeConfiguration.cs
index 6fffb31b..f9eef7cf 100644
--- a/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/AppPinEntityTypeConfiguration.cs
+++ b/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/AppPinEntityTypeConfiguration.cs
@@ -1,8 +1,6 @@
// Copyright (c) MASA Stack All rights reserved.
// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
-using Microsoft.EntityFrameworkCore.Metadata.Builders;
-
namespace Masa.Dcc.Service.Admin.Infrastructure.EntityConfigurations.App
{
public class AppPinEntityTypeConfiguration : IEntityTypeConfiguration
diff --git a/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/AppSecretEntityTypeConfiguration.cs b/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/AppSecretEntityTypeConfiguration.cs
index 83f7b613..93a789a3 100644
--- a/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/AppSecretEntityTypeConfiguration.cs
+++ b/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/AppSecretEntityTypeConfiguration.cs
@@ -1,8 +1,6 @@
// Copyright (c) MASA Stack All rights reserved.
// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
-using Microsoft.EntityFrameworkCore.Metadata.Builders;
-
namespace Masa.Dcc.Service.Admin.Infrastructure.EntityConfigurations.App
{
public class AppSecretEntityTypeConfiguration : IEntityTypeConfiguration
diff --git a/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/ConfigObjectEntityTypeConfiguration.cs b/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/ConfigObjectEntityTypeConfiguration.cs
index 834b1a19..e5b7fbab 100644
--- a/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/ConfigObjectEntityTypeConfiguration.cs
+++ b/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/ConfigObjectEntityTypeConfiguration.cs
@@ -1,8 +1,6 @@
// Copyright (c) MASA Stack All rights reserved.
// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
-using Microsoft.EntityFrameworkCore.Metadata.Builders;
-
namespace Masa.Dcc.Service.Admin.Infrastructure.EntityConfigurations.App
{
public class ConfigObjectEntityTypeConfiguration : IEntityTypeConfiguration
diff --git a/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/ConfigObjectReleaseEntityTypeConfiguration.cs b/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/ConfigObjectReleaseEntityTypeConfiguration.cs
index df8ff7b3..3caba81f 100644
--- a/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/ConfigObjectReleaseEntityTypeConfiguration.cs
+++ b/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/ConfigObjectReleaseEntityTypeConfiguration.cs
@@ -1,8 +1,6 @@
// Copyright (c) MASA Stack All rights reserved.
// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
-using Microsoft.EntityFrameworkCore.Metadata.Builders;
-
namespace Masa.Dcc.Service.Admin.Infrastructure.EntityConfigurations.App
{
public class ConfigObjectReleaseEntityTypeConfiguration : IEntityTypeConfiguration
diff --git a/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/PublicConfigEntityTypeConfiguration.cs b/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/PublicConfigEntityTypeConfiguration.cs
index d104b8b8..d474a401 100644
--- a/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/PublicConfigEntityTypeConfiguration.cs
+++ b/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/PublicConfigEntityTypeConfiguration.cs
@@ -1,8 +1,6 @@
// Copyright (c) MASA Stack All rights reserved.
// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
-using Microsoft.EntityFrameworkCore.Metadata.Builders;
-
namespace Masa.Dcc.Service.Admin.Infrastructure.EntityConfigurations.App
{
public class PublicConfigEntityTypeConfiguration : IEntityTypeConfiguration
diff --git a/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/PublicConfigObjectEntityTypeConfiguration.cs b/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/PublicConfigObjectEntityTypeConfiguration.cs
index 1431f2fa..bc75ea15 100644
--- a/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/PublicConfigObjectEntityTypeConfiguration.cs
+++ b/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/App/PublicConfigObjectEntityTypeConfiguration.cs
@@ -1,8 +1,6 @@
// Copyright (c) MASA Stack All rights reserved.
// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
-using Microsoft.EntityFrameworkCore.Metadata.Builders;
-
namespace Masa.Dcc.Service.Admin.Infrastructure.EntityConfigurations.App
{
public class PublicConfigObjectEntityTypeConfiguration : IEntityTypeConfiguration
diff --git a/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/Label/LabelEntityTypeConfiguration.cs b/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/Label/LabelEntityTypeConfiguration.cs
index ea01d1bb..3b9fe4e2 100644
--- a/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/Label/LabelEntityTypeConfiguration.cs
+++ b/src/Services/Masa.Dcc.Service/Infrastructure/EntityConfigurations/Label/LabelEntityTypeConfiguration.cs
@@ -1,8 +1,6 @@
// Copyright (c) MASA Stack All rights reserved.
// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
-using Microsoft.EntityFrameworkCore.Metadata.Builders;
-
namespace Masa.Dcc.Service.Admin.Infrastructure.EntityConfigurations.Label
{
public class LabelEntityTypeConfiguration : IEntityTypeConfiguration
diff --git a/src/Services/Masa.Dcc.Service/Program.cs b/src/Services/Masa.Dcc.Service/Program.cs
index 2f42d8f8..a056050d 100644
--- a/src/Services/Masa.Dcc.Service/Program.cs
+++ b/src/Services/Masa.Dcc.Service/Program.cs
@@ -21,8 +21,8 @@
builder.Services.AddMasaIdentity(options =>
{
- options.UserName = "name";
- options.UserId = "sub";
+ options.UserName = IdentityClaimConsts.USER_NAME;
+ options.UserId = IdentityClaimConsts.USER_ID;
options.Role = IdentityClaimConsts.ROLES;
options.Environment = IdentityClaimConsts.ENVIRONMENT;
options.Mapping(nameof(MasaUser.CurrentTeamId), IdentityClaimConsts.CURRENT_TEAM);
diff --git a/src/Services/Masa.Dcc.Service/Properties/launchSettings.json b/src/Services/Masa.Dcc.Service/Properties/launchSettings.json
index 69e7a754..392b0a85 100644
--- a/src/Services/Masa.Dcc.Service/Properties/launchSettings.json
+++ b/src/Services/Masa.Dcc.Service/Properties/launchSettings.json
@@ -11,16 +11,16 @@
"VERSION": "1.0-Prev",
"IS_DEMO": "False",
"DOMAIN_NAME": "masastack.com",
- "NAMESPACE": "masastack.com",
+ "MASA_NAMESPACE": "masastack.com",
"TLS_NAME": "",
- "CLUSTER": "Default",
+ "MASA_CLUSTER": "Default",
"OTLP_URL": "https://otel-collector.masastack:9013",
"REDIS": "{\"RedisHost\": \"10.130.0.19\", \"RedisPort\": 2135, \"RedisDb\": 3,\"RedisPassword\": \"Hzss@123\"}",
"CONNECTIONSTRING": "{\"Server\": \"10.130.0.19\", \"Port\": 2415,\"Database\":\"pm-dev\",\"UserId\": \"ss\",\"Password\":\"Hzss@123\"}",
"MASA_STACK": "[{\"id\":\"pm\",\"service\":{\"id\":\"pm-service-dev\",\"domain\":\"http://pm-service-dev.masastack.com\"},\"web\":{\"id\":\"pm-web-dev\",\"domain\":\"https://pm-dev.masastack.com\"}},{\"id\":\"dcc\",\"service\":{\"id\":\"dcc-service-dev\",\"domain\":\"http://dcc-service-dev.masastack.com\"},\"web\":{\"id\":\"dcc-web-dev\",\"domain\":\"https://dcc-dev.masastack.com\"}},{\"id\":\"tsc\",\"service\":{\"id\":\"tsc-service-dev\",\"domain\":\"http://tsc-service-dev.masastack.com\"},\"web\":{\"id\":\"tsc-web-dev\",\"domain\":\"https://tsc-dev.masastack.com\"}},{\"id\":\"alert\",\"service\":{\"id\":\"alert-service-dev\",\"domain\":\"http://alert-service-dev.masastack.com\"},\"web\":{\"id\":\"alert-web-dev\",\"domain\":\"https://alert-dev.masastack.com\"}},{\"id\":\"scheduler\",\"service\":{\"id\":\"scheduler-service-dev\",\"domain\":\"http://scheduler-service-dev.masastack.com\"},\"worker\":{\"id\":\"scheduler-worker-dev\",\"domain\":\"http://scheduler-worker-dev.masastack.com\"},\"web\":{\"id\":\"scheduler-web-dev\",\"domain\":\"https://scheduler-dev.masastack.com\"}},{\"id\":\"mc\",\"service\":{\"id\":\"mc-service-dev\",\"domain\":\"http://mc-service-dev.masastack.com\"},\"web\":{\"id\":\"mc-web-dev\",\"domain\":\"https://mc-dev.masastack.com\"}},{\"id\":\"auth\",\"service\":{\"id\":\"auth-service-dev\",\"domain\":\"http://auth-service-dev.masastack.com\"},\"web\":{\"id\":\"auth-web-dev\",\"domain\":\"https://auth-dev.masastack.com\"},\"sso\":{\"id\":\"auth-sso-dev\",\"domain\":\"https://auth-sso-dev.masastack.com\"}}]",
"ELASTIC": "{\"Nodes\": [\"http://es-ydy-new.lonsid.cn:9200\"],\"Index\": \"auth_user_development\"}",
- "ENVIRONMENT": "Development",
- "ADMIN_PWD": "admin_pwd",
+ "MASA_ENVIRONMENT": "Development",
+ "ADMIN_PWD": "admin123",
"DCC_SECRET": "masastack.com",
"SUFFIX_IDENTITY": "dev"
},
diff --git a/src/Services/Masa.Dcc.Service/Services/AppService.cs b/src/Services/Masa.Dcc.Service/Services/AppService.cs
index f8afda3a..45d3ff34 100644
--- a/src/Services/Masa.Dcc.Service/Services/AppService.cs
+++ b/src/Services/Masa.Dcc.Service/Services/AppService.cs
@@ -5,13 +5,8 @@ namespace Masa.Dcc.Service.Admin.Services;
public class AppService : ServiceBase
{
- private readonly IPmClient _pmClient;
- private readonly IAuthClient _authClient;
-
- public AppService(IPmClient pmClient, IAuthClient authClient)
+ public AppService()
{
- _pmClient = pmClient;
- _authClient = authClient;
App.MapGet("api/v1/app/{id}", GetAsync);
App.MapPost("api/v1/projects/app", GetListByProjectIdsAsync);
App.MapGet("api/v1/appWithEnvCluster/{id}", GetWithEnvironmentClusterAsync);
@@ -21,38 +16,31 @@ public AppService(IPmClient pmClient, IAuthClient authClient)
App.MapPost("api/v1/app/latestReleaseConfig", GetLatestReleaseConfigByAppAsync);
}
- public async Task GetAsync(int id)
+ public Task GetAsync(IPmClient pmClient, int id)
{
- var result = await _pmClient.AppService.GetAsync(id);
- return result;
+ return pmClient.AppService.GetAsync(id);
}
- public async Task> GetLatestReleaseConfigByAppAsync(IEventBus eventBus, LatestReleaseConfigRequestDto request)
+ public async Task> GetLatestReleaseConfigByAppAsync(IEventBus eventBus, IAuthClient authClient, LatestReleaseConfigRequestDto request)
{
var query = new AppLatestReleaseQuery(request.Items, request.EnvClusterId);
await eventBus.PublishAsync(query);
- return await _authClient.FillUserNameAsync(query.Result);
+ return await authClient.FillUserNameAsync(query.Result);
}
- public async Task> GetListAsync()
+ public async Task> GetListAsync(IPmClient pmClient)
{
- var result = await _pmClient.AppService.GetListAsync();
-
- return result;
+ return await pmClient.AppService.GetListAsync();
}
- public async Task> GetListByProjectIdsAsync([FromBody] List projectIds)
+ public async Task> GetListByProjectIdsAsync(IPmClient pmClient, [FromBody] List projectIds)
{
- var result = await _pmClient.AppService.GetListByProjectIdsAsync(projectIds);
-
- return result;
+ return await pmClient.AppService.GetListByProjectIdsAsync(projectIds);
}
- public async Task GetWithEnvironmentClusterAsync(int id)
+ public async Task GetWithEnvironmentClusterAsync(IPmClient pmClient, int id)
{
- var result = await _pmClient.AppService.GetWithEnvironmentClusterAsync(id);
-
- return result;
+ return await pmClient.AppService.GetWithEnvironmentClusterAsync(id);
}
public async Task AddAppPinAsync(IEventBus eventBus, int appId)
@@ -69,7 +57,6 @@ public async Task> GetAppPinListAsync(IEventBus eventBus, [FromB
{
var query = new AppPinQuery(appIds);
await eventBus.PublishAsync(query);
-
return query.Result;
}
}
diff --git a/src/Services/Masa.Dcc.Service/Services/BizConfigService.cs b/src/Services/Masa.Dcc.Service/Services/BizConfigService.cs
index 07b84356..ebfc2c3b 100644
--- a/src/Services/Masa.Dcc.Service/Services/BizConfigService.cs
+++ b/src/Services/Masa.Dcc.Service/Services/BizConfigService.cs
@@ -5,11 +5,9 @@ namespace Masa.Dcc.Service.Admin.Services
{
public class BizConfigService : ServiceBase
{
- private readonly IAuthClient _authClient;
- public BizConfigService(IAuthClient authClient)
+ public BizConfigService()
{
- _authClient = authClient;
App.MapPost("api/v1/bizConfig", AddAsync);
App.MapPut("api/v1/bizConfig", UpdateAsync);
App.MapGet("api/v1/bizConfig/{identity}", GetAsync);
@@ -17,11 +15,12 @@ public BizConfigService(IAuthClient authClient)
}
public async Task> GetLatestReleaseConfigByProjectAsync(IEventBus eventBus,
+ IAuthClient authClient,
LatestReleaseConfigRequestDto request)
{
var query = new ProjectLatestReleaseQuery(request.Items, request.EnvClusterId);
await eventBus.PublishAsync(query);
- return await _authClient.FillUserNameAsync(query.Result);
+ return await authClient.FillUserNameAsync(query.Result);
}
public async Task AddAsync(IEventBus eventBus, AddObjectConfigDto dto)
diff --git a/src/Services/Masa.Dcc.Service/Services/ClusterService.cs b/src/Services/Masa.Dcc.Service/Services/ClusterService.cs
index 3bbdad67..8189c72f 100644
--- a/src/Services/Masa.Dcc.Service/Services/ClusterService.cs
+++ b/src/Services/Masa.Dcc.Service/Services/ClusterService.cs
@@ -5,41 +5,38 @@ namespace Masa.Dcc.Service.Admin.Services;
public class ClusterService : ServiceBase
{
- private readonly IPmClient _pmClient;
-
public ClusterService(IPmClient pmClient)
{
- _pmClient = pmClient;
App.MapGet("api/v1/cluster", GetListAsync);
App.MapGet("api/v1/cluster/{Id}", GetAsync);
App.MapGet("api/v1/envClusters", GetEnvironmentClustersAsync);
App.MapGet("api/v1/{envId}/cluster", GetListByEnvIdAsync);
}
- public async Task> GetListAsync()
+ public async Task> GetListAsync(IPmClient pmClient)
{
- var result = await _pmClient.ClusterService.GetListAsync();
+ var result = await pmClient.ClusterService.GetListAsync();
return result;
}
- public async Task GetAsync(int Id)
+ public async Task GetAsync(IPmClient pmClient, int Id)
{
- var result = await _pmClient.ClusterService.GetAsync(Id);
+ var result = await pmClient.ClusterService.GetAsync(Id);
return result;
}
- public async Task> GetEnvironmentClustersAsync()
+ public async Task> GetEnvironmentClustersAsync(IPmClient pmClient)
{
- var result = await _pmClient.ClusterService.GetEnvironmentClustersAsync();
+ var result = await pmClient.ClusterService.GetEnvironmentClustersAsync();
return result;
}
- public async Task> GetListByEnvIdAsync(int envId)
+ public async Task> GetListByEnvIdAsync(IPmClient pmClient, int envId)
{
- var result = await _pmClient.ClusterService.GetListByEnvIdAsync(envId);
+ var result = await pmClient.ClusterService.GetListByEnvIdAsync(envId);
return result;
}
diff --git a/src/Services/Masa.Dcc.Service/Services/ConfigObjectService.cs b/src/Services/Masa.Dcc.Service/Services/ConfigObjectService.cs
index 9776da8c..4d8aa265 100644
--- a/src/Services/Masa.Dcc.Service/Services/ConfigObjectService.cs
+++ b/src/Services/Masa.Dcc.Service/Services/ConfigObjectService.cs
@@ -5,10 +5,8 @@ namespace Masa.Dcc.Service.Admin.Services;
public class ConfigObjectService : ServiceBase
{
- private readonly IAuthClient _authClient;
- public ConfigObjectService(IAuthClient authClient)
+ public ConfigObjectService()
{
- _authClient = authClient;
App.MapPost("api/v1/configObject", AddAsync);
App.MapDelete("api/v1/configObject", RemoveAsync);
App.MapGet("api/v1/configObjects/{envClusterId}/{objectId}/{type}/{getLatestRelease}", GetListAsync);
@@ -34,11 +32,11 @@ public async Task RemoveAsync(IEventBus eventBus, [FromBody] RemoveConfigObjectD
}
public async Task> GetListAsync(
- IEventBus eventBus, int envClusterId, int objectId, ConfigObjectType type, string configObjectName = "", bool getLatestRelease = false)
+ IEventBus eventBus, IAuthClient authClient, int envClusterId, int objectId, ConfigObjectType type, string configObjectName = "", bool getLatestRelease = false)
{
var query = new ConfigObjectsQuery(envClusterId, objectId, type, configObjectName, getLatestRelease);
await eventBus.PublishAsync(query);
- query.Result = await _authClient.FillUserNameAsync(query.Result);
+ query.Result = await authClient.FillUserNameAsync(query.Result);
return query.Result;
}
diff --git a/src/Services/Masa.Dcc.Service/Services/EnvironmentService.cs b/src/Services/Masa.Dcc.Service/Services/EnvironmentService.cs
index b1e16f46..556ed105 100644
--- a/src/Services/Masa.Dcc.Service/Services/EnvironmentService.cs
+++ b/src/Services/Masa.Dcc.Service/Services/EnvironmentService.cs
@@ -5,25 +5,22 @@ namespace Masa.Dcc.Service.Admin.Services;
public class EnvironmentService : ServiceBase
{
- private readonly IPmClient _pmClient;
-
public EnvironmentService(IPmClient pmClient)
{
- _pmClient = pmClient;
App.MapGet("api/v1/env", GetListAsync);
App.MapGet("api/v1/env/{Id}", GetAsync);
}
- public async Task> GetListAsync()
+ public async Task> GetListAsync(IPmClient pmClient)
{
- var result = await _pmClient.EnvironmentService.GetListAsync();
+ var result = await pmClient.EnvironmentService.GetListAsync();
return result;
}
- public async Task GetAsync(int Id)
+ public async Task GetAsync(IPmClient pmClient,int Id)
{
- var result = await _pmClient.EnvironmentService.GetAsync(Id);
+ var result = await pmClient.EnvironmentService.GetAsync(Id);
return result;
}
diff --git a/src/Services/Masa.Dcc.Service/Services/ProjectService.cs b/src/Services/Masa.Dcc.Service/Services/ProjectService.cs
index 41c28fad..ea6d4438 100644
--- a/src/Services/Masa.Dcc.Service/Services/ProjectService.cs
+++ b/src/Services/Masa.Dcc.Service/Services/ProjectService.cs
@@ -5,11 +5,8 @@ namespace Masa.Dcc.Service.Admin.Services;
public class ProjectService : ServiceBase
{
- private readonly IPmClient _pmClient;
-
public ProjectService(IPmClient pmClient)
{
- _pmClient = pmClient;
App.MapGet("api/v1/projectwithapps/{envName}", GetProjectListAsync);
App.MapGet("api/v1/project/{id}", GetAsync);
App.MapGet("api/v1/{envClusterId}/project", GetListByEnvironmentClusterIdAsync);
@@ -18,44 +15,44 @@ public ProjectService(IPmClient pmClient)
App.MapPost("api/v1/project/teamsProject", GetListByTeamIdsAsync);
}
- public async Task> GetProjectListAsync(string envName)
+ public async Task> GetProjectListAsync(IPmClient pmClient, string envName)
{
- var result = await _pmClient.ProjectService.GetProjectAppsAsync(envName);
+ var result = await pmClient.ProjectService.GetProjectAppsAsync(envName);
return result;
}
- public async Task GetAsync(int id)
+ public async Task GetAsync(IPmClient pmClient, int id)
{
- var result = await _pmClient.ProjectService.GetAsync(id);
+ var result = await pmClient.ProjectService.GetAsync(id);
return result;
}
- public async Task> GetListAsync()
+ public async Task> GetListAsync(IPmClient pmClient)
{
- var result = await _pmClient.ProjectService.GetListAsync();
+ var result = await pmClient.ProjectService.GetListAsync();
return result;
}
- public async Task> GetListByEnvironmentClusterIdAsync(int envClusterId)
+ public async Task> GetListByEnvironmentClusterIdAsync(IPmClient pmClient, int envClusterId)
{
- var result = await _pmClient.ProjectService.GetListByEnvironmentClusterIdAsync(envClusterId);
+ var result = await pmClient.ProjectService.GetListByEnvironmentClusterIdAsync(envClusterId);
return result;
}
- public async Task> GetProjectTypes()
+ public async Task> GetProjectTypes(IPmClient pmClient)
{
- var result = await _pmClient.ProjectService.GetProjectTypesAsync();
+ var result = await pmClient.ProjectService.GetProjectTypesAsync();
return result;
}
- public async Task> GetListByTeamIdsAsync([FromBody] List teamIds, IMultiEnvironmentUserContext multiEnvironmentUserContext)
+ public async Task> GetListByTeamIdsAsync(IPmClient pmClient, [FromBody] List teamIds, IMultiEnvironmentUserContext multiEnvironmentUserContext)
{
- var result = await _pmClient.ProjectService.GetListByTeamIdsAsync(teamIds, multiEnvironmentUserContext.Environment ?? "");
+ var result = await pmClient.ProjectService.GetListByTeamIdsAsync(teamIds, multiEnvironmentUserContext.Environment ?? "");
return result;
}
diff --git a/src/Services/Masa.Dcc.Service/_Imports.cs b/src/Services/Masa.Dcc.Service/_Imports.cs
index c0fdcd1f..718e02f8 100644
--- a/src/Services/Masa.Dcc.Service/_Imports.cs
+++ b/src/Services/Masa.Dcc.Service/_Imports.cs
@@ -28,8 +28,8 @@
global using Masa.BuildingBlocks.ReadWriteSplitting.Cqrs.Queries;
global using Masa.BuildingBlocks.StackSdks.Auth;
global using Masa.BuildingBlocks.StackSdks.Auth.Contracts;
-global using Masa.BuildingBlocks.StackSdks.Auth.Contracts.Consts;
global using Masa.BuildingBlocks.StackSdks.Config;
+global using Masa.BuildingBlocks.StackSdks.Config.Consts;
global using Masa.BuildingBlocks.StackSdks.Dcc.Contracts.Model;
global using Masa.BuildingBlocks.StackSdks.Middleware;
global using Masa.BuildingBlocks.StackSdks.Pm;
@@ -64,3 +64,4 @@
global using Microsoft.AspNetCore.Mvc;
global using Microsoft.EntityFrameworkCore;
global using Microsoft.EntityFrameworkCore.Design;
+global using Microsoft.EntityFrameworkCore.Metadata.Builders;
diff --git a/src/Web/Masa.Dcc.Web.Admin/Masa.Dcc.Web.Admin.Rcl/Masa.Dcc.Web.Admin.Rcl.csproj b/src/Web/Masa.Dcc.Web.Admin/Masa.Dcc.Web.Admin.Rcl/Masa.Dcc.Web.Admin.Rcl.csproj
index 3d632f3e..7f8cb9c8 100644
--- a/src/Web/Masa.Dcc.Web.Admin/Masa.Dcc.Web.Admin.Rcl/Masa.Dcc.Web.Admin.Rcl.csproj
+++ b/src/Web/Masa.Dcc.Web.Admin/Masa.Dcc.Web.Admin.Rcl/Masa.Dcc.Web.Admin.Rcl.csproj
@@ -11,8 +11,9 @@
-
+
+
diff --git a/src/Web/Masa.Dcc.Web.Admin/Masa.Dcc.Web.Admin.Server/Program.cs b/src/Web/Masa.Dcc.Web.Admin/Masa.Dcc.Web.Admin.Server/Program.cs
index 4eb65904..68740d8a 100644
--- a/src/Web/Masa.Dcc.Web.Admin/Masa.Dcc.Web.Admin.Server/Program.cs
+++ b/src/Web/Masa.Dcc.Web.Admin/Masa.Dcc.Web.Admin.Server/Program.cs
@@ -4,6 +4,7 @@
var builder = WebApplication.CreateBuilder(args);
await builder.Services.AddMasaStackComponentsAsync(project: MasaStackProject.DCC);
+
var masaStackConfig = builder.Services.GetMasaStackConfig();
builder.Services.AddValidatorsFromAssembly(typeof(LabelValueModel).Assembly, includeInternalTypes: true);
diff --git a/src/Web/Masa.Dcc.Web.Admin/Masa.Dcc.Web.Admin.Server/Properties/launchSettings.json b/src/Web/Masa.Dcc.Web.Admin/Masa.Dcc.Web.Admin.Server/Properties/launchSettings.json
index de8951b4..422bb390 100644
--- a/src/Web/Masa.Dcc.Web.Admin/Masa.Dcc.Web.Admin.Server/Properties/launchSettings.json
+++ b/src/Web/Masa.Dcc.Web.Admin/Masa.Dcc.Web.Admin.Server/Properties/launchSettings.json
@@ -20,11 +20,11 @@
"VERSION": "1.0-Prev",
"IS_DEMO": "False",
"DOMAIN_NAME": "masastack.com",
- "NAMESPACE": "masastack.com",
+ "MASA_NAMESPACE": "masastack.com",
"TLS_NAME": "",
- "CLUSTER": "Default",
+ "MASA_CLUSTER": "Default",
"OTLP_URL": "https://otel-collector.masastack:9013",
- "REDIS": "{\"RedisHost\": \"10.130.0.19\", \"RedisPort\": 2135, \"RedisDb\": 0,\"RedisPassword\": \"Hzss@123\"}",
+ "REDIS": "{\"RedisHost\": \"10.130.0.19\", \"RedisPort\": 2135, \"RedisDb\": 3,\"RedisPassword\": \"Hzss@123\"}",
"CONNECTIONSTRING": "{\"Server\": \"10.130.0.19\", \"Port\": 2415,\"Database\":\"pm-dev\",\"UserId\": \"ss\",\"Password\":\"Hzss@123\"}",
"MASA_STACK": "[{\"id\":\"pm\",\"service\":{\"id\":\"pm-service-dev\",\"domain\":\"http://pm-service-dev.masastack.com\"},\"web\":{\"id\":\"pm-web-dev\",\"domain\":\"https://pm-dev.masastack.com\"}},{\"id\":\"dcc\",\"service\":{\"id\":\"dcc-service-dev\",\"domain\":\"http://dcc-service-dev.masastack.com\"},\"web\":{\"id\":\"dcc-web-dev\",\"domain\":\"https://dcc-dev.masastack.com\"}},{\"id\":\"tsc\",\"service\":{\"id\":\"tsc-service-dev\",\"domain\":\"http://tsc-service-dev.masastack.com\"},\"web\":{\"id\":\"tsc-web-dev\",\"domain\":\"https://tsc-dev.masastack.com\"}},{\"id\":\"alert\",\"service\":{\"id\":\"alert-service-dev\",\"domain\":\"http://alert-service-dev.masastack.com\"},\"web\":{\"id\":\"alert-web-dev\",\"domain\":\"https://alert-dev.masastack.com\"}},{\"id\":\"scheduler\",\"service\":{\"id\":\"scheduler-service-dev\",\"domain\":\"http://scheduler-service-dev.masastack.com\"},\"worker\":{\"id\":\"scheduler-worker-dev\",\"domain\":\"http://scheduler-worker-dev.masastack.com\"},\"web\":{\"id\":\"scheduler-web-dev\",\"domain\":\"https://scheduler-dev.masastack.com\"}},{\"id\":\"mc\",\"service\":{\"id\":\"mc-service-dev\",\"domain\":\"http://mc-service-dev.masastack.com\"},\"web\":{\"id\":\"mc-web-dev\",\"domain\":\"https://mc-dev.masastack.com\"}},{\"id\":\"auth\",\"service\":{\"id\":\"auth-service-dev\",\"domain\":\"http://auth-service-dev.masastack.com\"},\"web\":{\"id\":\"auth-web-dev\",\"domain\":\"https://auth-dev.masastack.com\"},\"sso\":{\"id\":\"auth-sso-dev\",\"domain\":\"https://auth-sso-dev.masastack.com\"}}]",
"ELASTIC": "{\"Nodes\": [\"http://es-ydy-new.lonsid.cn:9200\"],\"Index\": \"auth_user_development\"}",
diff --git a/src/Web/Masa.Dcc.Web.Admin/Masa.Dcc.Web.Admin.WebAssembly/Program.cs b/src/Web/Masa.Dcc.Web.Admin/Masa.Dcc.Web.Admin.WebAssembly/Program.cs
index fd8ce7a3..3ec93b7a 100644
--- a/src/Web/Masa.Dcc.Web.Admin/Masa.Dcc.Web.Admin.WebAssembly/Program.cs
+++ b/src/Web/Masa.Dcc.Web.Admin/Masa.Dcc.Web.Admin.WebAssembly/Program.cs
@@ -1,4 +1,4 @@
-using Masa.Dcc.Web.Admin.Rcl.Global;
+using Masa.Dcc.Web.Admin.Rcl.Global;
using Masa.Dcc.Web.Admin.Rcl;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;