Skip to content

Commit

Permalink
Fixed: cancel button is not visible when removing a label/attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
bsekachev committed Jul 18, 2024
1 parent 511a2d9 commit 7d023c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
9 changes: 6 additions & 3 deletions cvat-ui/src/components/labels-editor/label-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import React, { RefObject } from 'react';
import { Row, Col } from 'antd/lib/grid';
import Icon, { DeleteOutlined, PlusCircleOutlined } from '@ant-design/icons';
import Icon, { DeleteOutlined, PlusCircleOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
import Input from 'antd/lib/input';
import Button from 'antd/lib/button';
import Checkbox from 'antd/lib/checkbox';
Expand Down Expand Up @@ -416,14 +416,17 @@ export default class LabelForm extends React.Component<Props> {
<CVATTooltip title='Delete the attribute'>
<Form.Item>
<Button
disabled={attr.id >= 0} // temporary disabled, does not work on the server
type='link'
className='cvat-delete-attribute-button'
onClick={(): void => {
if (attr.id >= 0) {
Modal.confirm({
className: 'cvat-modal-delete-label-attribute',
icon: <ExclamationCircleOutlined />,
title: `Do you want to remove the "${attr.name}" attribute?`,
content: 'This action is irreversible. It will remove corresponding annotations.',
content: 'This action is undone. All annotations associated to the attribute will be removed',
type: 'warning',
okButtonProps: { type: 'primary', danger: true },
onOk: () => {
this.removeAttribute(key);
setTimeout(() => {
Expand Down
12 changes: 5 additions & 7 deletions cvat-ui/src/components/labels-editor/labels-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ import './styles.scss';
import React from 'react';
import Tabs from 'antd/lib/tabs';
import Text from 'antd/lib/typography/Text';
import ModalConfirm from 'antd/lib/modal/confirm';
import {
EditOutlined, BuildOutlined, ExclamationCircleOutlined,
} from '@ant-design/icons';
import modal from 'antd/lib/modal';
import { EditOutlined, BuildOutlined, ExclamationCircleOutlined } from '@ant-design/icons';

import { SerializedLabel, SerializedAttribute } from 'cvat-core-wrapper';
import RawViewer from './raw-viewer';
Expand Down Expand Up @@ -160,13 +158,13 @@ export default class LabelsEditor extends React.PureComponent<LabelsEditorProps,
};

if (typeof label.id !== 'undefined' && label.id >= 0) {
ModalConfirm({
modal.confirm({
className: 'cvat-modal-delete-label',
icon: <ExclamationCircleOutlined />,
title: `Do you want to delete "${label.name}" label?`,
content: 'This action is irreversible. Annotation corresponding with this label will be deleted.',
content: 'This action is undone. All annotations associated to the label will be deleted.',
type: 'warning',
okType: 'danger',
okButtonProps: { type: 'primary', danger: true },
onOk() {
deleteLabel();
},
Expand Down

0 comments on commit 7d023c4

Please sign in to comment.