From b172d90b2b59ac55be4e32e461f60ad0ed10e01f Mon Sep 17 00:00:00 2001 From: kat Date: Thu, 17 Sep 2026 12:16:36 +0100 Subject: [PATCH] feat: add import/export buttons for single config file --- admin/src/components/ConfigDiff/index.jsx | 30 ++++++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/admin/src/components/ConfigDiff/index.jsx b/admin/src/components/ConfigDiff/index.jsx index 2599ac9..0d1e533 100644 --- a/admin/src/components/ConfigDiff/index.jsx +++ b/admin/src/components/ConfigDiff/index.jsx @@ -1,6 +1,9 @@ import React from 'react'; +import { useDispatch } from 'react-redux'; +import { Button } from '@strapi/design-system'; import RDV, { DiffMethod } from 'react-diff-viewer-continued'; import { useIntl } from 'react-intl'; +import { getFetchClient, useNotification } from '@strapi/strapi/admin'; /** * An issue with the diff-viewer library causes a difference in the way the library is exported. @@ -23,9 +26,15 @@ import { Grid, Typography, } from '@strapi/design-system'; +import ConfirmModal from '../ConfirmModal'; +import { exportAllConfig, importAllConfig } from '../../state/actions/Config'; const ConfigDiff = ({ oldValue, newValue, configName, trigger }) => { const { formatMessage } = useIntl(); + const dispatch = useDispatch(); + const { toggleNotification } = useNotification(); + const { post, get } = getFetchClient(); + const commonHeadingStyle = { paddingRight: '2rem' }; return ( @@ -40,11 +49,24 @@ const ConfigDiff = ({ oldValue, newValue, configName, trigger }) => { - - {formatMessage({ id: 'config-sync.ConfigDiff.SyncDirectory' })} + + {formatMessage({ id: 'config-sync.ConfigDiff.SyncDirectory' })} + + Import} + onSubmit={(force) => dispatch(importAllConfig([configName], force, toggleNotification, formatMessage, post, get))} + /> - - {formatMessage({ id: 'config-sync.ConfigDiff.Database' })} + + + {formatMessage({ id: 'config-sync.ConfigDiff.Database' })} + + Export} + onSubmit={() => dispatch(exportAllConfig([configName], toggleNotification, formatMessage, post, get))} + />