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

fix(ui): Users and Groups UI bug fixes #4746

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions datahub-web-react/src/app/entity/group/GroupInfoSideBar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Divider, message, Space, Button, Typography } from 'antd';
import { Divider, message, Space, Button, Typography, Row, Col } from 'antd';
import React, { useState } from 'react';
import styled from 'styled-components';
import { EditOutlined, MailOutlined, SlackOutlined } from '@ant-design/icons';
Expand Down Expand Up @@ -48,20 +48,21 @@ const TITLES = {
editGroup: 'Edit Group',
};

const GroupNameHeader = styled.div`
const GroupNameHeader = styled(Row)`
font-size: 20px;
line-height: 28px;
color: #262626;
margin: 16px 16px 8px 8px;
display: flex;
align-items: center;
justify-content: left;
justify-content: center;
min-height: 100px;
`;

const GroupName = styled.div`
margin-left: 12px;
max-width: 260px;
word-wrap: break-word;
width: 140px;
`;

/**
Expand Down Expand Up @@ -120,14 +121,18 @@ export default function GroupInfoSidebar({ sideBarData, refetch }: Props) {
<SideBar>
<SideBarSubSection className={canEditGroup ? '' : 'fullView'}>
<GroupNameHeader>
<CustomAvatar
useDefaultAvatar={false}
size={64}
photoUrl={photoUrl}
name={avatarName}
style={AVATAR_STYLE}
/>
<GroupName>{name}</GroupName>
<Col>
<CustomAvatar
useDefaultAvatar={false}
size={64}
photoUrl={photoUrl}
name={avatarName}
style={AVATAR_STYLE}
/>
</Col>
<Col>
<GroupName>{name}</GroupName>
</Col>
</GroupNameHeader>
<Divider className="divider-infoSection" />
<SocialDetails>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Tag } from 'antd';
import { Tag, Tooltip } from 'antd';
import React from 'react';
import { Link } from 'react-router-dom';
import styled from 'styled-components';
Expand Down Expand Up @@ -53,7 +53,11 @@ export default function GroupMembersSideBarSection({ total, relationships, onSee
photoUrl={user.editableProperties?.pictureLink || undefined}
useDefaultAvatar={false}
/>
{name}
{name.length > 15 ? (
<Tooltip title={name}>{`${name.substring(0, 15)}..`}</Tooltip>
) : (
<span>{name}</span>
)}
</Link>
</MemberTag>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Form, message, Modal, Select, Tag, Typography } from 'antd';
import React, { useRef, useState } from 'react';
import React, { useEffect, useRef, useState } from 'react';
import styled from 'styled-components';
import { Link } from 'react-router-dom';
import { useAddOwnerMutation } from '../../../../../../../graphql/mutations.generated';
Expand Down Expand Up @@ -50,6 +50,7 @@ type SelectedActor = {
};

export const AddOwnerModal = ({ urn, type, visible, hideOwnerType, defaultOwnerType, onClose, refetch }: Props) => {
console.log('defaultOwnerType', defaultOwnerType);
const entityRegistry = useEntityRegistry();
const [selectedActor, setSelectedActor] = useState<SelectedActor | undefined>(undefined);
const [selectedOwnerType, setSelectedOwnerType] = useState<OwnershipType>(defaultOwnerType || OwnershipType.None);
Expand Down Expand Up @@ -189,6 +190,12 @@ export const AddOwnerModal = ({ urn, type, visible, hideOwnerType, defaultOwnerT
const selectValue = (selectedActor && [selectedActor.displayName]) || [];
const ownershipTypes = OWNERSHIP_DISPLAY_TYPES;

useEffect(() => {
if (ownershipTypes) {
setSelectedOwnerType(ownershipTypes[0].type);
}
}, [ownershipTypes]);

// Handle the Enter press
// TODO: Allow user to be selected prior to executed the save.
// useEnterKeyListener({
Expand Down Expand Up @@ -240,7 +247,11 @@ export const AddOwnerModal = ({ urn, type, visible, hideOwnerType, defaultOwnerT
<Form.Item label={<Typography.Text strong>Type</Typography.Text>}>
<Typography.Paragraph>Choose an owner type</Typography.Paragraph>
<Form.Item name="type">
<Select value={selectedOwnerType} onChange={onSelectOwnerType}>
<Select
defaultValue={selectedOwnerType}
value={selectedOwnerType}
onChange={onSelectOwnerType}
>
{ownershipTypes.map((ownerType) => (
<Select.Option key={ownerType.type} value={ownerType.type}>
<Typography.Text>{ownerType.name}</Typography.Text>
Expand Down