Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: Minor UI fixes #3714

Merged
merged 5 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ const GraphTooltip = ({
options: {
tether: false,
altAxis: true,
boundary: contextElement ?? undefined,
},
},
{
Expand All @@ -85,12 +84,6 @@ const GraphTooltip = ({
offset: [30, 30],
},
},
{
name: 'flip',
options: {
boundary: contextElement ?? undefined,
},
},
],
}
);
Expand Down Expand Up @@ -129,7 +122,7 @@ const GraphTooltip = ({
return isFixed ? (
<>{children}</>
) : (
<div ref={setPopperElement} style={styles.popper} {...attributes.popper}>
<div ref={setPopperElement} style={styles.popper} {...attributes.popper} className="z-10">
{children}
</div>
);
Expand Down
7 changes: 7 additions & 0 deletions ui/packages/shared/profile/src/ProfileIcicleGraph/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ interface ProfileIcicleGraphProps {
navigateTo?: NavigateFunction;
loading: boolean;
setActionButtons?: (buttons: React.JSX.Element) => void;
error?: any;
}

const GroupAndSortActionButtons = ({navigateTo}: {navigateTo?: NavigateFunction}): JSX.Element => {
Expand Down Expand Up @@ -111,6 +112,7 @@ const ProfileIcicleGraph = function ProfileIcicleGraphNonMemo({
navigateTo,
loading,
setActionButtons,
error,
}: ProfileIcicleGraphProps): JSX.Element {
const compareMode: boolean =
selectQueryParam('compare_a') === 'true' && selectQueryParam('compare_b') === 'true';
Expand Down Expand Up @@ -175,6 +177,11 @@ const ProfileIcicleGraph = function ProfileIcicleGraphNonMemo({
);
}, [navigateTo, table, curPath, setNewCurPath, setActionButtons]);

if (error != null) {
console.error('Error: ', error);
return <div className="flex justify-center p-10">An error occurred: {error.message}</div>;
}

if (graph === undefined && table === undefined) return <div>no data...</div>;

if (total === 0n && !loading) return <>Profile has no samples</>;
Expand Down
20 changes: 5 additions & 15 deletions ui/packages/shared/profile/src/ProfileView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ interface SourceData {
export interface ProfileViewProps {
total: bigint;
filtered: bigint;
flamegraphData?: FlamegraphData;
flamegraphData: FlamegraphData;
topTableData?: TopTableData;
callgraphData?: CallgraphData;
sourceData?: SourceData;
Expand Down Expand Up @@ -229,15 +229,6 @@ export const ProfileView = ({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [graphvizLoaded, callgraphData?.data]);

if (flamegraphData?.error !== null) {
console.error('Error: ', flamegraphData?.error);
return (
<div className="flex justify-center p-10">
An error occurred: {flamegraphData?.error.message}
</div>
);
}

const setNewCurPath = (path: string[]): void => {
if (!arrayEquals(curPath, path)) {
setCurPath(path);
Expand All @@ -255,7 +246,7 @@ export const ProfileView = ({
}): JSX.Element => {
switch (type) {
case 'icicle': {
return flamegraphData?.table !== undefined || flamegraphData.data !== undefined ? (
return (
<ConditionalWrapper<ProfilerProps>
condition={perf?.onRender != null}
WrapperComponent={Profiler}
Expand All @@ -267,18 +258,17 @@ export const ProfileView = ({
<ProfileIcicleGraph
curPath={curPath}
setNewCurPath={setNewCurPath}
table={flamegraphData.table}
graph={flamegraphData.data}
table={flamegraphData?.table}
graph={flamegraphData?.data}
total={total}
filtered={filtered}
sampleUnit={sampleUnit}
navigateTo={navigateTo}
loading={flamegraphData.loading}
setActionButtons={setActionButtons}
error={flamegraphData.error}
/>
</ConditionalWrapper>
) : (
<> </>
);
}
case 'callgraph': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export const profileAwareRenderer = (
<LineProfileMetadata value={flat?.get(i) ?? 0n} total={total} filtered={filtered} />
<div
className={cx(
'w-11/12 flex-grow-0 border-l border-gray-200 pl-1 dark:border-gray-700',
'w-full flex-grow-0 border-l border-gray-200 pl-1 dark:border-gray-700',
{
'bg-yellow-200 dark:bg-yellow-700': isCurrentLine,
}
Expand Down