diff --git a/Backend/Backend/Controllers/TagController.cs b/Backend/Backend/Controllers/TagController.cs index 1c88e718f2828a295433e709041946f57db7900d..33c7c38cfea891f77cadf98398b7c760be114c71 100644 --- a/Backend/Backend/Controllers/TagController.cs +++ b/Backend/Backend/Controllers/TagController.cs @@ -30,7 +30,7 @@ public class TagController : Common.CommonControllerBase [Authorize] [ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(TagTreeResponse))] [ProducesResponseType((int)HttpStatusCode.Forbidden)] - public ActionResult<DocumentListResponse> GetTagTree([FromServices] ClientInfo clientInfo) + public ActionResult<TagTreeResponse> GetTagTree([FromServices] ClientInfo clientInfo) { if (clientInfo.LoggedUser == null) { diff --git a/Backend/Models/Tags/TagInfo.cs b/Backend/Models/Tags/TagInfo.cs index 839b2a2e2c9d6809f8ac4e0b57985aabb122ec41..b2606ac758827db263b3aa45eccbb1a578a6f400 100644 --- a/Backend/Models/Tags/TagInfo.cs +++ b/Backend/Models/Tags/TagInfo.cs @@ -7,5 +7,6 @@ public string Description { get; set; } public string Color { get; set; } public List<SubTagInfo> SubTags { get; set; } + public bool SentimentEnabled { get; set; } } } diff --git a/webapp/api/api.ts b/webapp/api/api.ts index 50cf8c7e7674878f4bc557055ebff52e092aa1ba..20b6213ea3295be6a2540948a822f7421186ec15 100644 --- a/webapp/api/api.ts +++ b/webapp/api/api.ts @@ -974,6 +974,12 @@ export interface TagInfo { * @memberof TagInfo */ 'subTags'?: Array<SubTagInfo> | null; + /** + * + * @type {boolean} + * @memberof TagInfo + */ + 'sentimentEnabled'?: boolean; } /** * diff --git a/webapp/components/modals/TagModal.tsx b/webapp/components/modals/TagModal.tsx index 9041c791e8c2a572584d6893222f60bcd28fd897..439fe838df6b7a3957bd7e2e5cacdd26661ead3a 100644 --- a/webapp/components/modals/TagModal.tsx +++ b/webapp/components/modals/TagModal.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Form, Input, Modal } from 'antd'; +import { Form, Input, Modal, Switch } from 'antd'; /** * All values that the modal window can show. @@ -8,6 +8,7 @@ export interface TagModalValues { name?: string; color?: string; description?: string; + sentimentEnabled?: boolean; } /** @@ -32,12 +33,14 @@ function TagModal(props: { name: props.defaultValues.name ?? '', color: props.defaultValues.color ?? 'black', description: props.defaultValues.description ?? '', + sentimentEnabled: props.defaultValues.sentimentEnabled ?? false, }; } else { values = { name: '', color: 'black', description: '', + sentimentEnabled: false, }; } /** @@ -61,6 +64,7 @@ function TagModal(props: { name: values.name, color: values.color, description: values.description, + sentimentEnabled: values.sentimentEnabled, }); }; @@ -85,7 +89,7 @@ function TagModal(props: { }); }} > - <Form form={form} labelCol={{ span: 4 }} initialValues={values}> + <Form form={form} labelCol={{ span: 8 }} initialValues={values}> <Form.Item label="Název" name="name" @@ -100,6 +104,19 @@ function TagModal(props: { > <Input type="color" /> </Form.Item> + <Form.Item + label="Povolit sentiment" + name="sentimentEnabled" + valuePropName="checked" + rules={[ + { + required: true, + message: 'ProsĂm zadejte zda má bĂ˝t povolenĂ˝ sentiment', + }, + ]} + > + <Switch /> + </Form.Item> <Form.Item label="Popis" name="description"> <Input.TextArea /> </Form.Item> diff --git a/webapp/pages/tags/index.tsx b/webapp/pages/tags/index.tsx index 7f54b6d7bff9090a6506dc4386285f6511f87966..1adff489241419ece45705e9da2870d44421124c 100644 --- a/webapp/pages/tags/index.tsx +++ b/webapp/pages/tags/index.tsx @@ -89,6 +89,14 @@ function TagsPage() { render: (columnData: boolean | undefined, record: any, index: number) => columnData !== undefined && <Checkbox checked={columnData} disabled />, }, + { + title: 'Povolit sentiment', + dataIndex: 'sentimentEnabled', + key: 'sentimentEnabled', + width: 150, + render: (columnData: boolean | undefined, record: any, index: number) => + columnData !== undefined && <Checkbox checked={columnData} disabled />, + }, { title: 'Popis', dataIndex: 'description', key: 'description' }, { title: '', @@ -184,6 +192,7 @@ function TagsPage() { name: val.name, description: val.description, color: val.color, + sentimentEnabled: val.sentimentEnabled, }) .then(() => loadData()); @@ -208,6 +217,7 @@ function TagsPage() { name: val.name, description: val.description, color: val.color, + sentimentEnabled: val.sentimentEnabled, }) .then(() => loadData()); @@ -331,6 +341,7 @@ function TagsPage() { name: tagInfo.name, description: tagInfo.description, color: tagInfo.color, + sentimentEnabled: tagInfo.sentimentEnabled, depth: 1, ...(tagInfo.subTags?.length && { children: tagInfo.subTags?.map((subInfo: any) => {