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 space = useGetSpaceParam()
const pageScope = useGetCurrentPageScope() const pageScope = useGetCurrentPageScope()
const history = useHistory() const history = useHistory()
const { routes, hooks, standalone } = useAppContext() const { routes } = useAppContext()
const { CODE_PULLREQ_LABELS: isLabelEnabled } = hooks?.useFeatureFlags()
const [activeTab, setActiveTab] = React.useState<string>(settingSection || SettingsTab.labels) const [activeTab, setActiveTab] = React.useState<string>(settingSection || SettingsTab.labels)
const { getString } = useStrings() const { getString } = useStrings()
const tabListArray = [ const tabListArray = [
...(isLabelEnabled || standalone
? [
{ {
id: SettingsTab.labels, id: SettingsTab.labels,
title: getString('labels.labels'), title: getString('labels.labels'),
panel: <LabelsListing activeTab={activeTab} currentPageScope={pageScope} space={space} /> panel: <LabelsListing activeTab={activeTab} currentPageScope={pageScope} space={space} />
} },
]
: []),
{ {
id: SettingsTab.branchProtection, id: SettingsTab.branchProtection,
title: getString('branchProtection.title'), title: getString('branchProtection.title'),

View File

@ -100,8 +100,7 @@ export const Conversation: React.FC<ConversationProps> = ({
refetchPullReq refetchPullReq
}) => { }) => {
const { getString } = useStrings() const { getString } = useStrings()
const { currentUser, routes, hooks } = useAppContext() const { currentUser, routes } = useAppContext()
const { CODE_PULLREQ_LABELS: isLabelEnabled } = hooks?.useFeatureFlags()
const location = useLocation() const location = useLocation()
const activities = usePullReqActivities() const activities = usePullReqActivities()
const { const {
@ -270,8 +269,7 @@ export const Conversation: React.FC<ConversationProps> = ({
() => () =>
activityBlocks?.map((commentItems, index) => { activityBlocks?.map((commentItems, index) => {
const threadId = commentItems[0].payload?.id const threadId = commentItems[0].payload?.id
const renderLabelActivities = const renderLabelActivities = commentItems[0].payload?.type !== CommentType.LABEL_MODIFY
commentItems[0].payload?.type !== CommentType.LABEL_MODIFY || isLabelEnabled || standalone
if (isSystemComment(commentItems)) { if (isSystemComment(commentItems)) {
return ( return (
<Render key={`thread-${threadId}`} when={renderLabelActivities}> <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 { Container, Layout, Text, Avatar, FlexExpander, useToaster, Utils, stringSubstitute } from '@harnessio/uicore'
import { Icon, IconName } from '@harnessio/icons' import { Icon, IconName } from '@harnessio/icons'
import { Color, FontVariation } from '@harnessio/design-system' import { Color, FontVariation } from '@harnessio/design-system'
import { Render } from 'react-jsx-match'
import { useAppContext } from 'AppContext'
import { OptionsMenuButton } from 'components/OptionsMenuButton/OptionsMenuButton' import { OptionsMenuButton } from 'components/OptionsMenuButton/OptionsMenuButton'
import { useStrings } from 'framework/strings' import { useStrings } from 'framework/strings'
import type { TypesPullReq, RepoRepositoryOutput, EnumPullReqReviewDecision, TypesScopesLabels } from 'services/code' import type { TypesPullReq, RepoRepositoryOutput, EnumPullReqReviewDecision, TypesScopesLabels } from 'services/code'
@ -47,8 +45,6 @@ interface PullRequestSideBarProps {
} }
const PullRequestSideBar = (props: PullRequestSideBarProps) => { const PullRequestSideBar = (props: PullRequestSideBarProps) => {
const { standalone, hooks } = useAppContext()
const { CODE_PULLREQ_LABELS: isLabelEnabled } = hooks?.useFeatureFlags()
const [labelQuery, setLabelQuery] = useState<string>('') const [labelQuery, setLabelQuery] = useState<string>('')
const { reviewers, repoMetadata, pullRequestMetadata, refetchReviewers, labels, refetchLabels, refetchActivities } = const { reviewers, repoMetadata, pullRequestMetadata, refetchReviewers, labels, refetchLabels, refetchActivities } =
props props
@ -406,7 +402,7 @@ const PullRequestSideBar = (props: PullRequestSideBarProps) => {
</Text> </Text>
)} */} )} */}
</Layout.Vertical> </Layout.Vertical>
<Render when={isLabelEnabled || standalone}>
<Layout.Vertical> <Layout.Vertical>
<Layout.Horizontal> <Layout.Horizontal>
<Text style={{ lineHeight: '24px' }} font={{ variation: FontVariation.H6 }}> <Text style={{ lineHeight: '24px' }} font={{ variation: FontVariation.H6 }}>
@ -473,7 +469,6 @@ const PullRequestSideBar = (props: PullRequestSideBarProps) => {
</Layout.Horizontal> </Layout.Horizontal>
</Container> </Container>
</Layout.Vertical> </Layout.Vertical>
</Render>
</Container> </Container>
</Container> </Container>
) )

View File

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

View File

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

View File

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