Skip to content

Commit 828cf04

Browse files
committed
Refactored report IDs in UI code
1 parent 4e8e2ac commit 828cf04

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

ui/components/app.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class App extends LitElement {
4242
return {
4343
component: { type: String },
4444
params: { type: Object },
45-
reportHash: { type: String },
45+
reportId: { type: String },
4646
mailId: { type: String },
4747
};
4848
}
@@ -51,7 +51,7 @@ export class App extends LitElement {
5151
super();
5252
this.component = "dashboard";
5353
this.params = {};
54-
this.reportHash = null;
54+
this.reportId = null;
5555
this.mailId = null;
5656
window.onhashchange = () => this.onHashChange();
5757
this.onHashChange();
@@ -81,10 +81,10 @@ export class App extends LitElement {
8181
this.component = "tlsrpt-reports";
8282
} else if (hash.startsWith("#/dmarc-reports/")) {
8383
this.component = "dmarc-report";
84-
this.reportHash = hash.substring(16);
84+
this.reportId = hash.substring(16);
8585
} else if (hash.startsWith("#/tlsrpt-reports/")) {
8686
this.component = "tlsrpt-report";
87-
this.reportHash = hash.substring(17);
87+
this.reportId = hash.substring(17);
8888
} else if (hash == "#/mails") {
8989
this.component = "mails";
9090
} else if (hash.startsWith("#/mails/")) {
@@ -104,9 +104,9 @@ export class App extends LitElement {
104104
} else if (this.component == "tlsrpt-reports") {
105105
component = html`<drv-tlsrpt-reports .params="${this.params}"></drv-tlsrpt-reports>`;
106106
} else if (this.component == "dmarc-report") {
107-
component = html`<drv-dmarc-report hash="${this.reportHash}"></drv-dmarc-report>`;
107+
component = html`<drv-dmarc-report id="${this.reportId}"></drv-dmarc-report>`;
108108
} else if (this.component == "tlsrpt-report") {
109-
component = html`<drv-tlsrpt-report hash="${this.reportHash}"></drv-tlsrpt-report>`;
109+
component = html`<drv-tlsrpt-report id="${this.reportId}"></drv-tlsrpt-report>`;
110110
} else if (this.component == "mails") {
111111
component = html`<drv-mails .params="${this.params}"></drv-mails>`;
112112
} else if (this.component == "mail") {

ui/components/dmarc-report.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ export class DmarcReport extends LitElement {
66

77
static get properties() {
88
return {
9-
hash: { type: String },
9+
id: { type: String },
1010
mailId: { type: String, attribute: false },
1111
};
1212
}
1313

1414
constructor() {
1515
super();
16-
this.hash = null;
16+
this.id = null;
1717
this.mailId = null;
1818
this.report = null;
1919
this.ip2dns = {};
@@ -22,8 +22,8 @@ export class DmarcReport extends LitElement {
2222
}
2323

2424
async updated(changedProperties) {
25-
if (changedProperties.has("hash") && changedProperties.hash !== this.hash && this.hash) {
26-
const response = await fetch("dmarc-reports/" + this.hash);
25+
if (changedProperties.has("id") && changedProperties.id !== this.id && this.id) {
26+
const response = await fetch("dmarc-reports/" + this.id);
2727
const rwi = await response.json();
2828
this.report = rwi.report;
2929
this.mailId = rwi.mail_id;
@@ -127,8 +127,8 @@ export class DmarcReport extends LitElement {
127127
<h1>Report Details</h1>
128128
<p>
129129
<a class="button" href="#/mails/${this.mailId}">Show Mail</a>
130-
<a class="button" href="/dmarc-reports/${this.hash}/xml" target="_blank">Open XML</a>
131-
<a class="button" href="/dmarc-reports/${this.hash}/json" target="_blank">Open JSON</a>
130+
<a class="button" href="/dmarc-reports/${this.id}/xml" target="_blank">Open XML</a>
131+
<a class="button" href="/dmarc-reports/${this.id}/json" target="_blank">Open JSON</a>
132132
</p>
133133
<table>
134134
<tr>

ui/components/tlsrpt-report.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ export class TlsRptReport extends LitElement {
66

77
static get properties() {
88
return {
9-
hash: { type: String },
9+
id: { type: String },
1010
mailId: { type: String, attribute: false },
1111
};
1212
}
1313

1414
constructor() {
1515
super();
16-
this.hash = null;
16+
this.id = null;
1717
this.mailId = null;
1818
this.report = null;
1919
this.ip2dns = {};
@@ -22,8 +22,8 @@ export class TlsRptReport extends LitElement {
2222
}
2323

2424
async updated(changedProperties) {
25-
if (changedProperties.has("hash") && changedProperties.hash !== this.hash && this.hash) {
26-
const response = await fetch("tlsrpt-reports/" + this.hash);
25+
if (changedProperties.has("id") && changedProperties.id !== this.id && this.id) {
26+
const response = await fetch("tlsrpt-reports/" + this.id);
2727
const rwi = await response.json();
2828
this.report = rwi.report;
2929
this.mailId = rwi.mail_id;
@@ -151,7 +151,7 @@ export class TlsRptReport extends LitElement {
151151
<h1>Report Details</h1>
152152
<p>
153153
<a class="button" href="#/mails/${this.mailId}">Show Mail</a>
154-
<a class="button" href="/tlsrpt-reports/${this.hash}/json" target="_blank">Open JSON</a>
154+
<a class="button" href="/tlsrpt-reports/${this.id}/json" target="_blank">Open JSON</a>
155155
</p>
156156
<table>
157157
<tr>

0 commit comments

Comments
 (0)