From d9445fccf31a7b1ecd9f2f774673fef7a80f5fbc Mon Sep 17 00:00:00 2001
From: Sachin Chaurasiya
Date: Tue, 12 Jul 2022 09:36:18 +0530
Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Activity=20Feed:=20Show=20"Request?=
=?UTF-8?q?=20Tag"=20button=20for=20Tags=20(#5862)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* ✨ Activity Feed: Show "Request Tag" button for Tags
* Fix alignment issues
* Add condition to show task for supported entities.
* Refactor Task detail page
* Refactor task description.
* Add flow for resolve task
---
.../DashboardDetails.component.tsx | 4 +
.../DatasetDetails.component.tsx | 6 +-
.../PipelineDetails.component.tsx | 4 +
.../TopicDetails/TopicDetails.component.tsx | 4 +
.../common/entityPageInfo/EntityPageInfo.tsx | 91 +++-
.../resources/ui/src/constants/constants.ts | 2 +
.../RequestTagPage/RequestTagPage.tsx | 282 ++++++++++++
.../TaskDetailPage/TaskDetailPage.tsx | 418 +++++-------------
.../src/pages/TasksPage/shared/Assignees.tsx | 2 +-
.../src/pages/TasksPage/shared/ClosedTask.tsx | 49 ++
.../pages/TasksPage/shared/ColumnDetail.tsx | 46 ++
.../pages/TasksPage/shared/CommentModal.tsx | 65 +++
.../TasksPage/shared/DescriptionTask.tsx | 152 +++++++
.../pages/TasksPage/shared/EntityDetail.tsx | 74 ++++
.../pages/TasksPage/shared/TagSuggestion.tsx | 124 ++++++
.../src/pages/TasksPage/shared/TagsTask.tsx | 47 ++
.../src/pages/TasksPage/shared/TaskStatus.tsx | 57 +++
.../ui/src/router/AuthenticatedAppRouter.tsx | 5 +
.../main/resources/ui/src/styles/x-master.css | 4 +-
.../main/resources/ui/src/utils/TasksUtils.ts | 27 ++
20 files changed, 1141 insertions(+), 322 deletions(-)
create mode 100644 openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/RequestTagPage/RequestTagPage.tsx
create mode 100644 openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/ClosedTask.tsx
create mode 100644 openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/ColumnDetail.tsx
create mode 100644 openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/CommentModal.tsx
create mode 100644 openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/DescriptionTask.tsx
create mode 100644 openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/EntityDetail.tsx
create mode 100644 openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/TagSuggestion.tsx
create mode 100644 openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/TagsTask.tsx
create mode 100644 openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/TaskStatus.tsx
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/DashboardDetails/DashboardDetails.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/DashboardDetails/DashboardDetails.component.tsx
index cb08bb400c8..4983b1771f7 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/DashboardDetails/DashboardDetails.component.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/components/DashboardDetails/DashboardDetails.component.tsx
@@ -466,6 +466,10 @@ const DashboardDetails = ({
= ({
= ({
void;
+ entityFieldTasks?: EntityFieldThreads[];
+ onThreadLinkSelect?: (value: string, threadType?: ThreadType) => void;
followHandler?: () => void;
tagsHandler?: (selectedTags?: Array) => void;
versionHandler?: () => void;
@@ -88,8 +94,11 @@ const EntityPageInfo = ({
onThreadLinkSelect,
entityFqn,
entityType,
+ entityFieldTasks,
}: Props) => {
+ const history = useHistory();
const tagThread = entityFieldThreads?.[0];
+ const tagTask = entityFieldTasks?.[0];
const [isEditable, setIsEditable] = useState(false);
const [entityFollowers, setEntityFollowers] =
useState>(followersList);
@@ -101,6 +110,10 @@ const EntityPageInfo = ({
document.getElementById('version-and-follow-section')?.offsetWidth
);
+ const handleRequestTags = () => {
+ history.push(getRequestTagsPath(entityType as string, entityFqn as string));
+ };
+
const handleTagSelection = (selectedTags?: Array) => {
if (selectedTags) {
const prevTags =
@@ -269,35 +282,74 @@ const EntityPageInfo = ({
const getThreadElements = () => {
if (!isUndefined(entityFieldThreads)) {
- return !isUndefined(tagThread) ? (
- onThreadLinkSelect?.(tagThread.entityLink)}>
-
+
{tagThread.count}
-
+
) : (
-
onThreadLinkSelect?.(
getEntityFeedLink(entityType, entityFqn, 'tags')
)
}>
-
-
+
+
);
} else {
return null;
}
};
+ const getRequestTagsElements = useCallback(() => {
+ const hasTags = !isEmpty(tags);
+
+ return onThreadLinkSelect && !hasTags ? (
+
+ ) : null;
+ }, [tags]);
+
+ const getTaskElement = useCallback(() => {
+ return !isUndefined(tagTask) ? (
+
+ ) : null;
+ }, [tagTask]);
+
useEffect(() => {
setEntityFollowers(followersList);
}, [followersList]);
@@ -454,7 +506,7 @@ const EntityPageInfo = ({
position="bottom"
trigger="click">
{
// Fetch tags and terms only once
@@ -479,14 +531,9 @@ const EntityPageInfo = ({
}}>
{tags.length || tier ? (
) : (
@@ -501,7 +548,11 @@ const EntityPageInfo = ({
- {getThreadElements()}
+
+ {getRequestTagsElements()}
+ {getTaskElement()}
+ {getThreadElements()}
+
)}
diff --git a/openmetadata-ui/src/main/resources/ui/src/constants/constants.ts b/openmetadata-ui/src/main/resources/ui/src/constants/constants.ts
index 3f029329883..39ea8f0eb0c 100644
--- a/openmetadata-ui/src/main/resources/ui/src/constants/constants.ts
+++ b/openmetadata-ui/src/main/resources/ui/src/constants/constants.ts
@@ -209,7 +209,9 @@ export const ROUTES = {
// Tasks Routes
REQUEST_DESCRIPTION: `/request-description/${PLACEHOLDER_ROUTE_ENTITY_TYPE}/${PLACEHOLDER_ROUTE_ENTITY_FQN}`,
+ REQUEST_TAGS: `/request-tags/${PLACEHOLDER_ROUTE_ENTITY_TYPE}/${PLACEHOLDER_ROUTE_ENTITY_FQN}`,
UPDATE_DESCRIPTION: `/update-description/${PLACEHOLDER_ROUTE_ENTITY_TYPE}/${PLACEHOLDER_ROUTE_ENTITY_FQN}`,
+ UPDATE_TAGS: `/update-tags/${PLACEHOLDER_ROUTE_ENTITY_TYPE}/${PLACEHOLDER_ROUTE_ENTITY_FQN}`,
TASK_DETAIL: `/tasks/${PLACEHOLDER_TASK_ID}`,
ACTIVITY_PUSH_FEED: '/api/v1/push/feed',
diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/RequestTagPage/RequestTagPage.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/RequestTagPage/RequestTagPage.tsx
new file mode 100644
index 00000000000..64a98beffe2
--- /dev/null
+++ b/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/RequestTagPage/RequestTagPage.tsx
@@ -0,0 +1,282 @@
+/*
+ * Copyright 2021 Collate
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Button, Card, Input } from 'antd';
+import { AxiosError, AxiosResponse } from 'axios';
+import { capitalize, isNil } from 'lodash';
+import { observer } from 'mobx-react';
+import { EntityTags } from 'Models';
+import React, {
+ ChangeEvent,
+ useCallback,
+ useEffect,
+ useMemo,
+ useState,
+} from 'react';
+import { useHistory, useLocation, useParams } from 'react-router-dom';
+import AppState from '../../../AppState';
+import { postThread } from '../../../axiosAPIs/feedsAPI';
+import ProfilePicture from '../../../components/common/ProfilePicture/ProfilePicture';
+import TitleBreadcrumb from '../../../components/common/title-breadcrumb/title-breadcrumb.component';
+import { FQN_SEPARATOR_CHAR } from '../../../constants/char.constants';
+import { EntityField } from '../../../constants/feed.constants';
+import { EntityType } from '../../../enums/entity.enum';
+import {
+ CreateThread,
+ TaskType,
+} from '../../../generated/api/feed/createThread';
+import { ThreadType } from '../../../generated/entity/feed/thread';
+import { TagLabel } from '../../../generated/type/tagLabel';
+import { getEntityName } from '../../../utils/CommonUtils';
+import {
+ ENTITY_LINK_SEPARATOR,
+ getEntityFeedLink,
+} from '../../../utils/EntityUtils';
+import { getTagsWithoutTier, getTierTags } from '../../../utils/TableUtils';
+import {
+ fetchEntityDetail,
+ fetchOptions,
+ getBreadCrumbList,
+ getColumnObject,
+ getTaskDetailPath,
+} from '../../../utils/TasksUtils';
+import { showErrorToast, showSuccessToast } from '../../../utils/ToastUtils';
+import Assignees from '../shared/Assignees';
+import TagSuggestion from '../shared/TagSuggestion';
+import TaskPageLayout from '../shared/TaskPageLayout';
+import { cardStyles } from '../TaskPage.styles';
+import { EntityData, Option } from '../TasksPage.interface';
+
+const RequestTag = () => {
+ const location = useLocation();
+ const history = useHistory();
+
+ const { entityType, entityFQN } = useParams<{ [key: string]: string }>();
+ const queryParams = new URLSearchParams(location.search);
+
+ const field = queryParams.get('field');
+ const value = queryParams.get('value');
+
+ const [entityData, setEntityData] = useState({} as EntityData);
+ const [options, setOptions] = useState
-
-
+
@@ -651,7 +544,7 @@ const TaskDetailPage = () => {
)}
-
+
@@ -718,54 +611,24 @@ const TaskDetailPage = () => {
-
-
Description:
{' '}
- {!isEmpty(taskDetail) && (
-
- {isTaskClosed ? (
- getDiffView()
- ) : (
-
- {isRequestDescription && (
-
- {isTaskActionEdit && hasEditAccess() ? (
-
- ) : (
-
- {getCurrentDescription()}
-
- )}
-
- )}
-
- {isUpdateDescription && (
-
- {isTaskActionEdit && hasEditAccess() ? (
-
- ) : (
-
- {getCurrentDescription()}
-
- )}
-
- )}
-
- )}
-
- )}
-
+ {isTaskDescription && (
+
+ )}
+ {isTaskTags && (
+
+ )}
{hasEditAccess() && !isTaskClosed && (
{
)}
- {isTaskClosed && (
-
-
-
-
-
- {taskDetail?.task?.closedBy}
- {' '}
-
-
-
closed this task
-
- {toLower(
- getDayTimeByTimeStamp(
- taskDetail?.task?.closedAt as number
- )
- )}
-
-
- )}
+ {isTaskClosed && }
-
-
-
+
{
data-testid="task-right-sider"
width={600}>
-
+
{!isEmpty(taskFeedDetail) ? (
{
) : null}
-
+
{!isEmpty(taskFeedDetail) ? (
= ({ assignees, onSearch, onChange, options }) => {
return (