Commit 49dcc023 authored by Thomas Greiner's avatar Thomas Greiner

Issue 7287 - Use placeholders to insert URLs into devtools_panel_url string

parent c58770c1
Pipeline #47702195 passed with stages
in 8 minutes and 13 seconds
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<tr> <tr>
<td> <td>
<div class="request-wrapper"> <div class="request-wrapper">
<div class="url" data-i18n="devtools_request_url"></div> <div class="url"></div>
<div class="domain"></div> <div class="domain"></div>
</div> </div>
</td> </td>
......
...@@ -102,13 +102,15 @@ function createRecord(request, filter, template) ...@@ -102,13 +102,15 @@ function createRecord(request, filter, template)
row.querySelector(".domain").textContent = request.docDomain; row.querySelector(".domain").textContent = request.docDomain;
row.querySelector(".type").textContent = request.type; row.querySelector(".type").textContent = request.type;
const urlElement = row.querySelector("[data-i18n='devtools_request_url']"); const urlElement = row.querySelector(".url");
const actionWrapper = row.querySelector(".action-wrapper"); const actionWrapper = row.querySelector(".action-wrapper");
if (request.url) if (request.url)
{ {
ext.i18n.setElementText(urlElement, "devtools_request_url",
[request.url, request.rewrittenUrl]);
const originalUrl = urlElement.querySelector("[data-i18n-index='0']"); const originalUrl = urlElement.querySelector("[data-i18n-index='0']");
originalUrl.textContent = request.url;
originalUrl.setAttribute("href", request.url); originalUrl.setAttribute("href", request.url);
if (request.type != "POPUP") if (request.type != "POPUP")
...@@ -119,7 +121,6 @@ function createRecord(request, filter, template) ...@@ -119,7 +121,6 @@ function createRecord(request, filter, template)
if (request.rewrittenUrl) if (request.rewrittenUrl)
{ {
const rewrittenUrl = urlElement.querySelector("[data-i18n-index='1'"); const rewrittenUrl = urlElement.querySelector("[data-i18n-index='1'");
rewrittenUrl.textContent = request.rewrittenUrl;
rewrittenUrl.setAttribute("href", request.rewrittenUrl); rewrittenUrl.setAttribute("href", request.rewrittenUrl);
rewrittenUrl.addEventListener("click", onUrlClick); rewrittenUrl.addEventListener("click", onUrlClick);
} }
......
...@@ -60,8 +60,18 @@ ...@@ -60,8 +60,18 @@
"message": "Request" "message": "Request"
}, },
"devtools_request_url": { "devtools_request_url": {
"description": "https://gitlab.com/eyeo/specs/spec/blob/28aba213f76265253786a9ed64fdba1377644352/spec/abp/devtools-panel.md#request-column e.g. http://example.com/foo rewritten to http://example.com/bar", "description": "https://gitlab.com/eyeo/specs/spec/blob/28aba213f76265253786a9ed64fdba1377644352/spec/abp/devtools-panel.md#request-column",
"message": "<a0></a0> rewritten to <a1></a1>" "message": "<a0>$original$</a0> rewritten to <a1>$rewritten$</a1>",
"placeholders": {
"original": {
"content": "$1",
"example": "http://example.com/foo"
},
"rewritten": {
"content": "$2",
"example": "http://example.com/bar"
}
}
}, },
"devtools_type_title": { "devtools_type_title": {
"description": "https://gitlab.com/eyeo/specs/spec/blob/28aba213f76265253786a9ed64fdba1377644352/spec/abp/devtools-panel.md#type-column", "description": "https://gitlab.com/eyeo/specs/spec/blob/28aba213f76265253786a9ed64fdba1377644352/spec/abp/devtools-panel.md#type-column",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment