IO-1366 Audit Logging for Production Alert
This commit is contained in:
@@ -108,6 +108,14 @@ export function JobsDetailHeaderActions({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: job.id,
|
||||||
|
operation: AuditTrailMapping.alertToggle(
|
||||||
|
!!job.production_vars && !!job.production_vars.alert
|
||||||
|
? !job.production_vars.alert
|
||||||
|
: true
|
||||||
|
),
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSuspend = (e) => {
|
const handleSuspend = (e) => {
|
||||||
|
|||||||
@@ -1,12 +1,23 @@
|
|||||||
import { ExclamationCircleFilled } from "@ant-design/icons";
|
import { ExclamationCircleFilled } from "@ant-design/icons";
|
||||||
|
import { useMutation } from "@apollo/client";
|
||||||
import { Dropdown, Menu } from "antd";
|
import { Dropdown, Menu } from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useMutation } from "@apollo/client";
|
import { connect } from "react-redux";
|
||||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
|
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||||
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
|
|
||||||
export default function ProductionListColumnAlert({ record }) {
|
const mapStateToProps = createStructuredSelector({});
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
insertAuditTrail: ({ jobid, operation }) =>
|
||||||
|
dispatch(insertAuditTrail({ jobid, operation })),
|
||||||
|
});
|
||||||
|
|
||||||
|
export function ProductionListColumnAlert({ record, insertAuditTrail }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const [updateAlert] = useMutation(UPDATE_JOB);
|
const [updateAlert] = useMutation(UPDATE_JOB);
|
||||||
@@ -27,6 +38,14 @@ export default function ProductionListColumnAlert({ record }) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
});
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: record.id,
|
||||||
|
operation: AuditTrailMapping.alertToggle(
|
||||||
|
!!record.production_vars && !!record.production_vars.alert
|
||||||
|
? !record.production_vars.alert
|
||||||
|
: true
|
||||||
|
),
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
if (record.refetch) record.refetch();
|
if (record.refetch) record.refetch();
|
||||||
});
|
});
|
||||||
@@ -58,3 +77,8 @@ export default function ProductionListColumnAlert({ record }) {
|
|||||||
</Dropdown>
|
</Dropdown>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(ProductionListColumnAlert);
|
||||||
|
|||||||
@@ -103,6 +103,7 @@
|
|||||||
"admin_jobmarkforreexport": "ADMIN: Job marked for re-export.",
|
"admin_jobmarkforreexport": "ADMIN: Job marked for re-export.",
|
||||||
"admin_jobuninvoice": "ADMIN: Job has been uninvoiced.",
|
"admin_jobuninvoice": "ADMIN: Job has been uninvoiced.",
|
||||||
"admin_jobunvoid": "ADMIN: Job has been unvoided.",
|
"admin_jobunvoid": "ADMIN: Job has been unvoided.",
|
||||||
|
"alerttoggle": "Alert Toggle set to {{status}}",
|
||||||
"appointmentcancel": "Appointment canceled. Lost Reason: {{lost_sale_reason}}.",
|
"appointmentcancel": "Appointment canceled. Lost Reason: {{lost_sale_reason}}.",
|
||||||
"appointmentinsert": "Appointment created. Appointment Date: {{start}}.",
|
"appointmentinsert": "Appointment created. Appointment Date: {{start}}.",
|
||||||
"billposted": "Bill with invoice number {{invoice_number}} posted.",
|
"billposted": "Bill with invoice number {{invoice_number}} posted.",
|
||||||
|
|||||||
@@ -103,6 +103,7 @@
|
|||||||
"admin_jobmarkforreexport": "",
|
"admin_jobmarkforreexport": "",
|
||||||
"admin_jobuninvoice": "",
|
"admin_jobuninvoice": "",
|
||||||
"admin_jobunvoid": "",
|
"admin_jobunvoid": "",
|
||||||
|
"alerttoggle": "",
|
||||||
"appointmentcancel": "",
|
"appointmentcancel": "",
|
||||||
"appointmentinsert": "",
|
"appointmentinsert": "",
|
||||||
"billposted": "",
|
"billposted": "",
|
||||||
|
|||||||
@@ -103,6 +103,7 @@
|
|||||||
"admin_jobmarkforreexport": "",
|
"admin_jobmarkforreexport": "",
|
||||||
"admin_jobuninvoice": "",
|
"admin_jobuninvoice": "",
|
||||||
"admin_jobunvoid": "",
|
"admin_jobunvoid": "",
|
||||||
|
"alerttoggle": "",
|
||||||
"appointmentcancel": "",
|
"appointmentcancel": "",
|
||||||
"appointmentinsert": "",
|
"appointmentinsert": "",
|
||||||
"billposted": "",
|
"billposted": "",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import i18n from "i18next";
|
import i18n from "i18next";
|
||||||
|
|
||||||
const AuditTrailMapping = {
|
const AuditTrailMapping = {
|
||||||
|
alertToggle: (status) => i18n.t("audit_trail.messages.alerttoggle", { status }),
|
||||||
appointmentcancel: (lost_sale_reason) =>
|
appointmentcancel: (lost_sale_reason) =>
|
||||||
i18n.t("audit_trail.messages.appointmentcancel", { lost_sale_reason }),
|
i18n.t("audit_trail.messages.appointmentcancel", { lost_sale_reason }),
|
||||||
appointmentinsert: (start) =>
|
appointmentinsert: (start) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user