管理员设置是否启用或禁用 mini-profiler?

Continuing the discussion from How can you hide the MiniProfiler?:

Is this (in the admin settings) something possible to do? Since the mini-profiler is always on the left side of the screen, it’s often in the way for a language that has left-to-right reading and left-justified text. It’d be great if we could toggle it on only when needed for troubleshooting.

3 个赞

You can press alt+P to hide or show it at any time.

18 个赞

Where could I have learned that alt-p trick?

4 个赞

It’s in the source code, at the bottom of the page:

 data-toggle-shortcut="Alt+P" data-start-hidden="false"></script>
5 个赞

@codinghorror I use

chrome-extension://jlpkojjdgbllmedoapgfodplfhcbnbpn/update.html#help

Which uses Alt-P… :frowning:

Any chance that the keyboard shortcut could be configurable, or can be eventually turned off/on via the admin settings?

Did you try disabling your extension for a moment, then disabling the profiler, then re-enabling your extension? Seems like that would do it.

1 个赞

Hi @downey, is this first message still accurate? You reference enable_mini_profiler but here in Github the flag appears to be named load_mini_profiler

Also, after changing this setting, do I need to do an app reload, an app rebuild, or nothing (changes take effect immediately)?

Thanks-- E

2 个赞

Well much has changed in 5 years. I don’t know about a global disable, someone else might. AFAIK the Alt+P still works.

4 个赞

Thanks for your reply. I noticed it appear one day and had no idea why, so your answer helped a lot.

2 个赞

Apparently the mini profiler interface only appears for users that are designated as developers, not just any admin. Is that right?

Yes, only users in the developers role will see it.

1 个赞

What if there isn’t ALT-key… like in my iPhone or logitech-made-mac-keybord of iPad?

This isn’t any bigger issue and like to see snapshot of loading time, but when I take screenshots for users it looks a bit odd.

Note it is only visible to developers (you need to explicitly insert a row into a table)

You can always use the UI directly to tweak visibility.

2 个赞

用户如何被添加到“开发人员角色”或从中移除? 我没有看到这样的组。

1 个赞

app.yml 中指定的电子邮件地址默认匹配。

如果您想将其添加到其他用户,则需要直接编辑数据库。

3 个赞

你可以在 app.yml 中通过逗号分隔来添加多个开发者到 DISCOURSE_DEVELOPER_EMAILS。从该变量中删除电子邮件也会将他们从该角色中移除,除非你设法将其添加到数据库(我不知道这是可能的)。

6 个赞

我刚刚亲身体验了 UI 中关于 mini-profiler 信息不足的问题,不知道它是什么、叫什么、为什么会显示给我,以及如何隐藏它。我设置了网站但不是开发者,所以不需要看到它,只是习惯了它的存在。

至少,我建议更新文档来解释当前的行为:

除此之外,如果可能的话,我希望看到一些帮助文本,为那些对它感到困惑并想让它消失的用户提供指导,例如“Miniprofiler - 按 ALT+P 切换显示”。

下面的内容似乎是一个很好的向用户添加它的分步指南。

3 个赞

也许它应该默认关闭。然后想要它的人可以打开它,其他人则不会知道。

4 个赞

是的,我喜欢这个想法。即使你在 DISCOURSE_DEVELOPER_EMAILS 中,它也会默认关闭。

我注意到当我从 app.yml 中的 DISCOURSE_DEVELOPER_EMAILS 中删除我的电子邮件地址并重建时,我完全失去了 miniprofiler。我本以为它仍然会通过 ALT+P 显示,但可能有一些我不知道的技术细节。

2 个赞

这使得您能够看到 miniprofiler。

但是,可以将其更改为默认关闭,然后想要它的人可以按 ALT-P 键打开它。我认为这可以为几乎所有人解决这个问题。我怀疑如果默认关闭它,是否会有一堆人询问如何将其重新打开(我推测快捷方式在快捷方式菜单中)。

2 个赞