UI : Fix the missing drag icon from Teams Table (#9429)

* Fix the drag icon from Teams Table

* added drag option in expandable config

* remove unwanted css changes
This commit is contained in:
Ashish Gupta 2022-12-21 09:52:51 +05:30 committed by GitHub
parent 03edd9df56
commit 4fdf14f2da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 55 additions and 43 deletions

View File

@ -134,7 +134,7 @@ const TeamHierarchy: FC<TeamHierarchyProps> = ({
const expandableConfig: ExpandableConfig<Team> = useMemo( const expandableConfig: ExpandableConfig<Team> = useMemo(
() => ({ () => ({
...getTableExpandableConfig<Team>(), ...getTableExpandableConfig<Team>(true),
onExpand: (isOpen, record) => { onExpand: (isOpen, record) => {
if (isOpen && isEmpty(record.children)) { if (isOpen && isEmpty(record.children)) {
onTeamExpand(false, record.fullyQualifiedName, true); onTeamExpand(false, record.fullyQualifiedName, true);

View File

@ -54,40 +54,9 @@
td { td {
border-right: none; border-right: none;
background: @white; background: @white;
.drag-icon {
width: 12px;
height: 12px;
margin-right: 6px;
display: inline-flex;
visibility: hidden;
}
.expand-icon {
cursor: pointer;
}
.expand-cell-icon-container {
display: inline-flex;
margin-right: 8px;
}
.expand-cell-empty-icon-container {
width: 16px;
height: 16px;
display: inline-flex;
}
}
.ant-table-cell-with-append {
display: flex;
align-items: center;
} }
.ant-table-cell-row-hover { .ant-table-cell-row-hover {
background: @body-dark-bg-color; background: @body-dark-bg-color;
.drag-icon {
visibility: initial;
}
} }
} }
} }

View File

@ -1017,11 +1017,12 @@ const ServicePage: FunctionComponent = () => {
isRecursiveDelete isRecursiveDelete
afterDeleteAction={() => afterDeleteAction={() =>
history.push( history.push(
`/settings/services/${ getSettingPath(
GlobalSettingsMenuCategory.SERVICES,
SERVICE_CATEGORY_TYPE[ SERVICE_CATEGORY_TYPE[
serviceCategory as keyof typeof SERVICE_CATEGORY_TYPE serviceCategory as keyof typeof SERVICE_CATEGORY_TYPE
] ]
}` )
) )
} }
allowSoftDelete={false} allowSoftDelete={false}

View File

@ -9,6 +9,35 @@
.ant-table-bordered { .ant-table-bordered {
table { table {
border: 1px solid #dde3ea; border: 1px solid #dde3ea;
tbody {
tr {
td {
.drag-icon {
width: 12px;
height: 12px;
margin-right: 2px;
display: inline-flex;
visibility: hidden;
}
.expand-icon {
cursor: pointer;
}
.expand-cell-empty-icon-container {
width: 16px;
height: 16px;
display: inline-flex;
}
}
}
.ant-table-cell-row-hover {
.drag-icon {
visibility: initial;
}
}
}
} }
.ant-table-container > .ant-table-content > table > tbody > tr > td { .ant-table-container > .ant-table-content > table > tbody > tr > td {
border-right: none; border-right: none;

View File

@ -19,6 +19,7 @@ import { upperCase } from 'lodash';
import { EntityTags } from 'Models'; import { EntityTags } from 'Models';
import React from 'react'; import React from 'react';
import { ReactComponent as DashboardIcon } from '../assets/svg/dashboard-grey.svg'; import { ReactComponent as DashboardIcon } from '../assets/svg/dashboard-grey.svg';
import { ReactComponent as DragIcon } from '../assets/svg/drag.svg';
import { ReactComponent as DropDownIcon } from '../assets/svg/DropDown.svg'; import { ReactComponent as DropDownIcon } from '../assets/svg/DropDown.svg';
import { ReactComponent as RightArrowIcon } from '../assets/svg/ic-right-arrow.svg'; import { ReactComponent as RightArrowIcon } from '../assets/svg/ic-right-arrow.svg';
import { ReactComponent as MlModelIcon } from '../assets/svg/mlmodal.svg'; import { ReactComponent as MlModelIcon } from '../assets/svg/mlmodal.svg';
@ -369,10 +370,14 @@ export const getTestResultBadgeIcon = (status?: TestCaseStatus) => {
} }
}; };
export function getTableExpandableConfig<T>(): ExpandableConfig<T> { export function getTableExpandableConfig<T>(
isDraggable?: boolean
): ExpandableConfig<T> {
const expandableConfig: ExpandableConfig<T> = { const expandableConfig: ExpandableConfig<T> = {
expandIcon: ({ expanded, onExpand, expandable, record }) => expandIcon: ({ expanded, onExpand, expandable, record }) =>
expandable && ( expandable ? (
<>
{isDraggable && <Icon className="drag-icon" component={DragIcon} />}
<Icon <Icon
className="mr-1" className="mr-1"
component={expanded ? DropDownIcon : RightArrowIcon} component={expanded ? DropDownIcon : RightArrowIcon}
@ -380,6 +385,14 @@ export function getTableExpandableConfig<T>(): ExpandableConfig<T> {
size={16} size={16}
onClick={(e) => onExpand(record, e)} onClick={(e) => onExpand(record, e)}
/> />
</>
) : (
isDraggable && (
<>
<Icon className="drag-icon" component={DragIcon} />
<div className="expand-cell-empty-icon-container" />
</>
)
), ),
}; };