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:
@@ -116,12 +116,18 @@ export function NodeCard({ node }: { node: NodeDto }) {
|
||||
{inbound.remark} · {inbound.protocol} · :{inbound.port}
|
||||
</span>
|
||||
<div className="flex items-center gap-2">
|
||||
<Badge variant={inbound.isPublished ? 'success' : 'outline'}>
|
||||
{inbound.isPublished ? t('admin.nodes.published') : t('admin.nodes.unpublished')}
|
||||
<Badge variant={inbound.isAvailable ? (inbound.isPublished ? 'success' : 'outline') : 'destructive'}>
|
||||
{inbound.isAvailable
|
||||
? inbound.isPublished
|
||||
? t('admin.nodes.published')
|
||||
: t('admin.nodes.unpublished')
|
||||
: t('admin.nodes.unavailable')}
|
||||
</Badge>
|
||||
<Button size="sm" variant="outline" onClick={() => setPublishing(inbound)}>
|
||||
{t('admin.nodes.publish')}
|
||||
</Button>
|
||||
{inbound.isAvailable && (
|
||||
<Button size="sm" variant="outline" onClick={() => setPublishing(inbound)}>
|
||||
{t('admin.nodes.publish')}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
|
||||
@@ -3186,6 +3186,7 @@ export interface components {
|
||||
/** Format: int32 */
|
||||
port: number | string;
|
||||
isPublished: boolean;
|
||||
isAvailable: boolean;
|
||||
displayName: null | string;
|
||||
allowedRoleIds: string[];
|
||||
/** Format: date-time */
|
||||
|
||||
@@ -222,6 +222,7 @@ export type InboundDto = {
|
||||
remark: string
|
||||
port: number
|
||||
isPublished: boolean
|
||||
isAvailable: boolean
|
||||
displayName: string | null
|
||||
allowedRoleIds: string[]
|
||||
lastSyncAt: string | null
|
||||
|
||||
@@ -316,6 +316,7 @@ const resources = {
|
||||
publish: 'Публикация',
|
||||
published: 'Опубликован',
|
||||
unpublished: 'Не опубликован',
|
||||
unavailable: 'Недоступен на панели',
|
||||
publishSaved: 'Настройки публикации сохранены.',
|
||||
displayName: 'Отображаемое имя',
|
||||
allowedRoles: 'Доступно ролям',
|
||||
@@ -757,6 +758,7 @@ const resources = {
|
||||
publish: 'Publishing',
|
||||
published: 'Published',
|
||||
unpublished: 'Not published',
|
||||
unavailable: 'Unavailable on panel',
|
||||
publishSaved: 'Publishing settings saved.',
|
||||
displayName: 'Display name',
|
||||
allowedRoles: 'Allowed for roles',
|
||||
|
||||
Reference in New Issue
Block a user