From d3b261645644a37b1ce709a99514bee451a84886 Mon Sep 17 00:00:00 2001 From: IsaacCalligeros95 Date: Tue, 19 Nov 2024 09:35:51 +1030 Subject: [PATCH 1/3] Add IsDisabled to tenant editor/repository --- source/Octopus.Server.Client/Editors/TenantEditor.cs | 5 ++++- source/Octopus.Server.Client/Model/TenantResource.cs | 1 + .../Repositories/TenantRepository.cs | 8 +++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/source/Octopus.Server.Client/Editors/TenantEditor.cs b/source/Octopus.Server.Client/Editors/TenantEditor.cs index a36d914a7..f58fbc0b3 100644 --- a/source/Octopus.Server.Client/Editors/TenantEditor.cs +++ b/source/Octopus.Server.Client/Editors/TenantEditor.cs @@ -47,8 +47,9 @@ public TenantEditor CreateOrModify(string name) /// The Tenant's name /// The Tenant's description /// If provided, the Id of the Tenant that you want to clone + /// The Tenant's enabled/disabled state /// - public TenantEditor CreateOrModify(string name, string description, string cloneId = null) + public TenantEditor CreateOrModify(string name, string description, string cloneId = null, bool isDisabled = false) { if (!(repository as TenantRepository).Repository.HasLinkParameter("Tenants", "clone")) throw new OperationNotSupportedByOctopusServerException(cloneId == null @@ -62,12 +63,14 @@ public TenantEditor CreateOrModify(string name, string description, string clone { Name = name, Description = description, + IsDisabled = isDisabled, }, new { clone = cloneId }); } else { existing.Name = name; existing.Description = description; + existing.IsDisabled = isDisabled; Instance = repository.Modify(existing); } diff --git a/source/Octopus.Server.Client/Model/TenantResource.cs b/source/Octopus.Server.Client/Model/TenantResource.cs index e72e8e6e3..fb1e7f15b 100644 --- a/source/Octopus.Server.Client/Model/TenantResource.cs +++ b/source/Octopus.Server.Client/Model/TenantResource.cs @@ -72,6 +72,7 @@ public TenantResource ClearProjects() public string Slug { get; set; } + [Writeable] public bool IsDisabled { get; set; } public IconResource Icon { get; set; } diff --git a/source/Octopus.Server.Client/Repositories/TenantRepository.cs b/source/Octopus.Server.Client/Repositories/TenantRepository.cs index a61bcf45a..765779005 100644 --- a/source/Octopus.Server.Client/Repositories/TenantRepository.cs +++ b/source/Octopus.Server.Client/Repositories/TenantRepository.cs @@ -17,6 +17,7 @@ public interface ITenantRepository : IFindBySlug, ICreate, ITenantRepository @@ -80,7 +81,12 @@ public TenantEditor CreateOrModify(string name, string description) public TenantEditor CreateOrModify(string name, string description, string cloneId) { - return new TenantEditor(this).CreateOrModify(name, description, cloneId); + return new TenantEditor(this).CreateOrModify(name, description, cloneId, false); + } + + public TenantEditor CreateOrModify(string name, string description, string cloneId, bool isDisabled) + { + return new TenantEditor(this).CreateOrModify(name, description, cloneId, isDisabled); } } } \ No newline at end of file From 208f1450f257505d9148d584ba3d577f1d9c5238 Mon Sep 17 00:00:00 2001 From: IsaacCalligeros95 Date: Tue, 19 Nov 2024 09:43:43 +1030 Subject: [PATCH 2/3] Fix tests --- ....ThePublicSurfaceAreaShouldNotRegress..NETCore.approved.txt | 3 ++- ...ublicSurfaceAreaShouldNotRegress..NETFramework.approved.txt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETCore.approved.txt b/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETCore.approved.txt index cb2c99f11..336cd7276 100644 --- a/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETCore.approved.txt +++ b/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETCore.approved.txt @@ -986,7 +986,7 @@ Octopus.Client.Editors Octopus.Client.Editors.TenantEditor ClearTags() Octopus.Client.Editors.TenantEditor ConnectToProjectAndEnvironments(Octopus.Client.Model.ProjectResource, Octopus.Client.Model.EnvironmentResource[]) Octopus.Client.Editors.TenantEditor CreateOrModify(String) - Octopus.Client.Editors.TenantEditor CreateOrModify(String, String, String) + Octopus.Client.Editors.TenantEditor CreateOrModify(String, String, String, Boolean) Octopus.Client.Editors.TenantEditor Customize(Action) Octopus.Client.Editors.TenantEditor Save() Octopus.Client.Editors.TenantEditor SetLogo(String) @@ -8474,6 +8474,7 @@ Octopus.Client.Repositories Octopus.Client.Editors.TenantEditor CreateOrModify(String) Octopus.Client.Editors.TenantEditor CreateOrModify(String, String) Octopus.Client.Editors.TenantEditor CreateOrModify(String, String, String) + Octopus.Client.Editors.TenantEditor CreateOrModify(String, String, String, Boolean) List FindAll(String, String[], Int32) List GetMissingVariables(String, String, String) Octopus.Client.Model.TenantVariableResource GetVariables(Octopus.Client.Model.TenantResource) diff --git a/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETFramework.approved.txt b/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETFramework.approved.txt index a9f3d230f..0dbd40e13 100644 --- a/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETFramework.approved.txt +++ b/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETFramework.approved.txt @@ -987,7 +987,7 @@ Octopus.Client.Editors Octopus.Client.Editors.TenantEditor ClearTags() Octopus.Client.Editors.TenantEditor ConnectToProjectAndEnvironments(Octopus.Client.Model.ProjectResource, Octopus.Client.Model.EnvironmentResource[]) Octopus.Client.Editors.TenantEditor CreateOrModify(String) - Octopus.Client.Editors.TenantEditor CreateOrModify(String, String, String) + Octopus.Client.Editors.TenantEditor CreateOrModify(String, String, String, Boolean) Octopus.Client.Editors.TenantEditor Customize(Action) Octopus.Client.Editors.TenantEditor Save() Octopus.Client.Editors.TenantEditor SetLogo(String) @@ -8499,6 +8499,7 @@ Octopus.Client.Repositories Octopus.Client.Editors.TenantEditor CreateOrModify(String) Octopus.Client.Editors.TenantEditor CreateOrModify(String, String) Octopus.Client.Editors.TenantEditor CreateOrModify(String, String, String) + Octopus.Client.Editors.TenantEditor CreateOrModify(String, String, String, Boolean) List FindAll(String, String[], Int32) List GetMissingVariables(String, String, String) Octopus.Client.Model.TenantVariableResource GetVariables(Octopus.Client.Model.TenantResource) From 746d63355905e3aa8c736a1db0118b7ca9c75649 Mon Sep 17 00:00:00 2001 From: IsaacCalligeros95 Date: Tue, 19 Nov 2024 10:08:44 +1030 Subject: [PATCH 3/3] Tidy up --- source/Octopus.Server.Client/Repositories/TenantRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Octopus.Server.Client/Repositories/TenantRepository.cs b/source/Octopus.Server.Client/Repositories/TenantRepository.cs index 765779005..e83cd8bf0 100644 --- a/source/Octopus.Server.Client/Repositories/TenantRepository.cs +++ b/source/Octopus.Server.Client/Repositories/TenantRepository.cs @@ -81,7 +81,7 @@ public TenantEditor CreateOrModify(string name, string description) public TenantEditor CreateOrModify(string name, string description, string cloneId) { - return new TenantEditor(this).CreateOrModify(name, description, cloneId, false); + return new TenantEditor(this).CreateOrModify(name, description, cloneId); } public TenantEditor CreateOrModify(string name, string description, string cloneId, bool isDisabled)