Skip to content

Commit

Permalink
fix: make the trace details collapsed sidebar match the design
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadshaheer committed Sep 15, 2024
1 parent 46092b9 commit e800e89
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 23 deletions.
23 changes: 11 additions & 12 deletions frontend/src/container/AppLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,19 +255,16 @@ function AppLayout(props: AppLayoutProps): JSX.Element {
const isDashboardListView = (): boolean => routeKey === 'ALL_DASHBOARD';
const isAlertHistory = (): boolean => routeKey === 'ALERT_HISTORY';
const isAlertOverview = (): boolean => routeKey === 'ALERT_OVERVIEW';
const isDashboardView = (): boolean => {
/**
* need to match using regex here as the getRoute function will not work for
* routes with id
*/
const regex = /^\/dashboard\/[a-zA-Z0-9_-]+$/;
return regex.test(pathname);
};
const isPathMatch = (regex: RegExp): boolean => regex.test(pathname);

const isDashboardWidgetView = (): boolean => {
const regex = /^\/dashboard\/[a-zA-Z0-9_-]+\/new$/;
return regex.test(pathname);
};
const isDashboardView = (): boolean =>
isPathMatch(/^\/dashboard\/[a-zA-Z0-9_-]+$/);

const isDashboardWidgetView = (): boolean =>
isPathMatch(/^\/dashboard\/[a-zA-Z0-9_-]+\/new$/);

const isTraceDetailsView = (): boolean =>
isPathMatch(/^\/trace\/[a-zA-Z0-9]+(\?.*)?$/);

useEffect(() => {
if (isDarkMode) {
Expand Down Expand Up @@ -356,6 +353,8 @@ function AppLayout(props: AppLayoutProps): JSX.Element {
isMessagingQueues()
? 0
: '0 1rem',

...(isTraceDetailsView() ? { marginRight: 0 } : {}),
}}
>
{isToDisplayLayout && !renderFullScreen && <TopNav />}
Expand Down
10 changes: 2 additions & 8 deletions frontend/src/container/TraceDetail/SelectedSpanDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,10 @@ function SelectedSpanDetails(props: SelectedSpanDetailsProps): JSX.Element {
styledclass={[styles.selectedSpanDetailsContainer, styles.overflow]}
direction="vertical"
>
<Row
align="middle"
justify="space-between"
style={{
marginTop: '16px',
}}
>
<Row align="middle" justify="space-between">
<Typography.Text strong>Details for selected Span</Typography.Text>
<Button
className="periscope-btn nav-item-label "
className="periscope-btn nav-item-label expand-collapse-btn"
icon={<PanelRight size={16} />}
onClick={(): void => setCollapsed((prev) => !prev)}
/>
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/container/TraceDetail/TraceDetails.styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
}

.expand-collapse-btn {
margin: 12px 0 0 12px;
padding: 4px;
height: auto;
width: auto;
}
}
3 changes: 1 addition & 2 deletions frontend/src/container/TraceDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,8 @@ function TraceDetail({ response }: TraceDetailProps): JSX.Element {
collapsed={collapsed}
reverseArrow
width={300}
collapsedWidth={40}
collapsedWidth={48}
defaultCollapsed
// onCollapse={(value): void => setCollapsed(value)}
trigger={null}
data-testid="span-details-sider"
>
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/container/TraceDetail/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ export const selectedSpanDetailContainer = css`
position: relative;
display: flex;
flex-direction: column;
align-items: center;
padding-top: 12px;
`;

/**
Expand Down

0 comments on commit e800e89

Please sign in to comment.