mirror of
https://github.com/harness/drone.git
synced 2025-05-20 19:09:59 +08:00
Improve PR Checks polling in case PR does not have any checks (#297)
This commit is contained in:
parent
92f1bdc8b6
commit
4e1c852a01
3
web/.env
Normal file
3
web/.env
Normal file
@ -0,0 +1,3 @@
|
||||
STANDALONE=true
|
||||
PORT=3020
|
||||
API_URL=http://localhost:3000
|
@ -4,12 +4,16 @@
|
||||
@include vars;
|
||||
|
||||
&.fullPage {
|
||||
height: 100%;
|
||||
height: var(--page-height);
|
||||
}
|
||||
|
||||
:global {
|
||||
div[data-testid='page-body'] > div[data-testid='page-error'] {
|
||||
height: 80vh !important;
|
||||
height: 70vh !important;
|
||||
}
|
||||
|
||||
.PageBody--pageBody {
|
||||
min-height: calc(var(--page-height) - var(--page-header-height, 64px));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ export const Changes: React.FC<ChangesProps> = ({
|
||||
<Render when={error}>
|
||||
<PageError message={getErrorMessage(error || errorActivities)} onClick={voidFn(refetch)} />
|
||||
</Render>
|
||||
<Render when={!error}>
|
||||
<Render when={!error && !loading}>
|
||||
<Container className={cx(css.header, { [css.stickied]: isSticky })}>
|
||||
<Layout.Horizontal>
|
||||
<Container flex={{ alignItems: 'center' }}>
|
||||
|
@ -112,22 +112,19 @@ const CommitRangeDropdown: React.FC<CommitRangeDropdownProps> = ({
|
||||
margin={{ bottom: 'small' }}
|
||||
/>
|
||||
<Divider />
|
||||
<Container margin={{ top: 'small', bottom: 'small' }}>
|
||||
<Container margin={{ top: 'small', bottom: 'small' }} style={{ maxHeight: '40vh', overflow: 'auto' }}>
|
||||
{allCommits?.map((prCommit, index) => {
|
||||
const isSelected = selectedCommits.includes(prCommit.sha || '')
|
||||
|
||||
return (
|
||||
<Layout.Horizontal
|
||||
key={prCommit.sha}
|
||||
style={{ alignItems: 'center', cursor: 'pointer' }}
|
||||
padding={{ top: 'xsmall', bottom: 'xsmall' }}
|
||||
onClick={e => handleCheckboxClick(e, prCommit.sha as string)}>
|
||||
<Checkbox
|
||||
key={prCommit.sha}
|
||||
checked={isSelected}
|
||||
onClick={e => handleCheckboxClick(e, prCommit.sha as string)}
|
||||
/>
|
||||
<Checkbox checked={isSelected} onClick={e => handleCheckboxClick(e, prCommit.sha as string)} />
|
||||
<Text font={{ variation: FontVariation.SMALL_SEMI }} lineClamp={1} padding={{ right: 'small' }}>
|
||||
{allCommits.length - index} {prCommit.title}
|
||||
{`${allCommits.length - index} ${prCommit.title}`}
|
||||
</Text>
|
||||
<FlexExpander />
|
||||
<Text font={{ variation: FontVariation.SMALL_SEMI }} style={{ whiteSpace: 'nowrap' }}>
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useRef } from 'react'
|
||||
import React, { useEffect, useMemo, useRef } from 'react'
|
||||
import { Container } from '@harness/uicore'
|
||||
import { Terminal } from 'xterm'
|
||||
import { FitAddon } from 'xterm-addon-fit'
|
||||
@ -6,8 +6,9 @@ import { CanvasAddon } from 'xterm-addon-canvas'
|
||||
import { SearchAddon } from 'xterm-addon-search'
|
||||
import { WebLinksAddon } from 'xterm-addon-web-links'
|
||||
import 'xterm/css/xterm.css'
|
||||
import { useEventListener } from 'hooks/useEventListener'
|
||||
|
||||
const DEFAULT_SCROLLBACK_LINES = 1000
|
||||
const DEFAULT_SCROLLBACK_LINES = 100000
|
||||
|
||||
export type TermRefs = { term: Terminal; fitAddon: FitAddon } | undefined
|
||||
|
||||
@ -18,7 +19,7 @@ export interface LogViewerProps {
|
||||
/** Number of scrollback lines */
|
||||
scrollbackLines?: number
|
||||
|
||||
/** Log content as string. Note that we can support streaming easily if backend has it */
|
||||
/** Log content as string */
|
||||
content: string
|
||||
|
||||
termRefs?: React.MutableRefObject<TermRefs>
|
||||
@ -26,8 +27,8 @@ export interface LogViewerProps {
|
||||
|
||||
export const LogViewer: React.FC<LogViewerProps> = ({ scrollbackLines, content, termRefs }) => {
|
||||
const ref = useRef<HTMLDivElement | null>(null)
|
||||
const lines = content.split(/\r?\n/)
|
||||
const term = useRef<Terminal>()
|
||||
const lines = useMemo(() => content.split(/\r?\n/), [content])
|
||||
const term = useRef<{ term: Terminal; fitAddon: FitAddon }>()
|
||||
|
||||
useEffect(() => {
|
||||
if (!term.current) {
|
||||
@ -45,13 +46,12 @@ export const LogViewer: React.FC<LogViewerProps> = ({ scrollbackLines, content,
|
||||
const searchAddon = new SearchAddon()
|
||||
const fitAddon = new FitAddon()
|
||||
const webLinksAddon = new WebLinksAddon()
|
||||
|
||||
_term.loadAddon(searchAddon)
|
||||
_term.loadAddon(fitAddon)
|
||||
|
||||
_term.loadAddon(webLinksAddon)
|
||||
_term.loadAddon(new CanvasAddon())
|
||||
|
||||
_term.clear()
|
||||
_term.open(ref?.current as HTMLDivElement)
|
||||
|
||||
fitAddon.fit()
|
||||
@ -59,14 +59,22 @@ export const LogViewer: React.FC<LogViewerProps> = ({ scrollbackLines, content,
|
||||
|
||||
_term.write('\x1b[?25l') // disable cursor
|
||||
|
||||
lines.forEach((line, _index) => _term.writeln(line))
|
||||
term.current = { term: _term, fitAddon }
|
||||
|
||||
term.current = _term
|
||||
if (termRefs) {
|
||||
termRefs.current = { term: _term, fitAddon }
|
||||
termRefs.current = term.current
|
||||
}
|
||||
}
|
||||
}, []) // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
useEffect(() => {
|
||||
term.current?.term?.clear()
|
||||
lines.forEach(line => term.current?.term?.writeln(line))
|
||||
}, [lines])
|
||||
|
||||
useEventListener('resize', () => {
|
||||
term.current?.fitAddon?.fit()
|
||||
})
|
||||
|
||||
return <Container ref={ref} width="100%" height="100%" />
|
||||
}
|
||||
|
@ -70,6 +70,8 @@ export function usePRChecksDecision({
|
||||
}
|
||||
|
||||
setComplete(!_count.pending && !_count.running)
|
||||
} else {
|
||||
setComplete(false)
|
||||
}
|
||||
|
||||
return _status
|
||||
|
@ -423,7 +423,7 @@ descending: Descending
|
||||
active: Active
|
||||
pending: Pending
|
||||
resolved: Resolved
|
||||
showEverything: Everything
|
||||
showEverything: Show Everything
|
||||
allComments: All comments
|
||||
whatsNew: What's new
|
||||
myComments: My comments/replies
|
||||
|
@ -21,7 +21,7 @@ export const DefaultMenu: React.FC = () => {
|
||||
const repoPath = useMemo(() => repoMetadata?.path || '', [repoMetadata])
|
||||
const routeMatch = useRouteMatch()
|
||||
const isFilesSelected = useMemo(
|
||||
() => routeMatch.path === '/:space/:repoName' || routeMatch.path.startsWith('/:space/:repoName/edit'),
|
||||
() => routeMatch.path === '/:space*/:repoName' || routeMatch.path.startsWith('/:space*/:repoName/edit'),
|
||||
[routeMatch]
|
||||
)
|
||||
const isPipelineSelected = routeMatch.path.startsWith('/pipelines/:space*/pipeline/:pipeline')
|
||||
|
@ -1,5 +1,5 @@
|
||||
.mainCtn {
|
||||
min-height: var(--page-min-height, 100%);
|
||||
min-height: var(--page-height);
|
||||
background-color: var(--primary-bg) !important;
|
||||
|
||||
.pageCtn {
|
||||
|
@ -1,5 +1,5 @@
|
||||
.main {
|
||||
min-height: var(--page-min-height, 100%);
|
||||
min-height: var(--page-height);
|
||||
background-color: var(--white) !important;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
@ -1,4 +1,4 @@
|
||||
.main {
|
||||
min-height: var(--page-min-height, 100%);
|
||||
min-height: var(--page-height);
|
||||
background-color: var(--primary-bg) !important;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
.main {
|
||||
min-height: var(--page-min-height, 100%);
|
||||
min-height: var(--page-height);
|
||||
background-color: var(--primary-bg) !important;
|
||||
|
||||
.layout {
|
||||
|
@ -1,5 +1,5 @@
|
||||
.main {
|
||||
min-height: var(--page-min-height, 100%);
|
||||
min-height: var(--page-height);
|
||||
background-color: var(--primary-bg) !important;
|
||||
}
|
||||
.container {
|
||||
|
@ -1,5 +1,5 @@
|
||||
.main {
|
||||
min-height: var(--page-min-height, 100%);
|
||||
min-height: var(--page-height);
|
||||
background-color: var(--primary-bg) !important;
|
||||
|
||||
.layout {
|
||||
|
@ -1,10 +1,11 @@
|
||||
.main {
|
||||
--stage-title-height: 46px;
|
||||
--stage-detail-section-height: 40px;
|
||||
--stage-title-height: 54px;
|
||||
--stage-detail-section-height: 48px;
|
||||
--log-content-header-height: 64px;
|
||||
|
||||
background-color: var(--white) !important;
|
||||
min-height: calc(var(--page-min-height) - 156px);
|
||||
height: calc(100vh - 156px);
|
||||
height: calc(var(--page-height) - 156px);
|
||||
overflow: hidden;
|
||||
|
||||
> div {
|
||||
@ -97,26 +98,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
overflow: auto;
|
||||
padding: 0 var(--spacing-large) var(--spacing-medium);
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
&.terminal {
|
||||
overflow: hidden;
|
||||
|
||||
.header {
|
||||
padding: var(--spacing-medium) var(--spacing-large) 0;
|
||||
}
|
||||
|
||||
:global {
|
||||
.terminal.xterm {
|
||||
padding: var(--spacing-medium);
|
||||
padding: var(--spacing-small) var(--spacing-large) 0;
|
||||
}
|
||||
|
||||
// .terminal-container {
|
||||
// overflow: hidden;
|
||||
// }
|
||||
|
||||
// .xterm .xterm-viewport {
|
||||
// /* see : https://github.com/xtermjs/xterm.js/issues/3564#issuecomment-1004417440 */
|
||||
// width: initial !important;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,6 +121,7 @@
|
||||
position: sticky;
|
||||
top: 0;
|
||||
background-color: var(--black);
|
||||
height: var(--log-content-header-height);
|
||||
|
||||
.headerLayout {
|
||||
border-bottom: 1px solid var(--grey-800);
|
||||
@ -132,6 +129,14 @@
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.markdownContainer {
|
||||
padding-top: var(--spacing-medium);
|
||||
}
|
||||
|
||||
.terminalContainer {
|
||||
height: calc(100% - var(--log-content-header-height));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,8 @@ declare const styles: {
|
||||
readonly terminal: string
|
||||
readonly header: string
|
||||
readonly headerLayout: string
|
||||
readonly markdownContainer: string
|
||||
readonly terminalContainer: string
|
||||
readonly status: string
|
||||
readonly invert: string
|
||||
readonly noShrink: string
|
||||
|
@ -40,8 +40,8 @@ export const Checks: React.FC<ChecksProps> = props => {
|
||||
const termRefs = useRef<TermRefs>()
|
||||
const onSplitPaneResized = useCallback(() => termRefs.current?.fitAddon?.fit(), [])
|
||||
const [selectedItemData, setSelectedItemData] = useState<TypesCheck>()
|
||||
const shouldRenderMarkdown = useMemo(
|
||||
() => selectedItemData?.payload?.kind === PullRequestCheckType.EXTERNAL,
|
||||
const isCheckDataMarkdown = useMemo(
|
||||
() => selectedItemData?.payload?.kind === PullRequestCheckType.MARKDOWN,
|
||||
[selectedItemData?.payload?.kind]
|
||||
)
|
||||
const logContent = useMemo(
|
||||
@ -64,11 +64,16 @@ export const Checks: React.FC<ChecksProps> = props => {
|
||||
maxSize="calc(100% - 900px)"
|
||||
onDragFinished={onSplitPaneResized}
|
||||
primary="second">
|
||||
<ChecksMenu {...props} onDataItemChanged={setSelectedItemData} />
|
||||
<ChecksMenu
|
||||
{...props}
|
||||
onDataItemChanged={data => {
|
||||
setTimeout(() => setSelectedItemData(data), 0)
|
||||
}}
|
||||
/>
|
||||
<Container
|
||||
className={cx(css.content, {
|
||||
[css.markdown]: shouldRenderMarkdown,
|
||||
[css.terminal]: !shouldRenderMarkdown
|
||||
[css.markdown]: isCheckDataMarkdown,
|
||||
[css.terminal]: !isCheckDataMarkdown
|
||||
})}>
|
||||
<Render when={selectedItemData}>
|
||||
<Container className={css.header}>
|
||||
@ -101,14 +106,16 @@ export const Checks: React.FC<ChecksProps> = props => {
|
||||
</Layout.Horizontal>
|
||||
</Container>
|
||||
</Render>
|
||||
<Match expr={shouldRenderMarkdown}>
|
||||
<Match expr={isCheckDataMarkdown}>
|
||||
<Truthy>
|
||||
<Container padding={{ top: 'medium' }}>
|
||||
<Container className={css.markdownContainer}>
|
||||
<MarkdownViewer darkMode source={logContent} />
|
||||
</Container>
|
||||
</Truthy>
|
||||
<Falsy>
|
||||
<LogViewer termRefs={termRefs} content={`...`} />
|
||||
<Container className={css.terminalContainer}>
|
||||
<LogViewer termRefs={termRefs} content={logContent} />
|
||||
</Container>
|
||||
</Falsy>
|
||||
</Match>
|
||||
</Container>
|
||||
@ -164,6 +171,7 @@ const ChecksMenu: React.FC<ChecksMenuProps> = ({
|
||||
prChecksDecisionResult?.data?.[0]
|
||||
|
||||
if (defaultSelectedItem) {
|
||||
onDataItemChanged(defaultSelectedItem)
|
||||
setSelectedUID(defaultSelectedItem.uid)
|
||||
history.replace(
|
||||
routes.toCODEPullRequest({
|
||||
@ -174,7 +182,16 @@ const ChecksMenu: React.FC<ChecksMenuProps> = ({
|
||||
)
|
||||
}
|
||||
}
|
||||
}, [uid, prChecksDecisionResult?.data, selectedUID, history, routes, repoMetadata.path, pullRequestMetadata.number])
|
||||
}, [
|
||||
uid,
|
||||
prChecksDecisionResult?.data,
|
||||
selectedUID,
|
||||
history,
|
||||
routes,
|
||||
repoMetadata.path,
|
||||
pullRequestMetadata.number,
|
||||
onDataItemChanged
|
||||
])
|
||||
|
||||
return (
|
||||
<Container className={css.menu}>
|
||||
@ -185,7 +202,7 @@ const ChecksMenu: React.FC<ChecksMenuProps> = ({
|
||||
prChecksDecisionResult={prChecksDecisionResult}
|
||||
key={itemData.uid}
|
||||
itemData={itemData}
|
||||
expandable={itemData.payload?.kind !== PullRequestCheckType.EXTERNAL /* || itemData.uid === 'build'*/}
|
||||
expandable={false}
|
||||
isSelected={itemData.uid === selectedUID}
|
||||
onClick={() => {
|
||||
history.replace(
|
||||
@ -242,6 +259,7 @@ const CheckMenuItem: React.FC<CheckMenuItemProps> = ({ expandable, isSelected =
|
||||
<Text color={Color.GREY_300} font={{ variation: FontVariation.SMALL }} className={css.noShrink}>
|
||||
{timeDistance(itemData.updated, itemData.created)}
|
||||
</Text>
|
||||
|
||||
<PRCheckExecutionStatus
|
||||
className={cx(css.status, css.noShrink)}
|
||||
status={itemData.status as PRCheckExecutionState}
|
||||
|
@ -18,7 +18,7 @@ import { PRCheckExecutionStatus, PRCheckExecutionState } from 'components/PRChec
|
||||
import { useShowRequestError } from 'hooks/useShowRequestError'
|
||||
import type { TypesCheck } from 'services/code'
|
||||
import { useAppContext } from 'AppContext'
|
||||
import { PullRequestCheckType, PullRequestSection, timeDistance } from 'utils/Utils'
|
||||
import { PullRequestSection, timeDistance } from 'utils/Utils'
|
||||
import type { PRChecksDecisionResult } from 'hooks/usePRChecksDecision'
|
||||
import css from './ChecksOverview.module.scss'
|
||||
|
||||
@ -28,7 +28,7 @@ interface ChecksOverviewProps extends Pick<GitInfoProps, 'repoMetadata' | 'pullR
|
||||
|
||||
export function ChecksOverview({ repoMetadata, pullRequestMetadata, prChecksDecisionResult }: ChecksOverviewProps) {
|
||||
const { getString } = useStrings()
|
||||
const [isExpanded, toggleExpanded] = useToggle(true)
|
||||
const [isExpanded, toggleExpanded] = useToggle(false)
|
||||
const { data, overallStatus, error, color, message } = prChecksDecisionResult
|
||||
|
||||
useShowRequestError(error)
|
||||
@ -42,12 +42,12 @@ export function ChecksOverview({ repoMetadata, pullRequestMetadata, prChecksDeci
|
||||
<Truthy>
|
||||
<Container className={css.checks}>
|
||||
<Layout.Vertical spacing="medium">
|
||||
<CheckSection
|
||||
{/* <CheckSection
|
||||
repoMetadata={repoMetadata}
|
||||
pullRequestMetadata={pullRequestMetadata}
|
||||
data={data}
|
||||
isPipeline
|
||||
/>
|
||||
/> */}
|
||||
<CheckSection
|
||||
repoMetadata={repoMetadata}
|
||||
pullRequestMetadata={pullRequestMetadata}
|
||||
@ -88,11 +88,8 @@ interface CheckSectionProps extends Pick<GitInfoProps, 'repoMetadata' | 'pullReq
|
||||
const CheckSection: React.FC<CheckSectionProps> = ({ repoMetadata, pullRequestMetadata, data, isPipeline }) => {
|
||||
const { getString } = useStrings()
|
||||
const { routes } = useAppContext()
|
||||
const _data = data.filter(
|
||||
check => check.payload?.kind === (isPipeline ? PullRequestCheckType.PIPELINE : PullRequestCheckType.EXTERNAL)
|
||||
)
|
||||
|
||||
return _data.length ? (
|
||||
return data.length ? (
|
||||
<Container>
|
||||
<Layout.Vertical spacing="small">
|
||||
<Text
|
||||
@ -102,7 +99,7 @@ const CheckSection: React.FC<CheckSectionProps> = ({ repoMetadata, pullRequestMe
|
||||
{getString(isPipeline ? 'pageTitle.pipelines' : 'checks')}
|
||||
</Text>
|
||||
<Container className={css.table}>
|
||||
{_data.map(({ uid, status, summary, created, updated }) => (
|
||||
{data.map(({ uid, status, summary, created, updated }) => (
|
||||
<Container className={css.row} key={uid}>
|
||||
<Layout.Horizontal className={css.rowLayout}>
|
||||
<Container className={css.status}>
|
||||
|
@ -1,6 +1,5 @@
|
||||
.main {
|
||||
min-height: var(--page-min-height, 100%);
|
||||
background-color: var(--white) !important;
|
||||
min-height: var(--page-height);
|
||||
|
||||
> div[class*='PageHeader'] {
|
||||
border-bottom: none !important;
|
||||
|
@ -144,7 +144,7 @@ export default function PullRequest() {
|
||||
<Render when={repoMetadata && prData}>
|
||||
<>
|
||||
<PullRequestMetaLine repoMetadata={repoMetadata as TypesRepository} {...prData} />
|
||||
<Container className={tabContainerCSS.tabsContainer} style={{ minHeight: 'calc(100vh - 97px)' }}>
|
||||
<Container className={tabContainerCSS.tabsContainer}>
|
||||
<Tabs
|
||||
id="prTabs"
|
||||
defaultSelectedTabId={activeTab}
|
||||
|
@ -1,4 +1,6 @@
|
||||
.main {
|
||||
background-color: var(--white) !important;
|
||||
|
||||
.metaline {
|
||||
font-size: var(--font-size-small) !important;
|
||||
font-weight: 500 !important;
|
||||
|
@ -1,5 +1,5 @@
|
||||
.main {
|
||||
min-height: var(--page-min-height, 100%);
|
||||
min-height: var(--page-height);
|
||||
background-color: var(--primary-bg) !important;
|
||||
|
||||
.table {
|
||||
|
@ -1,5 +1,5 @@
|
||||
.main {
|
||||
min-height: var(--page-min-height, 100%);
|
||||
min-height: var(--page-height);
|
||||
background-color: var(--primary-bg) !important;
|
||||
|
||||
div[class*='NoDataCard'] {
|
||||
|
@ -1,11 +1,11 @@
|
||||
.main {
|
||||
min-height: var(--page-min-height, 100%);
|
||||
min-height: var(--page-height);
|
||||
background-color: var(--white) !important;
|
||||
|
||||
&.withFileViewer {
|
||||
&,
|
||||
> div:first-of-type {
|
||||
min-height: var(--page-min-height, 100vh) !important;
|
||||
min-height: var(--page-height) !important;
|
||||
}
|
||||
|
||||
> div:first-of-type {
|
||||
|
@ -1,4 +1,5 @@
|
||||
.resourceContent {
|
||||
background-color: var(--page-background) !important;
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
@ -1,4 +1,4 @@
|
||||
.main {
|
||||
min-height: var(--page-min-height, 100%);
|
||||
min-height: var(--page-height);
|
||||
background-color: var(--primary-bg) !important;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
.main {
|
||||
min-height: var(--page-min-height, 100%);
|
||||
min-height: var(--page-height);
|
||||
background-color: var(--primary-bg) !important;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
.main {
|
||||
min-height: var(--page-min-height, 100%);
|
||||
min-height: var(--page-height);
|
||||
background-color: var(--primary-bg) !important;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
.main {
|
||||
min-height: var(--page-min-height, 100%);
|
||||
min-height: var(--page-height);
|
||||
background-color: var(--primary-bg) !important;
|
||||
width: 100%;
|
||||
margin: var(--spacing-small);
|
||||
|
@ -1,4 +1,4 @@
|
||||
.main {
|
||||
min-height: var(--page-min-height, 100%);
|
||||
min-height: var(--page-height);
|
||||
background-color: var(--primary-bg) !important;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
.main {
|
||||
min-height: var(--page-min-height, 100%);
|
||||
min-height: var(--page-height);
|
||||
background-color: var(--primary-bg) !important;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import { useStrings } from 'framework/strings'
|
||||
import { useGetSpaceParam } from 'hooks/useGetSpaceParam'
|
||||
import {
|
||||
MembershipAddRequestBody,
|
||||
TypesMembership,
|
||||
TypesMembershipUser,
|
||||
TypesPrincipalInfo,
|
||||
useListPrincipals,
|
||||
useMembershipAdd,
|
||||
@ -23,7 +23,7 @@ const roles = ['reader', 'executor', 'contributor', 'space_owner'] as const
|
||||
|
||||
const useAddNewMember = ({ onClose }: { onClose: () => void }) => {
|
||||
const [isEditFlow, setIsEditFlow] = useState(false)
|
||||
const [membershipDetails, setMembershipDetails] = useState<TypesMembership>()
|
||||
const [membershipDetails, setMembershipDetails] = useState<TypesMembershipUser>()
|
||||
const [searchTerm, setSearchTerm] = useState('')
|
||||
|
||||
const space = useGetSpaceParam()
|
||||
|
@ -1,5 +1,5 @@
|
||||
.mainCtn {
|
||||
height: var(--page-min-height, 100%);
|
||||
height: var(--page-height);
|
||||
background-color: var(--primary-bg) !important;
|
||||
|
||||
.roleBadge {
|
||||
|
@ -6,7 +6,7 @@ import type { CellProps, Column } from 'react-table'
|
||||
import { StringKeys, useStrings } from 'framework/strings'
|
||||
import { useConfirmAct } from 'hooks/useConfirmAction'
|
||||
import { useGetSpaceParam } from 'hooks/useGetSpaceParam'
|
||||
import { EnumMembershipRole, TypesMembership, useMembershipDelete, useMembershipList } from 'services/code'
|
||||
import { EnumMembershipRole, TypesMembershipUser, useMembershipDelete, useMembershipList } from 'services/code'
|
||||
import { getErrorMessage } from 'utils/Utils'
|
||||
import { LoadingSpinner } from 'components/LoadingSpinner/LoadingSpinner'
|
||||
import { OptionsMenuButton } from 'components/OptionsMenuButton/OptionsMenuButton'
|
||||
@ -60,7 +60,7 @@ const SpaceAccessControl = () => {
|
||||
{
|
||||
Header: getString('user'),
|
||||
width: '30%',
|
||||
Cell: ({ row }: CellProps<TypesMembership>) => (
|
||||
Cell: ({ row }: CellProps<TypesMembershipUser>) => (
|
||||
<Layout.Horizontal style={{ alignItems: 'center' }}>
|
||||
<Avatar
|
||||
name={row.original.principal?.display_name}
|
||||
@ -78,7 +78,7 @@ const SpaceAccessControl = () => {
|
||||
{
|
||||
Header: getString('role'),
|
||||
width: '40%',
|
||||
Cell: ({ row }: CellProps<TypesMembership>) => {
|
||||
Cell: ({ row }: CellProps<TypesMembershipUser>) => {
|
||||
const stringKey = row.original.role ? roleStringKeyMap[row.original.role] : undefined
|
||||
|
||||
return (
|
||||
@ -91,7 +91,7 @@ const SpaceAccessControl = () => {
|
||||
{
|
||||
Header: getString('email'),
|
||||
width: '25%',
|
||||
Cell: ({ row }: CellProps<TypesMembership>) => (
|
||||
Cell: ({ row }: CellProps<TypesMembershipUser>) => (
|
||||
<Text font={{ variation: FontVariation.SMALL_SEMI }} lineClamp={1}>
|
||||
{row.original.principal?.email}
|
||||
</Text>
|
||||
@ -100,7 +100,7 @@ const SpaceAccessControl = () => {
|
||||
{
|
||||
accessor: 'action',
|
||||
width: '5%',
|
||||
Cell: ({ row }: CellProps<TypesMembership>) => {
|
||||
Cell: ({ row }: CellProps<TypesMembershipUser>) => {
|
||||
return (
|
||||
<OptionsMenuButton
|
||||
tooltipProps={{ isDark: true }}
|
||||
@ -118,7 +118,7 @@ const SpaceAccessControl = () => {
|
||||
)
|
||||
}
|
||||
}
|
||||
] as Column<TypesMembership>[],
|
||||
] as Column<TypesMembershipUser>[],
|
||||
[]
|
||||
)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
.mainCtn {
|
||||
height: var(--page-min-height, 100%);
|
||||
height: var(--page-height);
|
||||
background-color: var(--primary-bg) !important;
|
||||
|
||||
.roleBadge {
|
||||
@ -59,4 +59,4 @@
|
||||
|
||||
.verticalContainer {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
.mainCtn {
|
||||
height: var(--page-min-height, 100%);
|
||||
height: var(--page-height);
|
||||
background-color: var(--primary-bg) !important;
|
||||
|
||||
.pageCtn {
|
||||
|
@ -1,5 +1,5 @@
|
||||
.mainCtn {
|
||||
height: var(--page-min-height, 100%);
|
||||
height: var(--page-height);
|
||||
background-color: var(--primary-bg) !important;
|
||||
|
||||
.adminBadge {
|
||||
|
@ -1,5 +1,5 @@
|
||||
.main {
|
||||
min-height: var(--page-min-height, 100%);
|
||||
min-height: var(--page-height);
|
||||
background-color: var(--primary-bg) !important;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
.main {
|
||||
min-height: var(--page-min-height, 100%);
|
||||
min-height: var(--page-height);
|
||||
background-color: var(--primary-bg) !important;
|
||||
|
||||
.table {
|
||||
|
@ -7,7 +7,7 @@ import { getConfig } from '../config'
|
||||
export const SPEC_VERSION = '0.0.0'
|
||||
export type EnumAccessGrant = number
|
||||
|
||||
export type EnumCheckPayloadKind = 'external'
|
||||
export type EnumCheckPayloadKind = '' | 'markdown' | 'raw'
|
||||
|
||||
export type EnumCheckStatus = 'error' | 'failure' | 'pending' | 'running' | 'success'
|
||||
|
||||
@ -147,7 +147,7 @@ export type OpenapiContentType = 'file' | 'dir' | 'symlink' | 'submodule'
|
||||
|
||||
export interface OpenapiCreateBranchRequest {
|
||||
name?: string
|
||||
target?: string | null
|
||||
target?: string
|
||||
}
|
||||
|
||||
export interface OpenapiCreatePathRequest {
|
||||
@ -187,9 +187,9 @@ export interface OpenapiCreateSpaceRequest {
|
||||
}
|
||||
|
||||
export interface OpenapiCreateTagRequest {
|
||||
message?: string | null
|
||||
message?: string
|
||||
name?: string
|
||||
target?: string | null
|
||||
target?: string
|
||||
}
|
||||
|
||||
export interface OpenapiCreateTokenRequest {
|
||||
@ -250,14 +250,6 @@ export interface OpenapiRegisterRequest {
|
||||
uid?: string
|
||||
}
|
||||
|
||||
export interface OpenapiReportStatusCheckResultRequest {
|
||||
check_uid?: string
|
||||
link?: string
|
||||
payload?: TypesCheckPayload
|
||||
status?: EnumCheckStatus
|
||||
summary?: string
|
||||
}
|
||||
|
||||
export interface OpenapiReviewSubmitPullReqRequest {
|
||||
commit_sha?: string
|
||||
decision?: EnumPullReqReviewDecision
|
||||
@ -394,7 +386,7 @@ export interface RepoSymlinkContent {
|
||||
target?: string
|
||||
}
|
||||
|
||||
export type TimeDuration = number
|
||||
export type TimeDuration = number | null
|
||||
|
||||
export interface TypesCheck {
|
||||
created?: number
|
||||
@ -449,7 +441,15 @@ export interface TypesListCommitResponse {
|
||||
rename_details?: TypesRenameDetails[] | null
|
||||
}
|
||||
|
||||
export interface TypesMembership {
|
||||
export interface TypesMembershipSpace {
|
||||
added_by?: TypesPrincipalInfo
|
||||
created?: number
|
||||
role?: EnumMembershipRole
|
||||
space?: TypesSpace
|
||||
updated?: number
|
||||
}
|
||||
|
||||
export interface TypesMembershipUser {
|
||||
added_by?: TypesPrincipalInfo
|
||||
created?: number
|
||||
principal?: TypesPrincipalInfo
|
||||
@ -457,6 +457,11 @@ export interface TypesMembership {
|
||||
updated?: number
|
||||
}
|
||||
|
||||
export interface TypesMergeResponse {
|
||||
conflict_files?: string[]
|
||||
sha?: string
|
||||
}
|
||||
|
||||
export interface TypesPath {
|
||||
created?: number
|
||||
created_by?: number
|
||||
@ -600,7 +605,7 @@ export interface TypesSpace {
|
||||
|
||||
export interface TypesToken {
|
||||
created_by?: number
|
||||
expires_at?: number
|
||||
expires_at?: number | null
|
||||
grants?: EnumAccessGrant
|
||||
issued_at?: number
|
||||
principal_id?: number
|
||||
@ -1224,19 +1229,30 @@ export const useGetBranch = ({ repo_ref, branch_name, ...props }: UseGetBranchPr
|
||||
{ base: getConfig('code'), pathParams: { repo_ref, branch_name }, ...props }
|
||||
)
|
||||
|
||||
export interface ListStatusCheckResultsQueryParams {
|
||||
/**
|
||||
* The page to return.
|
||||
*/
|
||||
page?: number
|
||||
/**
|
||||
* The maximum number of results to return.
|
||||
*/
|
||||
limit?: number
|
||||
}
|
||||
|
||||
export interface ListStatusCheckResultsPathParams {
|
||||
repo_ref: string
|
||||
commit_sha: string
|
||||
}
|
||||
|
||||
export type ListStatusCheckResultsProps = Omit<
|
||||
GetProps<TypesCheck[], UsererrorError, void, ListStatusCheckResultsPathParams>,
|
||||
GetProps<TypesCheck[], UsererrorError, ListStatusCheckResultsQueryParams, ListStatusCheckResultsPathParams>,
|
||||
'path'
|
||||
> &
|
||||
ListStatusCheckResultsPathParams
|
||||
|
||||
export const ListStatusCheckResults = ({ repo_ref, commit_sha, ...props }: ListStatusCheckResultsProps) => (
|
||||
<Get<TypesCheck[], UsererrorError, void, ListStatusCheckResultsPathParams>
|
||||
<Get<TypesCheck[], UsererrorError, ListStatusCheckResultsQueryParams, ListStatusCheckResultsPathParams>
|
||||
path={`/repos/${repo_ref}/checks/commits/${commit_sha}`}
|
||||
base={getConfig('code')}
|
||||
{...props}
|
||||
@ -1244,13 +1260,13 @@ export const ListStatusCheckResults = ({ repo_ref, commit_sha, ...props }: ListS
|
||||
)
|
||||
|
||||
export type UseListStatusCheckResultsProps = Omit<
|
||||
UseGetProps<TypesCheck[], UsererrorError, void, ListStatusCheckResultsPathParams>,
|
||||
UseGetProps<TypesCheck[], UsererrorError, ListStatusCheckResultsQueryParams, ListStatusCheckResultsPathParams>,
|
||||
'path'
|
||||
> &
|
||||
ListStatusCheckResultsPathParams
|
||||
|
||||
export const useListStatusCheckResults = ({ repo_ref, commit_sha, ...props }: UseListStatusCheckResultsProps) =>
|
||||
useGet<TypesCheck[], UsererrorError, void, ListStatusCheckResultsPathParams>(
|
||||
useGet<TypesCheck[], UsererrorError, ListStatusCheckResultsQueryParams, ListStatusCheckResultsPathParams>(
|
||||
(paramsInPath: ListStatusCheckResultsPathParams) =>
|
||||
`/repos/${paramsInPath.repo_ref}/checks/commits/${paramsInPath.commit_sha}`,
|
||||
{ base: getConfig('code'), pathParams: { repo_ref, commit_sha }, ...props }
|
||||
@ -1261,12 +1277,20 @@ export interface ReportStatusCheckResultsPathParams {
|
||||
commit_sha: string
|
||||
}
|
||||
|
||||
export interface ReportStatusCheckResultsRequestBody {
|
||||
check_uid?: string
|
||||
link?: string
|
||||
payload?: TypesCheckPayload
|
||||
status?: EnumCheckStatus
|
||||
summary?: string
|
||||
}
|
||||
|
||||
export type ReportStatusCheckResultsProps = Omit<
|
||||
MutateProps<
|
||||
TypesCheck,
|
||||
UsererrorError,
|
||||
void,
|
||||
OpenapiReportStatusCheckResultRequest,
|
||||
ReportStatusCheckResultsRequestBody,
|
||||
ReportStatusCheckResultsPathParams
|
||||
>,
|
||||
'path' | 'verb'
|
||||
@ -1274,7 +1298,7 @@ export type ReportStatusCheckResultsProps = Omit<
|
||||
ReportStatusCheckResultsPathParams
|
||||
|
||||
export const ReportStatusCheckResults = ({ repo_ref, commit_sha, ...props }: ReportStatusCheckResultsProps) => (
|
||||
<Mutate<TypesCheck, UsererrorError, void, OpenapiReportStatusCheckResultRequest, ReportStatusCheckResultsPathParams>
|
||||
<Mutate<TypesCheck, UsererrorError, void, ReportStatusCheckResultsRequestBody, ReportStatusCheckResultsPathParams>
|
||||
verb="PUT"
|
||||
path={`/repos/${repo_ref}/checks/commits/${commit_sha}`}
|
||||
base={getConfig('code')}
|
||||
@ -1287,7 +1311,7 @@ export type UseReportStatusCheckResultsProps = Omit<
|
||||
TypesCheck,
|
||||
UsererrorError,
|
||||
void,
|
||||
OpenapiReportStatusCheckResultRequest,
|
||||
ReportStatusCheckResultsRequestBody,
|
||||
ReportStatusCheckResultsPathParams
|
||||
>,
|
||||
'path' | 'verb'
|
||||
@ -1295,13 +1319,7 @@ export type UseReportStatusCheckResultsProps = Omit<
|
||||
ReportStatusCheckResultsPathParams
|
||||
|
||||
export const useReportStatusCheckResults = ({ repo_ref, commit_sha, ...props }: UseReportStatusCheckResultsProps) =>
|
||||
useMutate<
|
||||
TypesCheck,
|
||||
UsererrorError,
|
||||
void,
|
||||
OpenapiReportStatusCheckResultRequest,
|
||||
ReportStatusCheckResultsPathParams
|
||||
>(
|
||||
useMutate<TypesCheck, UsererrorError, void, ReportStatusCheckResultsRequestBody, ReportStatusCheckResultsPathParams>(
|
||||
'PUT',
|
||||
(paramsInPath: ReportStatusCheckResultsPathParams) =>
|
||||
`/repos/${paramsInPath.repo_ref}/checks/commits/${paramsInPath.commit_sha}`,
|
||||
@ -1487,30 +1505,6 @@ export const useCalculateCommitDivergence = ({ repo_ref, ...props }: UseCalculat
|
||||
{ base: getConfig('code'), pathParams: { repo_ref }, ...props }
|
||||
)
|
||||
|
||||
export interface RawDiffPathParams {
|
||||
repo_ref: string
|
||||
range: string
|
||||
}
|
||||
|
||||
export type RawDiffProps = Omit<GetProps<void, UsererrorError, void, RawDiffPathParams>, 'path'> & RawDiffPathParams
|
||||
|
||||
export const RawDiff = ({ repo_ref, range, ...props }: RawDiffProps) => (
|
||||
<Get<void, UsererrorError, void, RawDiffPathParams>
|
||||
path={`/repos/${repo_ref}/diff/${range}`}
|
||||
base={getConfig('code')}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
|
||||
export type UseRawDiffProps = Omit<UseGetProps<void, UsererrorError, void, RawDiffPathParams>, 'path'> &
|
||||
RawDiffPathParams
|
||||
|
||||
export const useRawDiff = ({ repo_ref, range, ...props }: UseRawDiffProps) =>
|
||||
useGet<void, UsererrorError, void, RawDiffPathParams>(
|
||||
(paramsInPath: RawDiffPathParams) => `/repos/${paramsInPath.repo_ref}/diff/${paramsInPath.range}`,
|
||||
{ base: getConfig('code'), pathParams: { repo_ref, range }, ...props }
|
||||
)
|
||||
|
||||
export interface GetContentQueryParams {
|
||||
/**
|
||||
* The git reference (branch / tag / commitID) that will be used to retrieve the data. If no value is provided the default branch of the repository is used.
|
||||
@ -1553,28 +1547,28 @@ export const useGetContent = ({ repo_ref, path, ...props }: UseGetContentProps)
|
||||
{ base: getConfig('code'), pathParams: { repo_ref, path }, ...props }
|
||||
)
|
||||
|
||||
export interface DiffStatsPathParams {
|
||||
export interface RawDiffPathParams {
|
||||
repo_ref: string
|
||||
range: string
|
||||
}
|
||||
|
||||
export type DiffStatsProps = Omit<GetProps<TypesDiffStats, UsererrorError, void, DiffStatsPathParams>, 'path'> &
|
||||
DiffStatsPathParams
|
||||
export type RawDiffProps = Omit<GetProps<TypesDiffStats, UsererrorError, void, RawDiffPathParams>, 'path'> &
|
||||
RawDiffPathParams
|
||||
|
||||
export const DiffStats = ({ repo_ref, range, ...props }: DiffStatsProps) => (
|
||||
<Get<TypesDiffStats, UsererrorError, void, DiffStatsPathParams>
|
||||
path={`/repos/${repo_ref}/diff-stats/${range}`}
|
||||
export const RawDiff = ({ repo_ref, range, ...props }: RawDiffProps) => (
|
||||
<Get<TypesDiffStats, UsererrorError, void, RawDiffPathParams>
|
||||
path={`/repos/${repo_ref}/diff/${range}`}
|
||||
base={getConfig('code')}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
|
||||
export type UseDiffStatsProps = Omit<UseGetProps<TypesDiffStats, UsererrorError, void, DiffStatsPathParams>, 'path'> &
|
||||
DiffStatsPathParams
|
||||
export type UseRawDiffProps = Omit<UseGetProps<TypesDiffStats, UsererrorError, void, RawDiffPathParams>, 'path'> &
|
||||
RawDiffPathParams
|
||||
|
||||
export const useDiffStats = ({ repo_ref, range, ...props }: UseDiffStatsProps) =>
|
||||
useGet<TypesDiffStats, UsererrorError, void, DiffStatsPathParams>(
|
||||
(paramsInPath: DiffStatsPathParams) => `/repos/${paramsInPath.repo_ref}/diff-stats/${paramsInPath.range}`,
|
||||
export const useRawDiff = ({ repo_ref, range, ...props }: UseRawDiffProps) =>
|
||||
useGet<TypesDiffStats, UsererrorError, void, RawDiffPathParams>(
|
||||
(paramsInPath: RawDiffPathParams) => `/repos/${paramsInPath.repo_ref}/diff/${paramsInPath.range}`,
|
||||
{ base: getConfig('code'), pathParams: { repo_ref, range }, ...props }
|
||||
)
|
||||
|
||||
@ -2253,45 +2247,19 @@ export const useListPullReqCommits = ({ repo_ref, pullreq_number, ...props }: Us
|
||||
{ base: getConfig('code'), pathParams: { repo_ref, pullreq_number }, ...props }
|
||||
)
|
||||
|
||||
export interface RawPullReqDiffPathParams {
|
||||
repo_ref: string
|
||||
pullreq_number: number
|
||||
}
|
||||
|
||||
export type RawPullReqDiffProps = Omit<GetProps<void, UsererrorError, void, RawPullReqDiffPathParams>, 'path'> &
|
||||
RawPullReqDiffPathParams
|
||||
|
||||
export const RawPullReqDiff = ({ repo_ref, pullreq_number, ...props }: RawPullReqDiffProps) => (
|
||||
<Get<void, UsererrorError, void, RawPullReqDiffPathParams>
|
||||
path={`/repos/${repo_ref}/pullreq/${pullreq_number}/diff`}
|
||||
base={getConfig('code')}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
|
||||
export type UseRawPullReqDiffProps = Omit<UseGetProps<void, UsererrorError, void, RawPullReqDiffPathParams>, 'path'> &
|
||||
RawPullReqDiffPathParams
|
||||
|
||||
export const useRawPullReqDiff = ({ repo_ref, pullreq_number, ...props }: UseRawPullReqDiffProps) =>
|
||||
useGet<void, UsererrorError, void, RawPullReqDiffPathParams>(
|
||||
(paramsInPath: RawPullReqDiffPathParams) =>
|
||||
`/repos/${paramsInPath.repo_ref}/pullreq/${paramsInPath.pullreq_number}/diff`,
|
||||
{ base: getConfig('code'), pathParams: { repo_ref, pullreq_number }, ...props }
|
||||
)
|
||||
|
||||
export interface MergePullReqOpPathParams {
|
||||
repo_ref: string
|
||||
pullreq_number: number
|
||||
}
|
||||
|
||||
export type MergePullReqOpProps = Omit<
|
||||
MutateProps<void, UsererrorError, void, OpenapiMergePullReq, MergePullReqOpPathParams>,
|
||||
MutateProps<TypesMergeResponse, UsererrorError, void, OpenapiMergePullReq, MergePullReqOpPathParams>,
|
||||
'path' | 'verb'
|
||||
> &
|
||||
MergePullReqOpPathParams
|
||||
|
||||
export const MergePullReqOp = ({ repo_ref, pullreq_number, ...props }: MergePullReqOpProps) => (
|
||||
<Mutate<void, UsererrorError, void, OpenapiMergePullReq, MergePullReqOpPathParams>
|
||||
<Mutate<TypesMergeResponse, UsererrorError, void, OpenapiMergePullReq, MergePullReqOpPathParams>
|
||||
verb="POST"
|
||||
path={`/repos/${repo_ref}/pullreq/${pullreq_number}/merge`}
|
||||
base={getConfig('code')}
|
||||
@ -2300,13 +2268,13 @@ export const MergePullReqOp = ({ repo_ref, pullreq_number, ...props }: MergePull
|
||||
)
|
||||
|
||||
export type UseMergePullReqOpProps = Omit<
|
||||
UseMutateProps<void, UsererrorError, void, OpenapiMergePullReq, MergePullReqOpPathParams>,
|
||||
UseMutateProps<TypesMergeResponse, UsererrorError, void, OpenapiMergePullReq, MergePullReqOpPathParams>,
|
||||
'path' | 'verb'
|
||||
> &
|
||||
MergePullReqOpPathParams
|
||||
|
||||
export const useMergePullReqOp = ({ repo_ref, pullreq_number, ...props }: UseMergePullReqOpProps) =>
|
||||
useMutate<void, UsererrorError, void, OpenapiMergePullReq, MergePullReqOpPathParams>(
|
||||
useMutate<TypesMergeResponse, UsererrorError, void, OpenapiMergePullReq, MergePullReqOpPathParams>(
|
||||
'POST',
|
||||
(paramsInPath: MergePullReqOpPathParams) =>
|
||||
`/repos/${paramsInPath.repo_ref}/pullreq/${paramsInPath.pullreq_number}/merge`,
|
||||
@ -3117,18 +3085,41 @@ export const useUpdateSpace = ({ space_ref, ...props }: UseUpdateSpaceProps) =>
|
||||
{ base: getConfig('code'), pathParams: { space_ref }, ...props }
|
||||
)
|
||||
|
||||
export interface MembershipListQueryParams {
|
||||
/**
|
||||
* The substring by which the space members are filtered.
|
||||
*/
|
||||
query?: string
|
||||
/**
|
||||
* The order of the output.
|
||||
*/
|
||||
order?: 'asc' | 'desc'
|
||||
/**
|
||||
* The field by which the space members are sorted.
|
||||
*/
|
||||
sort?: 'created' | 'name'
|
||||
/**
|
||||
* The page to return.
|
||||
*/
|
||||
page?: number
|
||||
/**
|
||||
* The maximum number of results to return.
|
||||
*/
|
||||
limit?: number
|
||||
}
|
||||
|
||||
export interface MembershipListPathParams {
|
||||
space_ref: string
|
||||
}
|
||||
|
||||
export type MembershipListProps = Omit<
|
||||
GetProps<TypesMembership[], UsererrorError, void, MembershipListPathParams>,
|
||||
GetProps<TypesMembershipUser[], UsererrorError, MembershipListQueryParams, MembershipListPathParams>,
|
||||
'path'
|
||||
> &
|
||||
MembershipListPathParams
|
||||
|
||||
export const MembershipList = ({ space_ref, ...props }: MembershipListProps) => (
|
||||
<Get<TypesMembership[], UsererrorError, void, MembershipListPathParams>
|
||||
<Get<TypesMembershipUser[], UsererrorError, MembershipListQueryParams, MembershipListPathParams>
|
||||
path={`/spaces/${space_ref}/members`}
|
||||
base={getConfig('code')}
|
||||
{...props}
|
||||
@ -3136,13 +3127,13 @@ export const MembershipList = ({ space_ref, ...props }: MembershipListProps) =>
|
||||
)
|
||||
|
||||
export type UseMembershipListProps = Omit<
|
||||
UseGetProps<TypesMembership[], UsererrorError, void, MembershipListPathParams>,
|
||||
UseGetProps<TypesMembershipUser[], UsererrorError, MembershipListQueryParams, MembershipListPathParams>,
|
||||
'path'
|
||||
> &
|
||||
MembershipListPathParams
|
||||
|
||||
export const useMembershipList = ({ space_ref, ...props }: UseMembershipListProps) =>
|
||||
useGet<TypesMembership[], UsererrorError, void, MembershipListPathParams>(
|
||||
useGet<TypesMembershipUser[], UsererrorError, MembershipListQueryParams, MembershipListPathParams>(
|
||||
(paramsInPath: MembershipListPathParams) => `/spaces/${paramsInPath.space_ref}/members`,
|
||||
{ base: getConfig('code'), pathParams: { space_ref }, ...props }
|
||||
)
|
||||
@ -3157,13 +3148,13 @@ export interface MembershipAddRequestBody {
|
||||
}
|
||||
|
||||
export type MembershipAddProps = Omit<
|
||||
MutateProps<TypesMembership, UsererrorError, void, MembershipAddRequestBody, MembershipAddPathParams>,
|
||||
MutateProps<TypesMembershipUser, UsererrorError, void, MembershipAddRequestBody, MembershipAddPathParams>,
|
||||
'path' | 'verb'
|
||||
> &
|
||||
MembershipAddPathParams
|
||||
|
||||
export const MembershipAdd = ({ space_ref, ...props }: MembershipAddProps) => (
|
||||
<Mutate<TypesMembership, UsererrorError, void, MembershipAddRequestBody, MembershipAddPathParams>
|
||||
<Mutate<TypesMembershipUser, UsererrorError, void, MembershipAddRequestBody, MembershipAddPathParams>
|
||||
verb="POST"
|
||||
path={`/spaces/${space_ref}/members`}
|
||||
base={getConfig('code')}
|
||||
@ -3172,13 +3163,13 @@ export const MembershipAdd = ({ space_ref, ...props }: MembershipAddProps) => (
|
||||
)
|
||||
|
||||
export type UseMembershipAddProps = Omit<
|
||||
UseMutateProps<TypesMembership, UsererrorError, void, MembershipAddRequestBody, MembershipAddPathParams>,
|
||||
UseMutateProps<TypesMembershipUser, UsererrorError, void, MembershipAddRequestBody, MembershipAddPathParams>,
|
||||
'path' | 'verb'
|
||||
> &
|
||||
MembershipAddPathParams
|
||||
|
||||
export const useMembershipAdd = ({ space_ref, ...props }: UseMembershipAddProps) =>
|
||||
useMutate<TypesMembership, UsererrorError, void, MembershipAddRequestBody, MembershipAddPathParams>(
|
||||
useMutate<TypesMembershipUser, UsererrorError, void, MembershipAddRequestBody, MembershipAddPathParams>(
|
||||
'POST',
|
||||
(paramsInPath: MembershipAddPathParams) => `/spaces/${paramsInPath.space_ref}/members`,
|
||||
{ base: getConfig('code'), pathParams: { space_ref }, ...props }
|
||||
@ -3226,13 +3217,13 @@ export interface MembershipUpdateRequestBody {
|
||||
}
|
||||
|
||||
export type MembershipUpdateProps = Omit<
|
||||
MutateProps<TypesMembership, UsererrorError, void, MembershipUpdateRequestBody, MembershipUpdatePathParams>,
|
||||
MutateProps<TypesMembershipUser, UsererrorError, void, MembershipUpdateRequestBody, MembershipUpdatePathParams>,
|
||||
'path' | 'verb'
|
||||
> &
|
||||
MembershipUpdatePathParams
|
||||
|
||||
export const MembershipUpdate = ({ space_ref, user_uid, ...props }: MembershipUpdateProps) => (
|
||||
<Mutate<TypesMembership, UsererrorError, void, MembershipUpdateRequestBody, MembershipUpdatePathParams>
|
||||
<Mutate<TypesMembershipUser, UsererrorError, void, MembershipUpdateRequestBody, MembershipUpdatePathParams>
|
||||
verb="PATCH"
|
||||
path={`/spaces/${space_ref}/members/${user_uid}`}
|
||||
base={getConfig('code')}
|
||||
@ -3241,13 +3232,13 @@ export const MembershipUpdate = ({ space_ref, user_uid, ...props }: MembershipUp
|
||||
)
|
||||
|
||||
export type UseMembershipUpdateProps = Omit<
|
||||
UseMutateProps<TypesMembership, UsererrorError, void, MembershipUpdateRequestBody, MembershipUpdatePathParams>,
|
||||
UseMutateProps<TypesMembershipUser, UsererrorError, void, MembershipUpdateRequestBody, MembershipUpdatePathParams>,
|
||||
'path' | 'verb'
|
||||
> &
|
||||
MembershipUpdatePathParams
|
||||
|
||||
export const useMembershipUpdate = ({ space_ref, user_uid, ...props }: UseMembershipUpdateProps) =>
|
||||
useMutate<TypesMembership, UsererrorError, void, MembershipUpdateRequestBody, MembershipUpdatePathParams>(
|
||||
useMutate<TypesMembershipUser, UsererrorError, void, MembershipUpdateRequestBody, MembershipUpdatePathParams>(
|
||||
'PATCH',
|
||||
(paramsInPath: MembershipUpdatePathParams) => `/spaces/${paramsInPath.space_ref}/members/${paramsInPath.user_uid}`,
|
||||
{ base: getConfig('code'), pathParams: { space_ref, user_uid }, ...props }
|
||||
@ -3559,6 +3550,21 @@ export const useUpdateUser = (props: UseUpdateUserProps) =>
|
||||
...props
|
||||
})
|
||||
|
||||
export type MembershipSpacesProps = Omit<GetProps<TypesMembershipSpace[], UsererrorError, void, void>, 'path'>
|
||||
|
||||
export const MembershipSpaces = (props: MembershipSpacesProps) => (
|
||||
<Get<TypesMembershipSpace[], UsererrorError, void, void>
|
||||
path={`/user/memberships`}
|
||||
base={getConfig('code')}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
|
||||
export type UseMembershipSpacesProps = Omit<UseGetProps<TypesMembershipSpace[], UsererrorError, void, void>, 'path'>
|
||||
|
||||
export const useMembershipSpaces = (props: UseMembershipSpacesProps) =>
|
||||
useGet<TypesMembershipSpace[], UsererrorError, void, void>(`/user/memberships`, { base: getConfig('code'), ...props })
|
||||
|
||||
export type CreateTokenProps = Omit<
|
||||
MutateProps<TypesTokenResponse, UsererrorError, void, OpenapiCreateTokenRequest, void>,
|
||||
'path' | 'verb'
|
||||
|
@ -3,7 +3,7 @@ info:
|
||||
title: API Specification
|
||||
version: 0.0.0
|
||||
servers:
|
||||
- url: /api/v1/
|
||||
- url: /api/v1
|
||||
security:
|
||||
- bearerAuth: []
|
||||
paths:
|
||||
@ -887,6 +887,23 @@ paths:
|
||||
get:
|
||||
operationId: listStatusCheckResults
|
||||
parameters:
|
||||
- description: The page to return.
|
||||
in: query
|
||||
name: page
|
||||
required: false
|
||||
schema:
|
||||
default: 1
|
||||
minimum: 1
|
||||
type: integer
|
||||
- description: The maximum number of results to return.
|
||||
in: query
|
||||
name: limit
|
||||
required: false
|
||||
schema:
|
||||
default: 30
|
||||
maximum: 100
|
||||
minimum: 1
|
||||
type: integer
|
||||
- in: path
|
||||
name: repo_ref
|
||||
required: true
|
||||
@ -949,7 +966,18 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/OpenapiReportStatusCheckResultRequest'
|
||||
properties:
|
||||
check_uid:
|
||||
type: string
|
||||
link:
|
||||
type: string
|
||||
payload:
|
||||
$ref: '#/components/schemas/TypesCheckPayload'
|
||||
status:
|
||||
$ref: '#/components/schemas/EnumCheckStatus'
|
||||
summary:
|
||||
type: string
|
||||
type: object
|
||||
responses:
|
||||
'200':
|
||||
content:
|
||||
@ -1233,48 +1261,6 @@ paths:
|
||||
description: Internal Server Error
|
||||
tags:
|
||||
- repository
|
||||
/repos/{repo_ref}/compare/{range}:
|
||||
get:
|
||||
operationId: rawDiff
|
||||
parameters:
|
||||
- in: path
|
||||
name: repo_ref
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
- in: path
|
||||
name: range
|
||||
required: true
|
||||
schema:
|
||||
example: main..dev
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: OK
|
||||
'401':
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/UsererrorError'
|
||||
description: Unauthorized
|
||||
'403':
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/UsererrorError'
|
||||
description: Forbidden
|
||||
'500':
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/UsererrorError'
|
||||
description: Internal Server Error
|
||||
tags:
|
||||
- repository
|
||||
/repos/{repo_ref}/content/{path}:
|
||||
get:
|
||||
operationId: getContent
|
||||
@ -1339,9 +1325,9 @@ paths:
|
||||
description: Internal Server Error
|
||||
tags:
|
||||
- repository
|
||||
/repos/{repo_ref}/diff-stats/{range}:
|
||||
/repos/{repo_ref}/diff/{range}:
|
||||
get:
|
||||
operationId: diffStats
|
||||
operationId: rawDiff
|
||||
parameters:
|
||||
- in: path
|
||||
name: repo_ref
|
||||
@ -1360,6 +1346,9 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/TypesDiffStats'
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: OK
|
||||
'401':
|
||||
content:
|
||||
@ -2272,53 +2261,6 @@ paths:
|
||||
description: Internal Server Error
|
||||
tags:
|
||||
- pullreq
|
||||
/repos/{repo_ref}/pullreq/{pullreq_number}/diff:
|
||||
get:
|
||||
operationId: rawPullReqDiff
|
||||
parameters:
|
||||
- in: path
|
||||
name: repo_ref
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
- in: path
|
||||
name: pullreq_number
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
'200':
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: OK
|
||||
'401':
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/UsererrorError'
|
||||
description: Unauthorized
|
||||
'403':
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/UsererrorError'
|
||||
description: Forbidden
|
||||
'404':
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/UsererrorError'
|
||||
description: Not Found
|
||||
'500':
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/UsererrorError'
|
||||
description: Internal Server Error
|
||||
tags:
|
||||
- pullreq
|
||||
/repos/{repo_ref}/pullreq/{pullreq_number}/merge:
|
||||
post:
|
||||
operationId: mergePullReqOp
|
||||
@ -2340,6 +2282,10 @@ paths:
|
||||
$ref: '#/components/schemas/OpenapiMergePullReq'
|
||||
responses:
|
||||
'200':
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/TypesMergeResponse'
|
||||
description: OK
|
||||
'400':
|
||||
content:
|
||||
@ -3628,6 +3574,49 @@ paths:
|
||||
get:
|
||||
operationId: membershipList
|
||||
parameters:
|
||||
- description: The substring by which the space members are filtered.
|
||||
in: query
|
||||
name: query
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
- description: The order of the output.
|
||||
in: query
|
||||
name: order
|
||||
required: false
|
||||
schema:
|
||||
default: asc
|
||||
enum:
|
||||
- asc
|
||||
- desc
|
||||
type: string
|
||||
- description: The field by which the space members are sorted.
|
||||
in: query
|
||||
name: sort
|
||||
required: false
|
||||
schema:
|
||||
default: name
|
||||
enum:
|
||||
- created
|
||||
- name
|
||||
type: string
|
||||
- description: The page to return.
|
||||
in: query
|
||||
name: page
|
||||
required: false
|
||||
schema:
|
||||
default: 1
|
||||
minimum: 1
|
||||
type: integer
|
||||
- description: The maximum number of results to return.
|
||||
in: query
|
||||
name: limit
|
||||
required: false
|
||||
schema:
|
||||
default: 30
|
||||
maximum: 100
|
||||
minimum: 1
|
||||
type: integer
|
||||
- in: path
|
||||
name: space_ref
|
||||
required: true
|
||||
@ -3639,7 +3628,7 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/components/schemas/TypesMembership'
|
||||
$ref: '#/components/schemas/TypesMembershipUser'
|
||||
type: array
|
||||
description: OK
|
||||
'401':
|
||||
@ -3691,7 +3680,7 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/TypesMembership'
|
||||
$ref: '#/components/schemas/TypesMembershipUser'
|
||||
description: Created
|
||||
'401':
|
||||
content:
|
||||
@ -3788,7 +3777,7 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/TypesMembership'
|
||||
$ref: '#/components/schemas/TypesMembershipUser'
|
||||
description: OK
|
||||
'401':
|
||||
content:
|
||||
@ -4277,6 +4266,26 @@ paths:
|
||||
description: Internal Server Error
|
||||
tags:
|
||||
- user
|
||||
/user/memberships:
|
||||
get:
|
||||
operationId: membershipSpaces
|
||||
responses:
|
||||
'200':
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/components/schemas/TypesMembershipSpace'
|
||||
type: array
|
||||
description: OK
|
||||
'500':
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/UsererrorError'
|
||||
description: Internal Server Error
|
||||
tags:
|
||||
- user
|
||||
/user/token:
|
||||
post:
|
||||
operationId: createToken
|
||||
@ -4306,7 +4315,9 @@ components:
|
||||
type: integer
|
||||
EnumCheckPayloadKind:
|
||||
enum:
|
||||
- external
|
||||
- ''
|
||||
- markdown
|
||||
- raw
|
||||
type: string
|
||||
EnumCheckStatus:
|
||||
enum:
|
||||
@ -4574,7 +4585,6 @@ components:
|
||||
name:
|
||||
type: string
|
||||
target:
|
||||
nullable: true
|
||||
type: string
|
||||
type: object
|
||||
OpenapiCreatePathRequest:
|
||||
@ -4637,12 +4647,10 @@ components:
|
||||
OpenapiCreateTagRequest:
|
||||
properties:
|
||||
message:
|
||||
nullable: true
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
target:
|
||||
nullable: true
|
||||
type: string
|
||||
type: object
|
||||
OpenapiCreateTokenRequest:
|
||||
@ -4744,19 +4752,6 @@ components:
|
||||
uid:
|
||||
type: string
|
||||
type: object
|
||||
OpenapiReportStatusCheckResultRequest:
|
||||
properties:
|
||||
check_uid:
|
||||
type: string
|
||||
link:
|
||||
type: string
|
||||
payload:
|
||||
$ref: '#/components/schemas/TypesCheckPayload'
|
||||
status:
|
||||
$ref: '#/components/schemas/EnumCheckStatus'
|
||||
summary:
|
||||
type: string
|
||||
type: object
|
||||
OpenapiReviewSubmitPullReqRequest:
|
||||
properties:
|
||||
commit_sha:
|
||||
@ -4981,6 +4976,7 @@ components:
|
||||
type: string
|
||||
type: object
|
||||
TimeDuration:
|
||||
nullable: true
|
||||
type: integer
|
||||
TypesCheck:
|
||||
properties:
|
||||
@ -5071,7 +5067,20 @@ components:
|
||||
nullable: true
|
||||
type: array
|
||||
type: object
|
||||
TypesMembership:
|
||||
TypesMembershipSpace:
|
||||
properties:
|
||||
added_by:
|
||||
$ref: '#/components/schemas/TypesPrincipalInfo'
|
||||
created:
|
||||
type: integer
|
||||
role:
|
||||
$ref: '#/components/schemas/EnumMembershipRole'
|
||||
space:
|
||||
$ref: '#/components/schemas/TypesSpace'
|
||||
updated:
|
||||
type: integer
|
||||
type: object
|
||||
TypesMembershipUser:
|
||||
properties:
|
||||
added_by:
|
||||
$ref: '#/components/schemas/TypesPrincipalInfo'
|
||||
@ -5084,6 +5093,15 @@ components:
|
||||
updated:
|
||||
type: integer
|
||||
type: object
|
||||
TypesMergeResponse:
|
||||
properties:
|
||||
conflict_files:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
sha:
|
||||
type: string
|
||||
type: object
|
||||
TypesPath:
|
||||
properties:
|
||||
created:
|
||||
@ -5348,6 +5366,7 @@ components:
|
||||
created_by:
|
||||
type: integer
|
||||
expires_at:
|
||||
nullable: true
|
||||
type: integer
|
||||
grants:
|
||||
$ref: '#/components/schemas/EnumAccessGrant'
|
||||
|
@ -297,13 +297,6 @@ export enum MergeCheckStatus {
|
||||
CONFLICT = 'conflict'
|
||||
}
|
||||
|
||||
export enum PullRequestSection {
|
||||
CONVERSATION = 'conversation',
|
||||
COMMITS = 'commits',
|
||||
FILES_CHANGED = 'changes',
|
||||
CHECKS = 'checks'
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert number of bytes into human readable format
|
||||
*
|
||||
@ -324,6 +317,7 @@ export function formatBytes(bytes: number, decimals = 2) {
|
||||
}
|
||||
|
||||
export enum PullRequestCheckType {
|
||||
EXTERNAL = 'external',
|
||||
PIPELINE = 'pipeline' // TODO: This is not yet supported by backend
|
||||
EMPTY = '',
|
||||
RAW = 'raw',
|
||||
MARKDOWN = 'markdown'
|
||||
}
|
||||
|
@ -5,4 +5,6 @@
|
||||
--nav-menu-width: 232px;
|
||||
--nav-background: #f2f6fb;
|
||||
--page-background: #fbfcfd;
|
||||
|
||||
--page-height: var(--page-min-height, max(100vh, 800px));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user