Przeglądaj źródła

Merge pull request #1689 from weseek/feat/1235-user-management-cotrol

add notify comment
N1koge 6 lat temu
rodzic
commit
6b1e6a4e6b

+ 15 - 1
src/client/js/components/Admin/UserManagement.jsx

@@ -37,7 +37,16 @@ class UserManagement extends React.Component {
   }
 
   handleClick(statusType) {
-    if (this.validateToggleStatus(statusType)) this.props.adminUsersContainer.handleClick(statusType);
+    const { adminUsersContainer } = this.props;
+    if (!this.validateToggleStatus(statusType)) {
+      adminUsersContainer.setNotifyComment('You should check at least one checkbox.');
+      return;
+    }
+
+    if (adminUsersContainer.state.notifyComment.length > 0) {
+      adminUsersContainer.setNotifyComment('');
+    }
+    adminUsersContainer.handleClick(statusType);
   }
 
   validateToggleStatus(statusType) {
@@ -66,6 +75,8 @@ class UserManagement extends React.Component {
       </div>
     );
 
+    const notifyComment = (adminUsersContainer.state.notifyComment && <span className="text-warning">{ adminUsersContainer.state.notifyComment }</span>);
+
     const clearButton = (
       adminUsersContainer.state.searchText.length > 0
         ? <i className="icon-close search-clear"></i>
@@ -149,6 +160,9 @@ class UserManagement extends React.Component {
                 Reset
               </button>
             </div>
+
+            <div className="ml-5">{ notifyComment }</div>
+
           </div>
         </div>
 

+ 5 - 0
src/client/js/services/AdminUsersContainer.js

@@ -26,6 +26,7 @@ export default class AdminUsersContainer extends Container {
       pagingLimit: Infinity,
       selectedStatusList: new Set(['All']),
       searchText: '',
+      notifyComment: '',
     };
 
     this.showPasswordResetModal = this.showPasswordResetModal.bind(this);
@@ -40,6 +41,10 @@ export default class AdminUsersContainer extends Container {
     return 'AdminUsersContainer';
   }
 
+  setNotifyComment(notifyComment) {
+    this.setState({ notifyComment });
+  }
+
   isSelected(statusType) {
     return this.state.selectedStatusList.has(statusType);
   }