Bug 1796554 - Make about:logging look a bit better, fix inconsistencies when clicking various buttons. r=desktop-theme-reviewers,mossop,flod,dao

It's now clear when there is no log modules enabled.

Differential Revision: https://phabricator.services.mozilla.com/D160210
This commit is contained in:
Paul Adenot 2022-12-02 17:04:16 +00:00
Родитель bcac69f04d
Коммит a56991f3e1
5 изменённых файлов: 130 добавлений и 55 удалений

Просмотреть файл

@ -2,49 +2,62 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this - License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="Content-Security-Policy" content="default-src chrome:; object-src 'none'"> <meta http-equiv="Content-Security-Policy" content="default-src chrome:; object-src 'none'">
<meta name="color-scheme" content="light dark"> <meta name="color-scheme" content="light dark">
<title data-l10n-id="about-logging-title"></title> <title data-l10n-id="about-logging-title"></title>
<link rel="stylesheet" href="chrome://global/skin/aboutNetworking.css"> <link rel="stylesheet" href="chrome://global/skin/aboutLogging.css">
<link rel="stylesheet" href="chrome://global/skin/in-content/info-pages.css">
<script src="chrome://global/content/aboutLogging.js"></script> <script src="chrome://global/content/aboutLogging.js"></script>
<link rel="localization" href="toolkit/about/aboutLogging.ftl"> <link rel="localization" href="toolkit/about/aboutLogging.ftl">
</head> </head>
<body id="body"> <body id="body">
<div class="main-content"> <div class="main-content">
<div id="logging"> <div id="logging">
<span hidden id="buttons-disabled" data-l10n-id="about-logging-buttons-disabled"></span> <h1 id="title" data-l10n-id="about-logging-page-title"></h1>
<div class=page-section>
<button id="start-logging-button" data-l10n-id="about-logging-start-logging"></button>
<button id="stop-logging-button" data-l10n-id="about-logging-stop-logging"></button>
</div>
<div id=log-module-selection class=page-section>
<h2 data-l10n-id="about-logging-log-modules-selection"></h2>
<div>
<label for="current-log-modules" data-l10n-id="about-logging-currently-enabled-log-modules"></label>
<div id="current-log-modules"></div>
<span id="no-log-modules" data-l10n-id="about-logging-no-log-modules"></span>
</div>
<div>
<label for="log-modules" data-l10n-id="about-logging-new-log-modules"></label>
<input type="text" name="log-modules" id="log-modules" value="timestamp,sync,nsHttp:5,cache2:5,nsSocketTransport:5,nsHostResolver:5">
<button id="set-log-modules-button" data-l10n-id="about-logging-set-log-modules"></button>
</div>
</div>
<div id=logging-output class=page-section>
<div>
<span hidden id="buttons-disabled" data-l10n-id="about-logging-buttons-disabled"></span>
</div>
<div>
<div>
<label for="current-log-file" data-l10n-id="about-logging-current-log-file"></label>
<span id="current-log-file"></span>
</div>
<div>
<label for="log-file" data-l10n-id="about-logging-new-log-file"></label>
<input type="text" name="log-file" id="log-file">
<button id="open-log-file-button" data-l10n-id="about-logging-open-log-file-dir"></button>
<button id="set-log-file-button" data-l10n-id="about-logging-set-log-file"></button>
</div>
</div>
<div>
<p id="log-tutorial" data-l10n-id="about-logging-log-tutorial">
<a data-l10n-name="logging" href="https://firefox-source-docs.mozilla.org/networking/http/logging.html"></a>
</p>
</div>
</div>
</div> </div>
<div>
<button id="start-logging-button" data-l10n-id="about-logging-start-logging"></button>
<button id="stop-logging-button" data-l10n-id="about-logging-stop-logging"></button>
</div>
<br>
<br>
<div>
<label data-l10n-id="about-logging-current-log-file"></label>
<div id="current-log-file"></div><br>
<input type="text" name="log-file" id="log-file">
<button id="open-log-file-button" data-l10n-id="about-logging-open-log-file-dir"></button>
<button id="set-log-file-button" data-l10n-id="about-logging-set-log-file"></button>
</div>
<div>
<label data-l10n-id="about-logging-current-log-modules"></label>
<div id="current-log-modules"></div><br>
<input type="text" name="log-modules" id="log-modules" value="timestamp,sync,nsHttp:5,cache2:5,nsSocketTransport:5,nsHostResolver:5">
<button id="set-log-modules-button" data-l10n-id="about-logging-set-log-modules"></button>
</div>
<br>
<br>
<p id="log-tutorial" data-l10n-id="about-logging-log-tutorial">
<a data-l10n-name="logging" href="https://firefox-source-docs.mozilla.org/networking/http/logging.html"></a>
</p>
</div> </div>
</body> </body>
</html> </html>

Просмотреть файл

@ -10,12 +10,7 @@ const gDirServ = Cc["@mozilla.org/file/directory_service;1"].getService(
Ci.nsIDirectoryServiceProvider Ci.nsIDirectoryServiceProvider
); );
function col(element) { const $ = document.querySelector.bind(document);
let col = document.createElement("td");
let content = document.createTextNode(element);
col.appendChild(content);
return col;
}
let gInited = false; let gInited = false;
function init() { function init() {
@ -153,7 +148,15 @@ function updateLogModules() {
} }
} }
currentLogModules.innerText = activeLogModules.join(","); if (activeLogModules.length !== 0) {
currentLogModules.innerText = activeLogModules.join(",");
currentLogModules.hidden = false;
$("#no-log-modules").hidden = true;
} else {
currentLogModules.innerText = "";
currentLogModules.hidden = true;
$("#no-log-modules").hidden = false;
}
} }
} }
@ -193,23 +196,25 @@ function setLogModules() {
// Clear previously set log modules. // Clear previously set log modules.
clearLogModules(); clearLogModules();
let logModules = modules.split(","); if (modules.length !== 0) {
for (let module of logModules) { let logModules = modules.split(",");
if (module == "timestamp") { for (let module of logModules) {
Services.prefs.setBoolPref("logging.config.add_timestamp", true); if (module == "timestamp") {
} else if (module == "rotate") { Services.prefs.setBoolPref("logging.config.add_timestamp", true);
// XXX: rotate is not yet supported. } else if (module == "rotate") {
} else if (module == "append") { // XXX: rotate is not yet supported.
// XXX: append is not yet supported. } else if (module == "append") {
} else if (module == "sync") { // XXX: append is not yet supported.
Services.prefs.setBoolPref("logging.config.sync", true); } else if (module == "sync") {
} else if (module == "profilerstacks") { Services.prefs.setBoolPref("logging.config.sync", true);
Services.prefs.setBoolPref("logging.config.profilerstacks", true); } else if (module == "profilerstacks") {
} else { Services.prefs.setBoolPref("logging.config.profilerstacks", true);
let lastColon = module.lastIndexOf(":"); } else {
let key = module.slice(0, lastColon); let lastColon = module.lastIndexOf(":");
let value = parseInt(module.slice(lastColon + 1), 10); let key = module.slice(0, lastColon);
Services.prefs.setIntPref(`logging.${key}`, value); let value = parseInt(module.slice(lastColon + 1), 10);
Services.prefs.setIntPref(`logging.${key}`, value);
}
} }
} }

Просмотреть файл

@ -4,8 +4,10 @@
# This is the title of the page # This is the title of the page
about-logging-title = About Logging about-logging-title = About Logging
about-logging-current-log-file = Current Log File: about-logging-page-title = Logging manager
about-logging-current-log-modules = Current Log Modules: about-logging-current-log-file = Current log file:
about-logging-new-log-file = New log file:
about-logging-currently-enabled-log-modules = Currently enabled log modules:
about-logging-log-tutorial = about-logging-log-tutorial =
See <a data-l10n-name="logging">HTTP Logging</a> See <a data-l10n-name="logging">HTTP Logging</a>
for instructions on how to use this tool. for instructions on how to use this tool.
@ -16,3 +18,8 @@ about-logging-set-log-modules = Set Log Modules
about-logging-start-logging = Start Logging about-logging-start-logging = Start Logging
about-logging-stop-logging = Stop Logging about-logging-stop-logging = Stop Logging
about-logging-buttons-disabled = Logging configured via environment variables, dynamic configuration unavailable. about-logging-buttons-disabled = Logging configured via environment variables, dynamic configuration unavailable.
about-logging-log-modules-selection = Log module selection
about-logging-new-log-modules = New log modules:
about-logging-logging-output-selection = Logging output
about-logging-logging-to-file = Logging to a file
about-logging-no-log-modules = None

Просмотреть файл

@ -0,0 +1,49 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@import url("chrome://global/skin/in-content/common.css");
html {
height: 100%;
}
body {
height: 100%;
}
/** Content area **/
.main-content {
flex: 1;
}
#logging {
padding: 1em;
}
div.page-section {
padding: 0.5em;
}
div.page-section > div {
padding-inline-start: 0.5em;
}
#current-log-modules,
#no-log-modules {
font-family: monospace;
padding-inline-start: 8px;
margin-bottom: 1em;
}
#current-log-file {
font-family: monospace;
padding-inline-start: 8px;
}
input[type=text] {
width: 100%;
font-family: monospace;
padding-inline-start: 0;
}

Просмотреть файл

@ -16,6 +16,7 @@
skin/classic/global/aboutMemory.css (../../shared/aboutMemory.css) skin/classic/global/aboutMemory.css (../../shared/aboutMemory.css)
skin/classic/global/aboutNetError.css (../../shared/aboutNetError.css) skin/classic/global/aboutNetError.css (../../shared/aboutNetError.css)
skin/classic/global/aboutNetworking.css (../../shared/aboutNetworking.css) skin/classic/global/aboutNetworking.css (../../shared/aboutNetworking.css)
skin/classic/global/aboutLogging.css (../../shared/aboutLogging.css)
skin/classic/global/aboutReader.css (../../shared/aboutReader.css) skin/classic/global/aboutReader.css (../../shared/aboutReader.css)
skin/classic/global/aboutReaderPocket.css (../../shared/aboutReaderPocket.css) skin/classic/global/aboutReaderPocket.css (../../shared/aboutReaderPocket.css)
skin/classic/global/aboutRights.css (../../shared/aboutRights.css) skin/classic/global/aboutRights.css (../../shared/aboutRights.css)