Fix : Fixing long team name issues #2280 #2279 #2277 (#2286)

* Fix : Fixing #2280 #2279 #2277

* Addressing review comments
This commit is contained in:
Sachin Chaurasiya 2022-01-19 23:23:46 +05:30 committed by GitHub
parent f70755f0cc
commit aa17b32cd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 73 additions and 17 deletions

View File

@ -12,6 +12,7 @@
*/ */
import { AxiosResponse } from 'axios'; import { AxiosResponse } from 'axios';
import classNames from 'classnames';
import { isEmpty } from 'lodash'; import { isEmpty } from 'lodash';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import { TableDetail } from 'Models'; import { TableDetail } from 'Models';
@ -181,6 +182,8 @@ const ManageTab: FunctionComponent<Props> = ({
}); });
}; };
const ownerName = getOwnerById();
useEffect(() => { useEffect(() => {
getTierData(); getTierData();
}, []); }, []);
@ -225,7 +228,17 @@ const ManageTab: FunctionComponent<Props> = ({
theme="primary" theme="primary"
variant="link" variant="link"
onClick={() => setListVisible((visible) => !visible)}> onClick={() => setListVisible((visible) => !visible)}>
{getOwnerById() || 'Select Owner'} {ownerName ? (
<span
className={classNames('tw-truncate', {
'tw-w-52': ownerName.length > 32,
})}
title={ownerName}>
{ownerName}
</span>
) : (
'Select Owner'
)}
<SVGIcons <SVGIcons
alt="edit" alt="edit"
className="tw-ml-1" className="tw-ml-1"

View File

@ -47,8 +47,15 @@ const CheckBoxDropDownList = ({
checked={selectedItems?.includes(item.value as string)} checked={selectedItems?.includes(item.value as string)}
className="tw-ml-3 tw-mr-2 tw-align-middle custom-checkbox" className="tw-ml-3 tw-mr-2 tw-align-middle custom-checkbox"
type="checkbox" type="checkbox"
onChange={() => {
return;
}}
/> />
<p className="tw-inline-block">{item.name}</p> <p
className="tw-inline-block tw-truncate tw-w-52 tw-align-middle"
title={item.name as string}>
{item.name}
</p>
</div> </div>
) : ( ) : (
<Fragment /> <Fragment />

View File

@ -85,9 +85,10 @@ const DropDown: React.FC<DropDownProp> = ({
if (selectedItems?.includes(item.value as string)) { if (selectedItems?.includes(item.value as string)) {
return ( return (
<p <p
className="tw-bg-gray-200 tw-rounded tw-px-1 tw-text-grey-body" className="tw-bg-gray-200 tw-rounded tw-px-1 tw-text-grey-body tw-truncate tw-w-52 tw-align-middle"
key={item.value} key={item.value}
style={{ margin: '2px' }}> style={{ margin: '2px' }}
title={item.name as string}>
{item.name} {item.name}
</p> </p>
); );

View File

@ -69,7 +69,7 @@ const DropDownList: FunctionComponent<DropDownListProp> = ({
const getDropDownElement = (item: DropDownListItem, index: number) => { const getDropDownElement = (item: DropDownListItem, index: number) => {
return ( return (
<span <div
aria-disabled={item.disabled as boolean} aria-disabled={item.disabled as boolean}
className={classNames( className={classNames(
'tw-text-gray-700 tw-block tw-px-4 tw-py-2 tw-text-sm hover:tw-bg-body-hover tw-cursor-pointer', 'tw-text-gray-700 tw-block tw-px-4 tw-py-2 tw-text-sm hover:tw-bg-body-hover tw-cursor-pointer',
@ -80,8 +80,10 @@ const DropDownList: FunctionComponent<DropDownListProp> = ({
key={index} key={index}
role="menuitem" role="menuitem"
onClick={(e) => onSelect && onSelect(e, item.value)}> onClick={(e) => onSelect && onSelect(e, item.value)}>
{item.name} <p className="tw-truncate tw-w-52" title={item.name as string}>
</span> {item.name}
</p>
</div>
); );
}; };

View File

@ -120,9 +120,13 @@ const TeamsPage = () => {
) )
) { ) {
errData['name'] = 'Name already exists'; errData['name'] = 'Name already exists';
} else if (data.name.length < 1 || data.name.length > 128) {
errData['name'] = 'Name size must be between 1 and 128';
} }
if (!data.displayName?.trim()) { if (!data.displayName?.trim()) {
errData['displayName'] = 'Display name is required'; errData['displayName'] = 'Display name is required';
} else if (data.displayName.length < 1 || data.displayName.length > 128) {
errData['displayName'] = 'Display name size must be between 1 and 128';
} }
setErrorData(errData); setErrorData(errData);
@ -424,7 +428,9 @@ const TeamsPage = () => {
<div <div
className="tw-flex tw-justify-between tw-items-center" className="tw-flex tw-justify-between tw-items-center"
data-testid="header"> data-testid="header">
<div className="tw-heading tw-text-link tw-text-base"> <div
className="tw-heading tw-text-link tw-text-base tw-truncate tw-w-52"
title={currentTeam?.displayName}>
{currentTeam?.displayName} {currentTeam?.displayName}
</div> </div>
<NonAdminAction <NonAdminAction

View File

@ -11,6 +11,7 @@
* limitations under the License. * limitations under the License.
*/ */
import classNames from 'classnames';
import { isEmpty, isNil, isString } from 'lodash'; import { isEmpty, isNil, isString } from 'lodash';
import { Bucket, ExtraInfo, LeafNodes, LineagePos } from 'Models'; import { Bucket, ExtraInfo, LeafNodes, LineagePos } from 'Models';
import React from 'react'; import React from 'react';
@ -432,7 +433,13 @@ export const getInfoElements = (data: ExtraInfo) => {
rel="noopener noreferrer" rel="noopener noreferrer"
target={data.openInNewTab ? '_blank' : '_self'}> target={data.openInNewTab ? '_blank' : '_self'}>
<> <>
<span className="tw-mr-1">{displayVal}</span> <span
className={classNames('tw-mr-1 tw-inline-block tw-truncate', {
'tw-w-52': (displayVal as string).length > 32,
})}
title={displayVal as string}>
{displayVal}
</span>
{data.openInNewTab && ( {data.openInNewTab && (
<SVGIcons <SVGIcons
alt="external-link" alt="external-link"
@ -444,7 +451,20 @@ export const getInfoElements = (data: ExtraInfo) => {
</> </>
</a> </a>
) : ( ) : (
displayVal <>
{data.key === 'Owner' ? (
<span
className={classNames(
'tw-mr-1 tw-inline-block tw-truncate tw-align-text-bottom',
{ 'tw-w-52': (displayVal as string).length > 32 }
)}
title={displayVal as string}>
{displayVal}
</span>
) : (
<span>{displayVal}</span>
)}
</>
)} )}
</span> </span>
) : null} ) : null}

View File

@ -356,6 +356,9 @@ export const feedSummaryFromatter = (
} }
case fieldChange?.name === 'owner': { case fieldChange?.name === 'owner': {
const ownerName =
getOwnerName(newValue?.id as string) ||
getOwnerName(value?.id as string);
const ownerText = const ownerText =
!isEmpty(oldValue) && !isEmpty(newValue) ? ( !isEmpty(oldValue) && !isEmpty(newValue) ? (
<Fragment> <Fragment>
@ -363,11 +366,11 @@ export const feedSummaryFromatter = (
<Link <Link
className="tw-pl-1" className="tw-pl-1"
to={getTeamDetailsPath(newValue?.name || '')}> to={getTeamDetailsPath(newValue?.name || '')}>
{getOwnerName(newValue?.id as string)} <span title={ownerName}>{ownerName}</span>
</Link> </Link>
) : ( ) : (
<span className="tw-pl-1"> <span className="tw-pl-1" title={ownerName}>
{getOwnerName(newValue?.id as string)} {ownerName}
</span> </span>
)} )}
</Fragment> </Fragment>
@ -377,17 +380,21 @@ export const feedSummaryFromatter = (
<Link <Link
className="tw-pl-1" className="tw-pl-1"
to={getTeamDetailsPath(value?.name || '')}> to={getTeamDetailsPath(value?.name || '')}>
{getOwnerName(value?.id as string)} <span title={ownerName}>{ownerName}</span>
</Link> </Link>
) : ( ) : (
<span className="tw-pl-1"> <span className="tw-pl-1" title={ownerName}>
{getOwnerName(value?.id as string)} {ownerName}
</span> </span>
)} )}
</Fragment> </Fragment>
); );
summary = ( summary = (
<p key={uniqueId()}> <p
className={classNames('tw-truncate', {
'tw-w-52': ownerName.length > 32,
})}
key={uniqueId()}>
{`Assigned ownership to`} {`Assigned ownership to`}
{ownerText} {ownerText}
</p> </p>