Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat collaboration #2859

Merged
merged 96 commits into from
Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from 86 commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
0779e42
Fix #2778 UI : Add Queries tab for table details page.
Sachin-chaurasiya Feb 16, 2022
139e317
minor change
Sachin-chaurasiya Feb 16, 2022
fbfc807
Changing Table Queries text to Queries.
Sachin-chaurasiya Feb 17, 2022
cad67bf
Addressing comments
Sachin-chaurasiya Feb 17, 2022
c8c2a1c
Merge branch 'main' into issue-2778
Sachin-chaurasiya Feb 17, 2022
ec7546e
Merge branch 'main' into issue-2778
Sachin-chaurasiya Feb 18, 2022
ff2a5fb
Adding last run by user detail
Sachin-chaurasiya Feb 18, 2022
a4d7afe
Minor UI Changes
Sachin-chaurasiya Feb 18, 2022
576c7c5
Merge branch 'main' into issue-2778
Sachin-chaurasiya Feb 18, 2022
a187a4e
Removed icon
Sachin-chaurasiya Feb 18, 2022
5c0799f
Changing Query card style.
Sachin-chaurasiya Feb 18, 2022
3b939e2
Changing Icons
Sachin-chaurasiya Feb 18, 2022
4eb78f1
Merge branch 'main' into issue-2778
Sachin-chaurasiya Feb 19, 2022
6dae479
Merge branch 'main' into feat-collaboration
Sachin-chaurasiya Feb 19, 2022
3a09c25
Adding activity feed tab in entity details page.
Sachin-chaurasiya Feb 19, 2022
7fccf0d
Adding user feed on landing page.
Sachin-chaurasiya Feb 19, 2022
7c6c08c
Adding activity feed tab in topic entity page.
Sachin-chaurasiya Feb 19, 2022
4884432
Adding activity feed tab in dashboard entity page.
Sachin-chaurasiya Feb 19, 2022
5c60bd0
Fixing props issue in test file.
Sachin-chaurasiya Feb 19, 2022
32c63d5
Adding activity feed tab in pipeline entity page.
Sachin-chaurasiya Feb 19, 2022
f338825
Merge branch 'main' into feat-collaboration
Sachin-chaurasiya Feb 19, 2022
a9147a8
Adding support for activity feed in non-secure mode.
Sachin-chaurasiya Feb 19, 2022
7c19f1f
Adding avatar for 3 last replied users.
Sachin-chaurasiya Feb 19, 2022
df3894c
Adding more spacing between feed
Sachin-chaurasiya Feb 19, 2022
936f9e5
Adding background to feed message.
Sachin-chaurasiya Feb 19, 2022
9bb4fcf
Changing background color for entity detail page.
Sachin-chaurasiya Feb 19, 2022
b0718f8
Merge branch 'main' into feat-collaboration
Sachin-chaurasiya Feb 21, 2022
36a425e
Fixing height issue
Sachin-chaurasiya Feb 21, 2022
15a6afd
Addding first UI implementation of Feed Side panel.
Sachin-chaurasiya Feb 21, 2022
c8df960
Changing Initial state of sidepanel
Sachin-chaurasiya Feb 21, 2022
c33e8a4
Adding Rich text support for feed card header.
Sachin-chaurasiya Feb 21, 2022
951aa26
Adding Onboarding Placeholder if no feed data available on home page.
Sachin-chaurasiya Feb 21, 2022
b8b040d
Adding support for showing thread in side panel.
Sachin-chaurasiya Feb 21, 2022
7d7f6f0
Addressing feedback
Sachin-chaurasiya Feb 22, 2022
b4cfb3b
Addressing feedback.
Sachin-chaurasiya Feb 22, 2022
eb8df35
Integrating API in panel to get thread data by thread id.
Sachin-chaurasiya Feb 22, 2022
9038e0a
Created separate constant file for feed.
Sachin-chaurasiya Feb 22, 2022
bb2e96b
Adding Activity Feed tab on database details page.
Sachin-chaurasiya Feb 22, 2022
bfae3ac
Moving util method to utils file.
Sachin-chaurasiya Feb 22, 2022
b2b5ad5
Breaking down large component into small components for composition.
Sachin-chaurasiya Feb 22, 2022
0c9142e
Adding UI support for showing the latest 3 replies with indentation.
Sachin-chaurasiya Feb 22, 2022
60c26c5
Changing User Avatar styling.
Sachin-chaurasiya Feb 22, 2022
1caa0ed
Fixing Minor issue
Sachin-chaurasiya Feb 22, 2022
73bbdde
Changing font-size of action text
Sachin-chaurasiya Feb 22, 2022
f87724f
Minor changes
Sachin-chaurasiya Feb 23, 2022
54d58b2
Changing text for view more replies
Sachin-chaurasiya Feb 23, 2022
e52e2c2
Merge branch 'main' into feat-collaboration
Sachin-chaurasiya Feb 23, 2022
b5cde41
Minor change
Sachin-chaurasiya Feb 23, 2022
164ab5d
Hiding replies in home page feed
Sachin-chaurasiya Feb 23, 2022
c34c330
Adding onboarding placholder if no feed data available on entity page.
Sachin-chaurasiya Feb 23, 2022
07aa94b
Remove commented code.
Sachin-chaurasiya Feb 23, 2022
015c177
Merge branch 'main' into feat-collaboration
Sachin-chaurasiya Feb 23, 2022
be883f2
Adding editor for feed
Sachin-chaurasiya Feb 23, 2022
46fc402
Adding support for feededitor in panel
Sachin-chaurasiya Feb 23, 2022
9fb60d6
Adding support for posting feed in table entity.
Sachin-chaurasiya Feb 23, 2022
5a09abc
Fixing latest reply posts issue
Sachin-chaurasiya Feb 23, 2022
4fe06d2
Adding support for posting feed in topic entity.
Sachin-chaurasiya Feb 23, 2022
3e45505
Adding support for posting feed in dashboard entity.
Sachin-chaurasiya Feb 23, 2022
468ab74
Adding support for posting feed in pipeline entity.
Sachin-chaurasiya Feb 23, 2022
83eb04e
Adding support for posting feed in database entity.
Sachin-chaurasiya Feb 23, 2022
ee55ced
Removed feedCards test
Sachin-chaurasiya Feb 23, 2022
c27f948
Add placeholder text to the editor.
Sachin-chaurasiya Feb 23, 2022
ca213d1
Adding support for posting reply from home page feed.
Sachin-chaurasiya Feb 23, 2022
9c035fd
Minor style changes
Sachin-chaurasiya Feb 23, 2022
b7b6f59
Minor fix
Sachin-chaurasiya Feb 24, 2022
d10f6dd
Merge branch 'main' into feat-collaboration
Sachin-chaurasiya Feb 24, 2022
caa30a7
Add send icon in editor button and side panel in home page.
Sachin-chaurasiya Feb 24, 2022
05f4b77
Change UI logic to incorporate thread schema change.
Sachin-chaurasiya Feb 24, 2022
4b05e7f
Change postFeedHandler method to incorporate new thread schema.
Sachin-chaurasiya Feb 24, 2022
2dd4f8b
Add activity feed tab on all service pages.
Sachin-chaurasiya Feb 24, 2022
4380e51
Add support for changing editor send button background.
Sachin-chaurasiya Feb 24, 2022
d9cec43
Add support for posting reply on enter
Sachin-chaurasiya Feb 24, 2022
551b78b
Change Editor button icon
Sachin-chaurasiya Feb 24, 2022
62a5214
Fixed Failing tests
Sachin-chaurasiya Feb 24, 2022
8c09a62
Add license file
Sachin-chaurasiya Feb 24, 2022
3b23981
Add support for closing side panel on Escape key.
Sachin-chaurasiya Feb 24, 2022
3363997
Add tooltip for editor send button
Sachin-chaurasiya Feb 25, 2022
34e68e3
Minor style change
Sachin-chaurasiya Feb 25, 2022
c790cdd
Change user avatar to square shape
Sachin-chaurasiya Feb 25, 2022
e7a9ae7
Change editor send button styling
Sachin-chaurasiya Feb 25, 2022
47ae886
Move util method to utils file.
Sachin-chaurasiya Feb 25, 2022
aa5ce69
Change feed list layout to show main and latest feed.
Sachin-chaurasiya Feb 25, 2022
5be2795
Fix issue if there is no reply.
Sachin-chaurasiya Feb 25, 2022
63aa7c8
Minor style fix
Sachin-chaurasiya Feb 25, 2022
1bf77d7
Add thread count in activity tab for all entities.
Sachin-chaurasiya Feb 25, 2022
4768732
Fix failing test
Sachin-chaurasiya Feb 25, 2022
5d4da0e
change setup.py code
Sachin-chaurasiya Feb 28, 2022
5eba9ce
Minor tweak.
Sachin-chaurasiya Feb 28, 2022
f2c0c9f
Merge branch 'main' into feat-collaboration
Sachin-chaurasiya Feb 28, 2022
49bb575
Reverting change setup.py code
Sachin-chaurasiya Feb 28, 2022
2f6331b
Add chrome option
Sachin-chaurasiya Feb 28, 2022
adc113e
Change setup.py code
Sachin-chaurasiya Feb 28, 2022
703466f
@Sachin-chaurasiya
Sachin-chaurasiya Feb 28, 2022
6475f8c
Remove chrome option
Sachin-chaurasiya Feb 28, 2022
ea57f84
Revert setup.py change
Sachin-chaurasiya Feb 28, 2022
974a714
Merge branch 'main' into feat-collaboration
Sachin-chaurasiya Feb 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion openmetadata-ui/src/main/resources/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"postcss": "^8.3.2",
"process": "^0.11.10",
"prop-types": "^15.7.2",
"quill-markdown-shortcuts": "^0.0.10",
"react": "^16.14.0",
"react-codemirror2": "^7.2.1",
"react-copy-to-clipboard": "^5.0.4",
Expand All @@ -53,6 +54,7 @@
"react-js-pagination": "^3.0.3",
"react-markdown": "^6.0.3",
"react-oidc": "^1.0.3",
"react-quill": "^1.3.5",
"react-router-dom": "^5.2.0",
"react-select": "^3.1.1",
"react-slick": "^0.28.1",
Expand All @@ -68,7 +70,8 @@
"stream-http": "^3.2.0",
"styled-components": "^5.2.3",
"tailwindcss": "^2.1.4",
"to-arraybuffer": "^1.0.1"
"to-arraybuffer": "^1.0.1",
"turndown": "^7.1.1"
},
"scripts": {
"start": "NODE_ENV=development BABEL_ENV=development webpack serve --config ./webpack.config.dev.js --env development",
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 20 additions & 4 deletions openmetadata-ui/src/main/resources/ui/src/axiosAPIs/feedsAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,27 @@
*/

import { AxiosResponse } from 'axios';
import { Feed, FeedById } from 'Models';
import { Feed, Post } from 'Models';
import APIClient from './index';

export const getAllFeeds: Function = (): Promise<AxiosResponse> => {
return APIClient.get('/feed');
export const getAllFeeds: Function = (
entityLink?: string
): Promise<AxiosResponse> => {
return APIClient.get(`/feed`, {
params: {
entityLink: entityLink,
},
});
};

export const getFeedCount: Function = (
entityLink?: string
): Promise<AxiosResponse> => {
return APIClient.get(`/feed/count`, {
params: {
entityLink: entityLink,
},
});
};

export const postFeed: Function = (data: Feed): Promise<AxiosResponse> => {
Expand All @@ -29,7 +45,7 @@ export const getFeedById: Function = (id: string): Promise<AxiosResponse> => {

export const postFeedById: Function = (
id: string,
data: FeedById
data: Post
): Promise<AxiosResponse> => {
return APIClient.post(`/feed/${id}/posts`, data);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
/*
* 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 classNames from 'classnames';
import { isUndefined, toLower } from 'lodash';
import { Post } from 'Models';
import React, { FC, Fragment, HTMLAttributes } from 'react';
import { Link } from 'react-router-dom';
import AppState from '../../../AppState';
import { TabSpecificField } from '../../../enums/entity.enum';
import { getPartialNameFromFQN } from '../../../utils/CommonUtils';
import {
getEntityField,
getEntityFQN,
getEntityType,
getReplyText,
} from '../../../utils/FeedUtils';
import { getEntityLink } from '../../../utils/TableUtils';
import { getDayTimeByTimeStamp } from '../../../utils/TimeUtils';
import Avatar from '../../common/avatar/Avatar';
import RichTextEditorPreviewer from '../../common/rich-text-editor/RichTextEditorPreviewer';

interface ActivityFeedCardProp extends HTMLAttributes<HTMLDivElement> {
feed: Post;
entityLink?: string;
repliedUsers?: Array<string>;
replies?: number;
isEntityFeed?: boolean;
threadId?: string;
lastReplyTimeStamp?: number;
isFooterVisible?: boolean;
onThreadSelect?: (id: string) => void;
}
interface FeedHeaderProp
extends HTMLAttributes<HTMLDivElement>,
Pick<ActivityFeedCardProp, 'isEntityFeed'> {
createdBy: string;
timeStamp: number;
entityType: string;
entityFQN: string;
entityField: string;
}
interface FeedBodyProp extends HTMLAttributes<HTMLDivElement> {
message: string;
}
interface FeedFooterProp
extends HTMLAttributes<HTMLDivElement>,
Pick<
ActivityFeedCardProp,
| 'replies'
| 'repliedUsers'
| 'threadId'
| 'onThreadSelect'
| 'lastReplyTimeStamp'
| 'isFooterVisible'
> {}

const FeedHeader: FC<FeedHeaderProp> = ({
className,
createdBy,
timeStamp,
entityFQN,
entityType,
entityField,
isEntityFeed,
}) => {
return (
<div className={classNames('tw-flex tw-mb-1.5', className)}>
<Avatar name={createdBy} type="square" width="30" />
<h6 className="tw-flex tw-items-center tw-m-0 tw-heading tw-pl-2">
{createdBy}
{entityFQN && entityType && entityFQN ? (
<span className="tw-pl-1 tw-font-normal">
posted on{' '}
{isEntityFeed ? (
<span className="tw-heading">{entityField}</span>
) : (
<Fragment>
{entityType}{' '}
<Link
to={`${getEntityLink(
entityType as string,
entityFQN as string
)}/${TabSpecificField.ACTIVITY_FEED}`}>
<button className="link-text" disabled={AppState.isTourOpen}>
{getPartialNameFromFQN(
entityFQN as string,
entityType === 'table' ? ['table'] : ['database']
)}
</button>
</Link>
</Fragment>
)}
</span>
) : null}
<span className="tw-text-grey-muted tw-pl-2 tw-text-xs">
{getDayTimeByTimeStamp(timeStamp)}
</span>
</h6>
</div>
);
};

const FeedBody: FC<FeedBodyProp> = ({ message, className }) => {
return (
<div className={className}>
<RichTextEditorPreviewer
className="activity-feed-card-text"
enableSeeMoreVariant={false}
markdown={message}
/>
</div>
);
};

export const FeedFooter: FC<FeedFooterProp> = ({
repliedUsers,
replies,
className,
threadId,
onThreadSelect,
lastReplyTimeStamp,
isFooterVisible,
}) => {
const repliesCount = isUndefined(replies) ? 0 : replies;

return (
<div className={className}>
{!isUndefined(repliedUsers) &&
!isUndefined(replies) &&
isFooterVisible ? (
<div className="tw-flex tw-group">
{repliedUsers?.map((u, i) => (
<Avatar
className="tw-mt-0.5 tw-mx-0.5"
key={i}
name={u}
type="square"
width="22"
/>
))}
<p
className="tw-ml-1 link-text tw-text-xs tw-mt-1.5 tw-underline"
onClick={() => onThreadSelect?.(threadId as string)}>
{getReplyText(repliesCount)}
</p>
{lastReplyTimeStamp && repliesCount > 0 ? (
<span className="tw-text-grey-muted tw-pl-2 tw-text-xs tw-font-medium tw-mt-1.5">
Last reply{' '}
{toLower(getDayTimeByTimeStamp(lastReplyTimeStamp as number))}
</span>
) : null}
</div>
) : null}
</div>
);
};

const ActivityFeedCard: FC<ActivityFeedCardProp> = ({
feed,
className,
replies,
repliedUsers,
entityLink,
isEntityFeed,
threadId,
lastReplyTimeStamp,
onThreadSelect,
isFooterVisible = false,
}) => {
const entityType = getEntityType(entityLink as string);
const entityFQN = getEntityFQN(entityLink as string);
const entityField = getEntityField(entityLink as string);

return (
<div className={classNames(className)}>
<FeedHeader
createdBy={feed.from}
entityFQN={entityFQN as string}
entityField={entityField as string}
entityType={entityType as string}
isEntityFeed={isEntityFeed}
timeStamp={feed.postTs}
/>
<FeedBody
className="tw-mx-7 tw-ml-9 tw-bg-white tw-p-3 tw-border tw-border-main tw-rounded-md tw-break-all"
message={feed.message}
/>
<FeedFooter
className="tw-ml-9 tw-mt-3"
isFooterVisible={isFooterVisible}
lastReplyTimeStamp={lastReplyTimeStamp}
repliedUsers={repliedUsers}
replies={replies}
threadId={threadId}
onThreadSelect={onThreadSelect}
/>
</div>
);
};

export default ActivityFeedCard;
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* 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 classNames from 'classnames';
import React, { FC, HTMLAttributes, useRef, useState } from 'react';
import { HTMLToMarkdown } from '../../../utils/FeedUtils';
import SVGIcons from '../../../utils/SvgUtils';
import { Button } from '../../buttons/Button/Button';
import PopOver from '../../common/popover/PopOver';
import FeedEditor from '../../FeedEditor/FeedEditor';

interface ActivityFeedEditorProp extends HTMLAttributes<HTMLDivElement> {
onSave?: (value: string) => void;
buttonClass?: string;
}
type EditorContentRef = {
getEditorValue: () => string;
clearEditorValue: () => string;
};

const ActivityFeedEditor: FC<ActivityFeedEditorProp> = ({
className,
buttonClass = '',
onSave,
}) => {
const editorRef = useRef<EditorContentRef>();
const [editorValue, setEditorValue] = useState<string>('');

const onChangeHandler = (value: string) => {
setEditorValue(HTMLToMarkdown.turndown(value));
};

const onSaveHandler = () => {
if (editorRef.current) {
if (editorRef.current?.getEditorValue()) {
setEditorValue('');
editorRef.current?.clearEditorValue();
onSave?.(editorRef.current?.getEditorValue());
}
}
};

return (
<div className={classNames('tw-relative', className)}>
<FeedEditor
defaultValue={editorValue}
ref={editorRef}
onChangeHandler={onChangeHandler}
onSave={onSaveHandler}
/>
<div className="tw-absolute tw-right-2 tw-bottom-2 tw-flex tw-flex-row tw-items-center tw-justify-end">
<PopOver
html={
<>
<strong>Send now</strong>
</>
}
position="top"
size="small"
trigger="mouseenter">
<Button
className={classNames(
'tw-bg-gray-400 tw-py-0.5 tw-px-1 tw-rounded',
buttonClass
)}
disabled={editorValue.length === 0}
size="custom"
theme={editorValue.length > 0 ? 'primary' : 'default'}
variant="contained"
onClick={onSaveHandler}>
<SVGIcons alt="paper-plane" icon="icon-paper-plane" width="18px" />
</Button>
</PopOver>
</div>
</div>
);
};

export default ActivityFeedEditor;