Commit 3bf65f59 authored by horo@chromium.org's avatar horo@chromium.org

Clean-up serviceworker-internals page.

- Adhere to the 80-column limit
- Don't show the partition if there is no registrations nor versions.

BUG=358657

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274187 0039d316-1c4b-4281-b951-d872f2087c98
parent ec7f257a
...@@ -42,16 +42,20 @@ ...@@ -42,16 +42,20 @@
rows="3" cols="120" readonly jscontent="$this.log"></textarea> rows="3" cols="120" readonly jscontent="$this.log"></textarea>
</div> </div>
<div class="worker-controls"> <div class="worker-controls">
<button href="#" class="stop" jsdisplay="$this.running_status == 'RUNNING'" <button href="#" class="stop"
jsvalues=".cmdArgs:{partition_id:$partition_id,version_id:version_id}">Stop</button> jsvalues=".cmdArgs:{partition_id:$partition_id,version_id:version_id}"
<button href="#" class="sync" jsdisplay="$this.running_status == 'RUNNING'" jsdisplay="$this.running_status == 'RUNNING'">Stop</button>
jsvalues=".cmdArgs:{partition_id:$partition_id,version_id:version_id}">Sync</button> <button href="#" class="sync"
<button href="#" class="inspect" jsdisplay="$this.running_status == 'RUNNING'" jsvalues=".cmdArgs:{partition_id:$partition_id,version_id:version_id}"
jsvalues=".cmdArgs:{process_id:process_id,devtools_agent_route_id:devtools_agent_route_id}">Inspect</button> jsdisplay="$this.running_status == 'RUNNING'">Sync</button>
<button href="#" class="inspect"
jsvalues=".cmdArgs:{process_id:process_id,devtools_agent_route_id:devtools_agent_route_id}"
jsdisplay="$this.running_status == 'RUNNING'">Inspect</button>
<span class="operation-status" style="display: none">Running...</span> <span class="operation-status" style="display: none">Running...</span>
</div> </div>
</div> </div>
<div id="serviceworker-registration-template" class="serviceworker-registration"> <div id="serviceworker-registration-template"
class="serviceworker-registration">
<div class="serviceworker-scope"> <div class="serviceworker-scope">
<span>Scope:</span> <span>Scope:</span>
<span jscontent="scope"></span> <span jscontent="scope"></span>
...@@ -75,14 +79,20 @@ ...@@ -75,14 +79,20 @@
</div> </div>
<div class="registration-controls" jsdisplay="!$this.unregistered"> <div class="registration-controls" jsdisplay="!$this.unregistered">
<button href="#" class="unregister" <button href="#" class="unregister"
jsvalues=".cmdArgs:{partition_id:$partition_id,scope:scope}">Unregister</button> jsvalues=".cmdArgs:{partition_id:$partition_id,scope:scope}">
<button href="#" class="start" jsdisplay="$this.active.running_status != 'RUNNING'" Unregister
jsvalues=".cmdArgs:{partition_id:$partition_id,scope:scope}">Start</button> </button>
<button href="#" class="start"
jsdisplay="$this.active.running_status != 'RUNNING'"
jsvalues=".cmdArgs:{partition_id:$partition_id,scope:scope}">
Start
</button>
<span class="operation-status" style="display: none">Running...</span> <span class="operation-status" style="display: none">Running...</span>
</div> </div>
</div> </div>
<div id="serviceworker-list-template" <div id="serviceworker-list-template"
jsvalues="$partition_id:$this.partition_id;$partition_path:$this.partition_path;.partition_path:$this.partition_path"> jsvalues="$partition_id:$this.partition_id;.partition_id:$this.partition_id"
jsdisplay="$this.stored_registrations.length + $this.unregistered_registrations.length + $this.unregistered_versions.length > 0">
<div class="serviceworker-summary"> <div class="serviceworker-summary">
<span>Registrations in: </span> <span>Registrations in: </span>
<span jscontent="$this.partition_path"></span> <span jscontent="$this.partition_path"></span>
...@@ -91,7 +101,8 @@ ...@@ -91,7 +101,8 @@
<div class="serviceworker-item" jsselect="$this.stored_registrations"> <div class="serviceworker-item" jsselect="$this.stored_registrations">
<div transclude="serviceworker-registration-template"></div> <div transclude="serviceworker-registration-template"></div>
</div> </div>
<div class="serviceworker-item" jsselect="$this.unregistered_registrations"> <div class="serviceworker-item"
jsselect="$this.unregistered_registrations">
<div transclude="serviceworker-registration-template"></div> <div transclude="serviceworker-registration-template"></div>
</div> </div>
<div class="serviceworker-item" jsselect="$this.unregistered_versions"> <div class="serviceworker-item" jsselect="$this.unregistered_versions">
...@@ -102,9 +113,12 @@ ...@@ -102,9 +113,12 @@
<div id="serviceworker-options-template"> <div id="serviceworker-options-template">
<div> <div>
<span> <span>
<input type="checkbox" class="debug_on_start" jsvalues=".checked:$this.debug_on_start"> <input type="checkbox" class="debug_on_start"
jsvalues=".checked:$this.debug_on_start">
</span>
<span>
Opens the DevTools window for ServiceWorker on start for debugging.
</span> </span>
<span>Opens the DevTools window for ServiceWorker on start for debugging.</span>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -185,11 +185,11 @@ cr.define('serviceworker', function() { ...@@ -185,11 +185,11 @@ cr.define('serviceworker', function() {
unregistered_versions); unregistered_versions);
var template; var template;
var container = $('serviceworker-list'); var container = $('serviceworker-list');
// Existing templates are keyed by partition_path. This allows // Existing templates are keyed by partition_id. This allows
// the UI to be updated in-place rather than refreshing the // the UI to be updated in-place rather than refreshing the
// whole page. // whole page.
for (var i = 0; i < container.childNodes.length; ++i) { for (var i = 0; i < container.childNodes.length; ++i) {
if (container.childNodes[i].partition_path == partition_path) { if (container.childNodes[i].partition_id == partition_id) {
template = container.childNodes[i]; template = container.childNodes[i];
} }
} }
......
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