Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 87a3d8d1

Přidáno uživatelem Lukáš Vlček před více než 2 roky(ů)

Showing counts of annotations in admin document management

Zobrazit rozdíly:

webapp/pages/documents/admin/index.tsx
3 3

  
4 4
import { useUnauthRedirect } from '../../../hooks';
5 5
import { useRouter } from 'next/router';
6
import { Button, Table, Tag, Typography } from 'antd';
6
import { Button, Table, Typography } from 'antd';
7 7
import { faFileLines, faUser } from '@fortawesome/free-solid-svg-icons';
8 8
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
9 9
import { LoggedUserContext } from '../../../contexts/LoggedUserContext';
10 10
import { MainLayout } from '../../../layouts/MainLayout';
11 11
import AddDocumentModal from '../../../components/modals/AddDocumentModal';
12 12
import {
13
    AnnotationListInfo,
14 13
    DocumentListInfo,
14
    DocumentListResponse,
15 15
    DocumentUserInfo,
16 16
    EState,
17
    UserInfo,
18 17
} from '../../../api';
19
import { documentController, userController } from '../../../controllers';
18
import { documentController } from '../../../controllers';
20 19
import AssignDocumentModal from '../../../components/modals/AssignDocumentModal';
21 20
import { ShowToast } from '../../../utils/alerts';
22 21
import { TableDocInfo } from '../../../components/types/TableDocInfo';
......
25 24
    getNameTruncated,
26 25
    getUserInfoAlt,
27 26
} from '../../../utils/strings';
27
import { ABadge, BadgeStyle } from '../../../components/common/ABadge';
28 28

  
29 29
function AdminDocumentPage() {
30 30
    const redirecting = useUnauthRedirect('/login');
......
86 86
            dataIndex: 'length',
87 87
            key: 'length',
88 88
        },
89
        {
90
            title: 'Dokončeno | přiřazeno | vyžadováno',
91
            key: 'annotationCounts',
92
            render: (
93
                columnData: DocumentListResponse,
94
                record: DocumentListInfo,
95
                index: number
96
            ) => {
97
                const finished =
98
                    record.annotatingUsers?.filter((d) => d.state === EState.Done)
99
                        .length ?? 0;
100

  
101
                return (
102
                    <div>
103
                        <ABadge
104
                            style={
105
                                finished === record.annotatingUsers?.length
106
                                    ? BadgeStyle.SUCCESS
107
                                    : BadgeStyle.WARNING
108
                            }
109
                        >
110
                            {finished}
111
                        </ABadge>
112
                        {' | '}
113
                        <ABadge
114
                            style={
115
                                record.annotatingUsers?.length ===
116
                                record.requiredAnnotations
117
                                    ? BadgeStyle.SUCCESS
118
                                    : BadgeStyle.WARNING
119
                            }
120
                        >
121
                            {record.annotatingUsers?.length}
122
                        </ABadge>
123
                        {' | '}
124
                        <ABadge style={BadgeStyle.GENERAL}>
125
                            {record.requiredAnnotations}
126
                        </ABadge>
127
                    </div>
128
                );
129
            },
130
        },
89 131
        {
90 132
            title: 'Anotátoři',
91 133
            dataIndex: 'annotatingUsers',

Také k dispozici: Unified diff