Add legacy undefined checks Change-Id: I58c1fd45fd5eadbf5e243b7e32d97e6c1310d35c
diff --git a/BUILD b/BUILD index 6ff23b8..b669e82 100644 --- a/BUILD +++ b/BUILD
@@ -1,4 +1,5 @@ load("//tools/bzl:plugin.bzl", "gerrit_plugin") +load("//tools/bzl:genrule2.bzl", "genrule2") load("//tools/bzl:js.bzl", "polygerrit_plugin") gerrit_plugin( @@ -12,13 +13,26 @@ "Implementation-Vendor: Wikimedia Foundation", ], resources = glob(["src/main/**/*"]), + resource_jars = [":gr-zuul-status-static"], +) + +genrule2( + name = "gr-zuul-status-static", + srcs = [":gr-zuul-status"], + outs = ["gr-zuul-status-static.jar"], + cmd = " && ".join([ + "mkdir $$TMP/static", + "cp -r $(locations :gr-zuul-status) $$TMP/static", + "cd $$TMP", + "zip -Drq $$ROOT/$@ -g .", + ]), ) polygerrit_plugin( - name = "zuul_status_ui", + name = "gr-zuul-status", srcs = glob([ - "src/main/resources/static/*.html", - "src/main/resources/static/*.js", + "gr-zuul-status-view/*.html", + "gr-zuul-status-view/*.js", ]), - app = "src/main/resources/static/zuul-status.html", + app = "plugin.html", )
diff --git a/src/main/resources/static/zuul-status-view.html b/gr-zuul-status-view/gr-zuul-status-view.html similarity index 98% rename from src/main/resources/static/zuul-status-view.html rename to gr-zuul-status-view/gr-zuul-status-view.html index e50beab..dafdacc 100644 --- a/src/main/resources/static/zuul-status-view.html +++ b/gr-zuul-status-view/gr-zuul-status-view.html
@@ -12,7 +12,7 @@ limitations under the License. --> -<dom-module id="zuul-status-view"> +<dom-module id="gr-zuul-status-view"> <template> <style include="shared-styles"> #view-container { @@ -230,5 +230,5 @@ </svg> </iron-iconset-svg> </template> - <script src="zuul-status-view.js"></script> + <script src="gr-zuul-status-view.js"></script> </dom-module>
diff --git a/src/main/resources/static/zuul-status-view.js b/gr-zuul-status-view/gr-zuul-status-view.js similarity index 98% rename from src/main/resources/static/zuul-status-view.js rename to gr-zuul-status-view/gr-zuul-status-view.js index 105ebfe..650a07d 100644 --- a/src/main/resources/static/zuul-status-view.js +++ b/gr-zuul-status-view/gr-zuul-status-view.js
@@ -59,7 +59,9 @@ } Polymer({ - is: 'zuul-status-view', + is: 'gr-zuul-status-view', + _legacyUndefinedCheck: true, + properties: { zuulUrl: String, zuulTenant: { @@ -399,7 +401,6 @@ _getEnqueueTime(ms) { // Special format case for enqueue time to add style - let hours = 60 * 60 * 1000; let now = Date.now(); let delta = now - ms;
diff --git a/src/main/resources/static/zuul-status.html b/plugin.html similarity index 62% rename from src/main/resources/static/zuul-status.html rename to plugin.html index 3979d5a..9ad5520 100644 --- a/src/main/resources/static/zuul-status.html +++ b/plugin.html
@@ -12,18 +12,19 @@ limitations under the License. --> -<link rel="import" href="zuul-status-view.html"> +<link rel="import" href="./gr-zuul-status-view/gr-zuul-status-view.html"> <script> -(function() { - 'use strict'; + (function() { + 'use strict'; - Gerrit.install((plugin) => { - // Only supported in PolyGerrit in gerrit 2.16+. - if (!window.Polymer) { return; } + // This plugin is only supported in PolyGerrit from gerrit 2.16+ + if (window.Polymer) { + Gerrit.install((plugin) => { - plugin.registerCustomComponent( - 'change-view-integration', 'zuul-status-view'); - }); -})(); + plugin.registerCustomComponent( + 'change-view-integration', 'gr-zuul-status-view'); + }); + } + })(); </script>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/zuulstatus/HttpModule.java b/src/main/java/com/googlesource/gerrit/plugins/zuulstatus/HttpModule.java index ed8baeb..9fe0e6b 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/zuulstatus/HttpModule.java +++ b/src/main/java/com/googlesource/gerrit/plugins/zuulstatus/HttpModule.java
@@ -23,6 +23,6 @@ @Override protected void configureServlets() { DynamicSet.bind(binder(), WebUiPlugin.class) - .toInstance(new JavaScriptPlugin("zuul-status.html")); + .toInstance(new JavaScriptPlugin("gr-zuul-status.html")); } }