Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2012)

Unified Diff: Source/devtools/front_end/security/SecurityPanel.js

Issue 1323263003: Security panel origin view: truncate SAN to two entries by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/devtools/front_end/security/originView.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/security/SecurityPanel.js
diff --git a/Source/devtools/front_end/security/SecurityPanel.js b/Source/devtools/front_end/security/SecurityPanel.js
index da81c396a25dcdd2ada438246bc08a45af1dd923..ace63f49a5296b792a901aeed59fa0be17fa384b 100644
--- a/Source/devtools/front_end/security/SecurityPanel.js
+++ b/Source/devtools/front_end/security/SecurityPanel.js
@@ -458,9 +458,30 @@ WebInspector.SecurityOriginView.prototype = {
if (sanList.length === 0) {
sanDiv.textContent = WebInspector.UIString("(N/A)");
} 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");
- span.textContent = WebInspector.UIString(sanEntry);
+ span.textContent = sanList[i];
+ if (listIsTruncated && i >= truncatedNumToShow) {
dgozman 2015/09/03 20:11:05 no { for one-liners
+ span.classList.add("truncated-entry");
+ }
+ }
+ if (listIsTruncated) {
+ var truncatedSANToggle = sanDiv.createChild("div", "link");
+ truncatedSANToggle.href = "";
+
+ function toggleSANTruncation() {
dgozman 2015/09/03 20:11:05 nit: { on next line
+ if (sanDiv.classList.contains("truncated-san")) {
+ sanDiv.classList.remove("truncated-san")
+ truncatedSANToggle.textContent = WebInspector.UIString("Show fewer");
dgozman 2015/09/03 20:11:05 But all the UIs I've seen have "Show more/less".
lgarron 2015/09/03 20:29:46 "Show less" makes sense when there is a bunch of s
+ } else {
+ sanDiv.classList.add("truncated-san")
dgozman 2015/09/03 20:11:05 ;
+ truncatedSANToggle.textContent = WebInspector.UIString("Show more (%d in total)", sanList.length);
+ }
+ }
+ truncatedSANToggle.addEventListener("click", toggleSANTruncation, false);
+ toggleSANTruncation();
}
}
return sanDiv;
« no previous file with comments | « no previous file | Source/devtools/front_end/security/originView.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698