SULLEY\ryo-h 4 лет назад
Родитель
Сommit
8117835649

+ 12 - 12
packages/app/src/components/SearchPage.jsx

@@ -35,8 +35,8 @@ class SearchPage extends React.Component {
       searchResultCount: 0,
       searchResultCount: 0,
       activePage: 1,
       activePage: 1,
       pagingLimit: 10, // change to an appropriate limit number
       pagingLimit: 10, // change to an appropriate limit number
-      excludeUnderUserPage: true,
-      excludeUnderTrashPage: true,
+      excludeUserPages: true,
+      excludeTrashPages: true,
     };
     };
 
 
     this.changeURL = this.changeURL.bind(this);
     this.changeURL = this.changeURL.bind(this);
@@ -44,8 +44,8 @@ class SearchPage extends React.Component {
     this.searchHandler = this.searchHandler.bind(this);
     this.searchHandler = this.searchHandler.bind(this);
     this.selectPage = this.selectPage.bind(this);
     this.selectPage = this.selectPage.bind(this);
     this.toggleCheckBox = this.toggleCheckBox.bind(this);
     this.toggleCheckBox = this.toggleCheckBox.bind(this);
-    this.switchExcludingUnderUserPageHandler = this.switchExcludingUnderUserPageHandler.bind(this);
-    this.switchExcludingUnderTrashPageHandler = this.switchExcludingUnderTrashPageHandler.bind(this);
+    this.switchExcludingUserPagesHandler = this.switchExcludingUserPagesHandler.bind(this);
+    this.switchExcludingTrashPagesHandler = this.switchExcludingTrashPagesHandler.bind(this);
     this.onPagingNumberChanged = this.onPagingNumberChanged.bind(this);
     this.onPagingNumberChanged = this.onPagingNumberChanged.bind(this);
   }
   }
 
 
@@ -68,12 +68,12 @@ class SearchPage extends React.Component {
     return query;
     return query;
   }
   }
 
 
-  switchExcludingUnderUserPageHandler() {
-    this.setState({ excludeUnderUserPage: !this.state.excludeUnderUserPage });
+  switchExcludingUserPagesHandler() {
+    this.setState({ excludeUserPages: !this.state.excludeUserPages });
   }
   }
 
 
-  switchExcludingUnderTrashPageHandler() {
-    this.setState({ excludeUnderTrashPage: !this.state.excludeUnderTrashPage });
+  switchExcludingTrashPagesHandler() {
+    this.setState({ excludeTrashPages: !this.state.excludeTrashPages });
   }
   }
 
 
   changeURL(keyword, refreshHash) {
   changeURL(keyword, refreshHash) {
@@ -91,10 +91,10 @@ class SearchPage extends React.Component {
     let query = keyword;
     let query = keyword;
 
 
     // pages included in specific path are not retrived when prefix is added
     // pages included in specific path are not retrived when prefix is added
-    if (this.state.excludeUnderTrashPage) {
+    if (this.state.excludeTrashPages) {
       query = `${query} -prefix:${specificPathNames.trash}`;
       query = `${query} -prefix:${specificPathNames.trash}`;
     }
     }
-    if (this.state.excludeUnderUserPage) {
+    if (this.state.excludeUserPages) {
       query = `${query} -prefix:${specificPathNames.user}`;
       query = `${query} -prefix:${specificPathNames.user}`;
     }
     }
 
 
@@ -224,8 +224,8 @@ class SearchPage extends React.Component {
         searchingKeyword={this.state.searchingKeyword}
         searchingKeyword={this.state.searchingKeyword}
         appContainer={this.props.appContainer}
         appContainer={this.props.appContainer}
         onSearchInvoked={this.searchHandler}
         onSearchInvoked={this.searchHandler}
-        onSwitchExcludingUnderUserPageInvoked={this.switchExcludingUnderUserPageHandler}
-        onSwitchExcludingUnderTrashPageInvoked={this.switchExcludingUnderTrashPageHandler}
+        onSwitchExcludingUserPagesInvoked={this.switchExcludingUserPagesHandler}
+        onSwitchExcludingTrashPagesInvoked={this.switchExcludingTrashPagesHandler}
       >
       >
       </SearchControl>
       </SearchControl>
     );
     );

+ 16 - 16
packages/app/src/components/SearchPage/SearchControl.tsx

@@ -3,15 +3,15 @@ import { useTranslation } from 'react-i18next';
 import SearchPageForm from './SearchPageForm';
 import SearchPageForm from './SearchPageForm';
 import AppContainer from '../../client/services/AppContainer';
 import AppContainer from '../../client/services/AppContainer';
 import DeleteSelectedPageGroup from './DeleteSelectedPageGroup';
 import DeleteSelectedPageGroup from './DeleteSelectedPageGroup';
-import FilterOptionModal from './FilterOptionModal';
+import SearchOptionModal from './SearchOptionModal';
 import { CheckboxType } from '../../interfaces/search';
 import { CheckboxType } from '../../interfaces/search';
 
 
 type Props = {
 type Props = {
   searchingKeyword: string,
   searchingKeyword: string,
   appContainer: AppContainer,
   appContainer: AppContainer,
   onSearchInvoked: (data : any[]) => boolean,
   onSearchInvoked: (data : any[]) => boolean,
-  onSwitchExcludingUnderUserPageInvoked?: () => void,
-  onSwitchExcludingUnderTrashPageInvoked?: () => void,
+  onSwitchExcludingUserPagesInvoked?: () => void,
+  onSwitchExcludingTrashPagesInvoked?: () => void,
 }
 }
 
 
 const SearchControl: FC <Props> = (props: Props) => {
 const SearchControl: FC <Props> = (props: Props) => {
@@ -23,14 +23,14 @@ const SearchControl: FC <Props> = (props: Props) => {
   const { t } = useTranslation('');
   const { t } = useTranslation('');
 
 
   const switchExcludingUnderUserPageHandler = () => {
   const switchExcludingUnderUserPageHandler = () => {
-    if (props.onSwitchExcludingUnderUserPageInvoked != null) {
-      props.onSwitchExcludingUnderUserPageInvoked();
+    if (props.onSwitchExcludingUserPagesInvoked != null) {
+      props.onSwitchExcludingUserPagesInvoked();
     }
     }
   };
   };
 
 
   const switchExcludingUnderTrashPageHandler = () => {
   const switchExcludingUnderTrashPageHandler = () => {
-    if (props.onSwitchExcludingUnderTrashPageInvoked != null) {
-      props.onSwitchExcludingUnderTrashPageInvoked();
+    if (props.onSwitchExcludingTrashPagesInvoked != null) {
+      props.onSwitchExcludingTrashPagesInvoked();
     }
     }
   };
   };
 
 
@@ -49,21 +49,21 @@ const SearchControl: FC <Props> = (props: Props) => {
     // ref: https://getbootstrap.com/docs/4.5/components/forms/#checkboxes
     // ref: https://getbootstrap.com/docs/4.5/components/forms/#checkboxes
   };
   };
 
 
-  const openFilterOptionModalHandler = () => {
+  const openSearchOptionModalHandler = () => {
     setIsFileterOptionModalShown(true);
     setIsFileterOptionModalShown(true);
   };
   };
 
 
-  const closeFilterOptionModalHandler = () => {
+  const closeSearchOptionModalHandler = () => {
     setIsFileterOptionModalShown(false);
     setIsFileterOptionModalShown(false);
   };
   };
 
 
-  const rednerFilterOptionModal = () => {
+  const rednerSearchOptionModal = () => {
     return (
     return (
-      <FilterOptionModal
+      <SearchOptionModal
         isOpen={isFileterOptionModalShown || false}
         isOpen={isFileterOptionModalShown || false}
-        onClose={closeFilterOptionModalHandler}
-        onSwitchExcludingUnderUserPageInvoked={switchExcludingUnderUserPageHandler}
-        onSwitchExcludingUnderTrashPageInvoked={switchExcludingUnderTrashPageHandler}
+        onClose={closeSearchOptionModalHandler}
+        onSwitchExcludingUserPagesInvoked={switchExcludingUnderUserPageHandler}
+        onSwitchExcludingTrashPagesInvoked={switchExcludingUnderTrashPageHandler}
       />
       />
     );
     );
   };
   };
@@ -98,7 +98,7 @@ const SearchControl: FC <Props> = (props: Props) => {
           <button
           <button
             type="button"
             type="button"
             className="btn"
             className="btn"
-            onClick={openFilterOptionModalHandler}
+            onClick={openSearchOptionModalHandler}
           >
           >
             <i className="icon-equalizer"></i>
             <i className="icon-equalizer"></i>
           </button>
           </button>
@@ -128,7 +128,7 @@ const SearchControl: FC <Props> = (props: Props) => {
           </div>
           </div>
         </div>
         </div>
       </div>
       </div>
-      {rednerFilterOptionModal()}
+      {rednerSearchOptionModal()}
     </>
     </>
   );
   );
 };
 };