mirror of
https://github.com/harness/drone.git
synced 2025-05-19 02:20:03 +08:00
chore: [CODE-3073]: remove cyclic dependencies in code (#3315)
* chore: [CODE-3073]: Prettier * chore: [CODE-3073]: Prettier * chore: [CODE-3073]: Prettier * chore: [CODE-3073]: remove cyclic dependencies in code
This commit is contained in:
parent
d51474badc
commit
c05b105e32
@ -28,9 +28,8 @@ import {
|
|||||||
useMembershipAdd,
|
useMembershipAdd,
|
||||||
useMembershipUpdate
|
useMembershipUpdate
|
||||||
} from 'services/code'
|
} from 'services/code'
|
||||||
import { getErrorMessage, LIST_FETCHING_LIMIT } from 'utils/Utils'
|
import { getErrorMessage, LIST_FETCHING_LIMIT, roleStringKeyMap } from 'utils/Utils'
|
||||||
import { useModalHook } from 'hooks/useModalHook'
|
import { useModalHook } from 'hooks/useModalHook'
|
||||||
import { roleStringKeyMap } from '../SpaceAccessControl'
|
|
||||||
|
|
||||||
const roles = ['reader', 'executor', 'contributor', 'space_owner'] as const
|
const roles = ['reader', 'executor', 'contributor', 'space_owner'] as const
|
||||||
|
|
||||||
|
@ -19,25 +19,16 @@ import { Avatar, Button, ButtonVariation, Container, Layout, Page, TableV2, Text
|
|||||||
import { Color, FontVariation } from '@harnessio/design-system'
|
import { Color, FontVariation } from '@harnessio/design-system'
|
||||||
import type { CellProps, Column } from 'react-table'
|
import type { CellProps, Column } from 'react-table'
|
||||||
|
|
||||||
import { StringKeys, useStrings } from 'framework/strings'
|
import { useStrings } from 'framework/strings'
|
||||||
import { useConfirmAct } from 'hooks/useConfirmAction'
|
import { useConfirmAct } from 'hooks/useConfirmAction'
|
||||||
import { useGetSpaceParam } from 'hooks/useGetSpaceParam'
|
import { useGetSpaceParam } from 'hooks/useGetSpaceParam'
|
||||||
import { EnumMembershipRole, TypesMembershipUser, useMembershipDelete, useMembershipList } from 'services/code'
|
import { TypesMembershipUser, useMembershipDelete, useMembershipList } from 'services/code'
|
||||||
import { getErrorMessage } from 'utils/Utils'
|
import { getErrorMessage, roleStringKeyMap } from 'utils/Utils'
|
||||||
import { LoadingSpinner } from 'components/LoadingSpinner/LoadingSpinner'
|
import { LoadingSpinner } from 'components/LoadingSpinner/LoadingSpinner'
|
||||||
import { OptionsMenuButton } from 'components/OptionsMenuButton/OptionsMenuButton'
|
import { OptionsMenuButton } from 'components/OptionsMenuButton/OptionsMenuButton'
|
||||||
|
|
||||||
import useAddNewMember from './AddNewMember/AddNewMember'
|
import useAddNewMember from './AddNewMember/AddNewMember'
|
||||||
|
|
||||||
import css from './SpaceAccessControl.module.scss'
|
import css from './SpaceAccessControl.module.scss'
|
||||||
|
|
||||||
export const roleStringKeyMap: Record<EnumMembershipRole, StringKeys> = {
|
|
||||||
contributor: 'contributor',
|
|
||||||
executor: 'executor',
|
|
||||||
reader: 'reader',
|
|
||||||
space_owner: 'owner'
|
|
||||||
}
|
|
||||||
|
|
||||||
const SpaceAccessControl = () => {
|
const SpaceAccessControl = () => {
|
||||||
const { getString } = useStrings()
|
const { getString } = useStrings()
|
||||||
const { showError, showSuccess } = useToaster()
|
const { showError, showSuccess } = useToaster()
|
||||||
|
@ -31,9 +31,11 @@ import type {
|
|||||||
TypesLabelValue,
|
TypesLabelValue,
|
||||||
TypesPullReq,
|
TypesPullReq,
|
||||||
TypesOwnerEvaluation,
|
TypesOwnerEvaluation,
|
||||||
TypesPrincipalInfo
|
TypesPrincipalInfo,
|
||||||
|
EnumMembershipRole
|
||||||
} from 'services/code'
|
} from 'services/code'
|
||||||
import { PullReqReviewDecision } from 'pages/PullRequest/PullRequestUtils'
|
import { PullReqReviewDecision } from 'pages/PullRequest/PullRequestUtils'
|
||||||
|
import type { StringKeys } from 'framework/strings'
|
||||||
|
|
||||||
export enum ACCESS_MODES {
|
export enum ACCESS_MODES {
|
||||||
VIEW,
|
VIEW,
|
||||||
@ -1114,3 +1116,10 @@ export const replaceMentionEmailWithId = (
|
|||||||
[x: string]: TypesPrincipalInfo
|
[x: string]: TypesPrincipalInfo
|
||||||
}
|
}
|
||||||
) => input.replace(/@\[(\S+@\S+\.\S+)\]/g, (match, email) => (emailMap[email] ? `@[${emailMap[email].id}]` : match))
|
) => input.replace(/@\[(\S+@\S+\.\S+)\]/g, (match, email) => (emailMap[email] ? `@[${emailMap[email].id}]` : match))
|
||||||
|
|
||||||
|
export const roleStringKeyMap: Record<EnumMembershipRole, StringKeys> = {
|
||||||
|
contributor: 'contributor',
|
||||||
|
executor: 'executor',
|
||||||
|
reader: 'reader',
|
||||||
|
space_owner: 'owner'
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user