diff --git a/openmetadata-ui/src/main/resources/ui/src/components/ServiceInsights/AgentsStatusWidget/agents-status-widget.less b/openmetadata-ui/src/main/resources/ui/src/components/ServiceInsights/AgentsStatusWidget/agents-status-widget.less index e6910ebab9d..20fa7a718b8 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/ServiceInsights/AgentsStatusWidget/agents-status-widget.less +++ b/openmetadata-ui/src/main/resources/ui/src/components/ServiceInsights/AgentsStatusWidget/agents-status-widget.less @@ -42,7 +42,7 @@ } .collate-agent.ant-card.ant-card-bordered { - border-color: @blue-32; + border-color: @blue-39; background-color: @blue-33; .agent-icon-container { diff --git a/openmetadata-ui/src/main/resources/ui/src/components/ServiceInsights/ServiceInsightsTab.interface.ts b/openmetadata-ui/src/main/resources/ui/src/components/ServiceInsights/ServiceInsightsTab.interface.ts index de03ec6ab75..33b10f17f99 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/ServiceInsights/ServiceInsightsTab.interface.ts +++ b/openmetadata-ui/src/main/resources/ui/src/components/ServiceInsights/ServiceInsightsTab.interface.ts @@ -11,7 +11,12 @@ * limitations under the License. */ +import { NO_RUNS_STATUS } from '../../constants/ServiceInsightsTab.constants'; import { App } from '../../generated/entity/applications/app'; +import { + AppRunRecord, + Status, +} from '../../generated/entity/applications/appRunRecord'; import { IngestionPipeline, PipelineState, @@ -59,6 +64,12 @@ export interface AgentsLiveInfo status: PipelineState; } +export interface CollateAgentLiveInfo + extends Pick { + displayName: string; + status: Status | typeof NO_RUNS_STATUS; +} + export interface TotalAssetsCount { name: string; value: number; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/ServiceInsights/ServiceInsightsTab.tsx b/openmetadata-ui/src/main/resources/ui/src/components/ServiceInsights/ServiceInsightsTab.tsx index bcf2ec42cd7..c2b3c3efe0f 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/ServiceInsights/ServiceInsightsTab.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/ServiceInsights/ServiceInsightsTab.tsx @@ -240,7 +240,10 @@ const ServiceInsightsTab = ({ ); setAgentsInfo( - getFormattedAgentsListFromAgentsLiveInfo(data.ingestionPipelineStatus) + getFormattedAgentsListFromAgentsLiveInfo( + data.ingestionPipelineStatus, + data.appStatus + ) ); setTotalAssetsCount( diff --git a/openmetadata-ui/src/main/resources/ui/src/constants/ServiceInsightsTab.constants.ts b/openmetadata-ui/src/main/resources/ui/src/constants/ServiceInsightsTab.constants.ts index 8a0f321dcba..01abbb037fc 100644 --- a/openmetadata-ui/src/main/resources/ui/src/constants/ServiceInsightsTab.constants.ts +++ b/openmetadata-ui/src/main/resources/ui/src/constants/ServiceInsightsTab.constants.ts @@ -35,3 +35,4 @@ export const LIVE_CHARTS_LIST = [ ]; export const SERVICE_INSIGHTS_WORKFLOW_DEFINITION_NAME = 'AutoPilotWorkflow'; +export const NO_RUNS_STATUS = 'NO_RUNS'; diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/AgentsStatusWidgetUtils.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/AgentsStatusWidgetUtils.tsx index c775a37b65d..1c0c5a8b953 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/AgentsStatusWidgetUtils.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/utils/AgentsStatusWidgetUtils.tsx @@ -25,7 +25,10 @@ import { ReactComponent as ProfilerIcon } from '../assets/svg/ic-stack-search.sv import { groupBy, isEmpty, isUndefined, reduce } from 'lodash'; import { AgentsInfo } from '../components/ServiceInsights/AgentsStatusWidget/AgentsStatusWidget.interface'; -import { AgentsLiveInfo } from '../components/ServiceInsights/ServiceInsightsTab.interface'; +import { + AgentsLiveInfo, + CollateAgentLiveInfo, +} from '../components/ServiceInsights/ServiceInsightsTab.interface'; import { AUTOPILOT_AGENTS_ORDERED_LIST, AUTOPILOT_AGENTS_STATUS_ORDERED_LIST, @@ -35,6 +38,7 @@ import { COLLATE_DATA_QUALITY_APP_NAME, COLLATE_DOCUMENTATION_APP_NAME, } from '../constants/Applications.constant'; +import { NO_RUNS_STATUS } from '../constants/ServiceInsightsTab.constants'; import { AgentStatus } from '../enums/ServiceInsights.enum'; import { App } from '../generated/entity/applications/app'; import { @@ -122,7 +126,7 @@ export const getAgentIconFromType = (agentType: string) => { }; export const getAgentStatusLabelFromStatus = ( - status?: PipelineState | Status + status?: PipelineState | Status | typeof NO_RUNS_STATUS ) => { switch (status) { case PipelineState.Success: @@ -141,6 +145,7 @@ export const getAgentStatusLabelFromStatus = ( return AgentStatus.Running; case PipelineState.Queued: case Status.Pending: + case NO_RUNS_STATUS: default: return AgentStatus.Pending; } @@ -196,19 +201,47 @@ export const getFormattedAgentsList = ( }; export const getFormattedAgentsListFromAgentsLiveInfo = ( - agentsLiveInfo: AgentsLiveInfo[] + agentsLiveInfo: AgentsLiveInfo[], + collateAIagentsLiveInfo: CollateAgentLiveInfo[] ): AgentsInfo[] => { const filteredAgentsList = agentsLiveInfo.filter( (agent) => agent.provider === ProviderType.Automation ); - return filteredAgentsList.map((agent) => ({ + const formattedAgentsList = filteredAgentsList.map((agent) => ({ agentIcon: getAgentIconFromType(agent.pipelineType), agentType: agent.pipelineType, isCollateAgent: false, label: getAgentLabelFromType(agent.pipelineType), status: getAgentStatusLabelFromStatus(agent.status), })); + + const collateAIagents = collateAIagentsLiveInfo.map((agent) => ({ + agentIcon: getAgentIconFromType(agent.appName ?? ''), + agentType: agent.appName ?? '', + isCollateAgent: true, + label: getAgentLabelFromType(agent.appName ?? ''), + status: getAgentStatusLabelFromStatus(agent.status), + })); + + const allAgentsList: AgentsInfo[] = [ + ...formattedAgentsList, + ...collateAIagents, + ]; + + const orderedAgentsList = reduce( + AUTOPILOT_AGENTS_ORDERED_LIST, + (acc, agentType) => { + const agent = allAgentsList.find( + (agent) => agent.agentType === agentType + ); + + return [...acc, ...(isUndefined(agent) ? [] : [agent])]; + }, + [] as AgentsInfo[] + ); + + return orderedAgentsList; }; export const getAgentStatusSummary = (agentsList: AgentsInfo[]) => {