Repository navigation
Restructure into OSI.Signal9.* projects with a REST API - #49
Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements a comprehensive first pass at CRUD (Create, Read, Update, Delete) operations for the Signal9 RMM platform, establishing core infrastructure for tenant and agent management with a Blazor WebAssembly frontend, Azure Functions backend, and Entity Framework Core data layer.
Key Changes:
- Migrated from .NET 9 to .NET 10 across all projects with updated package references
- Restructured solution from
src/folder hierarchy to flat root-level project structure - Implemented full CRUD operations for tenants and agents with pagination, filtering, and sorting
- Added Blazor WebAssembly web portal with modern UI components and SignalR real-time communication
- Established data access layer with Entity Framework Core, Azure Table Storage, and in-memory fallbacks
Reviewed changes
Copilot reviewed 113 out of 232 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/DTO-Architecture.md | Comprehensive documentation of DTO system architecture, validation patterns, and usage guidelines |
| docs/API-Integration.md | API integration documentation covering endpoints, configuration, and development workflow |
| azure.yaml | Updated Azure deployment configuration with flat project paths and Static Web App hosting |
| Signal9.sln/Signal9.slnx | Restructured solution files removing nested folder structure and adding AppHost/ServiceDefaults projects |
| Signal9.Web/* | Complete Blazor WebAssembly application with pages, services, layouts, and styling |
| Signal9.Web.Functions/* | Azure Functions implementing tenant/agent/system/analytics CRUD operations |
| Signal9.Shared/* | Shared library with models, services, DTOs, and data access implementations |
Comments suppressed due to low confidence (1)
Signal9.Web.Functions/DashboardFunctions.cs:1
- Duplicate using statement for
Microsoft.Extensions.Logging. Remove one of these duplicate imports.
using Microsoft.Azure.Functions.Worker;
| if (!string.IsNullOrEmpty(request.ContactEmail)) | ||
| errors.Add("Invalid email format"); |
There was a problem hiding this comment.
This validation always adds an error if ContactEmail is not empty, regardless of whether the email format is valid. The logic should validate the email format and only add an error if the format is invalid, not if the field has a value.
| if (!string.IsNullOrEmpty(request.ContactEmail)) | ||
| errors.Add("Invalid email format"); |
There was a problem hiding this comment.
This validation always adds an error if ContactEmail is not empty, regardless of whether the email format is valid. The logic should validate the email format and only add an error if the format is invalid, not if the field has a value.
- Deleted unused CSS file _Layout.cshtml.css to clean up styles. - Removed _ValidationScriptsPartial.cshtml as validation scripts are no longer needed. - Eliminated _ViewImports.cshtml and _ViewStart.cshtml to streamline view imports and layout settings. - Added launch.json for Visual Studio Code to facilitate debugging and launching of the application. - Created launchSettings.json to define profiles for running the Signal9 platform. - Introduced Web Functions API documentation for CRUD operations on tenants and devices. - Added DTOs for web functions to handle requests and responses for tenants and agents. - Implemented App.razor for Blazor routing and layout management. - Developed Dashboard.razor for displaying key metrics and recent devices. - Created _Layout.cshtml for the main layout of the web application. - Added _Host.cshtml for hosting the Blazor application. - Implemented _Imports.razor for shared imports across pages. - Developed MainLayout.razor for consistent layout structure. - Created NavMenu.razor for navigation within the application. - Added layout.css for custom styles related to the layout. - Created startup scripts (start-platform.bat and start-platform.ps1) for easy service management.
… update appsettings and launch settings feat: Implement Tenant Management Page with CRUD functionality - Added Tenants.razor page for managing tenants, including search and filter options. - Integrated modal for creating and editing tenant details. - Implemented loading state and error handling for tenant data retrieval. - Created SignalRService for real-time updates and notifications. - Updated staticwebapp.config.json for API routing and security settings. - Added appsettings.Development.json for local API configuration. - Enhanced index.html with necessary styles and scripts for the application. fix: BLAZOR CONVERTED TO WASM AND WORKING IN SWA feat: Update tenant representation and search functionality - Changed tenant display from Code to Slug in Tenants.razor - Updated filtering logic to use Slug instead of Code - Adjusted tenant form model to map Slug to Code - Modified create tenant request to use Slug instead of Code feat: Introduce new DTOs for core entities - Added AgentCommandDto to represent commands sent to agents - Created AgentDto for managed endpoints in the Signal9 RMM system - Implemented TagDto for organizational labels - Developed TelemetryDataDto for performance metrics from agents - Introduced TenantDto for organizational units in the system - Centralized exports in index.ts for easy access to core DTOs test: Add sample tenant data for testing - Created test-tenant.json with sample tenant information Refactor DTOs and Services for Agent Management - Removed required Guid Id properties from various DTOs in Monitoring, Network, Remote Management, Security, and System namespaces. - Simplified AlertRuleResponse, NotificationResponse, and other related DTOs by removing CreatedAt and LastModified properties. - Updated IAgentService interface to return object types instead of specific DTOs for agent-related methods. - Introduced new AgentHeartbeatRequest, AgentQueryRequest, AgentRegistrationRequest, and AgentUpdateRequest DTOs for better agent management. - Added TelemetryDataDto to represent performance and system metrics from agents. - Updated AgentFunctions to reflect changes in DTOs and service methods. - Introduced GlobalUsings for cleaner code organization. refactor: Remove TelemetryDataDto and update global usings feat: Implement unified hierarchy DTO architecture and fix Swagger "Key: id" error
…ponents and models
Updated session-state progress to reflect task completion. Modified .gitignore for local development. Replaced TenantId with ParentId in multiple files to align with the new architecture. Enhanced JSON serialization in Program.cs and added Azure storage packages in the project file. Updated DTOs and service interfaces for better data handling. Improved CRUD operations in TenantFunctions and added new functions in DashboardFunctions. Reflected changes in Razor components and added necessary namespaces. Created DtoExtensions for mapping between request and response DTOs.
- Refactored DTOs to inherit from BaseDto<Guid> for improved type safety. - Simplified code in AgentHub.cs for generating agent configurations. - Added configuration files for Azure Static Web Apps CLI and service dependencies. - Updated package references, including Microsoft.AspNetCore.App and Microsoft.NETCore.App to version 9.0.7. - Enhanced visual representation in CodeMap.dgml with new assembly aliases and paths. - Restructured solution file to include new project sections. - Introduced new extension methods in AgentExtensions.cs for better DTO mapping.
This commit refactors the logging mechanism across multiple classes to use constructor-injected `ILogger` instances, enhancing consistency and testability. The `_logger` fields in `AgentCommunicationFunctions.cs`, `AgentHubService.cs`, `RelationalDataService.cs`, `TableStorageService.cs`, and `SignalRService.cs` have been removed in favor of constructor parameters. Additionally, several DTOs and records have been updated to initialize collections with empty arrays instead of using `new()`, reflecting modern C# practices. The namespaces for various DTOs have also been changed to `Signal9.Shared.DTOs.Core`, indicating a restructuring for better organization. Overall, these changes improve code readability and maintainability.
Refactored logging to use a consistent pattern, replaced legacy list initialization with modern syntax, and improved string interpolation. Updated entity relationships to use `ParentId` instead of `TenantId` for better hierarchy modeling. Enhanced DTOs and interfaces to use `Guid` for IDs, ensuring type safety. Simplified `AgentService` and introduced `AgentConfigurationResponse` with validation attributes. Improved tenant management, telemetry handling, and OpenAPI documentation. Updated database schema, adjusted indexes, and optimized query filters. Enhanced error handling, validation, and logging for better traceability. Removed legacy code, adopted modern C# features, and improved code readability. Updated Razor components and project files to align with modern standards. Improved testability and consistency across the codebase.
Transitioned AgentId and ParentId from string to Guid across the codebase for improved type safety and consistency. Updated DTOs, interfaces, services, and database entities to reflect this change. Refactored telemetry collection methods to use synchronous versions for memory and disk metrics. Adjusted logging, method signatures, and null handling for compatibility. Replaced TenantId references with ParentId for better alignment with the new structure.
…ject dependencies to .NET 10
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
The original branch carried these fixes in a merge commit, which the rebase dropped. Restores the tree to its pre-rebase state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
….sln - Delete ~5k lines of DTOs nothing referenced (Assets, Analytics, Network, RemoteManagement, Security, Monitoring, Tags, repositories) and empty files - Trim unused types from CommonDtos, TenantDtos, ConfigurationModels - Remove docs/ (AI session notes and an OpenAPI spec for removed annotations) - Remove api-docs workflow; it targeted src/ paths and an OpenAPI generator that no longer exist - Keep Signal9.slnx as the single solution file; drop Signal9.sln and the Test.razor scratch page Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Add Directory.Packages.props (central package management) and bump to latest stable, fixing vulnerable OpenTelemetry 1.14 packages - Remove unused packages (storage SDKs, SQL/Timer/Blob/Queue bindings, Newtonsoft, SignalR.Core 1.2, Azure.Identity, PerformanceCounter, etc.) - Remove EF Design/Tools, which pulled in vulnerable System.Security.Cryptography.Xml 9.0.0 - Remove the legacy self-hosted AgentHub from Shared - Move AppHost to the Aspire 13 SDK and pin Aspire package versions Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the two Azure Functions apps and Signal9.Shared with: - OSI.Signal9.API: controller-based REST API (tenants, agents, heartbeat, telemetry, commands) with SignalR hubs, EF Core on Azure SQL, ProblemDetails errors, OpenAPI, and an initial migration - OSI.Signal9.Contracts: dependency-free DTOs shared by API, Web and Agent - OSI.Signal9.API.Tests: in-memory integration tests (SQLite, fake clock) Rename AppHost, ServiceDefaults, Web and Agent to OSI.Signal9.*, and: - AppHost: Azure SQL (SQL Server container locally) + API + Web; drop Cosmos, Key Vault, the SignalR emulator and the SWA CLI container - Web: typed API client and dashboard hub; pages use real data, fake counters removed, Alerts/Reports marked as sample-data previews - Agent: Windows Service that enrolls, heartbeats, sends machine-wide telemetry and reports command results; unsupported commands fail explicitly instead of reporting success Also: CI on main/dev with strict warnings, grouped Dependabot updates, .gitattributes, dotnet-ef tool manifest, Microsoft.Testing.Platform runner, and rewritten README. Authentication is not implemented yet (see TODO(auth)). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Found running the full Aspire stack in a browser: the missing scoped-CSS bundle 404'd, the Blazor error bar and heading focus outline were always visible, Alerts used an icon font that isn't loaded, and a failed first SignalR connection was never retried. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ff346a7 to
da02534
Compare
* Refactor Signal9 Web Application Structure and Remove Unused Files - Deleted unused CSS file _Layout.cshtml.css to clean up styles. - Removed _ValidationScriptsPartial.cshtml as validation scripts are no longer needed. - Eliminated _ViewImports.cshtml and _ViewStart.cshtml to streamline view imports and layout settings. - Added launch.json for Visual Studio Code to facilitate debugging and launching of the application. - Created launchSettings.json to define profiles for running the Signal9 platform. - Introduced Web Functions API documentation for CRUD operations on tenants and devices. - Added DTOs for web functions to handle requests and responses for tenants and agents. - Implemented App.razor for Blazor routing and layout management. - Developed Dashboard.razor for displaying key metrics and recent devices. - Created _Layout.cshtml for the main layout of the web application. - Added _Host.cshtml for hosting the Blazor application. - Implemented _Imports.razor for shared imports across pages. - Developed MainLayout.razor for consistent layout structure. - Created NavMenu.razor for navigation within the application. - Added layout.css for custom styles related to the layout. - Created startup scripts (start-platform.bat and start-platform.ps1) for easy service management. * Add new service and model files for enhanced functionality * Refactor code structure for improved readability and maintainability * feat: Enhance Azure integration with CosmosDB, KeyVault, and SignalR; update appsettings and launch settings feat: Implement Tenant Management Page with CRUD functionality - Added Tenants.razor page for managing tenants, including search and filter options. - Integrated modal for creating and editing tenant details. - Implemented loading state and error handling for tenant data retrieval. - Created SignalRService for real-time updates and notifications. - Updated staticwebapp.config.json for API routing and security settings. - Added appsettings.Development.json for local API configuration. - Enhanced index.html with necessary styles and scripts for the application. fix: BLAZOR CONVERTED TO WASM AND WORKING IN SWA feat: Update tenant representation and search functionality - Changed tenant display from Code to Slug in Tenants.razor - Updated filtering logic to use Slug instead of Code - Adjusted tenant form model to map Slug to Code - Modified create tenant request to use Slug instead of Code feat: Introduce new DTOs for core entities - Added AgentCommandDto to represent commands sent to agents - Created AgentDto for managed endpoints in the Signal9 RMM system - Implemented TagDto for organizational labels - Developed TelemetryDataDto for performance metrics from agents - Introduced TenantDto for organizational units in the system - Centralized exports in index.ts for easy access to core DTOs test: Add sample tenant data for testing - Created test-tenant.json with sample tenant information Refactor DTOs and Services for Agent Management - Removed required Guid Id properties from various DTOs in Monitoring, Network, Remote Management, Security, and System namespaces. - Simplified AlertRuleResponse, NotificationResponse, and other related DTOs by removing CreatedAt and LastModified properties. - Updated IAgentService interface to return object types instead of specific DTOs for agent-related methods. - Introduced new AgentHeartbeatRequest, AgentQueryRequest, AgentRegistrationRequest, and AgentUpdateRequest DTOs for better agent management. - Added TelemetryDataDto to represent performance and system metrics from agents. - Updated AgentFunctions to reflect changes in DTOs and service methods. - Introduced GlobalUsings for cleaner code organization. refactor: Remove TelemetryDataDto and update global usings feat: Implement unified hierarchy DTO architecture and fix Swagger "Key: id" error * feat: Add _Imports.razor file with necessary using directives for components and models * Implement unified hierarchy architecture and updates Updated session-state progress to reflect task completion. Modified .gitignore for local development. Replaced TenantId with ParentId in multiple files to align with the new architecture. Enhanced JSON serialization in Program.cs and added Azure storage packages in the project file. Updated DTOs and service interfaces for better data handling. Improved CRUD operations in TenantFunctions and added new functions in DashboardFunctions. Reflected changes in Razor components and added necessary namespaces. Created DtoExtensions for mapping between request and response DTOs. * Update project structure, dependencies, and functionality - Refactored DTOs to inherit from BaseDto<Guid> for improved type safety. - Simplified code in AgentHub.cs for generating agent configurations. - Added configuration files for Azure Static Web Apps CLI and service dependencies. - Updated package references, including Microsoft.AspNetCore.App and Microsoft.NETCore.App to version 9.0.7. - Enhanced visual representation in CodeMap.dgml with new assembly aliases and paths. - Restructured solution file to include new project sections. - Introduced new extension methods in AgentExtensions.cs for better DTO mapping. * Refactor logging and update DTO initialization This commit refactors the logging mechanism across multiple classes to use constructor-injected `ILogger` instances, enhancing consistency and testability. The `_logger` fields in `AgentCommunicationFunctions.cs`, `AgentHubService.cs`, `RelationalDataService.cs`, `TableStorageService.cs`, and `SignalRService.cs` have been removed in favor of constructor parameters. Additionally, several DTOs and records have been updated to initialize collections with empty arrays instead of using `new()`, reflecting modern C# practices. The namespaces for various DTOs have also been changed to `Signal9.Shared.DTOs.Core`, indicating a restructuring for better organization. Overall, these changes improve code readability and maintainability. * Refactor and modernize codebase for maintainability Refactored logging to use a consistent pattern, replaced legacy list initialization with modern syntax, and improved string interpolation. Updated entity relationships to use `ParentId` instead of `TenantId` for better hierarchy modeling. Enhanced DTOs and interfaces to use `Guid` for IDs, ensuring type safety. Simplified `AgentService` and introduced `AgentConfigurationResponse` with validation attributes. Improved tenant management, telemetry handling, and OpenAPI documentation. Updated database schema, adjusted indexes, and optimized query filters. Enhanced error handling, validation, and logging for better traceability. Removed legacy code, adopted modern C# features, and improved code readability. Updated Razor components and project files to align with modern standards. Improved testability and consistency across the codebase. * Refactor AgentId and ParentId to use Guid Transitioned AgentId and ParentId from string to Guid across the codebase for improved type safety and consistency. Updated DTOs, interfaces, services, and database entities to reflect this change. Refactored telemetry collection methods to use synchronous versions for memory and disk metrics. Adjusted logging, method signatures, and null handling for compatibility. Replaced TenantId references with ParentId for better alignment with the new structure. * Refactor Azure Functions to remove OpenAPI annotations and update project dependencies to .NET 10 * Update Azure Functions package version and configure web application setup (#48) * Update Signal9.Shared/Extensions/DataMappingExtensions.cs * Reapply conflict resolution lost when rebasing onto dev The original branch carried these fixes in a merge commit, which the rebase dropped. Restores the tree to its pre-rebase state. * Remove dead DTOs, stale docs, broken api-docs workflow and duplicate .sln - Delete ~5k lines of DTOs nothing referenced (Assets, Analytics, Network, RemoteManagement, Security, Monitoring, Tags, repositories) and empty files - Trim unused types from CommonDtos, TenantDtos, ConfigurationModels - Remove docs/ (AI session notes and an OpenAPI spec for removed annotations) - Remove api-docs workflow; it targeted src/ paths and an OpenAPI generator that no longer exist - Keep Signal9.slnx as the single solution file; drop Signal9.sln and the Test.razor scratch page * Centralize package versions and drop unused dependencies - Add Directory.Packages.props (central package management) and bump to latest stable, fixing vulnerable OpenTelemetry 1.14 packages - Remove unused packages (storage SDKs, SQL/Timer/Blob/Queue bindings, Newtonsoft, SignalR.Core 1.2, Azure.Identity, PerformanceCounter, etc.) - Remove EF Design/Tools, which pulled in vulnerable System.Security.Cryptography.Xml 9.0.0 - Remove the legacy self-hosted AgentHub from Shared - Move AppHost to the Aspire 13 SDK and pin Aspire package versions * Restructure into OSI.Signal9.* projects with a REST API Replace the two Azure Functions apps and Signal9.Shared with: - OSI.Signal9.API: controller-based REST API (tenants, agents, heartbeat, telemetry, commands) with SignalR hubs, EF Core on Azure SQL, ProblemDetails errors, OpenAPI, and an initial migration - OSI.Signal9.Contracts: dependency-free DTOs shared by API, Web and Agent - OSI.Signal9.API.Tests: in-memory integration tests (SQLite, fake clock) Rename AppHost, ServiceDefaults, Web and Agent to OSI.Signal9.*, and: - AppHost: Azure SQL (SQL Server container locally) + API + Web; drop Cosmos, Key Vault, the SignalR emulator and the SWA CLI container - Web: typed API client and dashboard hub; pages use real data, fake counters removed, Alerts/Reports marked as sample-data previews - Agent: Windows Service that enrolls, heartbeats, sends machine-wide telemetry and reports command results; unsupported commands fail explicitly instead of reporting success Also: CI on main/dev with strict warnings, grouped Dependabot updates, .gitattributes, dotnet-ef tool manifest, Microsoft.Testing.Platform runner, and rewritten README. Authentication is not implemented yet (see TODO(auth)). * Fix dashboard styling gaps and retry the initial hub connection Found running the full Aspire stack in a browser: the missing scoped-CSS bundle 404'd, the Blazor error bar and heading focus outline were always visible, Alerts used an icon font that isn't loaded, and a failed first SignalR connection was never retried. Co-authored-by: Bender <bender@morningwood-gaming.local>
Restructures the repo into
OSI.Signal9.*projects. The API is rebuilt as a strict REST API on Azure SQL.What changed
OSI.Signal9.API: a new ASP.NET Core controller API, with EF Core on Azure SQL and SignalR hubs (/hubs/agents,/hubs/dashboard).Locationon create,ProblemDetailserrors, 409 for state conflicts./commands/{id}/result,/cancellation).OSI.Signal9.Contracts: shared DTOs with no server dependencies (no EF Core in the browser bundle).OSI.Signal9.Web: Blazor WASM for Static Web Apps.OSI.Signal9.Agent: a Windows Service.CollectSystemInfois implemented; the others report failure honestly.OSI.Signal9.AppHost: Aspire with SQL, the API and Web. Cosmos, Key Vault, the SignalR emulator and the SWA CLI are gone.Signal9.Shared, stale docs, the broken api-docs workflow, and the duplicate.sln.Directory.Packages.props.main/devthat fails on warnings and vulnerable packages..gitattributes.dotnet-eftool manifest.Verification
azddeployment.Known gaps (follow-up specs)
TODO(auth)markers). Next up: agent enrollment tokens with per-device identity, then Entra ID for dashboard users and tenant isolation.The open Dependabot alerts (
System.Text.Jsoninsrc/Signal9.Web) are on the default branch's old project layout, which this PR removes.🤖 Generated with Claude Code