Skip to content

Commit

Permalink
supported total unique user count in Team page (#18361)
Browse files Browse the repository at this point in the history
* supported total distinct user count in Team page

* minor improvement

* fix unit test

* added helpertext tooltip and change the label

* minor cosmetic update
  • Loading branch information
Ashish8689 authored and harshach committed Nov 3, 2024
1 parent f014fbd commit e847172
Show file tree
Hide file tree
Showing 17 changed files with 62 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1045,13 +1045,7 @@ const TeamDetailsV1 = ({

const tabs = useMemo(
() =>
getTabs(
currentTeam,
isGroupType,
isOrganization,
teamCount,
assetsCount
).map((tab) => ({
getTabs(currentTeam, isGroupType, teamCount, assetsCount).map((tab) => ({
...tab,
label: (
<TabsLabel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { TeamsPageTab } from './team.interface';
export const getTabs = (
currentTeam: Team,
isGroupType: boolean,
isOrganization: boolean,
teamsCount: number,
assetsCount: number
) => {
Expand Down Expand Up @@ -52,13 +51,9 @@ export const getTabs = (

const commonTabs = [tabs.roles, tabs.policies];

if (isOrganization) {
return [tabs.teams, ...commonTabs];
}

if (isGroupType) {
return [tabs.users, tabs.assets, ...commonTabs];
}

return [tabs.teams, tabs.users, ...commonTabs];
return [tabs.teams, ...commonTabs];
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { CheckOutlined, CloseOutlined } from '@ant-design/icons';
import {
CheckOutlined,
CloseOutlined,
InfoCircleOutlined,
} from '@ant-design/icons';
import { Button, Divider, Form, Input, Space, Tooltip, Typography } from 'antd';
import { isEmpty, last } from 'lodash';
import React, { useCallback, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { ReactComponent as EditIcon } from '../../../../../assets/svg/edit-new.svg';
import {
DE_ACTIVE_COLOR,
GRAYED_OUT_COLOR,
ICON_DIMENSION,
NO_DATA_PLACEHOLDER,
} from '../../../../../constants/constants';
Expand Down Expand Up @@ -314,6 +319,29 @@ const TeamsInfo = ({
updateTeamSubscription={updateTeamSubscription}
/>
{teamTypeElement}

<Divider type="vertical" />

<Space size={4}>
<Divider type="vertical" />
<Typography.Text className="text-grey-muted d-flex items-center">
{t('label.total-user-plural')}
<Tooltip
destroyTooltipOnHide
title={t('message.team-distinct-user-description')}>
<InfoCircleOutlined
className="m-x-xss"
data-testid="helper-icon"
style={{ color: GRAYED_OUT_COLOR }}
/>
</Tooltip>
{' : '}
</Typography.Text>

<Typography.Text className="font-medium" data-testid="team-user-count">
{currentTeam.userCount}
</Typography.Text>
</Space>
</Space>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ describe('TeamsInfo', () => {
render(<TeamsInfo {...teamProps} />);
});
const domainLabel = screen.getByText('DomainLabel');
const userCount = screen.getByTestId('team-user-count');

expect(domainLabel).toBeInTheDocument();
expect(userCount).toContainHTML('1');
});

it('should handle edit team email', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,7 @@
"total": "Total",
"total-entity": "Gesamte {{entity}}",
"total-index-sent": "Gesamtindex gesendet",
"total-user-plural": "Total Users",
"tour": "Tour",
"tracking": "Verfolgung",
"transportation-strategy": "Transportstrategie",
Expand Down Expand Up @@ -1821,6 +1822,7 @@
"system-tag-delete-disable-message": "Das Löschen von systemgenerierten Tags ist nicht zulässig. Sie können versuchen, den Tag stattdessen zu deaktivieren.",
"tag-update-confirmation": "Would you like to proceed with updating the tags?",
"take-quick-product-tour": "Machen Sie eine Produkttour, um loszulegen!",
"team-distinct-user-description": "The total number of distinct users belongs to this team.",
"team-moved-success": "Team erfolgreich verschoben!",
"team-no-asset": "Ihr Team hat keine Vermögenswerte.",
"test-case-schedule-description": "The data quality tests can be scheduled to run at the desired frequency. The timezone is in UTC.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,7 @@
"total": "Total",
"total-entity": "Total {{entity}}",
"total-index-sent": " Total index sent",
"total-user-plural": "Total Users",
"tour": "Tour",
"tracking": "Tracking",
"transportation-strategy": "Transportation Strategy",
Expand Down Expand Up @@ -1821,6 +1822,7 @@
"system-tag-delete-disable-message": "Deleting a system generated tags is not allowed. You can try disabling the tag instead.",
"tag-update-confirmation": "Would you like to proceed with updating the tags?",
"take-quick-product-tour": "Take a product tour to get started!",
"team-distinct-user-description": "The total number of distinct users belongs to this team.",
"team-moved-success": "Team moved successfully!",
"team-no-asset": "Your team does not have any assets.",
"test-case-schedule-description": "The data quality tests can be scheduled to run at the desired frequency. The timezone is in UTC.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,7 @@
"total": "Total",
"total-entity": "Total de {{entity}}",
"total-index-sent": "Total de índices enviados",
"total-user-plural": "Total Users",
"tour": "Recorrido",
"tracking": "Seguimiento",
"transportation-strategy": "Estrategia de transporte",
Expand Down Expand Up @@ -1821,6 +1822,7 @@
"system-tag-delete-disable-message": "No se permite eliminar una etiqueta generada por el sistema. Puedes intentar desactivar la etiqueta en su lugar.",
"tag-update-confirmation": "Would you like to proceed with updating the tags?",
"take-quick-product-tour": "¡Realiza un recorrido rápido del producto para comenzar!",
"team-distinct-user-description": "The total number of distinct users belongs to this team.",
"team-moved-success": "¡Equipo movido con éxito!",
"team-no-asset": "Tu equipo no tiene ningún activo.",
"test-case-schedule-description": "The data quality tests can be scheduled to run at the desired frequency. The timezone is in UTC.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,7 @@
"total": "Total",
"total-entity": "Total {{entity}}",
"total-index-sent": "Total d'Index Envoyés",
"total-user-plural": "Total Users",
"tour": "Visite",
"tracking": "Suivi",
"transportation-strategy": "Stratégie de Transport",
Expand Down Expand Up @@ -1821,6 +1822,7 @@
"system-tag-delete-disable-message": "Supprimer un tag système n'est pas permis. Tentez plutôt de désactiver ce tag.",
"tag-update-confirmation": "Would you like to proceed with updating the tags?",
"take-quick-product-tour": "Faites une visite guidée pour vous lancer!",
"team-distinct-user-description": "The total number of distinct users belongs to this team.",
"team-moved-success": "L'équipe a été déplacée avec succès !",
"team-no-asset": "Votre équipe n'a pas d'actifs de données",
"test-case-schedule-description": "Les tests de quelité de données peuvent être planifiés pour tourner à la fréquence désirée. La timezone est en UTC.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,7 @@
"total": "Total",
"total-entity": "סך הכל {{entity}}",
"total-index-sent": "סך הכל שלח אינדקס",
"total-user-plural": "Total Users",
"tour": "סיור",
"tracking": "מעקב",
"transportation-strategy": "אסטרטגיית הובלה",
Expand Down Expand Up @@ -1821,6 +1822,7 @@
"system-tag-delete-disable-message": "מחיקת תגיות שנוצרו באופן מערכתי אינה מותרת. ניתן לנסות לנטרל את התג במקום.",
"tag-update-confirmation": "Would you like to proceed with updating the tags?",
"take-quick-product-tour": "התחל סיור במוצר כדי להתחיל!",
"team-distinct-user-description": "The total number of distinct users belongs to this team.",
"team-moved-success": "הקבוצה הועברה בהצלחה!",
"team-no-asset": "לקבוצתך אין נכסים.",
"test-case-schedule-description": "The data quality tests can be scheduled to run at the desired frequency. The timezone is in UTC.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,7 @@
"total": "Total",
"total-entity": "合計 {{entity}}",
"total-index-sent": " Total index sent",
"total-user-plural": "Total Users",
"tour": "ツアー",
"tracking": "トラッキング",
"transportation-strategy": "Transportation Strategy",
Expand Down Expand Up @@ -1821,6 +1822,7 @@
"system-tag-delete-disable-message": "Deleting a system generated tags is not allowed. You can try disabling the tag instead.",
"tag-update-confirmation": "Would you like to proceed with updating the tags?",
"take-quick-product-tour": "Take a product tour to get started!",
"team-distinct-user-description": "The total number of distinct users belongs to this team.",
"team-moved-success": "チームの移動が成功しました!",
"team-no-asset": "あなたのチームはアセットを持っていません。",
"test-case-schedule-description": "The data quality tests can be scheduled to run at the desired frequency. The timezone is in UTC.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,7 @@
"total": "Total",
"total-entity": "{{entity}} totaal",
"total-index-sent": "Index verzonden totaal",
"total-user-plural": "Total Users",
"tour": "Rondleiding",
"tracking": "Tracking",
"transportation-strategy": "Transportstrategie",
Expand Down Expand Up @@ -1821,6 +1822,7 @@
"system-tag-delete-disable-message": "Het verwijderen van door het systeem gegenereerde tags is niet toegestaan. Je kunt proberen de tag uit te schakelen.",
"tag-update-confirmation": "Would you like to proceed with updating the tags?",
"take-quick-product-tour": "Maak een producttour om aan de slag te gaan!",
"team-distinct-user-description": "The total number of distinct users belongs to this team.",
"team-moved-success": "Team succesvol verplaatst!",
"team-no-asset": "Je team heeft geen assets.",
"test-case-schedule-description": "The data quality tests can be scheduled to run at the desired frequency. The timezone is in UTC.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,7 @@
"total": "مجموع",
"total-entity": "مجموع {{entity}}",
"total-index-sent": "مجموع ایندکس ارسال‌شده",
"total-user-plural": "Total Users",
"tour": "تور",
"tracking": "ردیابی",
"transportation-strategy": "استراتژی حمل و نقل",
Expand Down Expand Up @@ -1821,6 +1822,7 @@
"system-tag-delete-disable-message": "حذف برچسب‌های تولید شده توسط سیستم مجاز نیست. می‌توانید برچسب را غیرفعال کنید.",
"tag-update-confirmation": "آیا می‌خواهید به‌روزرسانی برچسب‌ها را ادامه دهید؟",
"take-quick-product-tour": "یک تور محصولی برای شروع بگذارید!",
"team-distinct-user-description": "The total number of distinct users belongs to this team.",
"team-moved-success": "تیم با موفقیت منتقل شد!",
"team-no-asset": "تیم شما هیچ دارایی ندارد.",
"test-case-schedule-description": "آزمون‌های کیفیت داده می‌توانند به صورت دوره‌ای برنامه‌ریزی شوند. منطقه زمانی به صورت UTC است.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,7 @@
"total": "Total",
"total-entity": "Total de {{entity}}",
"total-index-sent": " Total de índice enviado",
"total-user-plural": "Total Users",
"tour": "Tour",
"tracking": "Rastreamento",
"transportation-strategy": "Estratégia de Transporte",
Expand Down Expand Up @@ -1821,6 +1822,7 @@
"system-tag-delete-disable-message": "Não é permitido excluir tags geradas pelo sistema. Você pode tentar desativar a tag em vez disso.",
"tag-update-confirmation": "Would you like to proceed with updating the tags?",
"take-quick-product-tour": "Faça um tour pelo produto para começar!",
"team-distinct-user-description": "The total number of distinct users belongs to this team.",
"team-moved-success": "Equipe movida com sucesso!",
"team-no-asset": "Sua equipe não possui ativos.",
"test-case-schedule-description": "The data quality tests can be scheduled to run at the desired frequency. The timezone is in UTC.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,7 @@
"total": "Total",
"total-entity": "Все {{entity}}",
"total-index-sent": "Все индексы отправлены",
"total-user-plural": "Total Users",
"tour": "Руководство пользователя",
"tracking": "Отслеживание",
"transportation-strategy": "Стратегия транспортировки",
Expand Down Expand Up @@ -1821,6 +1822,7 @@
"system-tag-delete-disable-message": "Удаление сгенерированных системой тегов не допускается. Вместо этого вы можете попробовать отключить тег.",
"tag-update-confirmation": "Would you like to proceed with updating the tags?",
"take-quick-product-tour": "Ознакомьтесь с продуктом, чтобы начать работу!",
"team-distinct-user-description": "The total number of distinct users belongs to this team.",
"team-moved-success": "Команда успешно переехала!",
"team-no-asset": "У вашей команды нет объектов.",
"test-case-schedule-description": "The data quality tests can be scheduled to run at the desired frequency. The timezone is in UTC.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,7 @@
"total": "Total",
"total-entity": "所有{{entity}}",
"total-index-sent": "已发送的索引",
"total-user-plural": "Total Users",
"tour": "导览",
"tracking": "跟踪",
"transportation-strategy": "传输协议",
Expand Down Expand Up @@ -1821,6 +1822,7 @@
"system-tag-delete-disable-message": "无法删除系统默认的标签, 您可以尝试禁用标签",
"tag-update-confirmation": "Would you like to proceed with updating the tags?",
"take-quick-product-tour": "快速查看产品导览",
"team-distinct-user-description": "The total number of distinct users belongs to this team.",
"team-moved-success": "团队移动成功",
"team-no-asset": "您的团队没有任何资产",
"test-case-schedule-description": "数据质控测试可按所需频率安排运行, 时区为 UTC",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,17 @@ describe('Test Teams Page', () => {

expect(mockGetTeamByName.mock.calls[0]).toEqual([
'test',
{ fields: ['users', 'parents', 'profile', 'owners'], include: 'all' },
{
fields: ['users', 'userCount', 'parents', 'profile', 'owners'],
include: 'all',
},
]);
expect(mockGetTeamByName.mock.calls[1]).toEqual([
'test',
{
fields: [
'users',
'userCount',
'defaultRoles',
'policies',
'childrenCount',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ const TeamsPage = () => {
const data = await getTeamByName(name, {
fields: [
TabSpecificField.USERS,
TabSpecificField.USER_COUNT,
TabSpecificField.PARENTS,
TabSpecificField.PROFILE,
TabSpecificField.OWNERS,
Expand All @@ -242,6 +243,7 @@ const TeamsPage = () => {
const data = await getTeamByName(name, {
fields: [
TabSpecificField.USERS,
TabSpecificField.USER_COUNT,
TabSpecificField.DEFAULT_ROLES,
TabSpecificField.POLICIES,
TabSpecificField.CHILDREN_COUNT,
Expand Down

0 comments on commit e847172

Please sign in to comment.