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

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

@@ -35,8 +35,8 @@ class SearchPage extends React.Component {
       searchResultCount: 0,
       activePage: 1,
       pagingLimit: 10, // change to an appropriate limit number
-      isExcludeUnderUserPage: true,
-      isExcludeUnderTrashPage: true,
+      excludeUsersHome: true,
+      excludeTrash: true,
     };
 
     this.changeURL = this.changeURL.bind(this);
@@ -44,8 +44,8 @@ class SearchPage extends React.Component {
     this.searchHandler = this.searchHandler.bind(this);
     this.selectPage = this.selectPage.bind(this);
     this.toggleCheckBox = this.toggleCheckBox.bind(this);
-    this.switchIncludingUnderUserPage = this.switchIncludingUnderUserPage.bind(this);
-    this.switchIncludingUnderTrashPage = this.switchIncludingUnderTrashPage.bind(this);
+    this.onExcludeUsersHome = this.onExcludeUsersHome.bind(this);
+    this.onExcludeTrash = this.onExcludeTrash.bind(this);
     this.onPagingNumberChanged = this.onPagingNumberChanged.bind(this);
   }
 
@@ -68,12 +68,12 @@ class SearchPage extends React.Component {
     return query;
   }
 
-  switchIncludingUnderUserPage() {
-    this.setState({ isExcludeUnderUserPage: !this.state.isExcludeUnderUserPage });
+  onExcludeUsersHome() {
+    this.setState({ excludeUsersHome: !this.state.excludeUsersHome });
   }
 
-  switchIncludingUnderTrashPage() {
-    this.setState({ isExcludeUnderTrashPage: !this.state.isExcludeUnderTrashPage });
+  onExcludeTrash() {
+    this.setState({ excludeTrash: !this.state.excludeTrash });
   }
 
   changeURL(keyword, refreshHash) {
@@ -91,10 +91,10 @@ class SearchPage extends React.Component {
     let query = keyword;
 
     // pages included in specific path are not retrived when prefix is added
-    if (this.state.isExcludeUnderTrashPage) {
+    if (this.state.excludeTrash) {
       query = `${query} -prefix:${specificPathNames.trash}`;
     }
-    if (this.state.isExcludeUnderUserPage) {
+    if (this.state.excludeUsersHome) {
       query = `${query} -prefix:${specificPathNames.user}`;
     }
 
@@ -224,8 +224,8 @@ class SearchPage extends React.Component {
         searchingKeyword={this.state.searchingKeyword}
         appContainer={this.props.appContainer}
         onSearchInvoked={this.searchHandler}
-        switchIncludingUnderUserPage={this.switchIncludingUnderUserPage}
-        switchIncludingUnderTrashPage={this.switchIncludingUnderTrashPage}
+        onExcludeUsersHome={this.onExcludeUsersHome}
+        onExcludeTrash={this.onExcludeTrash}
       >
       </SearchControl>
     );

+ 4 - 4
packages/app/src/components/SearchPage/FilterOptionModal.tsx

@@ -9,8 +9,8 @@ import {
 type Props = {
   isOpen: boolean,
   onClose: () => void,
-  switchIncludingUnderUserPage?: () => void,
-  switchIncludingUnderTrashPage?: () => void,
+  onExcludeUsersHome?: () => void,
+  onExcludeTrash?: () => void,
 }
 
 // todo: implement filtering search result
@@ -37,7 +37,7 @@ const FilterOptionModal: FC<Props> = (props: Props) => {
               <input
                 className="mr-2"
                 type="checkbox"
-                onClick={props.switchIncludingUnderUserPage}
+                onClick={props.onExcludeUsersHome}
               />
               {t('Include Subordinated Target Page', { target: '/user' })}
             </label>
@@ -47,7 +47,7 @@ const FilterOptionModal: FC<Props> = (props: Props) => {
               <input
                 className="mr-2"
                 type="checkbox"
-                onClick={props.switchIncludingUnderTrashPage}
+                onClick={props.onExcludeTrash}
               />
               {t('Include Subordinated Target Page', { target: '/trash' })}
             </label>

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

@@ -10,8 +10,8 @@ type Props = {
   searchingKeyword: string,
   appContainer: AppContainer,
   onSearchInvoked: (data : any[]) => boolean,
-  switchIncludingUnderUserPage?: () => void,
-  switchIncludingUnderTrashPage?: () => void,
+  onExcludeUsersHome?: () => void,
+  onExcludeTrash?: () => void,
 }
 
 const SearchControl: FC <Props> = (props: Props) => {
@@ -22,15 +22,15 @@ const SearchControl: FC <Props> = (props: Props) => {
   const SearchPageFormTypeAny : any = SearchPageForm;
   const { t } = useTranslation('');
 
-  const switchIncludingUnderUserPage = () => {
-    if (props.switchIncludingUnderUserPage != null) {
-      props.switchIncludingUnderUserPage();
+  const onExcludeUsersHome = () => {
+    if (props.onExcludeUsersHome != null) {
+      props.onExcludeUsersHome();
     }
   };
 
-  const switchIncludingUnderTrashPage = () => {
-    if (props.switchIncludingUnderTrashPage != null) {
-      props.switchIncludingUnderTrashPage();
+  const onExcludeTrash = () => {
+    if (props.onExcludeTrash != null) {
+      props.onExcludeTrash();
     }
   };
 
@@ -62,8 +62,8 @@ const SearchControl: FC <Props> = (props: Props) => {
       <FilterOptionModal
         isOpen={isFileterOptionModalShown || false}
         onClose={closePageRenameModalHandler}
-        switchIncludingUnderUserPage={switchIncludingUnderUserPage}
-        switchIncludingUnderTrashPage={switchIncludingUnderTrashPage}
+        onExcludeUsersHome={onExcludeUsersHome}
+        onExcludeTrash={onExcludeTrash}
       />
     );
   };
@@ -110,7 +110,7 @@ const SearchControl: FC <Props> = (props: Props) => {
                 className="mr-2"
                 type="checkbox"
                 id="flexCheckDefault"
-                onClick={() => switchIncludingUnderUserPage()}
+                onClick={() => onExcludeUsersHome()}
               />
               {t('Include Subordinated Target Page', { target: '/user' })}
             </label>
@@ -121,7 +121,7 @@ const SearchControl: FC <Props> = (props: Props) => {
                 className="mr-2"
                 type="checkbox"
                 id="flexCheckChecked"
-                onClick={() => switchIncludingUnderTrashPage()}
+                onClick={() => onExcludeTrash()}
               />
               {t('Include Subordinated Target Page', { target: '/trash' })}
             </label>