Add IsAvailable property to Inbound and update related logic
- Introduced a new boolean property, `IsAvailable`, to the `Inbound` entity to track the availability status of inbounds based on synchronization results. - Updated the `SyncNodeCommandHandler` to mark inbounds as unavailable if they are not present in the latest synchronization but have existing configurations, preventing their deletion. - Enhanced the `MarkUnavailable` method to set both `IsAvailable` and `IsPublished` to false, reflecting the new status accurately. - Modified the frontend components to display the availability status of inbounds, ensuring users are informed of their current state. - Updated tests to cover the new behavior regarding inbound availability and its impact on revocation processes.
This commit is contained in:
1 parent
c196e0c322
commit
b980dc6cef
16 files changed
+1211
-14
No files matched your search
@@ -16,6 +16,7 @@ public sealed class Inbound : Entity
|
||||
public string Remark { get; private set; } = string.Empty;
|
||||
public int Port { get; private set; }
|
||||
public bool IsPublished { get; private set; }
|
||||
public bool IsAvailable { get; private set; } = true;
|
||||
public string? DisplayName { get; private set; }
|
||||
public IReadOnlyList<Guid> AllowedRoleIds { get; private set; } = [];
|
||||
public DateTimeOffset? LastSyncAt { get; private set; }
|
||||
@@ -39,6 +40,7 @@ public sealed class Inbound : Entity
|
||||
Remark = remark,
|
||||
Port = port,
|
||||
IsPublished = false,
|
||||
IsAvailable = true,
|
||||
LastSyncAt = DateTimeOffset.UtcNow,
|
||||
};
|
||||
}
|
||||
@@ -59,4 +61,15 @@ public sealed class Inbound : Entity
|
||||
}
|
||||
|
||||
public void Unpublish() => IsPublished = false;
|
||||
|
||||
/// <summary>
|
||||
/// Инбаунд пропал на панели (не пришёл в очередной синхронизации), но по нему есть конфиги —
|
||||
/// удалить запись нельзя (FK), поэтому помечаем недоступной вместо тихого "не опубликован":
|
||||
/// UI показывает явный статус, а Revoke пропускает обращение к панели как заведомо мёртвое.
|
||||
/// </summary>
|
||||
public void MarkUnavailable()
|
||||
{
|
||||
IsAvailable = false;
|
||||
IsPublished = false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user