Skip to content

Commit 94fdee7

Browse files
committed
MMI-3269 Override report from address
Update DevOps
1 parent e554d0a commit 94fdee7

File tree

15 files changed

+70
-30
lines changed

15 files changed

+70
-30
lines changed

app/editor/src/features/admin/reports/ReportFormSections.tsx

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -123,21 +123,19 @@ export const ReportFormSections = () => {
123123
<Row gap="1rem">
124124
<Col className="frm-in options" flex="1">
125125
<div>
126-
<label>Subject Line Options</label>
126+
<label>Email Options</label>
127127
</div>
128-
<Col>
129-
<p>Customize the email subject line.</p>
130-
<Row alignItems="center">
131-
<Col flex="1">
132-
<FormikText label="Text" name="settings.subject.text" required />
133-
</Col>
134-
<FormikCheckbox
135-
label="Show Today's Date"
136-
name="settings.subject.showTodaysDate"
137-
tooltip="Whether today's date will be included in the report subject line"
138-
/>
139-
</Row>
140-
</Col>
128+
<FormikText label="From" name="settings.from" />
129+
<Row alignItems="center">
130+
<Col flex="1">
131+
<FormikText label="Subject" name="settings.subject.text" required />
132+
</Col>
133+
<FormikCheckbox
134+
label="Show Today's Date"
135+
name="settings.subject.showTodaysDate"
136+
tooltip="Whether today's date will be included in the report subject line"
137+
/>
138+
</Row>
141139
</Col>
142140
<ReportOptions />
143141
</Row>

libs/net/ches/ChesService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public async Task<EmailResponseModel> SendEmailAsync(IEmail email)
228228
{
229229
ArgumentNullException.ThrowIfNull(email);
230230

231-
email.From = this.Options.From ?? email.From;
231+
email.From = !String.IsNullOrWhiteSpace(this.Options.From) ? this.Options.From : email.From;
232232

233233
if (this.Options.BccUser)
234234
{

libs/net/kafka/Models/ReportRequestModel.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ public class ReportRequestModel
5151
/// </summary>
5252
public int? AssignedId { get; set; }
5353

54+
/// <summary>
55+
/// get/set - Email Address that this report will be sent from.
56+
/// </summary>
57+
public string? From { get; set; }
58+
5459
/// <summary>
5560
/// get/set - Comma separated email addresses that this report will be sent to instead of subscribers.
5661
/// </summary>

libs/net/models/Settings/ReportSettingsModel.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ namespace TNO.API.Models.Settings;
66
public class ReportSettingsModel
77
{
88
#region Properties
9+
/// <summary>
10+
/// get/set - The email from address.
11+
/// </summary>
12+
public string From { get; set; } = "";
13+
914
/// <summary>
1015
/// get/set - Subject configuration settings.
1116
/// </summary>
@@ -42,6 +47,7 @@ public ReportSettingsModel() { }
4247

4348
public ReportSettingsModel(Dictionary<string, object> settings, JsonSerializerOptions options)
4449
{
50+
this.From = settings.GetDictionaryJsonValue<string>("from", "", options)!;
4551
this.Subject = settings.GetDictionaryJsonValue<ReportSubjectSettingsModel>("subject", new(), options)!;
4652
this.Headline = settings.GetDictionaryJsonValue<ReportHeadlineSettingsModel>("headline", new(), options)!;
4753
this.Content = settings.GetDictionaryJsonValue<ReportContentSettingsModel>("content", new(), options)!;

libs/net/template/ReportEngine.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ public async Task<string> GenerateBase64ImageAsync(
233233
var optionsBytes = Encoding.UTF8.GetBytes(optionsJson);
234234
var optionsBase64 = Convert.ToBase64String(optionsBytes);
235235

236-
237236
// Send request to Charts API to generate base64
238237
var body = new StringContent(dataJson, Encoding.UTF8, System.Net.Mime.MediaTypeNames.Application.Json);
239238
var width = model.ChartTemplate.SectionSettings.Width.HasValue ? $"width={model.ChartTemplate.SectionSettings.Width.Value}" : "";
@@ -244,7 +243,7 @@ public async Task<string> GenerateBase64ImageAsync(
244243
model.ChartTemplate.SectionSettings.ChartType ?? "bar",
245244
$"?{width}{height}&options={optionsBase64}"),
246245
body);
247-
this.Logger.LogDebug("Chart generated, chartTemplateId:{templateId} options:{options}", model.ChartTemplate.Id, optionsJson);
246+
this.Logger.LogDebug("Chart generated, chartTemplateId:{templateId}", model.ChartTemplate.Id);
248247
return await response.Content.ReadAsStringAsync();
249248
}
250249

@@ -499,7 +498,7 @@ await section.ChartTemplates.ForEachAsync(async chart =>
499498
{
500499
chart.SectionSettings ??= new();
501500
chart.SectionSettings.Options = MergeChartOptions(chart.Settings, chart.SectionSettings);
502-
var chartOptions = chart.SectionSettings.Options.ToJson();
501+
// var chartOptions = chart.SectionSettings.Options.ToJson();
503502

504503
var chartModel = new ChartEngineContentModel(
505504
ReportSectionModel.GenerateChartUid(section.Id, chart.Id),
@@ -508,7 +507,7 @@ await section.ChartTemplates.ForEachAsync(async chart =>
508507
settings.UseAllContent ? null : content);
509508
var chartRequestModel = new ChartRequestModel(chartModel);
510509
var base64Image = await this.GenerateBase64ImageAsync(chartRequestModel);
511-
this.Logger.LogDebug("Chart generated, reportId:{reportId} instanceId:{instanceId} sectionId:{sectionId} chartId:{chartId} options:{options}", report.Id, reportInstance?.Id, section.Id, chart.Id, chartOptions);
510+
this.Logger.LogDebug("Chart generated, reportId:{reportId} instanceId:{instanceId} sectionId:{sectionId} chartId:{chartId}", report.Id, reportInstance?.Id, section.Id, chart.Id);
512511

513512
// Replace Chart Stubs with the generated image.
514513
body = body.Replace(ReportSectionModel.GenerateChartUid(section.Id, chart.Id), base64Image);

libs/npm/core/src/hooks/api/interfaces/IReportSettingsModel.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
} from '.';
77

88
export interface IReportSettingsModel {
9+
from: string;
910
subject: IReportSubjectSettingsModel;
1011
headline: IReportHeadlineSettingsModel;
1112
content: IReportContentSettingsModel;

openshift/kustomize/services/reporting/base/deploy.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,13 @@ spec:
162162
configMapKeyRef:
163163
name: reporting-service
164164
key: TOPICS
165-
166-
# CHES Configuration
167-
- name: CHES__From
165+
- name: Service__DefaultFrom
168166
valueFrom:
169167
configMapKeyRef:
170168
name: ches
171169
key: CHES_FROM
170+
171+
# CHES Configuration
172172
- name: CHES__EmailEnabled
173173
valueFrom:
174174
configMapKeyRef:

openshift/kustomize/shared_resources/overlays/dev/kustomization.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ generatorOptions:
2121
disableNameSuffixHash: true
2222

2323
patches:
24+
- target:
25+
kind: ConfigMap
26+
name: ches
27+
patch: |-
28+
- op: replace
29+
path: /data/CHES_FROM
30+
value: Media Monitoring Insights <dev.mmi@gov.bc.ca>
2431
- target:
2532
kind: ConfigMap
2633
name: keycloak

openshift/kustomize/shared_resources/overlays/prod/kustomization.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ generatorOptions:
2121
disableNameSuffixHash: true
2222

2323
patches:
24+
- target:
25+
kind: ConfigMap
26+
name: ches
27+
patch: |-
28+
- op: replace
29+
path: /data/CHES_FROM
30+
value: Media Monitoring Insights <mmi@gov.bc.ca>
2431
- target:
2532
kind: ConfigMap
2633
name: keycloak

openshift/kustomize/shared_resources/overlays/test/kustomization.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ generatorOptions:
2121
disableNameSuffixHash: true
2222

2323
patches:
24+
- target:
25+
kind: ConfigMap
26+
name: ches
27+
patch: |-
28+
- op: replace
29+
path: /data/CHES_FROM
30+
value: Media Monitoring Insights <test.mmi@gov.bc.ca>
2431
- target:
2532
kind: ConfigMap
2633
name: keycloak

0 commit comments

Comments
 (0)