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

Side by Side Diff: sksysmon/res/imp/unitlist.html

Issue 1130673004: Add start, stop, restart buttons to sksysmon. (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Created 5 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 | « sksysmon/go/sksysmon/main.go ('k') | sksysmon/templates/index.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!-- The <unit-list-sk> custom element declaration. 1 <!-- The <unit-list-sk> custom element declaration.
2 2
3 Displays a list of systemd Units and their status. 3 Displays a list of systemd Units and their status.
4 4
5 Attributes: 5 Attributes:
6 units - A serialized slice of dbus.UnitStatus. See: 6 units - A serialized slice of dbus.UnitStatus. See:
7 http://godoc.org/github.com/coreos/go-systemd/dbus#UnitStatus Events: 7 http://godoc.org/github.com/coreos/go-systemd/dbus#UnitStatus Events:
8 8
9 Methods: 9 Methods:
10 none. 10 none.
11 11
12 Events: 12 Events:
13 none. 13 unit-updated - Sent when a units status has changed and the list should be
14 reloaded.
14 --> 15 -->
15 <polymer-element name="unit-list-sk"> 16 <polymer-element name="unit-list-sk">
16 <template> 17 <template>
17 <style type="text/css" media="screen"> 18 <style type="text/css" media="screen">
18 table { 19 paper-button:hover {
19 font-size: 20px; 20 background: #eee;
20 } 21 }
21 </style> 22 </style>
22 <table> 23 <table id=list>
23 <tr><th>Service</th><th>Status</th></tr> 24 <tr><th>Service</th><th>Status</th></tr>
24 <template repeat="{{u in units}}"> 25 <template repeat="{{u in units}}">
25 <tr><td>{{u.Name}}</td><td>{{u.SubState}}</td></tr> 26 <tr>
27 <td>{{u.Name}}</td><td>{{u.SubState}}</td>
28 <td><paper-button raised data-action="start" data-name="{{u.Name}}">St art</paper-button></td>
29 <td><paper-button raised data-action="stop" data-name="{{u.Name}}">Sto p</paper-button></td>
30 <td><paper-button raised data-action="restart" data-name="{{u.Name}}"> Restart</paper-button></td>
31 </tr>
26 </template> 32 </template>
27 </table> 33 </table>
34 <paper-toast id=toast></paper-toast>
28 </template> 35 </template>
29 <script> 36 <script>
30 Polymer({ 37 Polymer({
31 publish: { 38 publish: {
32 units: { 39 units: {
33 value: [], 40 value: [],
34 reflect: false, 41 reflect: false,
35 } 42 }
36 }, 43 },
44
45 ready: function() {
46 var that=this;
47 this.$.list.addEventListener('click', function(e) {
48 // Find the paper-button element, it has the name and action
49 // to perform in its data-attributes.
50 var ele = null;
51 for (var i=0; i<e.path.length; i++) {
52 if (e.path[i].nodeName == "PAPER-BUTTON") {
53 ele = e.path[i];
54 break;
55 }
56 }
57 if (ele) {
58 var params = {
59 name: ele.dataset.name,
60 action: ele.dataset.action,
61 };
62 sk.post('/_/change?'+sk.query.fromObject(params)).then(JSON.parse).t hen(function(json) {
63 that.$.toast.text = ele.dataset.name + ": " + json.result;
64 that.$.toast.show();
65 that.dispatchEvent(new CustomEvent('unit-updated'));
66 }).catch(function(e) {
67 that.$.toast.text = e;
68 that.$.toast.show();
69 })
70 }
71 });
72 },
37 }); 73 });
38 </script> 74 </script>
39 </polymer-element> 75 </polymer-element>
OLDNEW
« no previous file with comments | « sksysmon/go/sksysmon/main.go ('k') | sksysmon/templates/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698