Commit 0195ced5 authored by lgarron@chromium.org's avatar lgarron@chromium.org

Security panel origin view: truncate SAN to two entries by default.

Also add a link to toggle the full list.

BUG=523591

Review URL: https://codereview.chromium.org/1323263003

git-svn-id: svn://svn.chromium.org/blink/trunk@201746 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent b14cc2cd
...@@ -458,9 +458,30 @@ WebInspector.SecurityOriginView.prototype = { ...@@ -458,9 +458,30 @@ WebInspector.SecurityOriginView.prototype = {
if (sanList.length === 0) { if (sanList.length === 0) {
sanDiv.textContent = WebInspector.UIString("(N/A)"); sanDiv.textContent = WebInspector.UIString("(N/A)");
} else { } else {
for (var sanEntry of sanList) { var truncatedNumToShow = 2;
var listIsTruncated = sanList.length > truncatedNumToShow;
for (var i = 0; i < sanList.length; i++) {
var span = sanDiv.createChild("span", "san-entry"); var span = sanDiv.createChild("span", "san-entry");
span.textContent = WebInspector.UIString(sanEntry); span.textContent = sanList[i];
if (listIsTruncated && i >= truncatedNumToShow)
span.classList.add("truncated-entry");
}
if (listIsTruncated) {
var truncatedSANToggle = sanDiv.createChild("div", "link");
truncatedSANToggle.href = "";
function toggleSANTruncation()
{
if (sanDiv.classList.contains("truncated-san")) {
sanDiv.classList.remove("truncated-san")
truncatedSANToggle.textContent = WebInspector.UIString("Show less");
} else {
sanDiv.classList.add("truncated-san");
truncatedSANToggle.textContent = WebInspector.UIString("Show more (%d total)", sanList.length);
}
}
truncatedSANToggle.addEventListener("click", toggleSANTruncation, false);
toggleSANTruncation();
} }
} }
return sanDiv; return sanDiv;
......
...@@ -65,3 +65,7 @@ ...@@ -65,3 +65,7 @@
.security-origin-view .details-table .san-entry { .security-origin-view .details-table .san-entry {
display: block; display: block;
} }
.security-origin-view .truncated-san .truncated-entry {
display: none;
}
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