From 68e39d93a4a3fbf89c845c61195c64e1583d4ecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Tue, 16 Apr 2024 14:16:26 +0200 Subject: [PATCH] Change: Adjust dashboard dialogs for new UI --- src/web/pages/start/confirmremovedialog.jsx | 26 ++++++------ src/web/pages/start/editdashboarddialog.jsx | 46 ++++++++++----------- src/web/pages/start/newdashboarddialog.jsx | 13 +++--- 3 files changed, 38 insertions(+), 47 deletions(-) diff --git a/src/web/pages/start/confirmremovedialog.jsx b/src/web/pages/start/confirmremovedialog.jsx index e7ec4c53e0..df6bfd8c87 100644 --- a/src/web/pages/start/confirmremovedialog.jsx +++ b/src/web/pages/start/confirmremovedialog.jsx @@ -19,15 +19,14 @@ import React from 'react'; import styled from 'styled-components'; -import _ from 'gmp/locale'; - import PropTypes from 'web/utils/proptypes'; import Dialog from 'web/components/dialog/dialog'; import DialogContent from 'web/components/dialog/content'; -import DialogTitle from 'web/components/dialog/title'; import DialogTwoButtonFooter from 'web/components/dialog/twobuttonfooter'; +import useTranslation from 'web/hooks/useTranslation'; + const Content = styled.div` padding: 5px 15px; `; @@ -37,15 +36,14 @@ const ConfirmRemoveDialog = ({ dashboardId, onConfirm, onDeny, -}) => ( - - {({moveProps}) => ( +}) => { + const [_] = useTranslation(); + return ( + - {_( 'Do you really want to remove the Dashboard {{name}} and its ' + @@ -59,9 +57,9 @@ const ConfirmRemoveDialog = ({ onRightButtonClick={() => onConfirm(dashboardId)} /> - )} - -); + + ); +}; ConfirmRemoveDialog.propTypes = { dashboardId: PropTypes.string.isRequired, diff --git a/src/web/pages/start/editdashboarddialog.jsx b/src/web/pages/start/editdashboarddialog.jsx index 382eda631f..1c18902ac7 100644 --- a/src/web/pages/start/editdashboarddialog.jsx +++ b/src/web/pages/start/editdashboarddialog.jsx @@ -17,8 +17,6 @@ */ import React from 'react'; -import _ from 'gmp/locale'; - import SaveDialog from 'web/components/dialog/savedialog'; import FormGroup from 'web/components/form/formgroup'; @@ -26,6 +24,8 @@ import TextField from 'web/components/form/textfield'; import PropTypes from 'web/utils/proptypes'; +import useTranslation from 'web/hooks/useTranslation'; + import {MAX_TITLE_LENGTH} from './newdashboarddialog'; const EditDashboardDialog = ({ @@ -33,34 +33,32 @@ const EditDashboardDialog = ({ dashboardTitle, onClose, onSave, -}) => ( - - {({values, onValueChange}) => ( - - +}) => { + const [_] = useTranslation(); + return ( + + {({values, onValueChange}) => ( + - - )} - -); + )} + + ); +}; EditDashboardDialog.propTypes = { dashboardId: PropTypes.id.isRequired, @@ -70,5 +68,3 @@ EditDashboardDialog.propTypes = { }; export default EditDashboardDialog; - -// vim: set ts=2 sw=2 tw=80: diff --git a/src/web/pages/start/newdashboarddialog.jsx b/src/web/pages/start/newdashboarddialog.jsx index 0e3b8732d2..da1ec12e4e 100644 --- a/src/web/pages/start/newdashboarddialog.jsx +++ b/src/web/pages/start/newdashboarddialog.jsx @@ -17,8 +17,6 @@ */ import React from 'react'; -import _ from 'gmp/locale'; - import PropTypes from 'web/utils/proptypes'; import SaveDialog from 'web/components/dialog/savedialog'; @@ -45,6 +43,8 @@ import {TasksSeverityDisplay} from 'web/pages/tasks/dashboard/severityclassdispl import {TasksStatusDisplay} from 'web/pages/tasks/dashboard/statusdisplay'; /* eslint-enable max-len */ +import useTranslation from 'web/hooks/useTranslation'; + export const MAX_TITLE_LENGTH = 50; export const DEFAULT_DISPLAYS = [ @@ -82,6 +82,7 @@ const SECINFO_DEFAULT_DISPLAYS = [ const EMPTY_DISPLAYS = []; const NewDashboardDialog = ({additionalDisplayChoices, onClose, onSave}) => { + const [_] = useTranslation(); const defaultDisplayChoices = [ { label: _('Default'), @@ -114,9 +115,6 @@ const NewDashboardDialog = ({additionalDisplayChoices, onClose, onSave}) => { { > {({values, onValueChange}) => ( - + - +