commit 99a58334f368536fbf96cd8cf7f9ab2a6d9810ce
Author: Jaroslav Hrubý <hrubyj@students.zcu.cz>
Date:   Tue May 17 08:42:38 2022 +0200

    Tables - scroll instead pagination, export and delete buttons

diff --git a/webapp/pages/documents/admin/index.tsx b/webapp/pages/documents/admin/index.tsx
index 4d278b8..f447722 100644
--- a/webapp/pages/documents/admin/index.tsx
+++ b/webapp/pages/documents/admin/index.tsx
@@ -3,21 +3,23 @@ import React, { FocusEvent, useContext, useEffect, useState } from 'react';
 
 import { useUnauthRedirect } from '../../../hooks';
 import { useRouter } from 'next/router';
-import { Button, Row, Space, Table, Tag, Typography, Input } from 'antd';
-import { faFileLines, faUser } from '@fortawesome/free-solid-svg-icons';
+import { Button, Input, Row, Space, Table, Tag, Typography } from 'antd';
+import { faArrowsRotate, faFileLines, faUser } from '@fortawesome/free-solid-svg-icons';
 import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
 import { LoggedUserContext } from '../../../contexts/LoggedUserContext';
 import { MainLayout } from '../../../layouts/MainLayout';
 import AddDocumentModal from '../../../components/modals/AddDocumentModal';
 import {
+    DeleteDocumentsRequest,
     DocumentListInfo,
     DocumentListResponse,
     DocumentUserInfo,
     EState,
+    ExportRequest,
 } from '../../../api';
 import { documentController, userController } from '../../../controllers';
 import AssignDocumentModal from '../../../components/modals/AssignDocumentModal';
-import { ShowConfirm, ShowToast } from '../../../utils/alerts';
+import { ShowConfirm, ShowConfirmDelete, ShowToast } from '../../../utils/alerts';
 import { TableDocInfo } from '../../../components/types/TableDocInfo';
 import {
     getAnnotationStateColor,
@@ -32,12 +34,6 @@ import { UserFilter } from '../../../components/types/UserFilter';
 import { getColumnSearchProps, getLocaleProps } from '../../../utils/tableUtils';
 import { SweetAlertIcon } from 'sweetalert2';
 import { Stack } from 'react-bootstrap';
-import { AxiosRequestConfig } from 'axios';
-import { constants } from 'http2';
-import HTTP_STATUS_ACCEPTED = module;
-import HTTP_STATUS_OK = module;
-
-import { faArrowsRotate } from '@fortawesome/free-solid-svg-icons';
 
 import { faCircleCheck, faClock } from '@fortawesome/free-regular-svg-icons';
 import styles from '/styles/Icon.module.scss';
@@ -71,7 +67,7 @@ function AdminDocumentPage() {
         // @ts-ignore
         const filters: UserFilter[] = users?.map((user) => {
             return {
-                text: user.name + ' ' + user.surname,
+                text: user.surname + ' ' + user.name,
                 value: user.username,
             };
         });
@@ -228,6 +224,22 @@ function AdminDocumentPage() {
         }
     };
 
+    const deleteDocuments = () => {
+        const req: DeleteDocumentsRequest = { documentIds: selectedDocs };
+
+        ShowConfirmDelete(() => {
+            documentController.documentsDelete(req).then(() => {
+                ShowToast('Dokumenty byly úspěšně odstraněny');
+                fetchData();
+            });
+        }, 'dokumenty');
+    };
+
+    const exportDocuments = () => {
+        const req: ExportRequest = { documentIds: selectedDocs };
+        documentController.documentsExportPost(req);
+    };
+
     const changeDefaultAnotationCount = (e: FocusEvent<HTMLInputElement>) => {
         documentController.documentsRequiredAnnotationsGlobalPost({
             requiredAnnotations: parseInt(e.currentTarget.value),
@@ -516,12 +528,28 @@ function AdminDocumentPage() {
                     flexDirection: 'row',
                     justifyContent: 'flex-start',
                     gap: '20px',
+                    marginBottom: '20px',
                 }}
             >
                 <Button type={'primary'} onClick={showAddModal}>
                     Nahrát dokument
                 </Button>
 
+                <Button
+                    danger
+                    disabled={!(selectedDocs?.length > 0)}
+                    onClick={() => deleteDocuments()}
+                >
+                    Smazat dokumenty
+                </Button>
+
+                <Button
+                    disabled={!(selectedDocs?.length > 0)}
+                    onClick={() => exportDocuments()}
+                >
+                    Export
+                </Button>
+
                 <div>
                     <Button
                         onClick={showAssignModal}
@@ -568,7 +596,8 @@ function AdminDocumentPage() {
                 columns={columns}
                 dataSource={documents}
                 size="middle"
-                scroll={{ y: 600 }}
+                scroll={{ y: 'calc(65vh - 4em)' }}
+                pagination={false}
             />
         </MainLayout>
     );
diff --git a/webapp/pages/documents/annotator/index.tsx b/webapp/pages/documents/annotator/index.tsx
index 286cb86..54e9789 100644
--- a/webapp/pages/documents/annotator/index.tsx
+++ b/webapp/pages/documents/annotator/index.tsx
@@ -132,7 +132,8 @@ function UserDocumentPage() {
                 // @ts-ignore
                 dataSource={documents}
                 size="small"
-                scroll={{ y: 500 }}
+                scroll={{ y: 'calc(65vh - 4em)' }}
+                pagination={false}
             />
         </MainLayout>
     );
diff --git a/webapp/pages/users/index.tsx b/webapp/pages/users/index.tsx
index 8d1e2dc..8a99d50 100644
--- a/webapp/pages/users/index.tsx
+++ b/webapp/pages/users/index.tsx
@@ -217,7 +217,8 @@ function UsersPage() {
                 // @ts-ignore
                 columns={columns}
                 dataSource={users}
-                scroll={{ y: 800 }}
+                scroll={{ y: 'calc(70vh - 4em)' }}
+                pagination={false}
             />
         </MainLayout>
     );
diff --git a/webapp/yarn.lock b/webapp/yarn.lock
index 90a601c..9cf0171 100644
--- a/webapp/yarn.lock
+++ b/webapp/yarn.lock
@@ -93,6 +93,13 @@
   dependencies:
     "@fortawesome/fontawesome-common-types" "6.1.1"
 
+"@fortawesome/free-regular-svg-icons@^6.1.1":
+  version "6.1.1"
+  resolved "https://registry.yarnpkg.com/@fortawesome/free-regular-svg-icons/-/free-regular-svg-icons-6.1.1.tgz#3f2f58262a839edf0643cbacee7a8a8230061c98"
+  integrity sha512-xXiW7hcpgwmWtndKPOzG+43fPH7ZjxOaoeyooptSztGmJxCAflHZxXNK0GcT0uEsR4jTGQAfGklDZE5NHoBhKg==
+  dependencies:
+    "@fortawesome/fontawesome-common-types" "6.1.1"
+
 "@fortawesome/free-solid-svg-icons@^6.1.1":
   version "6.1.1"
   resolved "https://registry.yarnpkg.com/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-6.1.1.tgz#3369e673f8fe8be2fba30b1ec274d47490a830a6"
