Fix: Feeds UI adjustments and existing name restriction (#2154)

This commit is contained in:
darth-coder00 2022-01-11 18:54:59 +05:30 committed by GitHub
parent cf2381482d
commit adb63cc982
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 20 deletions

View File

@ -13,7 +13,7 @@
import { AxiosError, AxiosResponse } from 'axios';
import classNames from 'classnames';
import { isUndefined } from 'lodash';
import { isUndefined, toLower } from 'lodash';
import { EntityTags, FormErrorData } from 'Models';
import React, { useEffect, useState } from 'react';
import { Link } from 'react-router-dom';
@ -108,7 +108,9 @@ const TagsPage = () => {
} else if (/\s/g.test(data.name)) {
errData['name'] = 'Name with space is not allowed';
} else if (
!isUndefined(categories.find((item) => item.name === data.name))
!isUndefined(
categories.find((item) => toLower(item.name) === toLower(data.name))
)
) {
errData['name'] = 'Name already exists';
}
@ -155,7 +157,7 @@ const TagsPage = () => {
} else if (
!isUndefined(
currentCategory?.children?.find(
(item) => (item as TagClass)?.name === data.name
(item) => toLower((item as TagClass)?.name) === toLower(data.name)
)
)
) {

View File

@ -388,7 +388,7 @@ export const feedSummaryFromatter = (
);
summary = (
<p key={uniqueId()}>
{`Assigned Ownership to`}
{`Assigned ownership to`}
{ownerText}
</p>
);
@ -416,7 +416,7 @@ export const feedSummaryFromatter = (
case fieldChange?.name === 'followers': {
summary = (
<p key={uniqueId()}>{`${
fieldChange?.newValue ? 'Started Following' : 'Unfollowed'
fieldChange?.newValue ? 'Started following' : 'Unfollowed'
} ${_entityName}`}</p>
);
@ -443,6 +443,21 @@ export const getFeedSummary = (
return (
<Fragment>
{fieldsDeleted?.length ? (
<div className="tw-mb-2">
{fieldsDeleted?.map((d) => (
<Fragment key={uniqueId()}>
{feedSummaryFromatter(
d,
ChangeType.REMOVED,
entityName,
entityType,
entityFQN
)}
</Fragment>
))}
</div>
) : null}
{fieldsAdded?.length > 0 ? (
<div className="tw-mb-2">
{fieldsAdded?.map((a) => (
@ -473,21 +488,6 @@ export const getFeedSummary = (
))}
</div>
) : null}
{fieldsDeleted?.length ? (
<div className="tw-mb-2">
{fieldsDeleted?.map((d) => (
<Fragment key={uniqueId()}>
{feedSummaryFromatter(
d,
ChangeType.REMOVED,
entityName,
entityType,
entityFQN
)}
</Fragment>
))}
</div>
) : null}
</Fragment>
);
};