-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Allow to configure some options of the profiler interface #27678
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
Conversation
IE 11 doesn't handle CSS |
This however does mean we have to keep the existing styles, to have a fallback color for non-supporting browsers |
@wouterj in the past we've made similar decisions (for example when we switched to using Flexbox in some parts of the profiler). Probably all of our developers use a compatible browser (https://caniuse.com/#feat=css-variables). |
@nicolas-grekas for the webprofiler UI itself, I'm fine if it does not work in IE 11. Devs will hopefully still have a modern browser where the can open the profiler (the WDT is a different topic, as that's injecting in the page so being incompatible would hurt the dev debugging their own page in IE) |
@@ -647,7 +686,7 @@ tr.status-warning td { | |||
#menu-profiler li a { | |||
border: solid transparent; | |||
border-width: 2px 0; | |||
color: #CCC; | |||
color: var(--base-3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it use the variable if it does not change based on the theme ?
} | ||
|
||
.modal-wrap { | ||
-webkit-transition: all 0.3s ease-in-out; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, you can drop the vendor prefix here. All modern browsers support it unprefixed (and otherwise, it should still stay just before the unprefixed property IMO).
} | ||
</style> | ||
|
||
<a href="#" id="open-settings" data-triger="profiler-settings">Settings</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
semantically, this should be a <button type="button">
, not a link (not sure our profiler UI is accessible yet though)
</div> | ||
|
||
<script> | ||
let configOptions = document.querySelectorAll('.config-option'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is leaking tons of global variables in the page. Please wrap it in a function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let
doesn't leak in the global (window
) scope. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let
At the top level of programs and functions,
let
, unlikevar
, does not create a property on the global object.
(However, I would still wrap it, just to be safe of accidental var
usage and some other issues.)
let configOptions = document.querySelectorAll('.config-option'); | ||
let oppositeValues = { 'light': 'dark', 'dark': 'light', 'normal': 'wide', 'wide': 'normal' }; | ||
[...configOptions].forEach(option => { | ||
option.addEventListener('click', function (event) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should rely on the change
event. I'm not sure changes performed using the keyboard are triggering click
events.
--table-background: #fff; | ||
--table-header: #e0e0e0; | ||
--shadow: 0px 0px 1px rgba(128, 128, 128, .2); | ||
--border: 1px solid #e0e0e0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we have the whole border as a variable or only the color ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for the shadow btw
--page-background: #36393e; | ||
--table-border: #444; | ||
--table-background: #333; | ||
--table-header: #555; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--table-border
and --table-header
are the same color in light theme (as well as the color used by --border
), but they are different in dark mode. Is it expected ?
Having the dark theme switch as easy as that is great IMO. The maintenance cost of the feature is very low, so +1 from me on the idea. |
Regarding the wide mode, #25761 had a few rules to avoid some elements becoming too wide. Do we need them here ? |
</div> | ||
|
||
<div class="modal-footer"> | ||
<button class="btn close-modal">Save changes</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the wording save change
is confusing IMO. Even if you don't click this button (closing the profiler tab for instance), the changes are still persisted, as they are saved immediately, not when clicking this button.
The "Wide" option does not make much sense. Elements which are meant to be wide, like tables or plots, should be always wide. Other elements should keep some reasonable width anyway. Simple wide/not-wide switch will cause some elements to be too narrow or some to be too wide. It won't be perfect either way. Please take a look at CSS rules in #25761; they set optimal width to most elements (not perfect yet — few more rules may be required, but close enough). |
in dark mode the grey scale of the menu looks off IMHO |
I've made a lot of change according to the first comments. This is now ready to start reviewing all the details about design and code. Thanks! |
bbaf964
to
944c53f
Compare
Thank you @javiereguiluz. |
…ace (javiereguiluz) This PR was squashed before being merged into the 4.2-dev branch (closes #27678). Discussion ---------- Allow to configure some options of the profiler interface | Q | A | ------------- | --- | Branch? | master | Bug fix? | yno | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - This PR adds some configurable options for the interface of the Symfony profiler. First, you can configure the theme. The current one remains as the default light theme, but there's a new dark theme. A quick comparison:   The second option is the width of the profiler pages. The current normal width remains as the default, but there's a new dynamic width that is as width as the browser window. The "Performance" panel is the one where this option makes more sense. A quick comparison when using a 2560 x 1440 resolution:   All settings are managed by JavaScript and persisted in localStorage, so everything is fast and simple:  ----- Note to reviewers: * This is the first draft of the PR. * I expect: approval/rejection of this idea and general comments of the proposed solution. Once this is accepted, I will finish the feature tweaking/fixing the design and the HTML/CSS/JS/Twig code. Don't comment on those details for now. Thanks! Commits ------- 944c53f Allow to configure some options of the profiler interface
This PR adds some configurable options for the interface of the Symfony profiler.
First, you can configure the theme. The current one remains as the default light theme, but there's a new dark theme. A quick comparison:
The second option is the width of the profiler pages. The current normal width remains as the default, but there's a new dynamic width that is as width as the browser window. The "Performance" panel is the one where this option makes more sense. A quick comparison when using a 2560 x 1440 resolution:
All settings are managed by JavaScript and persisted in localStorage, so everything is fast and simple:
Note to reviewers:
Once this is accepted, I will finish the feature tweaking/fixing the design and the HTML/CSS/JS/Twig code. Don't comment on those details for now. Thanks!