Add react i18next to console
Signed-off-by: Jonathan <contact@grafikart.fr>
This commit is contained in:
@@ -18,9 +18,9 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
import { promisifyMutation, sprintf } from "@probo/helpers";
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { promisifyMutation } from "@probo/helpers";
|
||||
import { useConfirm } from "@probo/ui";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useMutation } from "react-relay";
|
||||
import { graphql } from "relay-runtime";
|
||||
|
||||
@@ -163,11 +163,11 @@ export const useDeleteAsset = (
|
||||
) => {
|
||||
const [mutate] = useMutation<AssetGraphDeleteMutation>(deleteAssetMutation);
|
||||
const confirm = useConfirm();
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return () => {
|
||||
if (!asset.id || !asset.name) {
|
||||
return alert(__("Failed to delete asset: missing id or name"));
|
||||
return alert(t("assetGraph.errors.deleteMissingIdOrName"));
|
||||
}
|
||||
confirm(
|
||||
() =>
|
||||
@@ -180,12 +180,7 @@ export const useDeleteAsset = (
|
||||
},
|
||||
}),
|
||||
{
|
||||
message: sprintf(
|
||||
__(
|
||||
"This will permanently delete \"%s\". This action cannot be undone.",
|
||||
),
|
||||
asset.name,
|
||||
),
|
||||
message: t("assetGraph.deleteConfirmation", { name: asset.name }),
|
||||
},
|
||||
);
|
||||
};
|
||||
@@ -193,7 +188,7 @@ export const useDeleteAsset = (
|
||||
|
||||
export const useCreateAsset = (connectionId: string) => {
|
||||
const [mutate, isMutating] = useMutation<AssetGraphCreateMutation>(createAssetMutation);
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return [
|
||||
(input: {
|
||||
@@ -206,18 +201,16 @@ export const useCreateAsset = (connectionId: string) => {
|
||||
dataTypesStored: string;
|
||||
}) => {
|
||||
if (!input.name?.trim()) {
|
||||
return alert(__("Failed to create asset: name is required"));
|
||||
return alert(t("assetGraph.errors.createNameRequired"));
|
||||
}
|
||||
if (!input.ownerId) {
|
||||
return alert(__("Failed to create asset: owner is required"));
|
||||
return alert(t("assetGraph.errors.createOwnerRequired"));
|
||||
}
|
||||
if (!input.organizationId) {
|
||||
return alert(__("Failed to create asset: organization is required"));
|
||||
return alert(t("assetGraph.errors.createOrganizationRequired"));
|
||||
}
|
||||
if (!input.dataTypesStored) {
|
||||
return alert(
|
||||
__("Failed to create asset: data types stored is required"),
|
||||
);
|
||||
return alert(t("assetGraph.errors.createDataTypesStoredRequired"));
|
||||
}
|
||||
|
||||
return promisifyMutation(mutate)({
|
||||
@@ -240,7 +233,7 @@ export const useCreateAsset = (connectionId: string) => {
|
||||
};
|
||||
|
||||
export const useUpdateAsset = () => {
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
const [mutate] = useMutation<AssetGraphUpdateMutation>(updateAssetMutation);
|
||||
|
||||
return (input: {
|
||||
@@ -253,7 +246,7 @@ export const useUpdateAsset = () => {
|
||||
thirdPartyIds?: string[];
|
||||
}) => {
|
||||
if (!input.id) {
|
||||
return alert(__("Failed to update asset: asset ID is required"));
|
||||
return alert(t("assetGraph.errors.updateIdRequired"));
|
||||
}
|
||||
|
||||
return promisifyMutation(mutate)({
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
import { promisifyMutation, sprintf } from "@probo/helpers";
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { promisifyMutation } from "@probo/helpers";
|
||||
import { useConfirm } from "@probo/ui";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useMutation } from "react-relay";
|
||||
import { graphql } from "relay-runtime";
|
||||
|
||||
@@ -148,10 +148,10 @@ export const useDeleteAudit = (
|
||||
connectionId: string,
|
||||
onSuccess?: () => void,
|
||||
) => {
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
const [mutate] = useMutationWithToasts(deleteAuditMutation, {
|
||||
successMessage: __("Audit deleted successfully"),
|
||||
errorMessage: __("Failed to delete audit"),
|
||||
successMessage: t("auditGraph.messages.deleted"),
|
||||
errorMessage: t("auditGraph.errors.delete"),
|
||||
});
|
||||
const confirm = useConfirm();
|
||||
|
||||
@@ -169,12 +169,7 @@ export const useDeleteAudit = (
|
||||
onSuccess?.();
|
||||
},
|
||||
{
|
||||
message: sprintf(
|
||||
__(
|
||||
"This will permanently delete the audit for %s. This action cannot be undone.",
|
||||
),
|
||||
audit.framework?.name ?? "",
|
||||
),
|
||||
message: t("auditGraph.deleteConfirmation", { frameworkName: audit.framework?.name ?? "" }),
|
||||
},
|
||||
);
|
||||
};
|
||||
@@ -183,7 +178,7 @@ export const useDeleteAudit = (
|
||||
export const useCreateAudit = (connectionId: string) => {
|
||||
// eslint-disable-next-line relay/generated-typescript-types
|
||||
const [mutate] = useMutation(createAuditMutation);
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (input: {
|
||||
organizationId: string;
|
||||
@@ -196,10 +191,10 @@ export const useCreateAudit = (connectionId: string) => {
|
||||
file?: File | null;
|
||||
}) => {
|
||||
if (!input.organizationId) {
|
||||
return alert(__("Failed to create audit: organization is required"));
|
||||
return alert(t("auditGraph.errors.createOrganizationRequired"));
|
||||
}
|
||||
if (!input.frameworkId) {
|
||||
return alert(__("Failed to create audit: framework is required"));
|
||||
return alert(t("auditGraph.errors.createFrameworkRequired"));
|
||||
}
|
||||
|
||||
return promisifyMutation(mutate)({
|
||||
@@ -224,7 +219,7 @@ export const useCreateAudit = (connectionId: string) => {
|
||||
export const useUpdateAudit = () => {
|
||||
// eslint-disable-next-line relay/generated-typescript-types
|
||||
const [mutate] = useMutation(updateAuditMutation);
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (input: {
|
||||
id: string;
|
||||
@@ -234,7 +229,7 @@ export const useUpdateAudit = () => {
|
||||
state?: string;
|
||||
}) => {
|
||||
if (!input.id) {
|
||||
return alert(__("Failed to update audit: audit ID is required"));
|
||||
return alert(t("auditGraph.errors.updateIdRequired"));
|
||||
}
|
||||
|
||||
return promisifyMutation(mutate)({
|
||||
@@ -263,15 +258,15 @@ export const uploadAuditReportMutation = graphql`
|
||||
`;
|
||||
|
||||
export const useUploadAuditReport = () => {
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
const [mutate, isLoading] = useMutationWithToasts(uploadAuditReportMutation, {
|
||||
successMessage: __("Audit report uploaded successfully"),
|
||||
errorMessage: __("Failed to upload audit report"),
|
||||
successMessage: t("auditGraph.messages.reportUploaded"),
|
||||
errorMessage: t("auditGraph.errors.uploadReport"),
|
||||
});
|
||||
|
||||
const uploadAuditReport = (input: { auditId: string; file: File }) => {
|
||||
if (!input.auditId) {
|
||||
return alert(__("Failed to upload report: audit ID is required"));
|
||||
return alert(t("auditGraph.errors.uploadReportIdRequired"));
|
||||
}
|
||||
|
||||
return mutate({
|
||||
@@ -308,10 +303,10 @@ export const deleteAuditReportMutation = graphql`
|
||||
`;
|
||||
|
||||
export const useDeleteAuditReport = () => {
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
const [mutate] = useMutationWithToasts(deleteAuditReportMutation, {
|
||||
successMessage: __("Audit report deleted successfully"),
|
||||
errorMessage: __("Failed to delete audit report"),
|
||||
successMessage: t("auditGraph.messages.reportDeleted"),
|
||||
errorMessage: t("auditGraph.errors.deleteReport"),
|
||||
});
|
||||
|
||||
return (input: { auditId: string }) => {
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
import { promisifyMutation, sprintf } from "@probo/helpers";
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { promisifyMutation } from "@probo/helpers";
|
||||
import { useConfirm } from "@probo/ui";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useMutation } from "react-relay";
|
||||
import { graphql } from "relay-runtime";
|
||||
|
||||
@@ -154,11 +154,11 @@ export const useDeleteDatum = (
|
||||
// eslint-disable-next-line relay/generated-typescript-types
|
||||
const [mutate] = useMutation(deleteDatumMutation);
|
||||
const confirm = useConfirm();
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return () => {
|
||||
if (!datum.id || !datum.name) {
|
||||
return alert(__("Failed to delete data: missing id or name"));
|
||||
return alert(t("datumGraph.errors.deleteMissingIdOrName"));
|
||||
}
|
||||
confirm(
|
||||
() =>
|
||||
@@ -171,12 +171,7 @@ export const useDeleteDatum = (
|
||||
},
|
||||
}),
|
||||
{
|
||||
message: sprintf(
|
||||
__(
|
||||
"This will permanently delete \"%s\". This action cannot be undone.",
|
||||
),
|
||||
datum.name,
|
||||
),
|
||||
message: t("datumGraph.deleteConfirmation", { name: datum.name }),
|
||||
},
|
||||
);
|
||||
};
|
||||
@@ -185,7 +180,7 @@ export const useDeleteDatum = (
|
||||
export const useCreateDatum = (connectionId: string) => {
|
||||
// eslint-disable-next-line relay/generated-typescript-types
|
||||
const [mutate] = useMutation(createDatumMutation);
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (input: {
|
||||
name: string;
|
||||
@@ -195,13 +190,13 @@ export const useCreateDatum = (connectionId: string) => {
|
||||
thirdPartyIds?: string[];
|
||||
}) => {
|
||||
if (!input.name?.trim()) {
|
||||
return alert(__("Failed to create data: name is required"));
|
||||
return alert(t("datumGraph.errors.createNameRequired"));
|
||||
}
|
||||
if (!input.ownerId) {
|
||||
return alert(__("Failed to create data: owner is required"));
|
||||
return alert(t("datumGraph.errors.createOwnerRequired"));
|
||||
}
|
||||
if (!input.organizationId) {
|
||||
return alert(__("Failed to create data: organization is required"));
|
||||
return alert(t("datumGraph.errors.createOrganizationRequired"));
|
||||
}
|
||||
|
||||
return promisifyMutation(mutate)({
|
||||
@@ -216,7 +211,7 @@ export const useCreateDatum = (connectionId: string) => {
|
||||
export const useUpdateDatum = () => {
|
||||
// eslint-disable-next-line relay/generated-typescript-types
|
||||
const [mutate] = useMutation(updateDatumMutation);
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (input: {
|
||||
id: string;
|
||||
@@ -226,7 +221,7 @@ export const useUpdateDatum = () => {
|
||||
thirdPartyIds?: string[];
|
||||
}) => {
|
||||
if (!input.id) {
|
||||
return alert(__("Failed to update data: missing id"));
|
||||
return alert(t("datumGraph.errors.updateMissingId"));
|
||||
}
|
||||
|
||||
return promisifyMutation(mutate)({
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { graphql } from "relay-runtime";
|
||||
|
||||
import type { DocumentGraphBulkExportDocumentsMutation } from "#/__generated__/core/DocumentGraphBulkExportDocumentsMutation.graphql";
|
||||
@@ -40,13 +40,13 @@ const deleteDocumentMutation = graphql`
|
||||
`;
|
||||
|
||||
export function useDeleteDocumentMutation() {
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return useMutationWithToasts<DocumentGraphDeleteMutation>(
|
||||
deleteDocumentMutation,
|
||||
{
|
||||
successMessage: __("Document deleted successfully."),
|
||||
errorMessage: __("Failed to delete document"),
|
||||
successMessage: t("documentGraph.messages.deleted"),
|
||||
errorMessage: t("documentGraph.errors.delete"),
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -62,11 +62,11 @@ const bulkDeleteDocumentsMutation = graphql`
|
||||
`;
|
||||
|
||||
export function useBulkDeleteDocumentsMutation() {
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return useMutationWithToasts(bulkDeleteDocumentsMutation, {
|
||||
successMessage: __("Documents deleted successfully."),
|
||||
errorMessage: __("Failed to delete documents"),
|
||||
successMessage: t("documentGraph.messages.bulkDeleted"),
|
||||
errorMessage: t("documentGraph.errors.bulkDelete"),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -81,15 +81,13 @@ const bulkExportDocumentsMutation = graphql`
|
||||
`;
|
||||
|
||||
export function useBulkExportDocumentsMutation() {
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return useMutationWithToasts<DocumentGraphBulkExportDocumentsMutation>(
|
||||
bulkExportDocumentsMutation,
|
||||
{
|
||||
successMessage: __(
|
||||
"Document export started successfully. You will receive an email when the export is ready.",
|
||||
),
|
||||
errorMessage: __("Failed to start document export"),
|
||||
successMessage: t("documentGraph.messages.exportStarted"),
|
||||
errorMessage: t("documentGraph.errors.export"),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -18,10 +18,9 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
import { sprintf } from "@probo/helpers";
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { useConfirm } from "@probo/ui";
|
||||
import { useCallback } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { graphql } from "relay-runtime";
|
||||
|
||||
import { useMutationWithToasts } from "../useMutationWithToasts";
|
||||
@@ -68,12 +67,12 @@ export const useDeleteFrameworkMutation = (
|
||||
framework: { id: string; name: string },
|
||||
connectionId: string,
|
||||
) => {
|
||||
const { t } = useTranslation();
|
||||
const [commitDelete] = useMutationWithToasts(deleteFrameworkMutation, {
|
||||
errorMessage: "Failed to delete framework",
|
||||
successMessage: "Framework deleted successfully",
|
||||
errorMessage: t("frameworkGraph.errors.delete"),
|
||||
successMessage: t("frameworkGraph.messages.deleted"),
|
||||
});
|
||||
const confirm = useConfirm();
|
||||
const { __ } = useTranslate();
|
||||
|
||||
return useCallback(
|
||||
(options?: { onSuccess?: () => void }) => {
|
||||
@@ -90,16 +89,13 @@ export const useDeleteFrameworkMutation = (
|
||||
});
|
||||
},
|
||||
{
|
||||
message: sprintf(
|
||||
__(
|
||||
"This will permanently delete framework \"%s\". This action cannot be undone.",
|
||||
),
|
||||
framework.name,
|
||||
),
|
||||
message: t("frameworkGraph.deleteConfirmation", {
|
||||
name: framework.name,
|
||||
}),
|
||||
},
|
||||
);
|
||||
},
|
||||
[framework, connectionId, commitDelete, confirm, __],
|
||||
[framework, connectionId, commitDelete, confirm, t],
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { graphql } from "relay-runtime";
|
||||
|
||||
import type { MeasureGraphDeleteMutation } from "#/__generated__/core/MeasureGraphDeleteMutation.graphql";
|
||||
@@ -39,13 +39,13 @@ const deleteMeasureMutation = graphql`
|
||||
`;
|
||||
|
||||
export function useDeleteMeasureMutation() {
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return useMutationWithToasts<MeasureGraphDeleteMutation>(
|
||||
deleteMeasureMutation,
|
||||
{
|
||||
successMessage: __("Measure deleted successfully."),
|
||||
errorMessage: __("Failed to delete measure"),
|
||||
successMessage: t("measureGraph.messages.deleted"),
|
||||
errorMessage: t("measureGraph.errors.delete"),
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -61,10 +61,10 @@ const measureUpdateMutation = graphql`
|
||||
`;
|
||||
|
||||
export const useUpdateMeasure = () => {
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return useMutationWithToasts(measureUpdateMutation, {
|
||||
successMessage: __("Measure updated successfully."),
|
||||
errorMessage: __("Failed to update measure"),
|
||||
successMessage: t("measureGraph.messages.updated"),
|
||||
errorMessage: t("measureGraph.errors.update"),
|
||||
});
|
||||
};
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
// SOFTWARE.
|
||||
|
||||
import { promisifyMutation } from "@probo/helpers";
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { useConfirm } from "@probo/ui";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useMutation } from "react-relay";
|
||||
import { graphql } from "relay-runtime";
|
||||
|
||||
@@ -149,10 +149,10 @@ export const useDeleteObligation = (
|
||||
obligation: { id: string },
|
||||
connectionId: string,
|
||||
) => {
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
const [mutate] = useMutationWithToasts(deleteObligationMutation, {
|
||||
successMessage: __("Obligation deleted successfully"),
|
||||
errorMessage: __("Failed to delete obligation"),
|
||||
successMessage: t("obligationGraph.messages.deleted"),
|
||||
errorMessage: t("obligationGraph.errors.delete"),
|
||||
});
|
||||
const confirm = useConfirm();
|
||||
|
||||
@@ -168,9 +168,7 @@ export const useDeleteObligation = (
|
||||
},
|
||||
}),
|
||||
{
|
||||
message: __(
|
||||
"This will permanently delete this obligation. This action cannot be undone.",
|
||||
),
|
||||
message: t("obligationGraph.deleteConfirmation"),
|
||||
},
|
||||
);
|
||||
};
|
||||
@@ -179,7 +177,7 @@ export const useDeleteObligation = (
|
||||
export const useCreateObligation = (connectionId: string) => {
|
||||
// eslint-disable-next-line relay/generated-typescript-types
|
||||
const [mutate] = useMutation(createObligationMutation);
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (input: {
|
||||
organizationId: string;
|
||||
@@ -195,10 +193,10 @@ export const useCreateObligation = (connectionId: string) => {
|
||||
status: string;
|
||||
}) => {
|
||||
if (!input.organizationId) {
|
||||
return alert(__("Failed to create obligation: organization is required"));
|
||||
return alert(t("obligationGraph.errors.createOrganizationRequired"));
|
||||
}
|
||||
if (!input.ownerId) {
|
||||
return alert(__("Failed to create obligation: owner is required"));
|
||||
return alert(t("obligationGraph.errors.createOwnerRequired"));
|
||||
}
|
||||
|
||||
return promisifyMutation(mutate)({
|
||||
@@ -225,7 +223,7 @@ export const useCreateObligation = (connectionId: string) => {
|
||||
export const useUpdateObligation = () => {
|
||||
// eslint-disable-next-line relay/generated-typescript-types
|
||||
const [mutate] = useMutation(updateObligationMutation);
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (input: {
|
||||
id: string;
|
||||
@@ -241,7 +239,7 @@ export const useUpdateObligation = () => {
|
||||
status?: string;
|
||||
}) => {
|
||||
if (!input.id) {
|
||||
return alert(__("Failed to update obligation: ID is required"));
|
||||
return alert(t("obligationGraph.errors.updateIdRequired"));
|
||||
}
|
||||
|
||||
return promisifyMutation(mutate)({
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
import { promisifyMutation, sprintf } from "@probo/helpers";
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { promisifyMutation } from "@probo/helpers";
|
||||
import { useConfirm } from "@probo/ui";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useMutation } from "react-relay";
|
||||
import { graphql } from "relay-runtime";
|
||||
|
||||
@@ -272,10 +272,10 @@ export const useDeleteProcessingActivity = (
|
||||
processingActivity: { id: string; name: string },
|
||||
connectionId: string,
|
||||
) => {
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
const [mutate] = useMutationWithToasts(deleteProcessingActivityMutation, {
|
||||
successMessage: __("Processing activity deleted successfully"),
|
||||
errorMessage: __("Failed to delete processing activity"),
|
||||
successMessage: t("processingActivityGraph.messages.deleted"),
|
||||
errorMessage: t("processingActivityGraph.errors.delete"),
|
||||
});
|
||||
const confirm = useConfirm();
|
||||
|
||||
@@ -291,12 +291,9 @@ export const useDeleteProcessingActivity = (
|
||||
},
|
||||
}),
|
||||
{
|
||||
message: sprintf(
|
||||
__(
|
||||
"This will permanently delete the processing activity %s. This action cannot be undone.",
|
||||
),
|
||||
processingActivity.name,
|
||||
),
|
||||
message: t("processingActivityGraph.deleteConfirmation", {
|
||||
name: processingActivity.name,
|
||||
}),
|
||||
},
|
||||
);
|
||||
};
|
||||
@@ -305,7 +302,7 @@ export const useDeleteProcessingActivity = (
|
||||
export const useCreateProcessingActivity = (connectionId?: string) => {
|
||||
// eslint-disable-next-line relay/generated-typescript-types
|
||||
const [mutate] = useMutation(createProcessingActivityMutation);
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (input: {
|
||||
organizationId: string;
|
||||
@@ -332,12 +329,12 @@ export const useCreateProcessingActivity = (connectionId?: string) => {
|
||||
}) => {
|
||||
if (!input.organizationId) {
|
||||
return alert(
|
||||
__("Failed to create processing activity: organization is required"),
|
||||
t("processingActivityGraph.errors.createOrganizationRequired"),
|
||||
);
|
||||
}
|
||||
if (!input.name) {
|
||||
return alert(
|
||||
__("Failed to create processing activity: name is required"),
|
||||
t("processingActivityGraph.errors.createNameRequired"),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -376,7 +373,7 @@ export const useCreateProcessingActivity = (connectionId?: string) => {
|
||||
export const useUpdateProcessingActivity = () => {
|
||||
// eslint-disable-next-line relay/generated-typescript-types
|
||||
const [mutate] = useMutation(updateProcessingActivityMutation);
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (input: {
|
||||
id: string;
|
||||
@@ -402,7 +399,7 @@ export const useUpdateProcessingActivity = () => {
|
||||
thirdPartyIds?: string[];
|
||||
}) => {
|
||||
if (!input.id) {
|
||||
return alert(__("Failed to update processing activity: ID is required"));
|
||||
return alert(t("processingActivityGraph.errors.updateIdRequired"));
|
||||
}
|
||||
|
||||
return promisifyMutation(mutate)({
|
||||
@@ -489,7 +486,7 @@ export const deleteDataProtectionImpactAssessmentMutation = graphql`
|
||||
export const useCreateDataProtectionImpactAssessment = () => {
|
||||
// eslint-disable-next-line relay/generated-typescript-types
|
||||
const [mutate] = useMutation(createDataProtectionImpactAssessmentMutation);
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (input: {
|
||||
processingActivityId: string;
|
||||
@@ -501,7 +498,7 @@ export const useCreateDataProtectionImpactAssessment = () => {
|
||||
}) => {
|
||||
if (!input.processingActivityId) {
|
||||
return alert(
|
||||
__("Failed to create DPIA: Processing Activity ID is required"),
|
||||
t("processingActivityGraph.errors.createDpiaProcessingActivityIdRequired"),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -516,7 +513,7 @@ export const useCreateDataProtectionImpactAssessment = () => {
|
||||
export const useUpdateDataProtectionImpactAssessment = () => {
|
||||
// eslint-disable-next-line relay/generated-typescript-types
|
||||
const [mutate] = useMutation(updateDataProtectionImpactAssessmentMutation);
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (input: {
|
||||
id: string;
|
||||
@@ -527,7 +524,7 @@ export const useUpdateDataProtectionImpactAssessment = () => {
|
||||
residualRisk?: ProcessingActivityDPIAResidualRisk;
|
||||
}) => {
|
||||
if (!input.id) {
|
||||
return alert(__("Failed to update DPIA: ID is required"));
|
||||
return alert(t("processingActivityGraph.errors.updateDpiaIdRequired"));
|
||||
}
|
||||
|
||||
return promisifyMutation(mutate)({
|
||||
@@ -542,12 +539,12 @@ export const useDeleteDataProtectionImpactAssessment = (
|
||||
dpia: { id: string },
|
||||
options?: { onSuccess?: () => void },
|
||||
) => {
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
const [mutate] = useMutationWithToasts(
|
||||
deleteDataProtectionImpactAssessmentMutation,
|
||||
{
|
||||
successMessage: __("DPIA deleted successfully"),
|
||||
errorMessage: __("Failed to delete DPIA"),
|
||||
successMessage: t("processingActivityGraph.messages.dpiaDeleted"),
|
||||
errorMessage: t("processingActivityGraph.errors.deleteDpia"),
|
||||
},
|
||||
);
|
||||
const confirm = useConfirm();
|
||||
@@ -564,9 +561,7 @@ export const useDeleteDataProtectionImpactAssessment = (
|
||||
onSuccess: options?.onSuccess,
|
||||
}),
|
||||
{
|
||||
message: __(
|
||||
"This will permanently delete this Data Protection Impact Assessment. This action cannot be undone.",
|
||||
),
|
||||
message: t("processingActivityGraph.dpiaDeleteConfirmation"),
|
||||
},
|
||||
);
|
||||
};
|
||||
@@ -648,7 +643,7 @@ export const deleteTransferImpactAssessmentMutation = graphql`
|
||||
export const useCreateTransferImpactAssessment = () => {
|
||||
// eslint-disable-next-line relay/generated-typescript-types
|
||||
const [mutate] = useMutation(createTransferImpactAssessmentMutation);
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (input: {
|
||||
processingActivityId: string;
|
||||
@@ -660,7 +655,7 @@ export const useCreateTransferImpactAssessment = () => {
|
||||
}) => {
|
||||
if (!input.processingActivityId) {
|
||||
return alert(
|
||||
__("Failed to create TIA: Processing Activity ID is required"),
|
||||
t("processingActivityGraph.errors.createTiaProcessingActivityIdRequired"),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -675,7 +670,7 @@ export const useCreateTransferImpactAssessment = () => {
|
||||
export const useUpdateTransferImpactAssessment = () => {
|
||||
// eslint-disable-next-line relay/generated-typescript-types
|
||||
const [mutate] = useMutation(updateTransferImpactAssessmentMutation);
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (input: {
|
||||
id: string;
|
||||
@@ -686,7 +681,7 @@ export const useUpdateTransferImpactAssessment = () => {
|
||||
supplementaryMeasures?: string;
|
||||
}) => {
|
||||
if (!input.id) {
|
||||
return alert(__("Failed to update TIA: ID is required"));
|
||||
return alert(t("processingActivityGraph.errors.updateTiaIdRequired"));
|
||||
}
|
||||
|
||||
return promisifyMutation(mutate)({
|
||||
@@ -701,12 +696,12 @@ export const useDeleteTransferImpactAssessment = (
|
||||
tia: { id: string },
|
||||
options?: { onSuccess?: () => void },
|
||||
) => {
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
const [mutate] = useMutationWithToasts(
|
||||
deleteTransferImpactAssessmentMutation,
|
||||
{
|
||||
successMessage: __("TIA deleted successfully"),
|
||||
errorMessage: __("Failed to delete TIA"),
|
||||
successMessage: t("processingActivityGraph.messages.tiaDeleted"),
|
||||
errorMessage: t("processingActivityGraph.errors.deleteTia"),
|
||||
},
|
||||
);
|
||||
const confirm = useConfirm();
|
||||
@@ -723,9 +718,7 @@ export const useDeleteTransferImpactAssessment = (
|
||||
onSuccess: options?.onSuccess,
|
||||
}),
|
||||
{
|
||||
message: __(
|
||||
"This will permanently delete this Transfer Impact Assessment. This action cannot be undone.",
|
||||
),
|
||||
message: t("processingActivityGraph.tiaDeleteConfirmation"),
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
import { promisifyMutation, sprintf } from "@probo/helpers";
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { promisifyMutation } from "@probo/helpers";
|
||||
import { useConfirm } from "@probo/ui";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useMutation } from "react-relay";
|
||||
import { graphql } from "relay-runtime";
|
||||
|
||||
@@ -126,10 +126,10 @@ export const useDeleteRightsRequest = (
|
||||
request: { id: string },
|
||||
connectionId: string,
|
||||
) => {
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
const [mutate] = useMutationWithToasts(deleteRightsRequestMutation, {
|
||||
successMessage: __("Rights request deleted successfully"),
|
||||
errorMessage: __("Failed to delete rights request"),
|
||||
successMessage: t("rightsRequestGraph.messages.deleted"),
|
||||
errorMessage: t("rightsRequestGraph.errors.delete"),
|
||||
});
|
||||
const confirm = useConfirm();
|
||||
|
||||
@@ -145,11 +145,7 @@ export const useDeleteRightsRequest = (
|
||||
},
|
||||
}),
|
||||
{
|
||||
message: sprintf(
|
||||
__(
|
||||
"This will permanently delete the rights request. This action cannot be undone.",
|
||||
),
|
||||
),
|
||||
message: t("rightsRequestGraph.deleteConfirmation"),
|
||||
},
|
||||
);
|
||||
};
|
||||
@@ -158,7 +154,7 @@ export const useDeleteRightsRequest = (
|
||||
export const useCreateRightsRequest = (connectionId: string) => {
|
||||
// eslint-disable-next-line relay/generated-typescript-types
|
||||
const [mutate] = useMutation(createRightsRequestMutation);
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (input: {
|
||||
organizationId: string;
|
||||
@@ -172,17 +168,17 @@ export const useCreateRightsRequest = (connectionId: string) => {
|
||||
}) => {
|
||||
if (!input.organizationId) {
|
||||
return alert(
|
||||
__("Failed to create rights request: organization is required"),
|
||||
t("rightsRequestGraph.errors.createOrganizationRequired"),
|
||||
);
|
||||
}
|
||||
if (!input.requestType) {
|
||||
return alert(
|
||||
__("Failed to create rights request: request type is required"),
|
||||
t("rightsRequestGraph.errors.createRequestTypeRequired"),
|
||||
);
|
||||
}
|
||||
if (!input.requestState) {
|
||||
return alert(
|
||||
__("Failed to create rights request: request state is required"),
|
||||
t("rightsRequestGraph.errors.createRequestStateRequired"),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -207,7 +203,7 @@ export const useCreateRightsRequest = (connectionId: string) => {
|
||||
export const useUpdateRightsRequest = () => {
|
||||
// eslint-disable-next-line relay/generated-typescript-types
|
||||
const [mutate] = useMutation(updateRightsRequestMutation);
|
||||
const { __ } = useTranslate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (input: {
|
||||
id: string;
|
||||
@@ -220,7 +216,7 @@ export const useUpdateRightsRequest = () => {
|
||||
actionTaken?: string;
|
||||
}) => {
|
||||
if (!input.id) {
|
||||
return alert(__("Failed to update rights request: ID is required"));
|
||||
return alert(t("rightsRequestGraph.errors.updateIdRequired"));
|
||||
}
|
||||
|
||||
return promisifyMutation(mutate)({
|
||||
|
||||
Reference in New Issue
Block a user