[chumpdetector plugin] Add Makefile.
Bug: 1319718
Change-Id: Idb91521ebed4fa365f7bac6fdb80e673370eae3f
Reviewed-on: https://chromium-review.googlesource.com/c/infra/gerrit-plugins/chumpdetector/+/3609311
Auto-Submit: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
diff --git a/README.md b/README.md
index 9ba9590..5955d9b 100644
--- a/README.md
+++ b/README.md
@@ -91,22 +91,22 @@
## Web Plugin Development
+Run the commands below in web/.
+
For running TypeScript unit tests execute:
- bazel test --test_output=all //plugins/chumpdetector/web:karma_test
+ make test
For checking or fixing eslint formatter problems run:
- bazel test //plugins/chumpdetector/web:lint_test
- bazel run //plugins/chumpdetector/web:lint_bin -- \
- --fix "$(pwd)/plugins/chumpdetector/web"
+ make lint_test
+ make lint_fix
For testing the plugin with
[Gerrit FE Dev Helper](https://gerrit.googlesource.com/gerrit-fe-dev-helper/)
-build the JavaScript bundle and copy it to the `plugins/chumpdetector` folder:
+the command below builds the JavaScript bundle and copies it to the `plugins/chumpdetector` folder:
- bazel build //plugins/chumpdetector/web:chumpdetector
- cp -f bazel-bin/plugins/chumpdetector/web/chumpdetector.js plugins/
+ make build
Start polygerit-ui server:
diff --git a/web/Makefile b/web/Makefile
new file mode 100644
index 0000000..5329ed1
--- /dev/null
+++ b/web/Makefile
@@ -0,0 +1,18 @@
+# Copyright 2022 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+.PHONY: test
+
+test:
+ bazel test --test_output=all //plugins/chumpdetector/web:karma_test
+
+lint_test:
+ bazel test //plugins/chumpdetector/web:lint_test
+
+lint_fix:
+ bazel run //plugins/chumpdetector/web:lint_bin -- --fix "./"
+
+build:
+ bazel build //plugins/chumpdetector/web:chumpdetector && \
+ cp -f ../../../bazel-bin/plugins/chumpdetector/web/chumpdetector.js ../
diff --git a/web/tree-status.ts b/web/tree-status.ts
index e97812d..5c8b417 100644
--- a/web/tree-status.ts
+++ b/web/tree-status.ts
@@ -59,12 +59,17 @@
export class TreeStatus {
private readonly restApi: RestPluginApi;
+
private readonly updateInterval: number;
private config: Config | null = null;
+
private elements: TreeStatusComponents[] = [];
+
private initialized = false;
+
private shouldFetchStatus = false;
+
private status: Status | null = null;
constructor(restApi: RestPluginApi) {