Skip to content

Commit

Permalink
Merge branch 'release/0.6.9' into CE-1273-v3
Browse files Browse the repository at this point in the history
  • Loading branch information
afwilcox authored Dec 7, 2024
2 parents aee011e + de00b07 commit f4d89f9
Show file tree
Hide file tree
Showing 21 changed files with 428 additions and 223 deletions.
8 changes: 4 additions & 4 deletions backend/src/v1/complaint/complaint.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,15 @@ export class ComplaintController {
@Public()
@Post("/staging/action-taken")
@UseGuards(ApiKeyGuard)
stageActionTaken(@Body() action: ActionTaken) {
this.stagingService.stageObject("ACTION-TAKEN", action);
async stageActionTaken(@Body() action: ActionTaken) {
return await this.stagingService.stageObject("ACTION-TAKEN", action);
}

@Public()
@Post("/staging/action-taken-update")
@UseGuards(ApiKeyGuard)
stageActionTakenUpdate(@Body() action: ActionTaken) {
this.stagingService.stageObject("ACTION-TAKEN-UPDATE", action);
async stageActionTakenUpdate(@Body() action: ActionTaken) {
return await this.stagingService.stageObject("ACTION-TAKEN-UPDATE", action);
}

@Public()
Expand Down
4 changes: 2 additions & 2 deletions charts/app/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
{{- $webeocPosition := (get $secretData "webeocPosition" | b64dec | default "") }}
{{- $webeocIncident := (get $secretData "webeocIncident" | b64dec | default "") }}
{{- $webeocUrl := (get $secretData "webeocUrl" | b64dec | default "") }}
{{- $webeocComplaintHistorySeconds := (get $secretData "webeocComplaintHistorySeconds" | b64dec | default "") }}
{{- $webeocCronExpression := (get $secretData "webeocCronExpression" | b64dec | default "") }}
{{- $webeocLogPath := (get $secretData "webeocLogPath" | b64dec | default "") }}
{{- $backupDir := (get $secretData "backupDir" | b64dec | default "") }}
{{- $backupStrategy := (get $secretData "backupStrategy" | b64dec | default "") }}
{{- $numBackups := (get $secretData "numBackups" | b64dec | default "") }}
Expand Down Expand Up @@ -120,8 +120,8 @@ data:
WEBEOC_POSITION: {{ $webeocPosition | b64enc | quote }}
WEBEOC_INCIDENT: {{ $webeocIncident | b64enc | quote }}
WEBEOC_URL: {{ $webeocUrl | b64enc | quote }}
WEBEOC_COMPLAINT_HISTORY_SECONDS: {{ $webeocComplaintHistorySeconds | b64enc | quote }}
WEBEOC_CRON_EXPRESSION: {{ $webeocCronExpression | b64enc | quote }}
WEBEOC_LOG_PATH: {{ $webeocLogPath | b64enc | quote }}
COMPLAINTS_API_KEY: {{ $caseManagementApiKey | b64enc | quote }}
{{- end }}
{{- if not (lookup "v1" "Secret" .Release.Namespace (printf "%s-flyway" .Release.Name)) }}
Expand Down
17 changes: 13 additions & 4 deletions charts/app/templates/webeoc/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ spec:
labels:
{{- include "webeoc.labels" . | nindent 8 }}
spec:
volumes:
- name: {{ include "webeoc.fullname" . }}
persistentVolumeClaim:
claimName: {{ include "webeoc.fullname" . }}
automountServiceAccountToken: false
{{- if .Values.webeoc.podSecurityContext }}
securityContext:
Expand All @@ -33,20 +37,23 @@ spec:
securityContext:
{{- toYaml .Values.webeoc.securityContext | nindent 12 }}
{{- end }}
image: "{{.Values.global.registry}}/{{.Values.global.repository}}/webeoc:{{ .Values.global.tag | default .Chart.AppVersion }}"
image: "{{ .Values.global.registry }}/{{ .Values.global.repository }}/webeoc:{{ .Values.global.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ default "Always" .Values.webeoc.imagePullPolicy }}
envFrom:
- secretRef:
name: {{.Release.Name}}-webeoc
name: {{ .Release.Name }}-webeoc
env:
- name: LOG_LEVEL
value: info
- name: NODE_TLS_REJECT_UNAUTHORIZED
value: "0"
- name: NATS_HOST
value: nats://{{.Release.Name}}-nats:4222
value: nats://{{ .Release.Name }}-nats:4222
- name: COMPLAINTS_MANAGEMENT_API_URL
value: https://{{.Release.Name}}-frontend.apps.silver.devops.gov.bc.ca/api/v1
value: https://{{ .Release.Name }}-frontend.apps.silver.devops.gov.bc.ca/api/v1
volumeMounts:
- name: {{ include "webeoc.fullname" . }}
mountPath: /mnt/data
ports:
- name: http
containerPort: {{ .Values.webeoc.service.targetPort }}
Expand All @@ -69,9 +76,11 @@ spec:
timeoutSeconds: 5
resources: # this is optional
limits:
ephemeral-storage: "25Mi"
cpu: 80m
memory: 150Mi
requests:
ephemeral-storage: "15Mi"
cpu: 40m
memory: 75Mi
{{- with .Values.webeoc.nodeSelector }}
Expand Down
15 changes: 15 additions & 0 deletions charts/app/templates/webeoc/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if .Values.webeoc.enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "webeoc.fullname" . }}
labels:
{{- include "webeoc.labels" . | nindent 4 }}
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: "25Mi"
storageClassName: netapp-file-standard
{{- end }}
2 changes: 1 addition & 1 deletion charts/app/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ global:
webeocPosition: ~
webeocIncident: ~
webeocUrl: ~
webeocComplaintHistorySeconds: ~
webeocCronExpression: ~
webeocLogPath: ~
backupDir: ~
backupStrategy: ~
numBackups: ~
Expand Down
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,8 @@ services:
volumes:
- ./webeoc:/app:z
- /app/node_modules
- ./webeoc/logs:/mnt/data # this is just for the developer webeoc logging
user: root
working_dir: "/app"


Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ const defaultAuthorization: DrugAuthorization = {
date: new Date(),
};

type modalProps = {
title: string;
description: string;
confirmText: string;
cancelText: string;
confirm: () => void | null;
cancel: () => void | null;
};

export const EditOutcome: FC<props> = ({ id, index, outcome, assignedOfficer: officer, agency, update, toggle }) => {
//-- select data from redux
const speciesList = useAppSelector(selectSpeciesCodeDropdown);
Expand All @@ -58,6 +67,18 @@ export const EditOutcome: FC<props> = ({ id, index, outcome, assignedOfficer: of
const showSectionErrors = isInEdit.showSectionErrors;

const [showModal, setShowModal] = useState(false);
const [modalContent, setModalContent] = useState<modalProps>({
title: "",
description: "",
confirmText: "",
cancelText: "",
confirm: () => {
return null;
},
cancel: () => {
return null;
},
});

//-- new input data
const [data, applyData] = useState<AnimalOutcome>({ ...outcome });
Expand Down Expand Up @@ -318,6 +339,14 @@ export const EditOutcome: FC<props> = ({ id, index, outcome, assignedOfficer: of
};

const handleCancel = () => {
setModalContent({
title: "Cancel changes?",
description: "Your changes will be lost.",
confirmText: "No, go back",
cancelText: "Yes, cancel changes",
confirm: close,
cancel: cancel,
});
setShowModal(true);
};
const close = () => {
Expand All @@ -329,16 +358,35 @@ export const EditOutcome: FC<props> = ({ id, index, outcome, assignedOfficer: of
toggle("");
};

const showEditWarning = (onConfirm: Function, onCancel?: Function) => {
setModalContent({
title: "Confirm changes?",
description:
"Editing the outcome or date of this report might affect public reporting statistics. Are you sure you want to continue?",
confirmText: "Yes",
cancelText: "No",
confirm: () => {
if (onConfirm) {
onConfirm();
}
setShowModal(false);
},
cancel: () => {
if (onCancel) {
onCancel();
}
setShowModal(false);
},
});
setShowModal(true);
};

return (
<>
<StandaloneConfirmCancelModal
title="Cancel changes?"
description="Your changes will be lost."
{...modalContent}
show={showModal}
closeAndCancel={cancel}
close={close}
/>

<Card
className="comp-animal-card comp-outcome-report-block"
border={showSectionErrors ? "danger" : "default"}
Expand Down Expand Up @@ -493,8 +541,11 @@ export const EditOutcome: FC<props> = ({ id, index, outcome, assignedOfficer: of
options={outcomes}
enableValidation={false}
placeholder={"Select"}
value={getDropdownOption(data.outcome, outcomes)}
onChange={(evt) => {
updateModel("outcome", evt?.value);
showEditWarning(() => {
updateModel("outcome", evt?.value);
});
}}
defaultOption={getDropdownOption(data.outcome, outcomes)}
/>
Expand Down Expand Up @@ -540,7 +591,9 @@ export const EditOutcome: FC<props> = ({ id, index, outcome, assignedOfficer: of
id="equipment-day-set"
maxDate={new Date()}
onChange={(input: Date) => {
handleOutcomeDateChange(input);
showEditWarning(() => {
handleOutcomeDateChange(input);
});
}}
selectedDate={data?.date}
placeholder={"Select"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@ type props = {
show: boolean;
title: string;
description: string;
close: () => void | null;
closeAndCancel: () => void | null;
confirmText: string;
cancelText: string;
confirm: () => void | null;
cancel: () => void | null;
};

export const StandaloneConfirmCancelModal: FC<props> = ({ show, title, description, close, closeAndCancel }) => {
export const StandaloneConfirmCancelModal: FC<props> = ({
show,
title,
description,
confirmText,
cancelText,
confirm,
cancel,
}) => {
return (
<Modal
show={show}
Expand All @@ -34,11 +44,11 @@ export const StandaloneConfirmCancelModal: FC<props> = ({ show, title, descripti
<Modal.Footer>
<Button
variant="outline-primary"
onClick={close}
onClick={confirm}
>
No, go back
{confirmText}
</Button>
<Button onClick={closeAndCancel}>Yes, cancel changes</Button>
<Button onClick={cancel}>{cancelText}</Button>
</Modal.Footer>
</Modal>
);
Expand Down
16 changes: 16 additions & 0 deletions terraform/alerts_prod.tf
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,20 @@ resource "sysdig_monitor_alert_v2_prometheus" "nr_database_prod_storage_usage" {
service = "NatCom Database"
app = "NatCom"
}
}
resource "sysdig_monitor_alert_v2_prometheus" "nr_webeoc_prod_storage_usage" {
name = "Prod Webeoc Custom Log Storage Alert"
description = "Alert when the PVC storage usage is too high"
severity = "high"
query = "sysdig_fs_used_percent{kube_cluster_name=\"silver\",kube_namespace_name=\"c1c7ed-prod\",kube_deployment_name=\"nr-compliance-enforcement-prod-webeoc\"} > 70"
enabled = true
duration_seconds = 600
notification_channels {
id = sysdig_monitor_notification_channel_email.prod_environment_alerts.id
renotify_every_minutes = 120
}
labels = {
service = "NatCom Webeoc"
app = "NatCom"
}
}
16 changes: 16 additions & 0 deletions terraform/alerts_test.tf
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,20 @@ resource "sysdig_monitor_alert_v2_prometheus" "nr_database_test_storage_usage" {
service = "NatCom Database"
app = "NatCom"
}
}
resource "sysdig_monitor_alert_v2_prometheus" "nr_webeoc_test_storage_usage" {
name = "Test Webeoc Custom Log Storage Alert"
description = "Alert when the PVC storage usage is too high"
severity = "high"
query = "sysdig_fs_used_percent{kube_cluster_name=\"silver\",kube_namespace_name=\"c1c7ed-test\",kube_deployment_name=\"nr-compliance-enforcement-test-webeoc\"} > 70"
enabled = true
duration_seconds = 600
notification_channels {
id = sysdig_monitor_notification_channel_email.test_environment_alerts.id
renotify_every_minutes = 120
}
labels = {
service = "NatCom Webeoc"
app = "NatCom"
}
}
4 changes: 2 additions & 2 deletions terraform/channels.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource "sysdig_monitor_notification_channel_email" "test_environment_alerts" {
name = "Team Wolverine - Test Environment Alerts"
recipients = ["[email protected]"]
recipients = ["[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]"]
enabled = true
notify_when_ok = true
notify_when_resolved = true
Expand All @@ -9,7 +9,7 @@ resource "sysdig_monitor_notification_channel_email" "test_environment_alerts" {
}
resource "sysdig_monitor_notification_channel_email" "prod_environment_alerts" {
name = "Team Wolverine - Prod Environment Alerts"
recipients = ["[email protected]"]
recipients = ["[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]"]
enabled = true
notify_when_ok = true
notify_when_resolved = true
Expand Down
22 changes: 0 additions & 22 deletions webeoc/.eslintrc.js

This file was deleted.

6 changes: 4 additions & 2 deletions webeoc/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
/node_modules

# Logs
logs
*.log
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Include the log directory for local development but ignore all the logs inside of it
!/logs/
logs/*.log

# OS
.DS_Store

Expand Down
7 changes: 7 additions & 0 deletions webeoc/src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ export const STREAMS = {
ACTIONS_TAKEN: "actions",
};

export const OPERATIONS = {
COMPLAINT: "Complaint(s)",
COMPLAINT_UPDATE: "Complaint Update(s)",
ACTION_TAKEN: "Action(s) Taken",
ACTION_TAKEN_UPDATE: "Action Taken Update(s)",
};

export const STREAM_TOPICS = {
COMPLAINTS: "new_complaints",
STAGING_COMPLAINTS: "new_staging_complaints",
Expand Down
Loading

0 comments on commit f4d89f9

Please sign in to comment.