-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '4.10.0' into enhancement/7080-add-filter-by-value-to-do…
…cument-details-fields
- Loading branch information
Showing
55 changed files
with
19,693 additions
and
6,336 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,14 +1,27 @@ | ||
import { UI_COLOR_AGENT_STATUS, UI_LABEL_NAME_AGENT_STATUS, API_NAME_AGENT_STATUS } from '../constants'; | ||
import { | ||
UI_COLOR_AGENT_STATUS, | ||
UI_LABEL_NAME_AGENT_STATUS, | ||
API_NAME_AGENT_STATUS, | ||
} from '../constants'; | ||
|
||
type TAgentStatus = typeof API_NAME_AGENT_STATUS[keyof typeof API_NAME_AGENT_STATUS]; | ||
export type TAgentStatus = | ||
(typeof API_NAME_AGENT_STATUS)[keyof typeof API_NAME_AGENT_STATUS]; | ||
|
||
type TAgentStatusColor = typeof UI_COLOR_AGENT_STATUS[keyof typeof UI_COLOR_AGENT_STATUS]; | ||
type TAgentStatusLabel = typeof UI_LABEL_NAME_AGENT_STATUS[keyof typeof UI_LABEL_NAME_AGENT_STATUS]; | ||
type TAgentStatusColor = | ||
(typeof UI_COLOR_AGENT_STATUS)[keyof typeof UI_COLOR_AGENT_STATUS]; | ||
type TAgentStatusLabel = | ||
(typeof UI_LABEL_NAME_AGENT_STATUS)[keyof typeof UI_LABEL_NAME_AGENT_STATUS]; | ||
|
||
export function agentStatusColorByAgentStatus(status: TAgentStatus): TAgentStatusColor{ | ||
return UI_COLOR_AGENT_STATUS[status] || UI_COLOR_AGENT_STATUS.default; | ||
export function agentStatusColorByAgentStatus( | ||
status: TAgentStatus, | ||
): TAgentStatusColor { | ||
return UI_COLOR_AGENT_STATUS[status] || UI_COLOR_AGENT_STATUS.default; | ||
} | ||
|
||
export function agentStatusLabelByAgentStatus(status: TAgentStatus): TAgentStatusLabel{ | ||
return UI_LABEL_NAME_AGENT_STATUS[status] || UI_LABEL_NAME_AGENT_STATUS.default; | ||
} | ||
export function agentStatusLabelByAgentStatus( | ||
status: TAgentStatus, | ||
): TAgentStatusLabel { | ||
return ( | ||
UI_LABEL_NAME_AGENT_STATUS[status] || UI_LABEL_NAME_AGENT_STATUS.default | ||
); | ||
} |
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
68 changes: 68 additions & 0 deletions
68
plugins/main/public/components/agents/stats/agent-stats.test.tsx
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,68 @@ | ||
import React from 'react'; | ||
import { render, act } from '@testing-library/react'; | ||
import { AgentStats } from './agent-stats'; | ||
import { queryDataTestAttr } from '../../../../test/public/query-attr'; | ||
import { CSS } from '../../../../test/utils/CSS'; | ||
|
||
jest.mock('../../../react-services', () => ({ | ||
WzRequest: { | ||
apiReq: jest.fn().mockResolvedValue(undefined), | ||
}, | ||
})); | ||
|
||
describe('AgentStats', () => { | ||
it('should not render agent info ribbon', async () => { | ||
await act(async () => { | ||
const { container } = render(<AgentStats agent={{ id: '000' }} />); | ||
|
||
const agentInfoRibbon = container.querySelector( | ||
queryDataTestAttr('agent-info'), | ||
); | ||
expect(agentInfoRibbon).toBeFalsy(); | ||
}); | ||
}); | ||
|
||
it('should render stats info ribbon', async () => { | ||
await act(async () => { | ||
const { container } = render(<AgentStats agent={{ id: '000' }} />); | ||
|
||
expect( | ||
container.querySelector(queryDataTestAttr('ribbon-item-status')), | ||
).toBeTruthy(); | ||
|
||
expect( | ||
container.querySelector( | ||
queryDataTestAttr('ribbon-item-buffer_enabled'), | ||
), | ||
).toBeTruthy(); | ||
|
||
expect( | ||
container.querySelector(queryDataTestAttr('ribbon-item-msg_buffer')), | ||
).toBeTruthy(); | ||
|
||
expect( | ||
container.querySelector(queryDataTestAttr('ribbon-item-msg_count')), | ||
).toBeTruthy(); | ||
|
||
expect( | ||
container.querySelector(queryDataTestAttr('ribbon-item-msg_sent')), | ||
).toBeTruthy(); | ||
|
||
expect( | ||
container.querySelector(queryDataTestAttr('ribbon-item-last_ack')), | ||
).toBeTruthy(); | ||
|
||
expect( | ||
container.querySelector( | ||
queryDataTestAttr('ribbon-item-last_keepalive'), | ||
), | ||
).toBeTruthy(); | ||
|
||
expect( | ||
container.querySelectorAll( | ||
queryDataTestAttr('ribbon-item-', CSS.Attribute.Substring), | ||
), | ||
).toHaveLength(7); | ||
}); | ||
}); | ||
}); |
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
Oops, something went wrong.