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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js

Issue 1922073002: DevTools: polish service worker inspector UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaselined test Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.VBox} 7 * @extends {WebInspector.VBox}
8 * @implements {WebInspector.TargetManager.Observer} 8 * @implements {WebInspector.TargetManager.Observer}
9 */ 9 */
10 WebInspector.ServiceWorkersView = function() 10 WebInspector.ServiceWorkersView = function()
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 var toolbar = new WebInspector.Toolbar("", this.element); 268 var toolbar = new WebInspector.Toolbar("", this.element);
269 this._updateButton = new WebInspector.ToolbarButton(WebInspector.UIString("U pdate"), "refresh-toolbar-item", WebInspector.UIString("Update")); 269 this._updateButton = new WebInspector.ToolbarButton(WebInspector.UIString("U pdate"), "refresh-toolbar-item", WebInspector.UIString("Update"));
270 this._updateButton.addEventListener("click", this._updateButtonClicked.bind( this)); 270 this._updateButton.addEventListener("click", this._updateButtonClicked.bind( this));
271 toolbar.appendToolbarItem(this._updateButton); 271 toolbar.appendToolbarItem(this._updateButton);
272 272
273 toolbar.appendSeparator(); 273 toolbar.appendSeparator();
274 this._pushButton = new WebInspector.ToolbarButton(WebInspector.UIString("Emu late push event"), "notification-toolbar-item", WebInspector.UIString("Push")); 274 this._pushButton = new WebInspector.ToolbarButton(WebInspector.UIString("Emu late push event"), "notification-toolbar-item", WebInspector.UIString("Push"));
275 this._pushButton.addEventListener("click", this._pushButtonClicked.bind(this )); 275 this._pushButton.addEventListener("click", this._pushButtonClicked.bind(this ));
276 toolbar.appendToolbarItem(this._pushButton); 276 toolbar.appendToolbarItem(this._pushButton);
277 toolbar.appendSpacer(); 277 toolbar.appendSpacer();
278 this._deleteButton = new WebInspector.ToolbarButton(WebInspector.UIString("D elete"), "garbage-collect-toolbar-item", WebInspector.UIString("Delete")); 278 this._deleteButton = new WebInspector.ToolbarButton(WebInspector.UIString("U nregister service worker"), "garbage-collect-toolbar-item", WebInspector.UIStrin g("Unregister"));
279 this._deleteButton.addEventListener("click", this._deleteButtonClicked.bind( this)); 279 this._deleteButton.addEventListener("click", this._deleteButtonClicked.bind( this));
280 toolbar.appendToolbarItem(this._deleteButton); 280 toolbar.appendToolbarItem(this._deleteButton);
281 281
282 this._tabbedPane = new WebInspector.TabbedPane(); 282 this._tabbedPane = new WebInspector.TabbedPane();
283 this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSele cted, this._tabSelected, this); 283 this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSele cted, this._tabSelected, this);
284 var modes = WebInspector.ServiceWorkerVersion.Modes; 284 var modes = WebInspector.ServiceWorkerVersion.Modes;
285 this._tabbedPane.appendTab(modes.Installing, WebInspector.UIString("Installi ng"), new WebInspector.VBox()); 285 this._tabbedPane.appendTab(modes.Installing, WebInspector.UIString("Installi ng"), new WebInspector.VBox());
286 this._tabbedPane.appendTab(modes.Waiting, WebInspector.UIString("Waiting"), new WebInspector.VBox()); 286 this._tabbedPane.appendTab(modes.Waiting, WebInspector.UIString("Waiting"), new WebInspector.VBox());
287 this._tabbedPane.appendTab(modes.Active, WebInspector.UIString("Active"), ne w WebInspector.VBox()); 287 this._tabbedPane.appendTab(modes.Active, WebInspector.UIString("Active"), ne w WebInspector.VBox());
288 this._tabbedPane.appendTab(modes.Redundant, WebInspector.UIString("Redundant "), new WebInspector.VBox()); 288 this._tabbedPane.appendTab(modes.Redundant, WebInspector.UIString("Redundant "), new WebInspector.VBox());
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 */ 417 */
418 this._clientInfoCache = {}; 418 this._clientInfoCache = {};
419 this._createElements(); 419 this._createElements();
420 this._updateVersion(version); 420 this._updateVersion(version);
421 } 421 }
422 422
423 WebInspector.SWVersionWidget.prototype = { 423 WebInspector.SWVersionWidget.prototype = {
424 _createElements: function() 424 _createElements: function()
425 { 425 {
426 var panel = createElementWithClass("div", "service-workers-versions-pane l"); 426 var panel = createElementWithClass("div", "service-workers-versions-pane l");
427 var leftPanel = panel.createChild("div", "service-workers-versions-panel -left"); 427 var leftPanel = panel.createChild("div", "service-workers-versions-panel -top");
428 var rightPanel = panel.createChild("div", "service-workers-versions-pane l-right"); 428 var rightPanel = panel.createChild("div", "service-workers-versions-pane l-bottom");
429 this._stateCell = this._addTableRow(leftPanel, WebInspector.UIString("St ate")); 429 this._scriptCell = this._addTableRow(leftPanel, WebInspector.UIString("U RL"));
430 this._workerCell = this._addTableRow(leftPanel, WebInspector.UIString("W orker")); 430 this._workerCell = this._addTableRow(leftPanel, WebInspector.UIString("S tate"));
431 this._scriptCell = this._addTableRow(leftPanel, WebInspector.UIString("S cript URL"));
432 this._updatedCell = this._addTableRow(leftPanel, WebInspector.UIString(" Updated")); 431 this._updatedCell = this._addTableRow(leftPanel, WebInspector.UIString(" Updated"));
433 this._updatedCell.classList.add("service-worker-script-response-time"); 432 this._updatedCell.classList.add("service-worker-script-response-time");
434 this._scriptLastModifiedCell = this._addTableRow(leftPanel, WebInspector .UIString("Last-Modified")); 433 this._scriptLastModifiedCell = this._addTableRow(leftPanel, WebInspector .UIString("Last-Modified"));
435 this._scriptLastModifiedCell.classList.add("service-worker-script-last-m odified"); 434 this._scriptLastModifiedCell.classList.add("service-worker-script-last-m odified");
436 rightPanel.createChild("div", "service-workers-versions-table-messages-t itle").createTextChild(WebInspector.UIString("Recent messages")); 435 rightPanel.createChild("div", "service-workers-versions-table-title").cr eateTextChild(WebInspector.UIString("Recent messages"));
437 this._messagesPanel = rightPanel.createChild("div", "service-workers-ver sions-table-messages-content"); 436 this._messagesPanel = rightPanel.createChild("div", "service-workers-ver sions-table-messages-content");
438 this._clientsTitle = rightPanel.createChild("div", "service-workers-vers ions-table-clients-title"); 437 this._clientsTitle = rightPanel.createChild("div", "service-workers-vers ions-table-title");
439 this._clientsTitle.createTextChild(WebInspector.UIString("Controlled cli ents")); 438 this._clientsTitle.createTextChild(WebInspector.UIString("Controlled cli ents"));
440 this._clientsPanel = rightPanel.createChild("div", "service-workers-vers ions-table-clients-content"); 439 this._clientsPanel = rightPanel.createChild("div", "service-workers-vers ions-table-clients-content");
441 this.element.appendChild(panel); 440 this.element.appendChild(panel);
442 }, 441 },
443 442
444 /** 443 /**
445 * @param {!WebInspector.ServiceWorkerVersion} version 444 * @param {!WebInspector.ServiceWorkerVersion} version
446 */ 445 */
447 _updateVersion: function(version) 446 _updateVersion: function(version)
448 { 447 {
449 this._stateCell.setTextAndTitle(version.status);
450
451 this._workerCell.removeChildren(); 448 this._workerCell.removeChildren();
452 if (version.isRunning() || version.isStarting() || version.isStartable() ) { 449 if (version.isRunning() || version.isStarting() || version.isStartable() ) {
453 var runningStatusCell = this._workerCell.createChild("div", "service -workers-versions-table-worker-running-status-cell"); 450 var runningStatusCell = this._workerCell.createChild("div", "service -workers-versions-table-worker-running-status-cell");
454 var runningStatusLeftCell = runningStatusCell.createChild("div", "se rvice-workers-versions-table-running-status-left-cell"); 451 var runningStatusLeftCell = runningStatusCell.createChild("div");
455 var runningStatusRightCell = runningStatusCell.createChild("div", "s ervice-workers-versions-table-running-status-right-cell"); 452 var runningStatusRightCell = runningStatusCell.createChild("div");
456 if (version.isRunning() || version.isStarting()) { 453 if (version.isRunning() || version.isStarting()) {
457 var toolbar = new WebInspector.Toolbar("", runningStatusLeftCell ); 454 var toolbar = new WebInspector.Toolbar("", runningStatusRightCel l);
458 var stopButton = new WebInspector.ToolbarButton(WebInspector.UIS tring("Stop"), "stop-toolbar-item"); 455 var stopButton = new WebInspector.ToolbarButton(WebInspector.UIS tring("Stop"), "stop-toolbar-item");
459 stopButton.addEventListener("click", this._stopButtonClicked.bin d(this, version.id)); 456 stopButton.addEventListener("click", this._stopButtonClicked.bin d(this, version.id));
460 toolbar.appendToolbarItem(stopButton); 457 toolbar.appendToolbarItem(stopButton);
461 } else if (version.isStartable()) { 458 } else if (version.isStartable()) {
462 var toolbar = new WebInspector.Toolbar("", runningStatusLeftCell ); 459 var toolbar = new WebInspector.Toolbar("", runningStatusRightCel l);
463 var startButton = new WebInspector.ToolbarButton(WebInspector.UI String("Start"), "play-toolbar-item"); 460 var startButton = new WebInspector.ToolbarButton(WebInspector.UI String("Start"), "play-toolbar-item");
464 startButton.addEventListener("click", this._startButtonClicked.b ind(this)); 461 startButton.addEventListener("click", this._startButtonClicked.b ind(this));
465 toolbar.appendToolbarItem(startButton); 462 toolbar.appendToolbarItem(startButton);
466 } 463 }
467 runningStatusRightCell.setTextAndTitle(version.runningStatus); 464 runningStatusLeftCell.setTextAndTitle(version.runningStatus);
468 if (version.isRunning() || version.isStarting()) { 465 if ((version.isRunning() || version.isStarting()) && !this._manager. hasWorkerWithVersionId(version.id)) {
469 var inspectButton = runningStatusRightCell.createChild("div", "s ervice-workers-versions-table-running-status-inspect"); 466 var inspectButton = runningStatusLeftCell.createChild("span", "s ervice-workers-versions-table-running-status-inspect");
470 inspectButton.setTextAndTitle(WebInspector.UIString("inspect")); 467 inspectButton.setTextAndTitle(WebInspector.UIString("inspect"));
471 inspectButton.addEventListener("click", this._inspectButtonClick ed.bind(this, version.id), false); 468 inspectButton.addEventListener("click", this._inspectButtonClick ed.bind(this, version.id), false);
472 } 469 }
473 } else { 470 } else {
474 this._workerCell.setTextAndTitle(version.runningStatus); 471 this._workerCell.setTextAndTitle(version.runningStatus);
475 } 472 }
476 473
477 this._scriptCell.setTextAndTitle(version.scriptURL.asParsedURL().path); 474 this._scriptCell.setTextAndTitle(version.scriptURL.asParsedURL().path);
478 this._updatedCell.setTextAndTitle(version.scriptResponseTime ? (new Date (version.scriptResponseTime * 1000)).toConsoleTime() : ""); 475 this._updatedCell.setTextAndTitle(version.scriptResponseTime ? (new Date (version.scriptResponseTime * 1000)).toConsoleTime() : "");
479 this._scriptLastModifiedCell.setTextAndTitle(version.scriptLastModified ? (new Date(version.scriptLastModified * 1000)).toConsoleTime() : ""); 476 this._scriptLastModifiedCell.setTextAndTitle(version.scriptLastModified ? (new Date(version.scriptLastModified * 1000)).toConsoleTime() : "");
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 * @param {string} versionId 584 * @param {string} versionId
588 * @param {!Event} event 585 * @param {!Event} event
589 */ 586 */
590 _inspectButtonClicked: function(versionId, event) 587 _inspectButtonClicked: function(versionId, event)
591 { 588 {
592 this._manager.inspectWorker(versionId); 589 this._manager.inspectWorker(versionId);
593 }, 590 },
594 591
595 __proto__: WebInspector.VBox.prototype 592 __proto__: WebInspector.VBox.prototype
596 } 593 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698