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

Unified Diff: appengine/swarming/elements/res/imp/common/task-behavior.html

Issue 2337363004: Add task-page (Closed) Base URL: git@github.com:luci/luci-py@task-data
Patch Set: Alignment take 2 Created 4 years, 3 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/common/task-behavior.html
diff --git a/appengine/swarming/elements/res/imp/common/task-behavior.html b/appengine/swarming/elements/res/imp/common/task-behavior.html
new file mode 100644
index 0000000000000000000000000000000000000000..970a461695215332237d7baa6d65f53a2b5b62f4
--- /dev/null
+++ b/appengine/swarming/elements/res/imp/common/task-behavior.html
@@ -0,0 +1,101 @@
+<!--
+ Copyright 2016 The LUCI Authors. All rights reserved.
+ Use of this source code is governed under the Apache License, Version 2.0
+ that can be found in the LICENSE file.
+
+ It contains the definition of the following Behaviors:
+
+ SwarmingBehaviors.TaskBehavior
+
+ This behavior contains many constants and some functions that are useful
+ for task-related code.
+
+ It also includes the style module "task-style" to allow for common styles
+ to be shared across multiple pages.
+
+-->
+<script>
+ window.SwarmingBehaviors = window.SwarmingBehaviors || {};
+ (function(){
+ SwarmingBehaviors.TaskBehavior = {
+ properties: {
+ BOT_DIED: {
+ type: String,
+ value: "BOT_DIED",
+ },
+ CANCELED: {
+ type: String,
+ value: "CANCELED",
+ },
+ COMPLETED: {
+ type: String,
+ value: "COMPLETED",
+ },
+ COMPLETED_DEDUPED: {
+ type: String,
+ value: "COMPLETED (DEDUPED)",
+ },
+ COMPLETED_FAILURE: {
+ type: String,
+ value: "COMPLETED (FAILURE)",
+ },
+ COMPLETED_SUCCESS: {
+ type: String,
+ value: "COMPLETED (SUCCESS)",
+ },
+ EXPIRED: {
+ type: String,
+ value: "EXPIRED",
+ },
+ PENDING: {
+ type: String,
+ value: "PENDING",
+ },
+ RUNNING: {
+ type: String,
+ value: "RUNNING",
+ },
+ TIMED_OUT: {
+ type: String,
+ value: "TIMED_OUT",
+ },
+ },
+
+ stateClass: function(state) {
+ if (state === this.CANCELED || state === this.TIMED_OUT || state === this.EXPIRED) {
+ return "exception";
+ }
+ if (state === this.BOT_DIED) {
+ return "bot_died";
+ }
+ if (state === this.COMPLETED_FAILURE) {
+ return "failed_task";
+ }
+ if (state === this.RUNNING || state === this.PENDING) {
+ return "pending_task";
+ }
+ return "";
+ }
+ };
+ })();
+</script>
+
+<dom-module id="task-style">
+ <template>
+ <style>
+ /* These colors are from buildbot */
+ .failed_task {
+ background-color: #ffdddd;
+ }
+ .bot_died {
+ background-color: #cccccc;
+ }
+ .exception {
+ background-color: #edd2ff;
+ }
+ .pending_task {
+ background-color: #fffc6c;
+ }
+ </style>
+ </template>
+</dom-module>

Powered by Google App Engine
This is Rietveld 408576698