PolyGerrit UI: Split plugin to html and js files

Change-Id: I8d9d140fe77b2dc52b3138b9e42acc394712c376
diff --git a/BUILD b/BUILD
index 27d5da3..4de410f 100644
--- a/BUILD
+++ b/BUILD
@@ -59,5 +59,9 @@
 
 polygerrit_plugin(
     name = "gr-verify-status",
-    app = "gr-verify-status-plugin.html",
+    srcs = [
+        "gr-verify-status/gr-verify-status-panel.html",
+        "gr-verify-status/gr-verify-status-panel.js",
+    ],
+    app = "plugin.html",
 )
diff --git a/gr-verify-status-plugin.html b/gr-verify-status-plugin.html
deleted file mode 100644
index a453cd5..0000000
--- a/gr-verify-status-plugin.html
+++ /dev/null
@@ -1,118 +0,0 @@
-<!--
-Copyright (C) 2019 The Android Open Source Project
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-http://www.apache.org/licenses/LICENSE-2.0
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<dom-module id="verify-status">
-  <script type="text/javascript">
-    if (window.Polymer) {
-      Gerrit.install(function(plugin) {
-          plugin.registerCustomComponent(
-          'change-metadata-item', 'gr-verify-status-panel');
-      });
-    }
-  </script>
-</dom-module>
-
-<dom-module id="gr-verify-status-panel">
-  <template>
-    <style include="gr-form-styles"></style>
-    <style>
-        .u-green {
-            color: #388E3C;
-        }
-        .u-red {
-            color: #D32F2F;
-        }
-    </style>
-    <div id="verify-status">
-        <span class="u-green">Passed: [[verifyStatus.summary.passed]]</span>,
-        <span class="u-red">Failed: [[verifyStatus.summary.failed]]</span>,
-        <span class="u-black">Not done: [[verifyStatus.summary.notdone]]</span>
-    </div>
-    <div class="separatedSection style-scope gr-change-metadata"
-        style="margin-top: 0; padding: 0">
-      <table class="test_result_table">
-        <tbody>
-            <template is="dom-repeat" items="{{verifyStatus.results}}">
-            <tr>
-                <td class="cell verifiedstatus"><a href$="[[item.url]]">[[item.name]]</a></td>
-                <td class="cell verifiedstatus verifiedstatus_value">[[item.value]]</td>
-            </tr>
-            </template>
-        </tbody>
-      </table>
-    </div>
-  </template>
-  <script type="text/javascript">
-    (function() {
-      'use strict';
-      const Defs = {};
-      /**
-       * @typedef {{
-       *   summary: Object,
-       *   results: Array,
-       * }}
-       */
-      Defs.verifyStatus;
-
-      Polymer({
-        is: 'gr-verify-status-panel',
-
-        properties: {
-            verifyStatus: {
-                /** @type {Defs.verifystatus} */
-                type: Object,
-            },
-            revision: {
-                type: Object,
-            },
-            change: {
-                type: Object,
-            }
-        },
-
-        attached() {
-            this._fetchData(this.revision);
-        },
-
-        _fetchData(revision) {
-          if (!revision) return;
-          const query ='/verify-status~verifications?sort=REPORTER&filter=CURRENT';
-          const endpoint = '/changes/' + this.change.id + '/revisions/' +
-                           revision._number + query;
-
-          const errFn = response => {
-              this.fire('page-error', {response});
-          };
-
-          this.plugin.restApi().get(endpoint, errFn).then(r => {
-              let summary = {failed:0, passed:0, notdone:0};
-              let results = [];
-              for (let checkid in r) {
-                  let check= r[checkid];
-                  if (check.value == '0') {
-                      summary.notdone +=1;}
-                  else if (check.value == 1) {
-                      summary.passed +=1;
-                  }
-                  else {
-                      summary.failed +=1;
-                  }
-                  results.push(check);
-              };
-
-              this.verifyStatus = {summary, results};
-          });
-        },
-      });
-    }());
-  </script>
-</dom-module>
diff --git a/gr-verify-status/gr-verify-status-panel.html b/gr-verify-status/gr-verify-status-panel.html
new file mode 100644
index 0000000..e34af9c
--- /dev/null
+++ b/gr-verify-status/gr-verify-status-panel.html
@@ -0,0 +1,45 @@
+<!--
+Copyright (C) 2019 The Android Open Source Project
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<dom-module id="gr-verify-status-panel">
+  <template>
+    <style include="gr-form-styles"></style>
+    <style>
+        .u-green {
+            color: #388E3C;
+        }
+        .u-red {
+            color: #D32F2F;
+        }
+    </style>
+    <div id="gr-verify-status">
+        <span class="u-green">Passed: [[verifyStatus.summary.passed]]</span>,
+        <span class="u-red">Failed: [[verifyStatus.summary.failed]]</span>,
+        <span class="u-black">Not done: [[verifyStatus.summary.notdone]]</span>
+    </div>
+    <div class="separatedSection style-scope gr-change-metadata"
+        style="margin-top: 0; padding: 0">
+      <table class="test_result_table">
+        <tbody>
+            <template is="dom-repeat" items="{{verifyStatus.results}}">
+            <tr>
+                <td class="cell verifiedstatus"><a href$="[[item.url]]">[[item.name]]</a></td>
+                <td class="cell verifiedstatus verifiedstatus_value">[[item.value]]</td>
+            </tr>
+            </template>
+        </tbody>
+      </table>
+    </div>
+  </template>
+  <script src="gr-verify-status-panel.js"></script>
+</dom-module>
diff --git a/gr-verify-status/gr-verify-status-panel.js b/gr-verify-status/gr-verify-status-panel.js
new file mode 100644
index 0000000..bdacdef
--- /dev/null
+++ b/gr-verify-status/gr-verify-status-panel.js
@@ -0,0 +1,75 @@
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+(function() {
+  'use strict';
+  const Defs = {};
+  /**
+   * @typedef {{
+   *   summary: Object,
+   *   results: Array,
+   * }}
+   */
+  Defs.verifyStatus;
+
+  Polymer({
+    is: 'gr-verify-status-panel',
+
+    properties: {
+        verifyStatus: {
+            /** @type {Defs.verifystatus} */
+            type: Object,
+        },
+        revision: {
+            type: Object,
+        },
+        change: {
+            type: Object,
+        }
+    },
+
+    attached() {
+        this._fetchData(this.revision);
+    },
+
+    _fetchData(revision) {
+      if (!revision) return;
+      const query ='/verify-status~verifications?sort=REPORTER&filter=CURRENT';
+      const endpoint = '/changes/' + this.change.id + '/revisions/' +
+                       revision._number + query;
+
+      const errFn = response => {
+          this.fire('page-error', {response});
+      };
+
+      this.plugin.restApi().get(endpoint, errFn).then(r => {
+          let summary = {failed:0, passed:0, notdone:0};
+          let results = [];
+          for (let checkid in r) {
+              let check= r[checkid];
+              if (check.value == '0') {
+                  summary.notdone +=1;}
+              else if (check.value == 1) {
+                  summary.passed +=1;
+              }
+              else {
+                  summary.failed +=1;
+              }
+              results.push(check);
+          };
+
+          this.verifyStatus = {summary, results};
+      });
+    },
+  });
+}());
diff --git a/plugin.html b/plugin.html
new file mode 100644
index 0000000..e1b3d61
--- /dev/null
+++ b/plugin.html
@@ -0,0 +1,28 @@
+<!--
+Copyright (C) 2019 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<link rel="import" href="./gr-verify-status/gr-verify-status-panel.html">
+
+<dom-module id="verify-status">
+  <script>
+    if (window.Polymer) {
+      Gerrit.install(function(plugin) {
+          plugin.registerCustomComponent(
+              'change-metadata-item', 'gr-verify-status-panel');
+      });
+    }
+  </script>
+</dom-module>