mirror of
https://github.com/harness/drone.git
synced 2025-05-06 17:19:13 +08:00
fix: [code-1099]: fix image upload and text in protection form and spacing (#797)
This commit is contained in:
parent
fcf9ce6a5d
commit
5f2c81b2af
@ -66,7 +66,7 @@ const ProtectionRulesForm = (props: {
|
|||||||
name={'blockBranchDeletion'}
|
name={'blockBranchDeletion'}
|
||||||
/>
|
/>
|
||||||
<Text padding={{ left: 'xlarge' }} className={css.checkboxText}>
|
<Text padding={{ left: 'xlarge' }} className={css.checkboxText}>
|
||||||
{getString('branchProtection.blockBranchCreationText')}
|
{getString('branchProtection.blockBranchDeletionText')}
|
||||||
</Text>
|
</Text>
|
||||||
<hr className={css.dividerContainer} />
|
<hr className={css.dividerContainer} />
|
||||||
<FormInput.CheckBox
|
<FormInput.CheckBox
|
||||||
|
@ -108,6 +108,7 @@ interface CommentBoxProps<T> {
|
|||||||
enableReplyPlaceHolder?: boolean
|
enableReplyPlaceHolder?: boolean
|
||||||
repoMetadata: TypesRepository | undefined
|
repoMetadata: TypesRepository | undefined
|
||||||
standalone: boolean
|
standalone: boolean
|
||||||
|
routingId: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const CommentBox = <T = unknown,>({
|
export const CommentBox = <T = unknown,>({
|
||||||
@ -130,7 +131,8 @@ export const CommentBox = <T = unknown,>({
|
|||||||
autoFocusAndPosition,
|
autoFocusAndPosition,
|
||||||
enableReplyPlaceHolder,
|
enableReplyPlaceHolder,
|
||||||
repoMetadata,
|
repoMetadata,
|
||||||
standalone
|
standalone,
|
||||||
|
routingId
|
||||||
}: CommentBoxProps<T>) => {
|
}: CommentBoxProps<T>) => {
|
||||||
const { getString } = useStrings()
|
const { getString } = useStrings()
|
||||||
const [comments, setComments] = useState<CommentItem<T>[]>(commentItems)
|
const [comments, setComments] = useState<CommentItem<T>[]>(commentItems)
|
||||||
@ -246,6 +248,7 @@ export const CommentBox = <T = unknown,>({
|
|||||||
<Falsy>
|
<Falsy>
|
||||||
<Container className={cx(css.newCommentContainer, { [css.hasThread]: !!comments.length })}>
|
<Container className={cx(css.newCommentContainer, { [css.hasThread]: !!comments.length })}>
|
||||||
<MarkdownEditorWithPreview
|
<MarkdownEditorWithPreview
|
||||||
|
routingId={routingId}
|
||||||
standalone={standalone}
|
standalone={standalone}
|
||||||
repoMetadata={repoMetadata}
|
repoMetadata={repoMetadata}
|
||||||
className={editorClassName}
|
className={editorClassName}
|
||||||
@ -324,7 +327,7 @@ const CommentsThread = <T = unknown,>({
|
|||||||
repoMetadata
|
repoMetadata
|
||||||
}: CommentsThreadProps<T>) => {
|
}: CommentsThreadProps<T>) => {
|
||||||
const { getString } = useStrings()
|
const { getString } = useStrings()
|
||||||
const { standalone } = useAppContext()
|
const { standalone, routingId } = useAppContext()
|
||||||
const [editIndexes, setEditIndexes] = useState<Record<number, boolean>>({})
|
const [editIndexes, setEditIndexes] = useState<Record<number, boolean>>({})
|
||||||
const resetStateAtIndex = useCallback(
|
const resetStateAtIndex = useCallback(
|
||||||
(index: number) => {
|
(index: number) => {
|
||||||
@ -429,6 +432,7 @@ const CommentsThread = <T = unknown,>({
|
|||||||
<Truthy>
|
<Truthy>
|
||||||
<Container className={css.editCommentContainer}>
|
<Container className={css.editCommentContainer}>
|
||||||
<MarkdownEditorWithPreview
|
<MarkdownEditorWithPreview
|
||||||
|
routingId={routingId}
|
||||||
standalone={standalone}
|
standalone={standalone}
|
||||||
repoMetadata={repoMetadata}
|
repoMetadata={repoMetadata}
|
||||||
value={commentItem?.content}
|
value={commentItem?.content}
|
||||||
|
@ -105,7 +105,7 @@ export const DiffViewer: React.FC<DiffViewerProps> = ({
|
|||||||
commitRange,
|
commitRange,
|
||||||
scrollElement
|
scrollElement
|
||||||
}) => {
|
}) => {
|
||||||
const { routes } = useAppContext()
|
const { routes, routingId } = useAppContext()
|
||||||
const { getString } = useStrings()
|
const { getString } = useStrings()
|
||||||
const viewedPath = useMemo(
|
const viewedPath = useMemo(
|
||||||
() => `/api/v1/repos/${repoMetadata.path}/+/pullreq/${pullRequestMetadata?.number}/file-views`,
|
() => `/api/v1/repos/${repoMetadata.path}/+/pullreq/${pullRequestMetadata?.number}/file-views`,
|
||||||
@ -228,6 +228,7 @@ export const DiffViewer: React.FC<DiffViewerProps> = ({
|
|||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<AppWrapper>
|
<AppWrapper>
|
||||||
<CommentBox
|
<CommentBox
|
||||||
|
routingId={routingId}
|
||||||
standalone={standalone}
|
standalone={standalone}
|
||||||
repoMetadata={repoMetadata}
|
repoMetadata={repoMetadata}
|
||||||
commentItems={comment.commentItems}
|
commentItems={comment.commentItems}
|
||||||
|
@ -52,6 +52,7 @@ export interface EditorProps {
|
|||||||
repoMetadata: TypesRepository | undefined
|
repoMetadata: TypesRepository | undefined
|
||||||
inGitBlame?: boolean
|
inGitBlame?: boolean
|
||||||
standalone: boolean
|
standalone: boolean
|
||||||
|
routingId?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Editor = React.memo(function CodeMirrorReactEditor({
|
export const Editor = React.memo(function CodeMirrorReactEditor({
|
||||||
@ -71,7 +72,8 @@ export const Editor = React.memo(function CodeMirrorReactEditor({
|
|||||||
darkTheme,
|
darkTheme,
|
||||||
repoMetadata,
|
repoMetadata,
|
||||||
inGitBlame = false,
|
inGitBlame = false,
|
||||||
standalone
|
standalone,
|
||||||
|
routingId
|
||||||
}: EditorProps) {
|
}: EditorProps) {
|
||||||
const { showError } = useToaster()
|
const { showError } = useToaster()
|
||||||
const { getString } = useStrings()
|
const { getString } = useStrings()
|
||||||
@ -100,7 +102,7 @@ export const Editor = React.memo(function CodeMirrorReactEditor({
|
|||||||
|
|
||||||
const updateContentWithoutStateChange = () => {
|
const updateContentWithoutStateChange = () => {
|
||||||
setUploading(true)
|
setUploading(true)
|
||||||
if (view.current && markdownContent) {
|
if (view.current && markdownContent && !inGitBlame) {
|
||||||
const currentContent = view.current.state.doc.toString()
|
const currentContent = view.current.state.doc.toString()
|
||||||
const markdownInsert = ``
|
const markdownInsert = ``
|
||||||
// Create a transaction to update the document content
|
// Create a transaction to update the document content
|
||||||
@ -200,7 +202,9 @@ export const Editor = React.memo(function CodeMirrorReactEditor({
|
|||||||
}
|
}
|
||||||
}, [filename, forMarkdown, view, languageConfig, markdownLanguageSupport])
|
}, [filename, forMarkdown, view, languageConfig, markdownLanguageSupport])
|
||||||
const handleUploadCallback = (file: File) => {
|
const handleUploadCallback = (file: File) => {
|
||||||
handleUpload(file, setMarkdownContent, repoMetadata, showError, standalone)
|
if (!inGitBlame) {
|
||||||
|
handleUpload(file, setMarkdownContent, repoMetadata, showError, standalone, routingId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const handleDropForUpload = async (event: any) => {
|
const handleDropForUpload = async (event: any) => {
|
||||||
|
@ -96,6 +96,7 @@ interface MarkdownEditorWithPreviewProps {
|
|||||||
autoFocusAndPosition?: boolean
|
autoFocusAndPosition?: boolean
|
||||||
repoMetadata: TypesRepository | undefined
|
repoMetadata: TypesRepository | undefined
|
||||||
standalone: boolean
|
standalone: boolean
|
||||||
|
routingId: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export function MarkdownEditorWithPreview({
|
export function MarkdownEditorWithPreview({
|
||||||
@ -114,11 +115,11 @@ export function MarkdownEditorWithPreview({
|
|||||||
autoFocusAndPosition,
|
autoFocusAndPosition,
|
||||||
secondarySaveButton: SecondarySaveButton,
|
secondarySaveButton: SecondarySaveButton,
|
||||||
repoMetadata,
|
repoMetadata,
|
||||||
standalone
|
standalone,
|
||||||
|
routingId
|
||||||
}: MarkdownEditorWithPreviewProps) {
|
}: MarkdownEditorWithPreviewProps) {
|
||||||
const { getString } = useStrings()
|
const { getString } = useStrings()
|
||||||
const fileInputRef = useRef<HTMLInputElement>(null)
|
const fileInputRef = useRef<HTMLInputElement>(null)
|
||||||
|
|
||||||
const [selectedTab, setSelectedTab] = useState(MarkdownEditorTab.WRITE)
|
const [selectedTab, setSelectedTab] = useState(MarkdownEditorTab.WRITE)
|
||||||
const viewRef = useRef<EditorView>()
|
const viewRef = useRef<EditorView>()
|
||||||
const containerRef = useRef<HTMLDivElement>(null)
|
const containerRef = useRef<HTMLDivElement>(null)
|
||||||
@ -366,7 +367,7 @@ export function MarkdownEditorWithPreview({
|
|||||||
variation={ButtonVariation.PRIMARY}
|
variation={ButtonVariation.PRIMARY}
|
||||||
disabled={false}
|
disabled={false}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
handleUpload(file as File, setMarkdownContent, repoMetadata, showError, standalone)
|
handleUpload(file as File, setMarkdownContent, repoMetadata, showError, standalone, routingId)
|
||||||
setOpen(false)
|
setOpen(false)
|
||||||
setFile(undefined)
|
setFile(undefined)
|
||||||
}}
|
}}
|
||||||
@ -420,6 +421,7 @@ export function MarkdownEditorWithPreview({
|
|||||||
</Container>
|
</Container>
|
||||||
<Container className={css.tabContent}>
|
<Container className={css.tabContent}>
|
||||||
<Editor
|
<Editor
|
||||||
|
routingId={routingId}
|
||||||
standalone={standalone}
|
standalone={standalone}
|
||||||
repoMetadata={repoMetadata}
|
repoMetadata={repoMetadata}
|
||||||
forMarkdown
|
forMarkdown
|
||||||
|
@ -58,7 +58,7 @@ import css from './Compare.module.scss'
|
|||||||
export default function Compare() {
|
export default function Compare() {
|
||||||
const { getString } = useStrings()
|
const { getString } = useStrings()
|
||||||
const history = useHistory()
|
const history = useHistory()
|
||||||
const { routes, standalone } = useAppContext()
|
const { routes, standalone, routingId } = useAppContext()
|
||||||
const { repoMetadata, error, loading, diffRefs } = useGetRepositoryMetadata()
|
const { repoMetadata, error, loading, diffRefs } = useGetRepositoryMetadata()
|
||||||
const [sourceGitRef, setSourceGitRef] = useState(diffRefs.sourceGitRef)
|
const [sourceGitRef, setSourceGitRef] = useState(diffRefs.sourceGitRef)
|
||||||
const [targetGitRef, setTargetGitRef] = useState(diffRefs.targetGitRef)
|
const [targetGitRef, setTargetGitRef] = useState(diffRefs.targetGitRef)
|
||||||
@ -243,6 +243,7 @@ export default function Compare() {
|
|||||||
<Layout.Vertical spacing="small">
|
<Layout.Vertical spacing="small">
|
||||||
<Text font={{ variation: FontVariation.SMALL_BOLD }}>{getString('description')}</Text>
|
<Text font={{ variation: FontVariation.SMALL_BOLD }}>{getString('description')}</Text>
|
||||||
<MarkdownEditorWithPreview
|
<MarkdownEditorWithPreview
|
||||||
|
routingId={routingId}
|
||||||
standalone={standalone}
|
standalone={standalone}
|
||||||
repoMetadata={repoMetadata}
|
repoMetadata={repoMetadata}
|
||||||
value={description}
|
value={description}
|
||||||
|
@ -160,3 +160,7 @@
|
|||||||
.waitingContainer {
|
.waitingContainer {
|
||||||
justify-content: unset !important;
|
justify-content: unset !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.codeOwner {
|
||||||
|
--layout-spacing: 1px !important;
|
||||||
|
}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
export declare const approvalText: string
|
export declare const approvalText: string
|
||||||
export declare const checks: string
|
export declare const checks: string
|
||||||
export declare const circle: string
|
export declare const circle: string
|
||||||
|
export declare const codeOwner: string
|
||||||
export declare const codeOwnerTable: string
|
export declare const codeOwnerTable: string
|
||||||
export declare const desc: string
|
export declare const desc: string
|
||||||
export declare const layout: string
|
export declare const layout: string
|
||||||
|
@ -44,6 +44,7 @@ import css from './CodeOwnersOverview.module.scss'
|
|||||||
interface ChecksOverviewProps extends Pick<GitInfoProps, 'repoMetadata' | 'pullRequestMetadata'> {
|
interface ChecksOverviewProps extends Pick<GitInfoProps, 'repoMetadata' | 'pullRequestMetadata'> {
|
||||||
prChecksDecisionResult: PRChecksDecisionResult
|
prChecksDecisionResult: PRChecksDecisionResult
|
||||||
codeOwners?: TypesCodeOwnerEvaluation
|
codeOwners?: TypesCodeOwnerEvaluation
|
||||||
|
standalone: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
enum CodeOwnerReqDecision {
|
enum CodeOwnerReqDecision {
|
||||||
@ -56,7 +57,8 @@ export function CodeOwnersOverview({
|
|||||||
codeOwners,
|
codeOwners,
|
||||||
repoMetadata,
|
repoMetadata,
|
||||||
pullRequestMetadata,
|
pullRequestMetadata,
|
||||||
prChecksDecisionResult
|
prChecksDecisionResult,
|
||||||
|
standalone
|
||||||
}: ChecksOverviewProps) {
|
}: ChecksOverviewProps) {
|
||||||
const { getString } = useStrings()
|
const { getString } = useStrings()
|
||||||
const [isExpanded, toggleExpanded] = useToggle(false)
|
const [isExpanded, toggleExpanded] = useToggle(false)
|
||||||
@ -100,7 +102,7 @@ export function CodeOwnersOverview({
|
|||||||
const { borderColor, message, overallStatus } = checkEntries(changeReqEntries, waitingEntries, approvalEntries)
|
const { borderColor, message, overallStatus } = checkEntries(changeReqEntries, waitingEntries, approvalEntries)
|
||||||
return codeOwners?.evaluation_entries?.length ? (
|
return codeOwners?.evaluation_entries?.length ? (
|
||||||
<Container
|
<Container
|
||||||
className={css.main}
|
className={cx(css.main, { [css.codeOwner]: !standalone })}
|
||||||
margin={{ top: 'medium', bottom: pullRequestMetadata.description ? undefined : 'large' }}
|
margin={{ top: 'medium', bottom: pullRequestMetadata.description ? undefined : 'large' }}
|
||||||
style={{ '--border-color': Utils.getRealCSSColor(borderColor) } as React.CSSProperties}>
|
style={{ '--border-color': Utils.getRealCSSColor(borderColor) } as React.CSSProperties}>
|
||||||
<Match expr={isExpanded}>
|
<Match expr={isExpanded}>
|
||||||
|
@ -51,6 +51,7 @@ export interface ConversationProps extends Pick<GitInfoProps, 'repoMetadata' | '
|
|||||||
onCancelEditDescription: () => void
|
onCancelEditDescription: () => void
|
||||||
prChecksDecisionResult?: PRChecksDecisionResult
|
prChecksDecisionResult?: PRChecksDecisionResult
|
||||||
standalone: boolean
|
standalone: boolean
|
||||||
|
routingId: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Conversation: React.FC<ConversationProps> = ({
|
export const Conversation: React.FC<ConversationProps> = ({
|
||||||
@ -61,7 +62,8 @@ export const Conversation: React.FC<ConversationProps> = ({
|
|||||||
showEditDescription,
|
showEditDescription,
|
||||||
onCancelEditDescription,
|
onCancelEditDescription,
|
||||||
prChecksDecisionResult,
|
prChecksDecisionResult,
|
||||||
standalone
|
standalone,
|
||||||
|
routingId
|
||||||
}) => {
|
}) => {
|
||||||
const { getString } = useStrings()
|
const { getString } = useStrings()
|
||||||
const { currentUser } = useAppContext()
|
const { currentUser } = useAppContext()
|
||||||
@ -187,6 +189,7 @@ export const Conversation: React.FC<ConversationProps> = ({
|
|||||||
const newCommentBox = useMemo(() => {
|
const newCommentBox = useMemo(() => {
|
||||||
return (
|
return (
|
||||||
<CommentBox
|
<CommentBox
|
||||||
|
routingId={routingId}
|
||||||
standalone={standalone}
|
standalone={standalone}
|
||||||
repoMetadata={repoMetadata}
|
repoMetadata={repoMetadata}
|
||||||
fluid
|
fluid
|
||||||
@ -254,6 +257,7 @@ export const Conversation: React.FC<ConversationProps> = ({
|
|||||||
}
|
}
|
||||||
title={
|
title={
|
||||||
<CommentBox
|
<CommentBox
|
||||||
|
routingId={routingId}
|
||||||
standalone={standalone}
|
standalone={standalone}
|
||||||
repoMetadata={repoMetadata}
|
repoMetadata={repoMetadata}
|
||||||
key={threadId}
|
key={threadId}
|
||||||
@ -383,6 +387,7 @@ export const Conversation: React.FC<ConversationProps> = ({
|
|||||||
)}
|
)}
|
||||||
{codeOwners && prChecksDecisionResult && (
|
{codeOwners && prChecksDecisionResult && (
|
||||||
<CodeOwnersOverview
|
<CodeOwnersOverview
|
||||||
|
standalone={standalone}
|
||||||
codeOwners={codeOwners}
|
codeOwners={codeOwners}
|
||||||
repoMetadata={repoMetadata}
|
repoMetadata={repoMetadata}
|
||||||
pullRequestMetadata={pullRequestMetadata}
|
pullRequestMetadata={pullRequestMetadata}
|
||||||
@ -392,6 +397,7 @@ export const Conversation: React.FC<ConversationProps> = ({
|
|||||||
|
|
||||||
{(hasDescription || showEditDescription) && (
|
{(hasDescription || showEditDescription) && (
|
||||||
<DescriptionBox
|
<DescriptionBox
|
||||||
|
routingId={routingId}
|
||||||
standalone={standalone}
|
standalone={standalone}
|
||||||
repoMetadata={repoMetadata}
|
repoMetadata={repoMetadata}
|
||||||
pullRequestMetadata={pullRequestMetadata}
|
pullRequestMetadata={pullRequestMetadata}
|
||||||
|
@ -37,7 +37,8 @@ export const DescriptionBox: React.FC<DescriptionBoxProps> = ({
|
|||||||
pullRequestMetadata,
|
pullRequestMetadata,
|
||||||
onCommentUpdate: refreshPullRequestMetadata,
|
onCommentUpdate: refreshPullRequestMetadata,
|
||||||
onCancelEditDescription,
|
onCancelEditDescription,
|
||||||
standalone
|
standalone,
|
||||||
|
routingId
|
||||||
}) => {
|
}) => {
|
||||||
const [edit, setEdit] = useState(false)
|
const [edit, setEdit] = useState(false)
|
||||||
const [dirty, setDirty] = useState(false)
|
const [dirty, setDirty] = useState(false)
|
||||||
@ -64,6 +65,7 @@ export const DescriptionBox: React.FC<DescriptionBoxProps> = ({
|
|||||||
<Container padding={!edit ? { left: 'small', bottom: 'small' } : undefined}>
|
<Container padding={!edit ? { left: 'small', bottom: 'small' } : undefined}>
|
||||||
{(edit && (
|
{(edit && (
|
||||||
<MarkdownEditorWithPreview
|
<MarkdownEditorWithPreview
|
||||||
|
routingId={routingId}
|
||||||
standalone={standalone}
|
standalone={standalone}
|
||||||
repoMetadata={repoMetadata}
|
repoMetadata={repoMetadata}
|
||||||
value={content}
|
value={content}
|
||||||
|
@ -47,7 +47,7 @@ const SSE_EVENTS = ['pullreq_updated']
|
|||||||
export default function PullRequest() {
|
export default function PullRequest() {
|
||||||
const history = useHistory()
|
const history = useHistory()
|
||||||
const { getString } = useStrings()
|
const { getString } = useStrings()
|
||||||
const { routes, standalone } = useAppContext()
|
const { routes, standalone, routingId } = useAppContext()
|
||||||
const space = useGetSpaceParam()
|
const space = useGetSpaceParam()
|
||||||
const {
|
const {
|
||||||
repoMetadata,
|
repoMetadata,
|
||||||
@ -240,6 +240,7 @@ export default function PullRequest() {
|
|||||||
),
|
),
|
||||||
panel: (
|
panel: (
|
||||||
<Conversation
|
<Conversation
|
||||||
|
routingId={routingId}
|
||||||
standalone={standalone}
|
standalone={standalone}
|
||||||
repoMetadata={repoMetadata as TypesRepository}
|
repoMetadata={repoMetadata as TypesRepository}
|
||||||
pullRequestMetadata={prData as TypesPullReq}
|
pullRequestMetadata={prData as TypesPullReq}
|
||||||
|
@ -28,6 +28,7 @@ import type {
|
|||||||
TypesPullReq,
|
TypesPullReq,
|
||||||
TypesRepository
|
TypesRepository
|
||||||
} from 'services/code'
|
} from 'services/code'
|
||||||
|
import { getConfig } from 'services/config'
|
||||||
import { getErrorMessage } from './Utils'
|
import { getErrorMessage } from './Utils'
|
||||||
|
|
||||||
export interface GitInfoProps {
|
export interface GitInfoProps {
|
||||||
@ -251,12 +252,13 @@ export const handleUpload = (
|
|||||||
setMarkdownContent: (data: string) => void,
|
setMarkdownContent: (data: string) => void,
|
||||||
repoMetadata: TypesRepository | undefined,
|
repoMetadata: TypesRepository | undefined,
|
||||||
showError: (message: React.ReactNode, timeout?: number | undefined, key?: string | undefined) => void,
|
showError: (message: React.ReactNode, timeout?: number | undefined, key?: string | undefined) => void,
|
||||||
standalone: boolean
|
standalone: boolean,
|
||||||
|
routingId?: string
|
||||||
) => {
|
) => {
|
||||||
const reader = new FileReader()
|
const reader = new FileReader()
|
||||||
// Set up a function to be called when the load event is triggered
|
// Set up a function to be called when the load event is triggered
|
||||||
reader.onload = async function () {
|
reader.onload = async function () {
|
||||||
const markdown = await uploadImage(reader.result, showError, repoMetadata, standalone)
|
const markdown = await uploadImage(reader.result, showError, repoMetadata, standalone, routingId)
|
||||||
setMarkdownContent(markdown) // Set the markdown content
|
setMarkdownContent(markdown) // Set the markdown content
|
||||||
}
|
}
|
||||||
reader.readAsArrayBuffer(blob) // This will trigger the onload function when the reading is complete
|
reader.readAsArrayBuffer(blob) // This will trigger the onload function when the reading is complete
|
||||||
@ -267,11 +269,14 @@ export const uploadImage = async (
|
|||||||
fileBlob: any,
|
fileBlob: any,
|
||||||
showError: (message: React.ReactNode, timeout?: number | undefined, key?: string | undefined) => void,
|
showError: (message: React.ReactNode, timeout?: number | undefined, key?: string | undefined) => void,
|
||||||
repoMetadata: TypesRepository | undefined,
|
repoMetadata: TypesRepository | undefined,
|
||||||
standalone: boolean
|
standalone: boolean,
|
||||||
|
routingId?: string
|
||||||
) => {
|
) => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${window.location.origin}/${standalone ? '' : 'code/'}api/v1/repos/${repoMetadata?.path}/+/uploads/`,
|
`${window.location.origin}${getConfig(
|
||||||
|
`code/api/v1/repos/${repoMetadata?.path}/+/uploads${standalone || !routingId ? `` : `?routingId=${routingId}`}`
|
||||||
|
)}`,
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
|
Loading…
Reference in New Issue
Block a user