[alert-manager] Go to silence tab to get an empty silence to populate
Screenshot: https://screenshot.googleplex.com/QmnwkTXYuNd
Bug: skia:9587
Change-Id: If1c15137a694ea73c02be5e97726356abd169363
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/251363
Commit-Queue: Ravi Mistry <rmistry@google.com>
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
diff --git a/am/modules/alert-manager-sk/alert-manager-sk.js b/am/modules/alert-manager-sk/alert-manager-sk.js
index 8afbaf7..3662cc5 100644
--- a/am/modules/alert-manager-sk/alert-manager-sk.js
+++ b/am/modules/alert-manager-sk/alert-manager-sk.js
@@ -315,8 +315,21 @@
if (e.detail.index === 3) {
this._getStats();
}
- this._rhs_state = START;
- this._render();
+ // If tab is silences then display empty silence to populate from scratch.
+ // This will go away if any existing silence is clicked on.
+ if (e.detail.index === 2) {
+ fetch('/_/new_silence', {
+ credentials: 'include',
+ }).then(jsonOrThrow).then((json) => {
+ this._selected = null;
+ this._current_silence = json;
+ this._rhs_state = EDIT_SILENCE;
+ this._render();
+ }).catch(errorMessage);
+ } else {
+ this._rhs_state = START;
+ this._render();
+ }
}
_clickHandler(e) {