itizawa 6 лет назад
Родитель
Сommit
2d092c1ce2

+ 2 - 1
resource/locales/en-US/translation.json

@@ -613,7 +613,8 @@
     "updated_slackApp": "Succeeded to update Slack App Configuration setting",
     "add_notification_pattern": "Add user trigger notification patterns",
     "delete_notification_pattern": "Delete notification pattern",
-    "delete_notification_pattern_desc": "Once deleted, it cannot be recovered"
+    "delete_notification_pattern_desc1": "Delete Path: {{path}}",
+    "delete_notification_pattern_desc2": "Once deleted, it cannot be recovered"
   },
   "customize_page": {
     "recommended": "Recommended",

+ 2 - 1
resource/locales/ja/translation.json

@@ -596,7 +596,8 @@
     "updated_slackApp": "SlackApp設定を更新しました",
     "add_notification_pattern": "通知パターンを追加しました。",
     "delete_notification_pattern": "通知パターンを削除しました。",
-    "delete_notification_pattern_desc": "Once deleted, it cannot be recovered"
+    "delete_notification_pattern_desc1": "Path: {{path}} を削除します。",
+    "delete_notification_pattern_desc2": "Once deleted, it cannot be recovered"
   },
   "customize_page": {
     "recommended": "おすすめ",

+ 14 - 11
src/client/js/components/Admin/Notification/GlobalNotificationList.jsx

@@ -20,7 +20,7 @@ class GlobalNotificationList extends React.Component {
 
     this.state = {
       isConfirmationModalOpen: false,
-      notificatiionIdForConfiguration: null,
+      notificatiionForConfiguration: null,
     };
 
     this.openConfirmationModal = this.openConfirmationModal.bind(this);
@@ -28,19 +28,19 @@ class GlobalNotificationList extends React.Component {
     this.onClickSubmit = this.onClickSubmit.bind(this);
   }
 
-  openConfirmationModal(notificatiionId) {
-    this.setState({ isConfirmationModalOpen: true, notificatiionIdForConfiguration: notificatiionId });
+  openConfirmationModal(notificatiion) {
+    this.setState({ isConfirmationModalOpen: true, notificatiionForConfiguration: notificatiion });
   }
 
   closeConfirmationModal() {
-    this.setState({ isConfirmationModalOpen: false, notificatiionIdForConfiguration: null });
+    this.setState({ isConfirmationModalOpen: false, notificatiionForConfiguration: null });
   }
 
   async onClickSubmit() {
     const { t, adminNotificationContainer } = this.props;
 
     try {
-      await adminNotificationContainer.deleteGlobalNotificationPattern(this.state.notificatiionIdForConfiguration);
+      await adminNotificationContainer.deleteGlobalNotificationPattern(this.state.notificatiionForConfiguration);
       toastSuccess(t('notification_setting.delete_notification_pattern'));
     }
     catch (err) {
@@ -115,7 +115,7 @@ class GlobalNotificationList extends React.Component {
                         <i className="icon-fw icon-note"></i> {t('Edit')}
                       </a>
                     </li>
-                    <li onClick={() => this.openConfirmationModal(notification._id)}>
+                    <li onClick={() => this.openConfirmationModal(notification)}>
                       <a>
                         <i className="icon-fw icon-fire text-danger"></i> {t('Delete')}
                       </a>
@@ -126,11 +126,14 @@ class GlobalNotificationList extends React.Component {
             </tr>
           );
         })}
-        <NotificationDeleteModal
-          isOpen={this.state.isConfirmationModalOpen}
-          onClose={this.closeConfirmationModal}
-          onClickSubmit={this.onClickSubmit}
-        />;
+        {this.state.notificatiionForConfiguration != null && (
+          <NotificationDeleteModal
+            isOpen={this.state.isConfirmationModalOpen}
+            onClose={this.closeConfirmationModal}
+            onClickSubmit={this.onClickSubmit}
+            notificatiionForConfiguration={this.state.notificatiionForConfiguration}
+          />
+        )}
       </React.Fragment>
     );
 

+ 6 - 3
src/client/js/components/Admin/Notification/NotificationDeleteModal.jsx

@@ -7,8 +7,7 @@ import Modal from 'react-bootstrap/es/Modal';
 class NotificationDeleteModal extends React.PureComponent {
 
   render() {
-    const { t } = this.props;
-
+    const { t, notificatiionForConfiguration } = this.props;
     return (
       <Modal show={this.props.isOpen} onHide={this.props.onClose}>
         <Modal.Header className="modal-header" closeButton>
@@ -19,8 +18,11 @@ class NotificationDeleteModal extends React.PureComponent {
           </Modal.Title>
         </Modal.Header>
         <Modal.Body>
+          <p>
+            {t('notification_setting.delete_notification_pattern_desc1', { path: notificatiionForConfiguration.triggerPath })}
+          </p>
           <span className="text-danger">
-            {t('notification_setting.delete_notification_pattern_desc')}
+            {t('notification_setting.delete_notification_pattern_desc2')}
           </span>
         </Modal.Body>
         <Modal.Footer className="text-right">
@@ -40,6 +42,7 @@ NotificationDeleteModal.propTypes = {
   isOpen: PropTypes.bool.isRequired,
   onClose: PropTypes.func.isRequired,
   onClickSubmit: PropTypes.func.isRequired,
+  notificatiionForConfiguration: PropTypes.object.isRequired,
 };
 
 export default withTranslation()(NotificationDeleteModal);