فهرست منبع

disable feature to archive pages

yusuketk 5 سال پیش
والد
کامیت
70794eb6d9
3فایلهای تغییر یافته به همراه111 افزوده شده و 106 حذف شده
  1. 29 26
      src/client/js/components/Page/PageShareManagement.jsx
  2. 2 1
      src/server/models/index.js
  3. 80 79
      src/server/routes/apiv3/page.js

+ 29 - 26
src/client/js/components/Page/PageShareManagement.jsx

@@ -9,21 +9,23 @@ import AppContainer from '../../services/AppContainer';
 import PageContainer from '../../services/PageContainer';
 import OutsideShareLinkModal from '../OutsideShareLinkModal';
 
-import ArchiveCreateModal from '../ArchiveCreateModal';
+// TODO GW-2746 bulk export pages
+// import ArchiveCreateModal from '../ArchiveCreateModal';
 
 const PageShareManagement = (props) => {
   const { t, appContainer, pageContainer } = props;
 
+  // TODO GW-2746 bulk export pages
+  // eslint-disable-next-line no-unused-vars
   const { path, pageId } = pageContainer.state;
   const { currentUser } = appContainer;
 
   const [isOutsideShareLinkModalShown, setIsOutsideShareLinkModalShown] = useState(false);
 
-  const [isArchiveCreateModalShown, setIsArchiveCreateModalShown] = useState(false);
-
-  const [totalPages, setTotalPages] = useState(null);
-
-  const [errorMessage, setErrorMessage] = useState(null);
+  // TODO GW-2746 bulk export pages
+  // const [isArchiveCreateModalShown, setIsArchiveCreateModalShown] = useState(false);
+  // const [totalPages, setTotalPages] = useState(null);
+  // const [errorMessage, setErrorMessage] = useState(null);
 
   function openOutsideShareLinkModalHandler() {
     setIsOutsideShareLinkModalShown(true);
@@ -33,15 +35,16 @@ const PageShareManagement = (props) => {
     setIsOutsideShareLinkModalShown(false);
   }
 
-  async function getArchivePageData() {
-    try {
-      const res = await appContainer.apiv3Get('page/count-children-pages', { pageId });
-      setTotalPages(res.data.dummy);
-    }
-    catch (err) {
-      setErrorMessage(t('export_bulk.failed_to_count_pages'));
-    }
-  }
+  // TODO GW-2746 bulk export pages
+  // async function getArchivePageData() {
+  //   try {
+  //     const res = await appContainer.apiv3Get('page/count-children-pages', { pageId });
+  //     setTotalPages(res.data.dummy);
+  //   }
+  //   catch (err) {
+  //     setErrorMessage(t('export_bulk.failed_to_count_pages'));
+  //   }
+  // }
 
   async function exportPageHandler(format) {
     const { pageId, revisionId } = pageContainer.state;
@@ -52,16 +55,15 @@ const PageShareManagement = (props) => {
   }
 
   // TODO GW-2746 create api to bulk export pages
-  // eslint-disable-next-line no-unused-vars
-  function openArchiveModalHandler() {
-    setIsArchiveCreateModalShown(true);
-    getArchivePageData();
-  }
-
+  // function openArchiveModalHandler() {
+  //   setIsArchiveCreateModalShown(true);
+  //   getArchivePageData();
+  // }
 
-  function closeArchiveCreateModalHandler() {
-    setIsArchiveCreateModalShown(false);
-  }
+  // TODO GW-2746 create api to bulk export pages
+  // function closeArchiveCreateModalHandler() {
+  //   setIsArchiveCreateModalShown(false);
+  // }
 
 
   function renderModals() {
@@ -76,13 +78,14 @@ const PageShareManagement = (props) => {
           onClose={closeOutsideShareLinkModalHandler}
         />
 
-        <ArchiveCreateModal
+        {/* TODO GW-2746 bulk export pages */}
+        {/* <ArchiveCreateModal
           isOpen={isArchiveCreateModalShown}
           onClose={closeArchiveCreateModalHandler}
           path={path}
           errorMessage={errorMessage}
           totalPages={totalPages}
-        />
+        /> */}
       </>
     );
   }

+ 2 - 1
src/server/models/index.js

@@ -1,7 +1,8 @@
 module.exports = {
   Config: require('./config'),
   Page: require('./page'),
-  PageArchive: require('./page-archive'),
+  // TODO GW-2746 bulk export pages
+  // PageArchive: require('./page-archive'),
   PageTagRelation: require('./page-tag-relation'),
   User: require('./user'),
   ExternalAccount: require('./external-account'),

+ 80 - 79
src/server/routes/apiv3/page.js

@@ -253,85 +253,86 @@ module.exports = (crowi) => {
     return stream.pipe(res);
   });
 
-  /**
-   * @swagger
-   *
-   *    /page/archive:
-   *      post:
-   *        tags: [Page]
-   *        summary: /page/archive
-   *        description: create page archive
-   *        requestBody:
-   *          content:
-   *            application/json:
-   *              schema:
-   *                properties:
-   *                  rootPagePath:
-   *                    type: string
-   *                    description: path of the root page
-   *                  isCommentDownload:
-   *                    type: boolean
-   *                    description: whether archive data contains comments
-   *                  isAttachmentFileDownload:
-   *                    type: boolean
-   *                    description: whether archive data contains attachments
-   *                  isSubordinatedPageDownload:
-   *                    type: boolean
-   *                    description: whether archive data children pages
-   *                  fileType:
-   *                    type: string
-   *                    description: file type of archive data(.md, .pdf)
-   *                  hierarchyType:
-   *                    type: string
-   *                    description: method of select children pages archive data contains('allSubordinatedPage', 'decideHierarchy')
-   *                  hierarchyValue:
-   *                    type: number
-   *                    description: depth of hierarchy(use when hierarchyType is 'decideHierarchy')
-   *        responses:
-   *          200:
-   *            description: create page archive
-   *            content:
-   *              application/json:
-   *                schema:
-   *                  $ref: '#/components/schemas/Page'
-   */
-  router.post('/archive', accessTokenParser, loginRequired, csrf, validator.archive, apiV3FormValidator, async(req, res) => {
-    const PageArchive = crowi.model('PageArchive');
-
-    const {
-      rootPagePath,
-      isCommentDownload,
-      isAttachmentFileDownload,
-      fileType,
-    } = req.body;
-    const owner = req.user._id;
-
-    const numOfPages = 1; // TODO 最終的にzipファイルに取り込むページ数を入れる
-
-    const createdPageArchive = PageArchive.create({
-      owner,
-      fileType,
-      rootPagePath,
-      numOfPages,
-      hasComment: isCommentDownload,
-      hasAttachment: isAttachmentFileDownload,
-    });
-
-    console.log(createdPageArchive);
-    return res.apiv3({ });
-
-  });
-
-  router.get('/count-children-pages', accessTokenParser, loginRequired, async(req, res) => {
-
-    // TO DO implement correct number at another task
-
-    const { pageId } = req.query;
-    console.log(pageId);
-
-    const dummy = 6;
-    return res.apiv3({ dummy });
-  });
+  // TODO GW-2746 bulk export pages
+  // /**
+  //  * @swagger
+  //  *
+  //  *    /page/archive:
+  //  *      post:
+  //  *        tags: [Page]
+  //  *        summary: /page/archive
+  //  *        description: create page archive
+  //  *        requestBody:
+  //  *          content:
+  //  *            application/json:
+  //  *              schema:
+  //  *                properties:
+  //  *                  rootPagePath:
+  //  *                    type: string
+  //  *                    description: path of the root page
+  //  *                  isCommentDownload:
+  //  *                    type: boolean
+  //  *                    description: whether archive data contains comments
+  //  *                  isAttachmentFileDownload:
+  //  *                    type: boolean
+  //  *                    description: whether archive data contains attachments
+  //  *                  isSubordinatedPageDownload:
+  //  *                    type: boolean
+  //  *                    description: whether archive data children pages
+  //  *                  fileType:
+  //  *                    type: string
+  //  *                    description: file type of archive data(.md, .pdf)
+  //  *                  hierarchyType:
+  //  *                    type: string
+  //  *                    description: method of select children pages archive data contains('allSubordinatedPage', 'decideHierarchy')
+  //  *                  hierarchyValue:
+  //  *                    type: number
+  //  *                    description: depth of hierarchy(use when hierarchyType is 'decideHierarchy')
+  //  *        responses:
+  //  *          200:
+  //  *            description: create page archive
+  //  *            content:
+  //  *              application/json:
+  //  *                schema:
+  //  *                  $ref: '#/components/schemas/Page'
+  //  */
+  // router.post('/archive', accessTokenParser, loginRequired, csrf, validator.archive, apiV3FormValidator, async(req, res) => {
+  //   const PageArchive = crowi.model('PageArchive');
+
+  //   const {
+  //     rootPagePath,
+  //     isCommentDownload,
+  //     isAttachmentFileDownload,
+  //     fileType,
+  //   } = req.body;
+  //   const owner = req.user._id;
+
+  //   const numOfPages = 1; // TODO 最終的にzipファイルに取り込むページ数を入れる
+
+  //   const createdPageArchive = PageArchive.create({
+  //     owner,
+  //     fileType,
+  //     rootPagePath,
+  //     numOfPages,
+  //     hasComment: isCommentDownload,
+  //     hasAttachment: isAttachmentFileDownload,
+  //   });
+
+  //   console.log(createdPageArchive);
+  //   return res.apiv3({ });
+
+  // });
+
+  // router.get('/count-children-pages', accessTokenParser, loginRequired, async(req, res) => {
+
+  //   // TO DO implement correct number at another task
+
+  //   const { pageId } = req.query;
+  //   console.log(pageId);
+
+  //   const dummy = 6;
+  //   return res.apiv3({ dummy });
+  // });
 
   return router;
 };