mirror of
https://github.com/harness/drone.git
synced 2025-05-18 18:09:56 +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,
|
||||
useMembershipUpdate
|
||||
} 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 { roleStringKeyMap } from '../SpaceAccessControl'
|
||||
|
||||
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 type { CellProps, Column } from 'react-table'
|
||||
|
||||
import { StringKeys, useStrings } from 'framework/strings'
|
||||
import { useStrings } from 'framework/strings'
|
||||
import { useConfirmAct } from 'hooks/useConfirmAction'
|
||||
import { useGetSpaceParam } from 'hooks/useGetSpaceParam'
|
||||
import { EnumMembershipRole, TypesMembershipUser, useMembershipDelete, useMembershipList } from 'services/code'
|
||||
import { getErrorMessage } from 'utils/Utils'
|
||||
import { TypesMembershipUser, useMembershipDelete, useMembershipList } from 'services/code'
|
||||
import { getErrorMessage, roleStringKeyMap } from 'utils/Utils'
|
||||
import { LoadingSpinner } from 'components/LoadingSpinner/LoadingSpinner'
|
||||
import { OptionsMenuButton } from 'components/OptionsMenuButton/OptionsMenuButton'
|
||||
|
||||
import useAddNewMember from './AddNewMember/AddNewMember'
|
||||
|
||||
import css from './SpaceAccessControl.module.scss'
|
||||
|
||||
export const roleStringKeyMap: Record<EnumMembershipRole, StringKeys> = {
|
||||
contributor: 'contributor',
|
||||
executor: 'executor',
|
||||
reader: 'reader',
|
||||
space_owner: 'owner'
|
||||
}
|
||||
|
||||
const SpaceAccessControl = () => {
|
||||
const { getString } = useStrings()
|
||||
const { showError, showSuccess } = useToaster()
|
||||
|
@ -31,9 +31,11 @@ import type {
|
||||
TypesLabelValue,
|
||||
TypesPullReq,
|
||||
TypesOwnerEvaluation,
|
||||
TypesPrincipalInfo
|
||||
TypesPrincipalInfo,
|
||||
EnumMembershipRole
|
||||
} from 'services/code'
|
||||
import { PullReqReviewDecision } from 'pages/PullRequest/PullRequestUtils'
|
||||
import type { StringKeys } from 'framework/strings'
|
||||
|
||||
export enum ACCESS_MODES {
|
||||
VIEW,
|
||||
@ -1114,3 +1116,10 @@ export const replaceMentionEmailWithId = (
|
||||
[x: string]: TypesPrincipalInfo
|
||||
}
|
||||
) => 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