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

Unified Diff: appengine/swarming/elements/res/imp/botpage/bot-page-shared-behavior.html

Issue 2291323002: Introduce new bot-page UI (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@bot-page
Patch Set: Tweak table to look contiguous 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/botpage/bot-page-shared-behavior.html
diff --git a/appengine/swarming/elements/res/imp/botpage/bot-page-shared-behavior.html b/appengine/swarming/elements/res/imp/botpage/bot-page-shared-behavior.html
new file mode 100644
index 0000000000000000000000000000000000000000..d5f3df01e4c0c63608720cc2784161cb26f77444
--- /dev/null
+++ b/appengine/swarming/elements/res/imp/botpage/bot-page-shared-behavior.html
@@ -0,0 +1,46 @@
+<!--
+ 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.
+
+ window.SwarmingBehaviors.BotPageBehavior contains any shared functions and
+ constants used by the bot-page and its sub-elements.
+
+ To use it, include
+ behaviors: [SwarmingBehaviors.BotPageBehavior]
+ in the creation of your Polymer element.
+-->
+<link rel="import" href="/res/imp/common/common-behavior.html">
+<script>
+ (function(){
+
+
+ // This behavior wraps up all the shared bot-page functionality by
+ // extending SwarmingBehaviors.CommonBehavior
+ SwarmingBehaviors.BotPageBehavior = [SwarmingBehaviors.CommonBehavior, {
+
+ // timeDiffApprox returns the approximate difference between now and
+ // the specified date.
+ _timeDiffApprox: function(date){
+ if (!date) {
+ return "eons";
+ }
+ return sk.human.diffDate(date.getTime());
+ },
+
+ // timeDiffExact returns the exact difference between the two specified
+ // dates. E.g. 2d 22h 22m 28s ago If a second date is not provided,
+ // now is used.
+ _timeDiffExact: function(first, second){
+ if (!first) {
+ return "eons";
+ }
+ if (!second) {
+ second = new Date();
+ }
+ return sk.human.strDuration((second.getTime() - first.getTime())/1000);
+ },
+
+ }];
+ })()
+</script>

Powered by Google App Engine
This is Rietveld 408576698