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

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

Issue 1946333005: DevTools: follow up to v391774 with small UI fixes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 scriptElement.removeChildren(); 204 scriptElement.removeChildren();
205 var components = WebInspector.ParsedURL.splitURLIntoPathComponents(a ctive.scriptURL); 205 var components = WebInspector.ParsedURL.splitURLIntoPathComponents(a ctive.scriptURL);
206 scriptElement.appendChild(WebInspector.linkifyURLAsNode(active.scrip tURL, components.peekLast())); 206 scriptElement.appendChild(WebInspector.linkifyURLAsNode(active.scrip tURL, components.peekLast()));
207 scriptElement.createChild("div", "report-field-value-subtitle").text Content = WebInspector.UIString("Last modified %s", new Date(active.scriptLastMo dified * 1000).toLocaleString()); 207 scriptElement.createChild("div", "report-field-value-subtitle").text Content = WebInspector.UIString("Last modified %s", new Date(active.scriptLastMo dified * 1000).toLocaleString());
208 208
209 var activeEntry = versionsStack.createChild("div", "service-worker-v ersion"); 209 var activeEntry = versionsStack.createChild("div", "service-worker-v ersion");
210 activeEntry.createChild("div", "service-worker-active-circle"); 210 activeEntry.createChild("div", "service-worker-active-circle");
211 activeEntry.createChild("span").textContent = WebInspector.UIString( "#%s active and is %s", active.id, active.runningStatus); 211 activeEntry.createChild("span").textContent = WebInspector.UIString( "#%s active and is %s", active.id, active.runningStatus);
212 212
213 if (active.isRunning() || active.isStarting()) { 213 if (active.isRunning() || active.isStarting()) {
214 var stopButton = createLink(activeEntry, WebInspector.UIString(" stop"), this._stopButtonClicked.bind(this, active.id)); 214 createLink(activeEntry, WebInspector.UIString("stop"), this._sto pButtonClicked.bind(this, active.id));
215 if (!this._manager.targetForVersionId(active.id)) { 215 if (!this._manager.targetForVersionId(active.id))
216 var inspectButton = createLink(activeEntry, WebInspector.UIS tring("inspect"), this._inspectButtonClicked.bind(this, active.id)); 216 createLink(activeEntry, WebInspector.UIString("inspect"), th is._inspectButtonClicked.bind(this, active.id));
217 }
218 } else if (active.isStartable()) { 217 } else if (active.isStartable()) {
219 var startButton = createLink(activeEntry, WebInspector.UIString( "start"), this._startButtonClicked.bind(this)); 218 createLink(activeEntry, WebInspector.UIString("start"), this._st artButtonClicked.bind(this));
220 } 219 }
221 220
222 var clientsList = this._wrapWidget(this._section.appendField(WebInsp ector.UIString("Clients"))); 221 var clientsList = this._wrapWidget(this._section.appendField(WebInsp ector.UIString("Clients")));
223 clientsList.removeChildren(); 222 clientsList.removeChildren();
224 this._section.setFieldVisible(WebInspector.UIString("Clients"), acti ve.controlledClients.length); 223 this._section.setFieldVisible(WebInspector.UIString("Clients"), acti ve.controlledClients.length);
225 for (var client of active.controlledClients) { 224 for (var client of active.controlledClients) {
226 var clientLabelText = clientsList.createChild("div", "service-wo rker-client"); 225 var clientLabelText = clientsList.createChild("div", "service-wo rker-client");
227 if (this._clientInfoCache.has(client)) 226 if (this._clientInfoCache.has(client))
228 this._updateClientInfo(clientLabelText, /** @type {!WebInspe ctor.TargetInfo} */(this._clientInfoCache.get(client))); 227 this._updateClientInfo(clientLabelText, /** @type {!WebInspe ctor.TargetInfo} */(this._clientInfoCache.get(client)));
229 this._manager.getTargetInfo(client, this._onClientInfo.bind(this , clientLabelText)); 228 this._manager.getTargetInfo(client, this._onClientInfo.bind(this , clientLabelText));
230 } 229 }
231 } 230 }
232 231
233 if (waiting) { 232 if (waiting) {
234 var waitingEntry = versionsStack.createChild("div", "service-worker- version"); 233 var waitingEntry = versionsStack.createChild("div", "service-worker- version");
235 waitingEntry.createChild("div", "service-worker-waiting-circle"); 234 waitingEntry.createChild("div", "service-worker-waiting-circle");
236 waitingEntry.createChild("span").textContent = WebInspector.UIString ("#%s waiting to activate", waiting.id); 235 waitingEntry.createChild("span").textContent = WebInspector.UIString ("#%s waiting to activate", waiting.id);
237 var skipButton = createLink(waitingEntry, WebInspector.UIString("ski pWaiting"), this._skipButtonClicked.bind(this)); 236 createLink(waitingEntry, WebInspector.UIString("skipWaiting"), this. _skipButtonClicked.bind(this));
238 waitingEntry.createChild("div", "service-worker-subtitle").textConte nt = new Date(waiting.scriptLastModified * 1000).toLocaleString(); 237 waitingEntry.createChild("div", "service-worker-subtitle").textConte nt = new Date(waiting.scriptLastModified * 1000).toLocaleString();
238 if (!this._manager.targetForVersionId(waiting.id) && (waiting.isRunn ing() || waiting.isStarting()))
239 createLink(waitingEntry, WebInspector.UIString("inspect"), this. _inspectButtonClicked.bind(this, waiting.id));
239 } 240 }
240 if (installing) { 241 if (installing) {
241 var installingEntry = versionsStack.createChild("div", "service-work er-version"); 242 var installingEntry = versionsStack.createChild("div", "service-work er-version");
242 installingEntry.createChild("div", "service-worker-installing-circle "); 243 installingEntry.createChild("div", "service-worker-installing-circle ");
243 installingEntry.createChild("span").textContent = WebInspector.UIStr ing("#%s installing", installing.id); 244 installingEntry.createChild("span").textContent = WebInspector.UIStr ing("#%s installing", installing.id);
244 installingEntry.createChild("div", "service-worker-subtitle").textCo ntent = new Date(installing.scriptLastModified * 1000).toLocaleString(); 245 installingEntry.createChild("div", "service-worker-subtitle").textCo ntent = new Date(installing.scriptLastModified * 1000).toLocaleString();
246 if (!this._manager.targetForVersionId(installing.id) && (installing. isRunning() || installing.isStarting()))
247 createLink(installingEntry, WebInspector.UIString("inspect"), th is._inspectButtonClicked.bind(this, installing.id));
245 } 248 }
246 249
247 this._section.setFieldVisible(WebInspector.UIString("Errors"), !!this._r egistration.errors.length); 250 this._section.setFieldVisible(WebInspector.UIString("Errors"), !!this._r egistration.errors.length);
248 var errorsValue = this._wrapWidget(this._section.appendField(WebInspecto r.UIString("Errors"))); 251 var errorsValue = this._wrapWidget(this._section.appendField(WebInspecto r.UIString("Errors")));
249 var errorsLabel = createLabel(String(this._registration.errors.length), "error-icon"); 252 var errorsLabel = createLabel(String(this._registration.errors.length), "error-icon");
250 errorsLabel.classList.add("service-worker-errors-label"); 253 errorsLabel.classList.add("service-worker-errors-label");
251 errorsValue.appendChild(errorsLabel); 254 errorsValue.appendChild(errorsLabel);
252 this._moreButton = createLink(errorsValue, this._errorsList.classList.co ntains("hidden") ? WebInspector.UIString("details") : WebInspector.UIString("hid e"), this._moreErrorsButtonClicked.bind(this)); 255 this._moreButton = createLink(errorsValue, this._errorsList.classList.co ntains("hidden") ? WebInspector.UIString("details") : WebInspector.UIString("hid e"), this._moreErrorsButtonClicked.bind(this));
253 var clearButton = createLink(errorsValue, WebInspector.UIString("clear") , this._clearErrorsButtonClicked.bind(this)); 256 createLink(errorsValue, WebInspector.UIString("clear"), this._clearError sButtonClicked.bind(this));
254 257
255 /** 258 /**
256 * @param {!Element} parent 259 * @param {!Element} parent
257 * @param {string} title 260 * @param {string} title
258 * @param {function()} listener 261 * @param {function()} listener
262 * @return {!Element}
259 */ 263 */
260 function createLink(parent, title, listener) 264 function createLink(parent, title, listener)
261 { 265 {
262 var span = parent.createChild("span", "link"); 266 var span = parent.createChild("span", "link");
263 span.textContent = title; 267 span.textContent = title;
264 span.addEventListener("click", listener, false); 268 span.addEventListener("click", listener, false);
269 return span;
265 } 270 }
266 return Promise.resolve(); 271 return Promise.resolve();
267 }, 272 },
268 273
269 /** 274 /**
270 * @param {!ServiceWorkerAgent.ServiceWorkerErrorMessage} error 275 * @param {!ServiceWorkerAgent.ServiceWorkerErrorMessage} error
271 */ 276 */
272 _addError: function(error) 277 _addError: function(error)
273 { 278 {
274 var target = this._manager.targetForVersionId(error.versionId); 279 var target = this._manager.targetForVersionId(error.versionId);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 return contentElement; 392 return contentElement;
388 }, 393 },
389 394
390 _dispose: function() 395 _dispose: function()
391 { 396 {
392 this._linkifier.dispose(); 397 this._linkifier.dispose();
393 if (this._pendingUpdate) 398 if (this._pendingUpdate)
394 clearTimeout(this._pendingUpdate); 399 clearTimeout(this._pendingUpdate);
395 } 400 }
396 } 401 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698