-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Admin UI: Show number of Identities in Clients overview page (#312)
* feat: add ClientOverview DTO * feat: use ClientOverview in Clients controller * feat: add NumberOfIdentities field to ClientOverview in the AdminUi * test: add integration tests for ClientOverview * fix: merge fix * fix: add missing DefaultTier property to ClientOverview * chore: create SqlServer migrations for ClientOverviews * chore: create Postgres migrations for ClientOverviews * fix: add missing DROP to ClientOverviews migrations * chore: move ClientOverviews variable in the AdminUiDbContext * refactor: improve Client List responsiveness in the AdminUi * Upgrade Helm chart for Consumer API and Admin UI (#316) * feat: set consumer api version to 3.0.0 * feat: set admin ui version to 2.0.0 * fix: merge fix * refactor: improve AdminUi client overview responsiveness * refactor: improve ClientsOverview migrations * fix: add missing link to the Client Details in the Clients Overview page * ci: trigger pipelines --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Daniel Almeida <[email protected]>
- Loading branch information
1 parent
1fbd662
commit a9111fb
Showing
19 changed files
with
430 additions
and
35 deletions.
There are no files selected for viewing
106 changes: 106 additions & 0 deletions
106
...Ui.Infrastructure.Database.Postgres/Migrations/20230929151518_ClientsOverview.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
...src/AdminUi.Infrastructure.Database.Postgres/Migrations/20230929151518_ClientsOverview.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace AdminUi.Infrastructure.Database.Postgres.Migrations | ||
{ | ||
/// <inheritdoc /> | ||
public partial class ClientsOverview : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.Sql(""" | ||
CREATE VIEW "ClientOverviews" AS | ||
SELECT | ||
CLIENTS."ClientId" AS "ClientId", | ||
CLIENTS."DisplayName" AS "DisplayName", | ||
CLIENTS."DefaultTier" AS "DefaultTier", | ||
CLIENTS."CreatedAt" AS "CreatedAt", | ||
( | ||
SELECT COUNT("ClientId") | ||
FROM "Devices"."Identities" | ||
WHERE "ClientId" = CLIENTS."ClientId" | ||
) AS "NumberOfIdentities" | ||
FROM "Devices"."OpenIddictApplications" CLIENTS | ||
"""); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.Sql(""" DROP VIEW "ClientOverviews" """); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
...i.Infrastructure.Database.SqlServer/Migrations/20230929144733_ClientsOverview.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
...rc/AdminUi.Infrastructure.Database.SqlServer/Migrations/20230929144733_ClientsOverview.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace AdminUi.Infrastructure.Database.SqlServer.Migrations | ||
{ | ||
/// <inheritdoc /> | ||
public partial class ClientsOverview : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.Sql(""" | ||
CREATE VIEW ClientOverviews AS | ||
SELECT | ||
CLIENTS.ClientId, | ||
CLIENTS.DisplayName, | ||
CLIENTS.DefaultTier, | ||
CLIENTS.CreatedAt, | ||
( | ||
SELECT COUNT(ClientId) | ||
FROM Devices.Identities | ||
WHERE ClientId = CLIENTS.ClientId | ||
) AS NumberOfIdentities | ||
FROM Devices.OpenIddictApplications CLIENTS | ||
"""); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.Sql(""" DROP VIEW ClientOverviews """); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace AdminUi.Infrastructure.DTOs; | ||
public class ClientOverview | ||
{ | ||
public string ClientId { get; set; } | ||
public string DisplayName { get; set; } | ||
public string DefaultTier { get; set; } | ||
public DateTime CreatedAt { get; set; } | ||
public int NumberOfIdentities { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...re/Persistence/Database/EntityTypeConfigurations/ClientOverviewEntityTypeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using AdminUi.Infrastructure.DTOs; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
|
||
namespace AdminUi.Infrastructure.Persistence.Database.EntityTypeConfigurations; | ||
public class ClientOverviewEntityTypeConfiguration : IEntityTypeConfiguration<ClientOverview> | ||
{ | ||
public void Configure(EntityTypeBuilder<ClientOverview> builder) | ||
{ | ||
builder.ToView("ClientOverviews"); | ||
builder.HasNoKey(); | ||
} | ||
} |
Oops, something went wrong.