FIX: CSS tweak and production position fix for miniprofiler (#17493)

* DEV: Format miniprofiler html
* FIX: Move miniprofiler to the right in production
* UX: Fix and merge miniprofiler css
This commit is contained in:
Jarek Radosz 2022-07-14 13:03:43 +02:00 committed by GitHub
parent 737c0a7b9f
commit 4b935b61eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 10 deletions

View File

@ -141,10 +141,30 @@ function bodyFooter(buffer, bootstrap, headers) {
let v = generateUID();
buffer.push(`
<script async type="text/javascript" id="mini-profiler" src="/mini-profiler-resources/includes.js?v=${v}" data-css-url="/mini-profiler-resources/includes.css?v=${v}" data-version="${v}" data-path="/mini-profiler-resources/" data-horizontal-position="right" data-vertical-position="top" data-trivial="false" data-children="false" data-max-traces="20" data-controls="false" data-total-sql-count="false" data-authorized="true" data-toggle-shortcut="alt+p" data-start-hidden="false" data-collapse-results="true" data-html-container="body" data-hidden-custom-fields="x" data-ids="${headers.get(
"x-miniprofiler-ids"
)}"></script>
`);
<script
async
type="text/javascript"
id="mini-profiler"
src="/mini-profiler-resources/includes.js?v=${v}"
data-css-url="/mini-profiler-resources/includes.css?v=${v}"
data-version="${v}"
data-path="/mini-profiler-resources/"
data-horizontal-position="right"
data-vertical-position="top"
data-trivial="false"
data-children="false"
data-max-traces="20"
data-controls="false"
data-total-sql-count="false"
data-authorized="true"
data-toggle-shortcut="alt+p"
data-start-hidden="false"
data-collapse-results="true"
data-html-container="body"
data-hidden-custom-fields="x"
data-ids="${headers.get("x-miniprofiler-ids")}"
></script>
`);
}
function hiddenLoginForm(buffer, bootstrap) {

View File

@ -1,7 +1,9 @@
// Some basic overrides to https://github.com/MiniProfiler/rack-mini-profiler/blob/master/lib/html/includes.scss
// which make the badge conform to the current site theme.
div.profiler-results {
div.profiler-results.profiler-top {
top: var(--header-offset);
.profiler-button {
background-color: var(--header_background);
color: var(--header_primary);
@ -16,7 +18,11 @@ div.profiler-results {
}
}
&.profiler-left.profiler-top .profiler-button {
&.profiler-left .profiler-button {
border-right: 1px solid var(--header_primary-low);
}
&.profiler-right .profiler-button {
border-left: 1px solid var(--header_primary-low);
}
}

View File

@ -380,10 +380,6 @@ table {
border-radius: 50%;
}
.profiler-results.profiler-right {
top: var(--header-offset) !important;
}
.flex-center-align {
display: flex;
align-items: center;

View File

@ -72,6 +72,8 @@ if defined?(Rack::MiniProfiler) && defined?(Rack::MiniProfiler::Config)
# does not get clobbered.
Rack::MiniProfiler.config.cookie_path = Discourse.base_path.presence || "/"
Rack::MiniProfiler.config.position = "right"
Rack::MiniProfiler.config.backtrace_ignores ||= []
Rack::MiniProfiler.config.backtrace_ignores << /lib\/rack\/message_bus.rb/
Rack::MiniProfiler.config.backtrace_ignores << /config\/initializers\/silence_logger/