import React from 'react'; import type {PreparedPlan, PreparedQueryData} from '../../../../../../store/reducers/query/types'; import type {TKqpStatsQuery} from '../../../../../../types/api/query'; import {RESULT_OPTIONS_IDS} from '../../constants'; import type {SectionID} from '../../constants'; import i18n from '../../i18n'; import {Ast} from '../Ast/Ast'; import {Graph} from '../Graph/Graph'; import {QueryJSONViewer} from '../QueryJSONViewer/QueryJSONViewer'; import {SimplifiedPlan} from '../SimplifiedPlan/SimplifiedPlan'; import {StubMessage} from '../Stub/Stub'; interface PlanSectionProps { activeSection: SectionID; sectionTitle: string; preparedPlan?: PreparedPlan; simplifiedPlan?: PreparedQueryData['simplifiedPlan']; stats?: TKqpStatsQuery; ast?: string; theme?: string; } export function PlanSection({ activeSection, sectionTitle, preparedPlan, simplifiedPlan, stats, ast, theme, }: PlanSectionProps) { const stubMessage = React.useMemo( () => i18n('description.empty-result', {activeSection: sectionTitle}), [sectionTitle], ); switch (activeSection) { case RESULT_OPTIONS_IDS.schema: { if (!preparedPlan?.nodes?.length) { return ; } return ; } case RESULT_OPTIONS_IDS.json: { if (!preparedPlan?.pristine) { return ; } return ; } case RESULT_OPTIONS_IDS.simplified: { if (!simplifiedPlan?.plan?.length) { return ; } return ; } case RESULT_OPTIONS_IDS.stats: { if (!stats) { return ; } return ; } case RESULT_OPTIONS_IDS.ast: { if (!ast) { return ; } return ; } default: return null; } }