Skip to content

Commit

Permalink
updated paths for re-direction
Browse files Browse the repository at this point in the history
Signed-off-by: sumukhswamy <[email protected]>
  • Loading branch information
sumukhswamy committed Oct 19, 2024
1 parent dac7c2c commit 758bbef
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ import { SearchBarProps, renderDatePicker } from '../common/search_bar';
import { SpanDetailFlyout } from '../traces/span_detail_flyout';
import { SpanDetailTable } from '../traces/span_detail_table';
import { ServiceMetrics } from './service_metrics';
import {
DEFAULT_DATA_SOURCE_NAME,
DEFAULT_DATA_SOURCE_TYPE,
} from '../../../../../common/constants/data_sources';
import { observabilityLogsID } from '../../../../../common/constants/shared';

interface ServiceViewProps extends TraceAnalyticsComponentDeps {
serviceName: string;
Expand All @@ -69,6 +74,7 @@ export function ServiceView(props: ServiceViewProps) {
const [redirect, setRedirect] = useState(false);
const [actionsMenuPopover, setActionsMenuPopover] = useState(false);

const isNewNavEnabled = coreRefs?.chrome?.navGroup?.getNavGroupEnabled();
const refresh = () => {
const DSL = filtersToDsl(
mode,
Expand Down Expand Up @@ -172,17 +178,28 @@ export function ServiceView(props: ServiceViewProps) {
name: 'View logs',
'data-test-subj': 'viewLogsButton',
onClick: () => {
coreRefs?.application!.navigateToApp('data-explorer', {
path: `discover#?_a=(discover:(columns:!(_source),isDirty:!f,sort:!()),metadata:(view:discover))&_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:${
props.startTime
},to:${props.endTime}))&_q=(filters:!(),query:(dataset:(dataSource:(id:'${
props.dataSourceMDSId[0].id ?? ''
}',title:'',type:DATA_SOURCE),id:'${
props.dataSourceMDSId[0].id
}::ss4o_logs-*',timeFieldName:'%40timestamp',title:'ss4o_logs-*',type:INDEXES),language:PPL,query:'source%20%3D%20ss4o_logs-*%20%7C%20where%20serviceName%20%3D%20${
props.serviceName
}'))`,
});
isNewNavEnabled
? coreRefs?.application!.navigateToApp('data-explorer', {
path: `discover#?_a=(discover:(columns:!(_source),isDirty:!f,sort:!()),metadata:(view:discover))&_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:${
props.startTime
},to:${props.endTime}))&_q=(filters:!(),query:(dataset:(dataSource:(id:'${
props.dataSourceMDSId[0].id ?? ''
}',title:'${props.dataSourceMDSId[0].label}',type:DATA_SOURCE),id:'${
props.dataSourceMDSId[0].id ?? ''
}::ss4o_logs-*',timeFieldName:'time',title:'ss4o_logs-*',type:INDEXES),language:PPL,query:'source%20%3D%20ss4o_logs-%2A%20%7C%20where%20serviceName%20%3D%20%22${
props.serviceName
}%22'))`,
})
: coreRefs?.application!.navigateToApp(observabilityLogsID, {
path: `#/explorer`,
state: {
DEFAULT_DATA_SOURCE_NAME,
DEFAULT_DATA_SOURCE_TYPE,
queryToRun: `source = ss4o_logs-* | where serviceName='${props.serviceName}'`,
startTimeRange: props.startTime,
endTimeRange: props.endTime,
},
});
},
},
]
Expand Down Expand Up @@ -537,6 +554,7 @@ export function ServiceView(props: ServiceViewProps) {
mode={mode}
serviceName={props.serviceName}
dataSourceMDSId={props.dataSourceMDSId[0].id}
dataSourceMDSLabel={props.dataSourceMDSId[0].label}
startTime={props.startTime}
endTime={props.endTime}
setCurrentSpan={setCurrentSpan}
Expand Down Expand Up @@ -565,6 +583,7 @@ export function ServiceView(props: ServiceViewProps) {
addSpanFilter={addSpanFilter}
mode={mode}
dataSourceMDSId={props.dataSourceMDSId[0].id}
dataSourceMDSLabel={props.dataSourceMDSId[0].label}
/>
)}
</EuiPageBody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export function SpanDetailFlyout(props: {
addSpanFilter: (field: string, value: any) => void;
mode: TraceAnalyticsMode;
dataSourceMDSId: string;
dataSourceMDSLabel: string | undefined;
serviceName?: string;
setCurrentSelectedService?: React.Dispatch<React.SetStateAction<string>> | undefined;
startTime?: string;
Expand Down Expand Up @@ -309,7 +310,7 @@ export function SpanDetailFlyout(props: {
props.dataSourceMDSId ?? ''
}',title:'',type:DATA_SOURCE),id:'${
props.dataSourceMDSId
}::ss4o_logs-*',timeFieldName:'%40timestamp',title:'ss4o_logs-*',type:INDEXES),language:PPL,query:'source%20%3D%20ss4o_logs-*%20%7C%20where%20${spanField}%20%3D%20!'${spanId}!''))`,
}::ss4o_logs-*',timeFieldName:'time',title:'ss4o_logs-*',type:INDEXES),language:PPL,query:'source%20%3D%20ss4o_logs-*%20%7C%20where%20${spanField}%20%3D%20!'${spanId}!''))`,
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function SpanDetailPanel(props: {
colorMap: any;
mode: TraceAnalyticsMode;
dataSourceMDSId: string;
dataSourceMDSLabel: string | undefined;
page?: string;
openSpanFlyout?: any;
data?: { gantt: any[]; table: any[]; ganttMaxX: number };
Expand Down Expand Up @@ -307,8 +308,8 @@ export function SpanDetailPanel(props: {
closeFlyout={() => setCurrentSpan('')}
addSpanFilter={addSpanFilter}
mode={mode}
dataSourceMDSId={props.dataSourceMDSId}
/>
dataSourceMDSId={props.dataSourceMDSId}
dataSourceMDSLabel={props.dataSourceMDSLabel} />
)}
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ export function TraceView(props: TraceViewProps) {
data={ganttData}
setData={setGanttData}
dataSourceMDSId={props.dataSourceMDSId[0].id}
dataSourceMDSLabel={props.dataSourceMDSId[0].label }
/>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
3 changes: 2 additions & 1 deletion public/components/trace_analytics/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export const Home = (props: HomeProps) => {
// Get existing query params
const queryParamsOnLoad = new URLSearchParams(window.location.href.split('?')[1]);
const dsFromURL = queryParamsOnLoad.get('datasourceId');

const [dataSourceMDSId, setDataSourceMDSId] = useState([
{ id: dsFromURL ?? undefined, label: undefined },
]);
Expand Down Expand Up @@ -310,6 +310,7 @@ export const Home = (props: HomeProps) => {
addSpanFilter={addSpanFilter}
mode={spanMode}
dataSourceMDSId={spanDataSourceMDSId}
dataSourceMDSLabel={dataSourceMDSId[0].label}
/>
);
};
Expand Down

0 comments on commit 758bbef

Please sign in to comment.