From 1fc7e45f51f638d3b4497d92dbf00f5b7f237e22 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Mon, 9 Dec 2019 10:10:40 +0300 Subject: [PATCH] Copy JOB info to clibpard --- cvat-ui/src/components/task-page/job-list.tsx | 32 +++++++++++++++++-- cvat-ui/src/stylesheet.css | 8 +++++ cvat-ui/src/utils/copy-to-clipboard.ts | 8 +++++ 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 cvat-ui/src/utils/copy-to-clipboard.ts diff --git a/cvat-ui/src/components/task-page/job-list.tsx b/cvat-ui/src/components/task-page/job-list.tsx index ad13707d..ab738b38 100644 --- a/cvat-ui/src/components/task-page/job-list.tsx +++ b/cvat-ui/src/components/task-page/job-list.tsx @@ -3,16 +3,19 @@ import React from 'react'; import { Row, Col, + Icon, Table, + Button, + Tooltip, } from 'antd'; import Text from 'antd/lib/typography/Text'; -import Title from 'antd/lib/typography/Title'; import moment from 'moment'; import UserSelector from './user-selector'; import getCore from '../../core'; +import copyToClipboard from '../../utils/copy-to-clipboard'; const core = getCore(); @@ -123,7 +126,32 @@ export default function JobListComponent(props: Props): JSX.Element {
- Jobs + Jobs + + + diff --git a/cvat-ui/src/stylesheet.css b/cvat-ui/src/stylesheet.css index 4c3c2b34..e8772391 100644 --- a/cvat-ui/src/stylesheet.css +++ b/cvat-ui/src/stylesheet.css @@ -435,6 +435,12 @@ background: white; } +.cvat-task-job-list > div:nth-child(1) > div:nth-child(1) { + display: -webkit-box; + display: -ms-flexbox; + display: flex; +} + .cvat-task-top-bar { margin-top: 20px; margin-bottom: 10px; @@ -590,6 +596,8 @@ textarea.ant-input.cvat-raw-labels-viewer { .ant-typography.cvat-jobs-header { margin-bottom: 0px; + font-size: 20px; + font-weight: bold; } /* Pagination in center */ diff --git a/cvat-ui/src/utils/copy-to-clipboard.ts b/cvat-ui/src/utils/copy-to-clipboard.ts new file mode 100644 index 00000000..561b25d1 --- /dev/null +++ b/cvat-ui/src/utils/copy-to-clipboard.ts @@ -0,0 +1,8 @@ +export default function copyToClipboard(str: string): void { + const el = document.createElement('textarea'); + el.value = str; + document.body.appendChild(el); + el.select(); + document.execCommand('copy'); + document.body.removeChild(el); +}