supported total unique user count in Team page (#18361)

* supported total distinct user count in Team page

* minor improvement

* fix unit test

* added helpertext tooltip and change the label

* minor cosmetic update

(cherry picked from commit 4c4587c82be9cca9874321566aab073ad3074250)
This commit is contained in:
Ashish Gupta 2024-10-23 02:20:26 +05:30
parent 9f60ba68f5
commit ed937b8e08
17 changed files with 62 additions and 15 deletions

View File

@ -1050,13 +1050,7 @@ const TeamDetailsV1 = ({
const tabs = useMemo( const tabs = useMemo(
() => () =>
getTabs( getTabs(currentTeam, isGroupType, teamCount, assetsCount).map((tab) => ({
currentTeam,
isGroupType,
isOrganization,
teamCount,
assetsCount
).map((tab) => ({
...tab, ...tab,
label: ( label: (
<TabsLabel <TabsLabel

View File

@ -18,7 +18,6 @@ import { TeamsPageTab } from './team.interface';
export const getTabs = ( export const getTabs = (
currentTeam: Team, currentTeam: Team,
isGroupType: boolean, isGroupType: boolean,
isOrganization: boolean,
teamsCount: number, teamsCount: number,
assetsCount: number assetsCount: number
) => { ) => {
@ -52,13 +51,9 @@ export const getTabs = (
const commonTabs = [tabs.roles, tabs.policies]; const commonTabs = [tabs.roles, tabs.policies];
if (isOrganization) {
return [tabs.teams, ...commonTabs];
}
if (isGroupType) { if (isGroupType) {
return [tabs.users, tabs.assets, ...commonTabs]; return [tabs.users, tabs.assets, ...commonTabs];
} }
return [tabs.teams, tabs.users, ...commonTabs]; return [tabs.teams, ...commonTabs];
}; };

View File

@ -10,7 +10,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 { Button, Divider, Form, Input, Space, Tooltip, Typography } from 'antd';
import { isEmpty, last } from 'lodash'; import { isEmpty, last } from 'lodash';
import React, { useCallback, useMemo, useState } from 'react'; import React, { useCallback, useMemo, useState } from 'react';
@ -18,6 +22,7 @@ import { useTranslation } from 'react-i18next';
import { ReactComponent as EditIcon } from '../../../../../assets/svg/edit-new.svg'; import { ReactComponent as EditIcon } from '../../../../../assets/svg/edit-new.svg';
import { import {
DE_ACTIVE_COLOR, DE_ACTIVE_COLOR,
GRAYED_OUT_COLOR,
ICON_DIMENSION, ICON_DIMENSION,
NO_DATA_PLACEHOLDER, NO_DATA_PLACEHOLDER,
} from '../../../../../constants/constants'; } from '../../../../../constants/constants';
@ -314,6 +319,29 @@ const TeamsInfo = ({
updateTeamSubscription={updateTeamSubscription} updateTeamSubscription={updateTeamSubscription}
/> />
{teamTypeElement} {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> </Space>
); );
}; };

View File

@ -93,8 +93,10 @@ describe('TeamsInfo', () => {
render(<TeamsInfo {...teamProps} />); render(<TeamsInfo {...teamProps} />);
}); });
const domainLabel = screen.getByText('DomainLabel'); const domainLabel = screen.getByText('DomainLabel');
const userCount = screen.getByTestId('team-user-count');
expect(domainLabel).toBeInTheDocument(); expect(domainLabel).toBeInTheDocument();
expect(userCount).toContainHTML('1');
}); });
it('should handle edit team email', () => { it('should handle edit team email', () => {

View File

@ -1229,6 +1229,7 @@
"total": "Total", "total": "Total",
"total-entity": "Gesamte {{entity}}", "total-entity": "Gesamte {{entity}}",
"total-index-sent": "Gesamtindex gesendet", "total-index-sent": "Gesamtindex gesendet",
"total-user-plural": "Total Users",
"tour": "Tour", "tour": "Tour",
"tracking": "Verfolgung", "tracking": "Verfolgung",
"transportation-strategy": "Transportstrategie", "transportation-strategy": "Transportstrategie",
@ -1808,6 +1809,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.", "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?", "tag-update-confirmation": "Would you like to proceed with updating the tags?",
"take-quick-product-tour": "Machen Sie eine Produkttour, um loszulegen!", "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-moved-success": "Team erfolgreich verschoben!",
"team-no-asset": "Ihr Team hat keine Vermögenswerte.", "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.", "test-case-schedule-description": "The data quality tests can be scheduled to run at the desired frequency. The timezone is in UTC.",

View File

@ -1229,6 +1229,7 @@
"total": "Total", "total": "Total",
"total-entity": "Total {{entity}}", "total-entity": "Total {{entity}}",
"total-index-sent": " Total index sent", "total-index-sent": " Total index sent",
"total-user-plural": "Total Users",
"tour": "Tour", "tour": "Tour",
"tracking": "Tracking", "tracking": "Tracking",
"transportation-strategy": "Transportation Strategy", "transportation-strategy": "Transportation Strategy",
@ -1808,6 +1809,7 @@
"system-tag-delete-disable-message": "Deleting a system generated tags is not allowed. You can try disabling the tag instead.", "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?", "tag-update-confirmation": "Would you like to proceed with updating the tags?",
"take-quick-product-tour": "Take a product tour to get started!", "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-moved-success": "Team moved successfully!",
"team-no-asset": "Your team does not have any assets.", "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.", "test-case-schedule-description": "The data quality tests can be scheduled to run at the desired frequency. The timezone is in UTC.",

View File

@ -1229,6 +1229,7 @@
"total": "Total", "total": "Total",
"total-entity": "Total de {{entity}}", "total-entity": "Total de {{entity}}",
"total-index-sent": "Total de índices enviados", "total-index-sent": "Total de índices enviados",
"total-user-plural": "Total Users",
"tour": "Recorrido", "tour": "Recorrido",
"tracking": "Seguimiento", "tracking": "Seguimiento",
"transportation-strategy": "Estrategia de transporte", "transportation-strategy": "Estrategia de transporte",
@ -1808,6 +1809,7 @@
"system-tag-delete-disable-message": "No se permite eliminar una etiqueta generada por el sistema. Puedes intentar desactivar la etiqueta en su lugar.", "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?", "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!", "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-moved-success": "¡Equipo movido con éxito!",
"team-no-asset": "Tu equipo no tiene ningún activo.", "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.", "test-case-schedule-description": "The data quality tests can be scheduled to run at the desired frequency. The timezone is in UTC.",

View File

@ -1229,6 +1229,7 @@
"total": "Total", "total": "Total",
"total-entity": "Total {{entity}}", "total-entity": "Total {{entity}}",
"total-index-sent": "Total d'Index Envoyés", "total-index-sent": "Total d'Index Envoyés",
"total-user-plural": "Total Users",
"tour": "Visite", "tour": "Visite",
"tracking": "Suivi", "tracking": "Suivi",
"transportation-strategy": "Stratégie de Transport", "transportation-strategy": "Stratégie de Transport",
@ -1808,6 +1809,7 @@
"system-tag-delete-disable-message": "Supprimer un tag système n'est pas permis. Tentez plutôt de désactiver ce tag.", "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?", "tag-update-confirmation": "Would you like to proceed with updating the tags?",
"take-quick-product-tour": "Faites une visite guidée pour vous lancer!", "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-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", "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.", "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.",

View File

@ -1229,6 +1229,7 @@
"total": "Total", "total": "Total",
"total-entity": "סך הכל {{entity}}", "total-entity": "סך הכל {{entity}}",
"total-index-sent": "סך הכל שלח אינדקס", "total-index-sent": "סך הכל שלח אינדקס",
"total-user-plural": "Total Users",
"tour": "סיור", "tour": "סיור",
"tracking": "מעקב", "tracking": "מעקב",
"transportation-strategy": "אסטרטגיית הובלה", "transportation-strategy": "אסטרטגיית הובלה",
@ -1808,6 +1809,7 @@
"system-tag-delete-disable-message": "מחיקת תגיות שנוצרו באופן מערכתי אינה מותרת. ניתן לנסות לנטרל את התג במקום.", "system-tag-delete-disable-message": "מחיקת תגיות שנוצרו באופן מערכתי אינה מותרת. ניתן לנסות לנטרל את התג במקום.",
"tag-update-confirmation": "Would you like to proceed with updating the tags?", "tag-update-confirmation": "Would you like to proceed with updating the tags?",
"take-quick-product-tour": "התחל סיור במוצר כדי להתחיל!", "take-quick-product-tour": "התחל סיור במוצר כדי להתחיל!",
"team-distinct-user-description": "The total number of distinct users belongs to this team.",
"team-moved-success": "הקבוצה הועברה בהצלחה!", "team-moved-success": "הקבוצה הועברה בהצלחה!",
"team-no-asset": "לקבוצתך אין נכסים.", "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.", "test-case-schedule-description": "The data quality tests can be scheduled to run at the desired frequency. The timezone is in UTC.",

View File

@ -1229,6 +1229,7 @@
"total": "Total", "total": "Total",
"total-entity": "合計 {{entity}}", "total-entity": "合計 {{entity}}",
"total-index-sent": " Total index sent", "total-index-sent": " Total index sent",
"total-user-plural": "Total Users",
"tour": "ツアー", "tour": "ツアー",
"tracking": "トラッキング", "tracking": "トラッキング",
"transportation-strategy": "Transportation Strategy", "transportation-strategy": "Transportation Strategy",
@ -1808,6 +1809,7 @@
"system-tag-delete-disable-message": "Deleting a system generated tags is not allowed. You can try disabling the tag instead.", "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?", "tag-update-confirmation": "Would you like to proceed with updating the tags?",
"take-quick-product-tour": "Take a product tour to get started!", "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-success": "チームの移動が成功しました!",
"team-no-asset": "あなたのチームはアセットを持っていません。", "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.", "test-case-schedule-description": "The data quality tests can be scheduled to run at the desired frequency. The timezone is in UTC.",

View File

@ -1229,6 +1229,7 @@
"total": "Total", "total": "Total",
"total-entity": "{{entity}} totaal", "total-entity": "{{entity}} totaal",
"total-index-sent": "Index verzonden totaal", "total-index-sent": "Index verzonden totaal",
"total-user-plural": "Total Users",
"tour": "Rondleiding", "tour": "Rondleiding",
"tracking": "Tracking", "tracking": "Tracking",
"transportation-strategy": "Transportstrategie", "transportation-strategy": "Transportstrategie",
@ -1808,6 +1809,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.", "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?", "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!", "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-moved-success": "Team succesvol verplaatst!",
"team-no-asset": "Je team heeft geen assets.", "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.", "test-case-schedule-description": "The data quality tests can be scheduled to run at the desired frequency. The timezone is in UTC.",

View File

@ -1238,6 +1238,7 @@
"total": "مجموع", "total": "مجموع",
"total-entity": "مجموع {{entity}}", "total-entity": "مجموع {{entity}}",
"total-index-sent": "مجموع ایندکس ارسال‌شده", "total-index-sent": "مجموع ایندکس ارسال‌شده",
"total-user-plural": "Total Users",
"tour": "تور", "tour": "تور",
"tracking": "ردیابی", "tracking": "ردیابی",
"transportation-strategy": "استراتژی حمل و نقل", "transportation-strategy": "استراتژی حمل و نقل",
@ -1816,6 +1817,7 @@
"system-tag-delete-disable-message": "حذف برچسب‌های تولید شده توسط سیستم مجاز نیست. می‌توانید برچسب را غیرفعال کنید.", "system-tag-delete-disable-message": "حذف برچسب‌های تولید شده توسط سیستم مجاز نیست. می‌توانید برچسب را غیرفعال کنید.",
"tag-update-confirmation": "آیا می‌خواهید به‌روزرسانی برچسب‌ها را ادامه دهید؟", "tag-update-confirmation": "آیا می‌خواهید به‌روزرسانی برچسب‌ها را ادامه دهید؟",
"take-quick-product-tour": "یک تور محصولی برای شروع بگذارید!", "take-quick-product-tour": "یک تور محصولی برای شروع بگذارید!",
"team-distinct-user-description": "The total number of distinct users belongs to this team.",
"team-moved-success": "تیم با موفقیت منتقل شد!", "team-moved-success": "تیم با موفقیت منتقل شد!",
"team-no-asset": "تیم شما هیچ دارایی ندارد.", "team-no-asset": "تیم شما هیچ دارایی ندارد.",
"test-case-schedule-description": "آزمون‌های کیفیت داده می‌توانند به صورت دوره‌ای برنامه‌ریزی شوند. منطقه زمانی به صورت UTC است.", "test-case-schedule-description": "آزمون‌های کیفیت داده می‌توانند به صورت دوره‌ای برنامه‌ریزی شوند. منطقه زمانی به صورت UTC است.",

View File

@ -1229,6 +1229,7 @@
"total": "Total", "total": "Total",
"total-entity": "Total de {{entity}}", "total-entity": "Total de {{entity}}",
"total-index-sent": " Total de índice enviado", "total-index-sent": " Total de índice enviado",
"total-user-plural": "Total Users",
"tour": "Tour", "tour": "Tour",
"tracking": "Rastreamento", "tracking": "Rastreamento",
"transportation-strategy": "Estratégia de Transporte", "transportation-strategy": "Estratégia de Transporte",
@ -1808,6 +1809,7 @@
"system-tag-delete-disable-message": "Não é permitido excluir tags geradas pelo sistema. Você pode tentar desativar a tag em vez disso.", "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?", "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!", "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-moved-success": "Equipe movida com sucesso!",
"team-no-asset": "Sua equipe não possui ativos.", "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.", "test-case-schedule-description": "The data quality tests can be scheduled to run at the desired frequency. The timezone is in UTC.",

View File

@ -1229,6 +1229,7 @@
"total": "Total", "total": "Total",
"total-entity": "Все {{entity}}", "total-entity": "Все {{entity}}",
"total-index-sent": "Все индексы отправлены", "total-index-sent": "Все индексы отправлены",
"total-user-plural": "Total Users",
"tour": "Руководство пользователя", "tour": "Руководство пользователя",
"tracking": "Отслеживание", "tracking": "Отслеживание",
"transportation-strategy": "Стратегия транспортировки", "transportation-strategy": "Стратегия транспортировки",
@ -1808,6 +1809,7 @@
"system-tag-delete-disable-message": "Удаление сгенерированных системой тегов не допускается. Вместо этого вы можете попробовать отключить тег.", "system-tag-delete-disable-message": "Удаление сгенерированных системой тегов не допускается. Вместо этого вы можете попробовать отключить тег.",
"tag-update-confirmation": "Would you like to proceed with updating the tags?", "tag-update-confirmation": "Would you like to proceed with updating the tags?",
"take-quick-product-tour": "Ознакомьтесь с продуктом, чтобы начать работу!", "take-quick-product-tour": "Ознакомьтесь с продуктом, чтобы начать работу!",
"team-distinct-user-description": "The total number of distinct users belongs to this team.",
"team-moved-success": "Команда успешно переехала!", "team-moved-success": "Команда успешно переехала!",
"team-no-asset": "У вашей команды нет объектов.", "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.", "test-case-schedule-description": "The data quality tests can be scheduled to run at the desired frequency. The timezone is in UTC.",

View File

@ -1229,6 +1229,7 @@
"total": "Total", "total": "Total",
"total-entity": "所有{{entity}}", "total-entity": "所有{{entity}}",
"total-index-sent": "已发送的索引", "total-index-sent": "已发送的索引",
"total-user-plural": "Total Users",
"tour": "导览", "tour": "导览",
"tracking": "跟踪", "tracking": "跟踪",
"transportation-strategy": "传输协议", "transportation-strategy": "传输协议",
@ -1808,6 +1809,7 @@
"system-tag-delete-disable-message": "无法删除系统默认的标签, 您可以尝试禁用标签", "system-tag-delete-disable-message": "无法删除系统默认的标签, 您可以尝试禁用标签",
"tag-update-confirmation": "Would you like to proceed with updating the tags?", "tag-update-confirmation": "Would you like to proceed with updating the tags?",
"take-quick-product-tour": "快速查看产品导览", "take-quick-product-tour": "快速查看产品导览",
"team-distinct-user-description": "The total number of distinct users belongs to this team.",
"team-moved-success": "团队移动成功", "team-moved-success": "团队移动成功",
"team-no-asset": "您的团队没有任何资产", "team-no-asset": "您的团队没有任何资产",
"test-case-schedule-description": "数据质控测试可按所需频率安排运行, 时区为 UTC", "test-case-schedule-description": "数据质控测试可按所需频率安排运行, 时区为 UTC",

View File

@ -154,13 +154,17 @@ describe('Test Teams Page', () => {
expect(mockGetTeamByName.mock.calls[0]).toEqual([ expect(mockGetTeamByName.mock.calls[0]).toEqual([
'test', 'test',
{ fields: ['users', 'parents', 'profile', 'owners'], include: 'all' }, {
fields: ['users', 'userCount', 'parents', 'profile', 'owners'],
include: 'all',
},
]); ]);
expect(mockGetTeamByName.mock.calls[1]).toEqual([ expect(mockGetTeamByName.mock.calls[1]).toEqual([
'test', 'test',
{ {
fields: [ fields: [
'users', 'users',
'userCount',
'defaultRoles', 'defaultRoles',
'policies', 'policies',
'childrenCount', 'childrenCount',

View File

@ -218,6 +218,7 @@ const TeamsPage = () => {
const data = await getTeamByName(name, { const data = await getTeamByName(name, {
fields: [ fields: [
TabSpecificField.USERS, TabSpecificField.USERS,
TabSpecificField.USER_COUNT,
TabSpecificField.PARENTS, TabSpecificField.PARENTS,
TabSpecificField.PROFILE, TabSpecificField.PROFILE,
TabSpecificField.OWNERS, TabSpecificField.OWNERS,
@ -242,6 +243,7 @@ const TeamsPage = () => {
const data = await getTeamByName(name, { const data = await getTeamByName(name, {
fields: [ fields: [
TabSpecificField.USERS, TabSpecificField.USERS,
TabSpecificField.USER_COUNT,
TabSpecificField.DEFAULT_ROLES, TabSpecificField.DEFAULT_ROLES,
TabSpecificField.POLICIES, TabSpecificField.POLICIES,
TabSpecificField.CHILDREN_COUNT, TabSpecificField.CHILDREN_COUNT,