fix: [CODE-2414] remove CODE_PULLREQ_LABELS (#3192)

* chore: [CODE-2414] remove CODE_PULLREQ_LABELS
This commit is contained in:
Ritik Kapoor 2024-12-31 16:40:35 +00:00 committed by Harness
parent aac9ace779
commit da756c486f
6 changed files with 98 additions and 125 deletions

View File

@ -33,21 +33,16 @@ export default function ManageRepositories() {
const space = useGetSpaceParam()
const pageScope = useGetCurrentPageScope()
const history = useHistory()
const { routes, hooks, standalone } = useAppContext()
const { CODE_PULLREQ_LABELS: isLabelEnabled } = hooks?.useFeatureFlags()
const { routes } = useAppContext()
const [activeTab, setActiveTab] = React.useState<string>(settingSection || SettingsTab.labels)
const { getString } = useStrings()
const tabListArray = [
...(isLabelEnabled || standalone
? [
{
id: SettingsTab.labels,
title: getString('labels.labels'),
panel: <LabelsListing activeTab={activeTab} currentPageScope={pageScope} space={space} />
}
]
: []),
},
{
id: SettingsTab.branchProtection,
title: getString('branchProtection.title'),

View File

@ -100,8 +100,7 @@ export const Conversation: React.FC<ConversationProps> = ({
refetchPullReq
}) => {
const { getString } = useStrings()
const { currentUser, routes, hooks } = useAppContext()
const { CODE_PULLREQ_LABELS: isLabelEnabled } = hooks?.useFeatureFlags()
const { currentUser, routes } = useAppContext()
const location = useLocation()
const activities = usePullReqActivities()
const {
@ -270,8 +269,7 @@ export const Conversation: React.FC<ConversationProps> = ({
() =>
activityBlocks?.map((commentItems, index) => {
const threadId = commentItems[0].payload?.id
const renderLabelActivities =
commentItems[0].payload?.type !== CommentType.LABEL_MODIFY || isLabelEnabled || standalone
const renderLabelActivities = commentItems[0].payload?.type !== CommentType.LABEL_MODIFY
if (isSystemComment(commentItems)) {
return (
<Render key={`thread-${threadId}`} when={renderLabelActivities}>

View File

@ -22,8 +22,6 @@ import cx from 'classnames'
import { Container, Layout, Text, Avatar, FlexExpander, useToaster, Utils, stringSubstitute } from '@harnessio/uicore'
import { Icon, IconName } from '@harnessio/icons'
import { Color, FontVariation } from '@harnessio/design-system'
import { Render } from 'react-jsx-match'
import { useAppContext } from 'AppContext'
import { OptionsMenuButton } from 'components/OptionsMenuButton/OptionsMenuButton'
import { useStrings } from 'framework/strings'
import type { TypesPullReq, RepoRepositoryOutput, EnumPullReqReviewDecision, TypesScopesLabels } from 'services/code'
@ -47,8 +45,6 @@ interface PullRequestSideBarProps {
}
const PullRequestSideBar = (props: PullRequestSideBarProps) => {
const { standalone, hooks } = useAppContext()
const { CODE_PULLREQ_LABELS: isLabelEnabled } = hooks?.useFeatureFlags()
const [labelQuery, setLabelQuery] = useState<string>('')
const { reviewers, repoMetadata, pullRequestMetadata, refetchReviewers, labels, refetchLabels, refetchActivities } =
props
@ -406,7 +402,7 @@ const PullRequestSideBar = (props: PullRequestSideBarProps) => {
</Text>
)} */}
</Layout.Vertical>
<Render when={isLabelEnabled || standalone}>
<Layout.Vertical>
<Layout.Horizontal>
<Text style={{ lineHeight: '24px' }} font={{ variation: FontVariation.H6 }}>
@ -473,7 +469,6 @@ const PullRequestSideBar = (props: PullRequestSideBarProps) => {
</Layout.Horizontal>
</Container>
</Layout.Vertical>
</Render>
</Container>
</Container>
)

View File

@ -77,7 +77,6 @@ export default function PullRequests() {
const { getString } = useStrings()
const history = useHistory()
const { routes, hooks, standalone, routingId } = useAppContext()
const { CODE_PULLREQ_LABELS: isLabelEnabled } = hooks?.useFeatureFlags()
const [searchTerm, setSearchTerm] = useState<string | undefined>()
const browserParams = useQueryParams<PageBrowserProps>()
const [filter, setFilter] = useState(browserParams?.state || (PullRequestFilterOption.OPEN as string))
@ -295,13 +294,7 @@ export default function PullRequests() {
</Text>
</Container>
</Layout.Horizontal>
<Render
when={
(isLabelEnabled || standalone) &&
row.original &&
row.original.labels &&
row.original.labels.length !== 0
}>
<Render when={row.original && row.original.labels && row.original.labels.length !== 0}>
{row.original?.labels?.map((label, index) => (
<Label
key={index}
@ -441,8 +434,7 @@ export default function PullRequests() {
</Text>
</Render>
{(isLabelEnabled || standalone) &&
labelFilter &&
{labelFilter &&
labelFilter?.length !== 0 &&
labelFilter?.map((label, index) => (
<Label

View File

@ -28,7 +28,6 @@ import {
} from '@harnessio/uicore'
import { Color, FontVariation } from '@harnessio/design-system'
import { sortBy } from 'lodash-es'
import { Render } from 'react-jsx-match'
import { getConfig, getUsingFetch } from 'services/config'
import { useStrings } from 'framework/strings'
import { CodeIcon, GitInfoProps, makeDiffRefs, PullRequestFilterOption } from 'utils/GitUtils'
@ -76,7 +75,6 @@ export function PullRequestsContentHeader({
const [loadingAuthors, setLoadingAuthors] = useState<boolean>(false)
const space = useGetSpaceParam()
const { hooks, currentUser, standalone, routingId, routes } = useAppContext()
const { CODE_PULLREQ_LABELS: isLabelEnabled } = hooks?.useFeatureFlags()
const permPushResult = hooks?.usePermissionTranslate?.(
{
resource: {
@ -194,7 +192,7 @@ export function PullRequestsContentHeader({
}}
/>
<FlexExpander />
<Render when={isLabelEnabled || standalone}>
<LabelFilter
labelFilterOption={labelFilterOption}
setLabelFilterOption={setLabelFilterOption}
@ -203,7 +201,7 @@ export function PullRequestsContentHeader({
repoMetadata={repoMetadata}
spaceRef={space}
/>
</Render>
<DropDown
value={authorFilterOption}
items={() => getAuthorsPromise()}

View File

@ -40,8 +40,7 @@ export default function RepositorySettings() {
const { repoMetadata, error, loading, refetch, settingSection, gitRef, resourcePath } = useGetRepositoryMetadata()
const space = useGetSpaceParam()
const history = useHistory()
const { routes, hooks, standalone } = useAppContext()
const { CODE_PULLREQ_LABELS: isLabelEnabled } = hooks?.useFeatureFlags()
const { routes } = useAppContext()
const [activeTab, setActiveTab] = React.useState<string>(settingSection || SettingsTab.general)
const { getString } = useStrings()
const { isRepositoryEmpty } = useGetResourceContent({
@ -66,8 +65,6 @@ export default function RepositorySettings() {
</Container>
)
},
...(isLabelEnabled || standalone
? [
{
id: SettingsTab.labels,
title: getString('labels.labels'),
@ -79,9 +76,7 @@ export default function RepositorySettings() {
space={space}
/>
)
}
]
: []),
},
{
id: SettingsTab.branchProtection,
title: getString('branchProtection.title'),