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
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Security-Policy" content="default-src chrome:; object-src 'none'">
<meta name="color-scheme" content="light dark">
<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>
<link rel="localization" href="toolkit/about/aboutLogging.ftl">
</head>
<body id="body">
<div class="main-content">
<div id="logging">
<span hidden id="buttons-disabled" data-l10n-id="about-logging-buttons-disabled"></span>
</div>
<div>
<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>
<br>
<br>
<div id=log-module-selection class=page-section>
<h2 data-l10n-id="about-logging-log-modules-selection"></h2>
<div>
<label data-l10n-id="about-logging-current-log-file"></label>
<div id="current-log-file"></div><br>
<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>
<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>
<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>
</body>
</html>

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

@ -10,12 +10,7 @@ const gDirServ = Cc["@mozilla.org/file/directory_service;1"].getService(
Ci.nsIDirectoryServiceProvider
);
function col(element) {
let col = document.createElement("td");
let content = document.createTextNode(element);
col.appendChild(content);
return col;
}
const $ = document.querySelector.bind(document);
let gInited = false;
function init() {
@ -153,7 +148,15 @@ function updateLogModules() {
}
}
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,6 +196,7 @@ function setLogModules() {
// Clear previously set log modules.
clearLogModules();
if (modules.length !== 0) {
let logModules = modules.split(",");
for (let module of logModules) {
if (module == "timestamp") {
@ -212,6 +216,7 @@ function setLogModules() {
Services.prefs.setIntPref(`logging.${key}`, value);
}
}
}
updateLogModules();
}

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

@ -4,8 +4,10 @@
# This is the title of the page
about-logging-title = About Logging
about-logging-current-log-file = Current Log File:
about-logging-current-log-modules = Current Log Modules:
about-logging-page-title = Logging manager
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 =
See <a data-l10n-name="logging">HTTP Logging</a>
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-stop-logging = Stop Logging
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/aboutNetError.css (../../shared/aboutNetError.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/aboutReaderPocket.css (../../shared/aboutReaderPocket.css)
skin/classic/global/aboutRights.css (../../shared/aboutRights.css)