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

Unified Diff: appengine/swarming/elements/res/imp/botlist/bot-list-summary.html

Issue 2408743002: Move elements/ to ui/ (Closed)
Patch Set: rebase again Created 4 years, 2 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
Index: appengine/swarming/elements/res/imp/botlist/bot-list-summary.html
diff --git a/appengine/swarming/elements/res/imp/botlist/bot-list-summary.html b/appengine/swarming/elements/res/imp/botlist/bot-list-summary.html
deleted file mode 100644
index 0781d35ca5654a7241fcaf1306f6dbdc943cfa31..0000000000000000000000000000000000000000
--- a/appengine/swarming/elements/res/imp/botlist/bot-list-summary.html
+++ /dev/null
@@ -1,241 +0,0 @@
-<!--
- This in an HTML Import-able file that contains the definition
- of the following elements:
-
- <bot-list-summary>
-
-
- Usage:
-
- <bot-list-summary></bot-list-summary>
-
- This element summarizes and displays the results of the current query.
-
- Properties:
- filtered_bots: Array<Object>, The bot list that is currently being shown
- (after filtering). The alive, dead, etc bots in this will be counted up
- for the summary. See bot-list-data for a description of this data type.
- fleet: Object, counts of all bots in the fleet. Contains "alive", "busy",
- "idle", "dead", and "quarantined".
- Methods:
- None.
-
- Events:
- None.
--->
-
-
-<link rel="import" href="/res/imp/common/swarming-app.html">
-
-<link rel="import" href="bot-list-shared-behavior.html">
-
-<dom-module id="bot-list-summary">
- <template>
- <style include="swarming-app-style">
- :host {
- display: block;
- border-left: 1px solid black;
- padding: 5px 5px;
- font-family: sans-serif;
- }
- .header {
- font-size: 1.2em;
- font-weight: bold;
- }
- .right {
- text-align: right;
- }
- .left {
- text-align: left;
- }
- </style>
-
- <div class="header">Fleet</div>
- <table>
- <tr>
- <td class="right">
- <a href$="[[_makeURL('','',columns.*,filtered_bots.*,sort,verbose)]]">All</a>:
- </td>
- <td class="left">[[fleet.all]]</td>
- </tr>
- <tr>
- <td class="right">
- <a href$="[[_makeURL('alive','',columns.*,filtered_bots.*,sort,verbose)]]">Alive</a>:
- </td>
- <td class="left">[[fleet.alive]]</td>
- </tr>
- <tr>
- <td class="right">
- <a href$="[[_makeURL('busy','',columns.*,filtered_bots.*,sort,verbose)]]">Busy</a>:
- </td>
- <td class="left">[[fleet.busy]]</td>
- </tr>
- <tr>
- <td class="right">
- <a href$="[[_makeURL('idle','',columns.*,filtered_bots.*,sort,verbose)]]">Idle</a>:
- </td>
- <td class="left">[[fleet.idle]]</td>
- </tr>
- <tr>
- <td class="right">
- <a href$="[[_makeURL('dead','',columns.*,filtered_bots.*,sort,verbose)]]">Dead</a>:
- </td>
- <td class="left">[[fleet.dead]]</td>
- </tr>
- <tr>
- <td class="right">
- <a href$="[[_makeURL('quarantined','',columns.*,filtered_bots.*,sort,verbose)]]">Quarantined</a>:
- </td>
- <td class="left">[[fleet.quarantined]]</td>
- </tr>
- </table>
-
- <div class="header">Displayed</div>
- <table>
- <tr>
- <td class="right">
- All:
- </td>
- <td class="left">[[_currently_showing.all]]</td>
- </tr>
- <tr>
- <td class="right">
- <a href$="[[_makeURL('alive','true',columns.*,filtered_bots.*,sort,verbose)]]">Alive</a>:
- </td>
- <td class="left">[[_currently_showing.alive]]</td>
- </tr>
- <tr>
- <td class="right">
- <a href$="[[_makeURL('busy','true',columns.*,filtered_bots.*,sort,verbose)]]">Busy</a>:
- </td>
- <td class="left">[[_currently_showing.busy]]</td>
- </tr>
- <tr>
- <td class="right">
- <a href$="[[_makeURL('idle','true',columns.*,filtered_bots.*,sort,verbose)]]">Idle</a>:
- </td>
- <td class="left">[[_currently_showing.idle]]</td>
- </tr>
- <tr>
- <td class="right">
- <a href$="[[_makeURL('dead','true',columns.*,filtered_bots.*,sort,verbose)]]">Dead</a>:
- </td>
- <td class="left">[[_currently_showing.dead]]</td>
- </tr>
- <tr>
- <td class="right">
- <a href$="[[_makeURL('quarantined','true',columns.*,filtered_bots.*,sort,verbose)]]">Quarantined</a>:
- </td>
- <td class="left">[[_currently_showing.quarantined]]</td>
- </tr>
- </table>
-
- </template>
- <script>
- Polymer({
- is: 'bot-list-summary',
-
- behaviors: [SwarmingBehaviors.BotListBehavior],
-
- properties: {
- columns: {
- type: Array,
- },
- filtered_bots: {
- type: Array,
- },
- fleet: {
- type: Object,
- },
- sort: {
- type: String,
- },
- verbose: {
- type: Boolean,
- },
-
- _currently_showing: {
- type: Object,
- value: function() {
- return {
- all: -1,
- alive: -1,
- busy: -1,
- idle: -1,
- dead: -1,
- quarantined: -1,
- };
- },
- },
- },
-
- // Do this because Array changes in Polymer don't always trigger normal
- // property observers
- observers: ["_recount(filtered_bots.*)"],
-
- _getFilterStr: function(filter) {
- if (!filter) {
- return "";
- }
- if (filter === "alive" || filter === "dead" ||
- filter === "quarantined") {
- return "status:" + filter;
- } else {
- return "task:" + filter;
- }
- },
-
- _makeURL: function(filter, preserveOthers) {
- if (preserveOthers) {
- var fstr = encodeURIComponent(this._getFilterStr(filter));
- if (window.location.href.indexOf(fstr) === -1) {
- return window.location.href + "&f=" + fstr;
- }
- // The filter is already on the list.
- return undefined;
- }
- var params = {
- s: [this.sort],
- c: this.columns,
- v: [this.verbose],
- }
- if (filter) {
- params["f"] = [this._getFilterStr(filter)];
- }
-
- return window.location.href.split('?')[0] + '?' + sk.query.fromParamSet(params);
- },
-
- _recount: function() {
- var curr = {
- all: 0,
- alive: 0,
- busy: 0,
- idle: 0,
- dead: 0,
- quarantined: 0,
- };
- if (!this.filtered_bots) {
- return curr;
- }
- this.filtered_bots.forEach(function(bot) {
- if (this._taskId(bot) === "idle") {
- curr.idle++;
- } else {
- curr.busy++;
- }
- if (bot.quarantined) {
- curr.quarantined++;
- }
- if (bot.is_dead) {
- curr.dead++;
- } else {
- curr.alive++;
- }
- curr.all++;
- }.bind(this));
- this.set("_currently_showing", curr);
- }
- });
- </script>
-</dom-module>

Powered by Google App Engine
This is Rietveld 408576698