管理员设置是否启用或禁用 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 个赞

@downey,这条第一条消息仍然准确吗?你提到了 enable_mini_profiler,但在这里的 GitHub 中,该标志似乎名为 load_mini_profilerdiscourse/config/discourse_defaults.conf at main · discourse/discourse · GitHub

另外,在更改此设置后,我需要重新加载应用、重建应用,还是无需任何操作(更改会立即生效)?

谢谢——E

2 个赞

好吧,五年间变化很大。关于全局禁用,我不太清楚,或许其他人知道。据我所知,Alt+P 仍然有效。

4 个赞

谢谢您的回复。我注意到它出现了一天,却不知原因,所以您的回答帮了大忙。

2 个赞

显然,Mini Profiler 界面仅对指定为开发者的用户显示,而非所有管理员。是这样吗?

是的,只有具有开发者角色的用户才能看到它。

1 个赞

如果没有 ALT 键怎么办……比如在我的 iPhone 或罗技为 iPad 设计的 Mac 键盘上?

这并非什么大问题,我希望能看到加载时间的截图,但当我为用户截取屏幕时,看起来有点奇怪。

注意,它仅对开发者可见(您需要显式地向表中插入一行)

您可以始终直接使用 UI 来调整可见性。

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 个赞