Skip to content

Commit 7a58ed6

Browse files
committed
Normalise a bunch of the file path display.
1 parent 08f5417 commit 7a58ed6

File tree

12 files changed

+36
-3
lines changed

12 files changed

+36
-3
lines changed

dispatchers/Html.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,8 @@ protected function before_output() {
400400
],
401401
'file_path_map' => QM_Output_Html::get_file_path_map(),
402402
'file_link_format' => QM_Output_Html::get_file_link_format(),
403+
'abspath' => QM_Util::normalize_path( ABSPATH ),
404+
'contentpath' => QM_Util::normalize_path( dirname( WP_CONTENT_DIR ) . '/' ),
403405
],
404406
'number_format' => $wp_locale->number_format,
405407
'locale_data' => self::get_script_locale_data(),

output/components/source-location.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export const SourceLocation = ( { text, file, line = 0, isFileName = false, expa
5555
<>
5656
<br/>
5757
<span className="qm-info qm-supplemental">
58-
{ `${mappedFile}:${line}` }
58+
{ `${Utils.stripAbspath( file, settings )}:${line}` }
5959
</span>
6060
</>
6161
) }

output/contexts/main-context.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export interface SettingsType {
1313
extended_query_prompt_reason: 'conflict' | 'disabled' | 'failed' | null;
1414
file_path_map: Record<string, string>;
1515
file_link_format: string | false;
16+
abspath: string;
17+
contentpath: string;
1618
}
1719

1820
export type MainContextType = {
@@ -42,5 +44,7 @@ export const MainContext = createContext<MainContextType>( {
4244
extended_query_prompt_reason: null,
4345
file_path_map: {},
4446
file_link_format: false,
47+
abspath: '',
48+
contentpath: '',
4549
},
4650
} );

output/html/block_editor.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export const BlockEditor = ( { data }: PanelProps<iBlockData> ) => {
8686
text={ row.callback.name }
8787
file={ row.callback.file || null }
8888
line={ row.callback.line || null }
89+
expanded
8990
/>
9091
),
9192
};

output/html/concerned_hooks.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export const ConcernedHooks = ( { data }: PanelProps<AbstractData> ) => {
8484
text={ text }
8585
file={ row.callback.file || '' }
8686
line={ row.callback.line || 0 }
87+
expanded
8788
/>
8889
);
8990
},

output/html/hooks.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ export const Hooks = ( { data }: PanelProps<DataTypes['hooks']> ) => {
138138
text={ text }
139139
file={ row.callback.file || null }
140140
line={ row.callback.line || 0 }
141+
expanded
141142
/>
142143
);
143144
},

output/html/languages.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ApproximateSize } from '../components/approximate-size';
22
import { FileName } from '../components/file-name';
3+
import { SourceLocation } from '../components/source-location';
34
import { PanelFooter } from '../panels/panel-footer';
45
import { TabularPanel } from '../panels/tabular-panel';
56
import { DataTypes } from '../data-types';
@@ -32,7 +33,7 @@ export const Languages = ( { data }: PanelProps<DataTypes['languages']> ) => {
3233
heading: __( 'Caller', 'query-monitor' ),
3334
render: ( row ) => (
3435
row.caller ? (
35-
<FileName
36+
<SourceLocation
3637
text={ row.caller.display }
3738
file={ row.caller.file }
3839
line={ row.caller.line }

output/html/theme.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ export const Theme = ( { data }: PanelProps<DataTypes['response']> ) => {
153153
{ data.count_template_parts[ filename ] > 1 && (
154154
<span className="qm-info qm-supplemental">
155155
<br/>
156+
&nbsp;-&nbsp;
156157
{ sprintf(
157158
/* translators: %s: The number of times that a template part file was included in the page */
158159
_nx( 'Included %s time', 'Included %s times', data.count_template_parts[ filename ], 'template parts', 'query-monitor' ),

output/panels/panels.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ export type iSettings = {
5656
};
5757
file_path_map: Record<string, string>;
5858
file_link_format: string | false;
59+
abspath: string;
60+
contentpath: string;
5961
};
6062

6163
type Props = {

output/qm.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ export const QM = ( props: Props ) => {
124124
extended_query_prompt_reason: props.settings.extended_query_prompt_reason,
125125
file_path_map: props.settings.file_path_map,
126126
file_link_format: props.settings.file_link_format,
127+
abspath: props.settings.abspath,
128+
contentpath: props.settings.contentpath,
127129
},
128130
};
129131

0 commit comments

Comments
 (0)