Perf - Fix alert-page-sk. We never saw diffs.
Bug: skia:9219
Change-Id: I15e10c0fadbbb63160b3a0663cfe3ff30962c8fb
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/234056
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
diff --git a/perf/modules/alerts-page-sk/alerts-page-sk.js b/perf/modules/alerts-page-sk/alerts-page-sk.js
index 1f10a33..25cf034 100644
--- a/perf/modules/alerts-page-sk/alerts-page-sk.js
+++ b/perf/modules/alerts-page-sk/alerts-page-sk.js
@@ -134,8 +134,7 @@
const id = +window.location.search.slice(1);
for (const alert of this._alerts) {
if (id === alert.id) {
- this.cfg = alerts[i];
- this._dialog.showModal();
+ this._startEditing(alerts[i]);
break;
}
}
@@ -145,14 +144,17 @@
_add() {
// Load an new Config from the server.
fetch('/_/alert/new').then(jsonOrThrow).then((json) => {
- this.cfg = json;
- // Pop up edit dialog using the new Config.
- this._dialog.showModal();
+ this._startEditing(json);
}).catch(errorMessage);
}
_edit(e) {
- this.cfg = e.target.__config;
+ this._startEditing(e.target.__config);
+ }
+
+ _startEditing(cfg) {
+ this._orig_cfg = JSON.parse(JSON.stringify(this._cfg));
+ this.cfg = cfg;
this._dialog.showModal();
}
@@ -196,7 +198,6 @@
if (this._cfg && !this._cfg.owner) {
this._cfg.owner = this._email;
}
- this._orig_cfg = JSON.parse(JSON.stringify(this._cfg));
this._render();
}