mirror of
https://github.com/harness/drone.git
synced 2025-05-11 06:30:06 +08:00
Merge branch 'more_ci_pages' of _OKE5H2PQKOUfzFFDuD4FA/default/CODE/gitness (#311)
This commit is contained in:
commit
2d5d991708
@ -14,6 +14,7 @@ export interface CODEProps {
|
|||||||
pipeline?: string
|
pipeline?: string
|
||||||
execution?: string
|
execution?: string
|
||||||
commitSHA?: string
|
commitSHA?: string
|
||||||
|
secret?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CODEQueryProps {
|
export interface CODEQueryProps {
|
||||||
@ -32,7 +33,8 @@ export const pathProps: Readonly<Omit<Required<CODEProps>, 'repoPath' | 'branch'
|
|||||||
webhookId: ':webhookId',
|
webhookId: ':webhookId',
|
||||||
pipeline: ':pipeline',
|
pipeline: ':pipeline',
|
||||||
execution: ':execution',
|
execution: ':execution',
|
||||||
commitSHA: ':commitSHA'
|
commitSHA: ':commitSHA',
|
||||||
|
secret: ':secret'
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CODERoutes {
|
export interface CODERoutes {
|
||||||
@ -73,6 +75,7 @@ export interface CODERoutes {
|
|||||||
|
|
||||||
toCODEExecutions: (args: Required<Pick<CODEProps, 'space' | 'pipeline'>>) => string
|
toCODEExecutions: (args: Required<Pick<CODEProps, 'space' | 'pipeline'>>) => string
|
||||||
toCODEExecution: (args: Required<Pick<CODEProps, 'space' | 'pipeline' | 'execution'>>) => string
|
toCODEExecution: (args: Required<Pick<CODEProps, 'space' | 'pipeline' | 'execution'>>) => string
|
||||||
|
toCODESecret: (args: Required<Pick<CODEProps, 'space' | 'secret'>>) => string
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -126,5 +129,7 @@ export const routes: CODERoutes = {
|
|||||||
toCODEWebhookDetails: ({ repoPath, webhookId }) => `/${repoPath}/webhook/${webhookId}`,
|
toCODEWebhookDetails: ({ repoPath, webhookId }) => `/${repoPath}/webhook/${webhookId}`,
|
||||||
|
|
||||||
toCODEExecutions: ({ space, pipeline }) => `/pipelines/${space}/pipeline/${pipeline}`,
|
toCODEExecutions: ({ space, pipeline }) => `/pipelines/${space}/pipeline/${pipeline}`,
|
||||||
toCODEExecution: ({ space, pipeline, execution }) => `/pipelines/${space}/pipeline/${pipeline}/execution/${execution}`
|
toCODEExecution: ({ space, pipeline, execution }) =>
|
||||||
|
`/pipelines/${space}/pipeline/${pipeline}/execution/${execution}`,
|
||||||
|
toCODESecret: ({ space, secret }) => `/secrets/${space}/secret/${secret}`
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ import { useStrings } from 'framework/strings'
|
|||||||
import { useFeatureFlag } from 'hooks/useFeatureFlag'
|
import { useFeatureFlag } from 'hooks/useFeatureFlag'
|
||||||
import ExecutionList from 'pages/ExecutionList/ExecutionList'
|
import ExecutionList from 'pages/ExecutionList/ExecutionList'
|
||||||
import Execution from 'pages/Execution/Execution'
|
import Execution from 'pages/Execution/Execution'
|
||||||
|
import Secret from 'pages/Secret/Secret'
|
||||||
|
|
||||||
export const RouteDestinations: React.FC = React.memo(function RouteDestinations() {
|
export const RouteDestinations: React.FC = React.memo(function RouteDestinations() {
|
||||||
const { getString } = useStrings()
|
const { getString } = useStrings()
|
||||||
@ -192,6 +193,14 @@ export const RouteDestinations: React.FC = React.memo(function RouteDestinations
|
|||||||
</Route>
|
</Route>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{OPEN_SOURCE_SECRETS && (
|
||||||
|
<Route path={routes.toCODESecret({ space: pathProps.space, secret: pathProps.secret })} exact>
|
||||||
|
<LayoutWithSideNav title={getString('pageTitle.secrets')}>
|
||||||
|
<Secret />
|
||||||
|
</LayoutWithSideNav>
|
||||||
|
</Route>
|
||||||
|
)}
|
||||||
|
|
||||||
{OPEN_SOURCE_SECRETS && (
|
{OPEN_SOURCE_SECRETS && (
|
||||||
<Route path={routes.toCODESecrets({ space: pathProps.space })} exact>
|
<Route path={routes.toCODESecrets({ space: pathProps.space })} exact>
|
||||||
<LayoutWithSideNav title={getString('pageTitle.secrets')}>
|
<LayoutWithSideNav title={getString('pageTitle.secrets')}>
|
||||||
|
159
web/src/components/NewSecretModalButton/NewSecretModalButton.tsx
Normal file
159
web/src/components/NewSecretModalButton/NewSecretModalButton.tsx
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
import {
|
||||||
|
useToaster,
|
||||||
|
type ButtonProps,
|
||||||
|
Button,
|
||||||
|
Dialog,
|
||||||
|
Layout,
|
||||||
|
Heading,
|
||||||
|
FontVariation,
|
||||||
|
Container,
|
||||||
|
Formik,
|
||||||
|
FormikForm,
|
||||||
|
FormInput,
|
||||||
|
Intent,
|
||||||
|
FlexExpander,
|
||||||
|
Icon
|
||||||
|
} from '@harness/uicore'
|
||||||
|
import { useModalHook } from '@harness/use-modal'
|
||||||
|
import React from 'react'
|
||||||
|
import { useMutate } from 'restful-react'
|
||||||
|
import * as yup from 'yup'
|
||||||
|
import { useStrings } from 'framework/strings'
|
||||||
|
import type { OpenapiCreateSecretRequest, TypesSecret } from 'services/code'
|
||||||
|
import { getErrorMessage } from 'utils/Utils'
|
||||||
|
|
||||||
|
interface SecretFormData {
|
||||||
|
value: string
|
||||||
|
description: string
|
||||||
|
name: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const formInitialValues: SecretFormData = {
|
||||||
|
value: '',
|
||||||
|
description: '',
|
||||||
|
name: ''
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface NewSecretModalButtonProps extends Omit<ButtonProps, 'onClick' | 'onSubmit'> {
|
||||||
|
space: string
|
||||||
|
modalTitle: string
|
||||||
|
submitButtonTitle?: string
|
||||||
|
cancelButtonTitle?: string
|
||||||
|
onSubmit: (data: TypesSecret) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export const NewSecretModalButton: React.FC<NewSecretModalButtonProps> = ({
|
||||||
|
space,
|
||||||
|
modalTitle,
|
||||||
|
submitButtonTitle,
|
||||||
|
cancelButtonTitle,
|
||||||
|
onSubmit,
|
||||||
|
...props
|
||||||
|
}) => {
|
||||||
|
const ModalComponent: React.FC = () => {
|
||||||
|
const { getString } = useStrings()
|
||||||
|
const { showError } = useToaster()
|
||||||
|
|
||||||
|
const { mutate: createSecret, loading } = useMutate<TypesSecret>({
|
||||||
|
verb: 'POST',
|
||||||
|
path: `/api/v1/secrets`
|
||||||
|
})
|
||||||
|
|
||||||
|
const handleSubmit = async (formData: SecretFormData) => {
|
||||||
|
try {
|
||||||
|
const payload: OpenapiCreateSecretRequest = {
|
||||||
|
space_ref: space,
|
||||||
|
data: formData.value,
|
||||||
|
description: formData.description,
|
||||||
|
uid: formData.name
|
||||||
|
}
|
||||||
|
const response = await createSecret(payload)
|
||||||
|
hideModal()
|
||||||
|
onSubmit(response)
|
||||||
|
} catch (exception) {
|
||||||
|
showError(getErrorMessage(exception), 0, getString('secrets.failedToCreate'))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dialog
|
||||||
|
isOpen
|
||||||
|
enforceFocus={false}
|
||||||
|
onClose={hideModal}
|
||||||
|
title={''}
|
||||||
|
style={{ width: 700, maxHeight: '95vh', overflow: 'auto' }}>
|
||||||
|
<Layout.Vertical
|
||||||
|
padding={{ left: 'xxlarge' }}
|
||||||
|
style={{ height: '100%' }}
|
||||||
|
data-testid="add-target-to-flag-modal">
|
||||||
|
<Heading level={3} font={{ variation: FontVariation.H3 }} margin={{ bottom: 'xlarge' }}>
|
||||||
|
{modalTitle}
|
||||||
|
</Heading>
|
||||||
|
|
||||||
|
<Container margin={{ right: 'xxlarge' }}>
|
||||||
|
<Formik
|
||||||
|
initialValues={formInitialValues}
|
||||||
|
formName="addSecret"
|
||||||
|
enableReinitialize={true}
|
||||||
|
validationSchema={yup.object().shape({
|
||||||
|
name: yup.string().trim().required(),
|
||||||
|
value: yup.string().trim().required()
|
||||||
|
})}
|
||||||
|
validateOnChange
|
||||||
|
validateOnBlur
|
||||||
|
onSubmit={handleSubmit}>
|
||||||
|
<FormikForm>
|
||||||
|
<FormInput.Text
|
||||||
|
name="name"
|
||||||
|
label={getString('name')}
|
||||||
|
placeholder={getString('secrets.enterSecretName')}
|
||||||
|
tooltipProps={{
|
||||||
|
dataTooltipId: 'secretNameTextField'
|
||||||
|
}}
|
||||||
|
inputGroup={{ autoFocus: true }}
|
||||||
|
/>
|
||||||
|
<FormInput.Text
|
||||||
|
name="value"
|
||||||
|
label={getString('value')}
|
||||||
|
placeholder={getString('secrets.value')}
|
||||||
|
tooltipProps={{
|
||||||
|
dataTooltipId: 'secretDescriptionTextField'
|
||||||
|
}}
|
||||||
|
inputGroup={{ type: 'password' }}
|
||||||
|
/>
|
||||||
|
<FormInput.Text
|
||||||
|
name="description"
|
||||||
|
label={getString('description')}
|
||||||
|
placeholder={getString('enterDescription')}
|
||||||
|
tooltipProps={{
|
||||||
|
dataTooltipId: 'secretDescriptionTextField'
|
||||||
|
}}
|
||||||
|
isOptional
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Layout.Horizontal
|
||||||
|
spacing="small"
|
||||||
|
padding={{ right: 'xxlarge', top: 'xxxlarge', bottom: 'large' }}
|
||||||
|
style={{ alignItems: 'center' }}>
|
||||||
|
<Button
|
||||||
|
type="submit"
|
||||||
|
text={getString('secrets.createSecret')}
|
||||||
|
intent={Intent.PRIMARY}
|
||||||
|
disabled={loading}
|
||||||
|
/>
|
||||||
|
<Button text={cancelButtonTitle || getString('cancel')} minimal onClick={hideModal} />
|
||||||
|
<FlexExpander />
|
||||||
|
{loading && <Icon intent={Intent.PRIMARY} name="spinner" size={16} />}
|
||||||
|
</Layout.Horizontal>
|
||||||
|
</FormikForm>
|
||||||
|
</Formik>
|
||||||
|
</Container>
|
||||||
|
</Layout.Vertical>
|
||||||
|
</Dialog>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const [openModal, hideModal] = useModalHook(ModalComponent, [onSubmit])
|
||||||
|
|
||||||
|
return <Button onClick={openModal} {...props} />
|
||||||
|
}
|
@ -176,6 +176,7 @@ export interface StringsMap {
|
|||||||
expired: string
|
expired: string
|
||||||
failed: string
|
failed: string
|
||||||
failedToCreateBranch: string
|
failedToCreateBranch: string
|
||||||
|
failedToCreatePipeline: string
|
||||||
failedToCreateRepo: string
|
failedToCreateRepo: string
|
||||||
failedToCreateSpace: string
|
failedToCreateSpace: string
|
||||||
failedToDeleteBranch: string
|
failedToDeleteBranch: string
|
||||||
@ -449,6 +450,13 @@ export interface StringsMap {
|
|||||||
search: string
|
search: string
|
||||||
searchBranches: string
|
searchBranches: string
|
||||||
secret: string
|
secret: string
|
||||||
|
'secrets.createSecret': string
|
||||||
|
'secrets.enterSecretName': string
|
||||||
|
'secrets.failedToCreate': string
|
||||||
|
'secrets.name': string
|
||||||
|
'secrets.newSecretButton': string
|
||||||
|
'secrets.noData': string
|
||||||
|
'secrets.value': string
|
||||||
selectBranchPlaceHolder: string
|
selectBranchPlaceHolder: string
|
||||||
selectRange: string
|
selectRange: string
|
||||||
selectSpace: string
|
selectSpace: string
|
||||||
@ -533,6 +541,7 @@ export interface StringsMap {
|
|||||||
'validation.spaceNamePatternIsNotValid': string
|
'validation.spaceNamePatternIsNotValid': string
|
||||||
'validation.uidInvalid': string
|
'validation.uidInvalid': string
|
||||||
'validation.uidRequired': string
|
'validation.uidRequired': string
|
||||||
|
value: string
|
||||||
viewAllBranches: string
|
viewAllBranches: string
|
||||||
viewAllTags: string
|
viewAllTags: string
|
||||||
viewCommitDetails: string
|
viewCommitDetails: string
|
||||||
|
@ -11,6 +11,7 @@ public: Public
|
|||||||
private: Private
|
private: Private
|
||||||
cancel: Cancel
|
cancel: Cancel
|
||||||
name: Name
|
name: Name
|
||||||
|
value: Value
|
||||||
help: help
|
help: help
|
||||||
search: Search
|
search: Search
|
||||||
description: Description
|
description: Description
|
||||||
@ -580,6 +581,7 @@ spaceMemberships:
|
|||||||
memberUpdated: Member updated successfully.
|
memberUpdated: Member updated successfully.
|
||||||
memberAdded: Member added successfully.
|
memberAdded: Member added successfully.
|
||||||
failedToCreateSpace: Failed to create Space. Please try again.
|
failedToCreateSpace: Failed to create Space. Please try again.
|
||||||
|
failedToCreatePipeline: Failed to create Pipeline. Please try again.
|
||||||
enterName: Enter the name
|
enterName: Enter the name
|
||||||
createSpace: Create Space
|
createSpace: Create Space
|
||||||
newSpace: New Space
|
newSpace: New Space
|
||||||
@ -623,3 +625,11 @@ executions:
|
|||||||
name: Execution Name
|
name: Execution Name
|
||||||
selectRange: Shift-click to select a range
|
selectRange: Shift-click to select a range
|
||||||
allCommits: All Commits
|
allCommits: All Commits
|
||||||
|
secrets:
|
||||||
|
noData: There are no secrets :(
|
||||||
|
newSecretButton: New Secret
|
||||||
|
name: Secret Name
|
||||||
|
failedToCreate: Failed to create Secret. Please try again.
|
||||||
|
enterSecretName: Enter Secret name
|
||||||
|
value: Secret Value
|
||||||
|
createSecret: Create Secret
|
||||||
|
@ -1,11 +1,29 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { Container, PageHeader } from '@harness/uicore'
|
import { Container, PageHeader } from '@harness/uicore'
|
||||||
|
import { useParams } from 'react-router-dom'
|
||||||
|
import { useGet } from 'restful-react'
|
||||||
|
import { useGetSpaceParam } from 'hooks/useGetSpaceParam'
|
||||||
|
import type { CODEProps } from 'RouteDefinitions'
|
||||||
|
import type { TypesExecution } from 'services/code'
|
||||||
import css from './Execution.module.scss'
|
import css from './Execution.module.scss'
|
||||||
|
|
||||||
const Execution = () => {
|
const Execution = () => {
|
||||||
|
const space = useGetSpaceParam()
|
||||||
|
const { pipeline, execution: executionNum } = useParams<CODEProps>()
|
||||||
|
|
||||||
|
const {
|
||||||
|
data: execution
|
||||||
|
// error,
|
||||||
|
// loading,
|
||||||
|
// refetch
|
||||||
|
// response
|
||||||
|
} = useGet<TypesExecution>({
|
||||||
|
path: `/api/v1/pipelines/${space}/${pipeline}/+/executions/${executionNum}`
|
||||||
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container className={css.main}>
|
<Container className={css.main}>
|
||||||
<PageHeader title={'THIS IS AN EXECUTION'} />
|
<PageHeader title={`EXECUTION STATUS = ${execution?.status}`} />
|
||||||
</Container>
|
</Container>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.withError {
|
||||||
|
display: grid;
|
||||||
|
}
|
||||||
|
|
||||||
.nameContainer {
|
.nameContainer {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ declare const styles: {
|
|||||||
readonly table: string
|
readonly table: string
|
||||||
readonly row: string
|
readonly row: string
|
||||||
readonly noDesc: string
|
readonly noDesc: string
|
||||||
|
readonly withError: string
|
||||||
readonly nameContainer: string
|
readonly nameContainer: string
|
||||||
readonly name: string
|
readonly name: string
|
||||||
readonly pinned: string
|
readonly pinned: string
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
import React, { useMemo, useState } from 'react'
|
import React, { useMemo } from 'react'
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
ButtonVariation,
|
ButtonVariation,
|
||||||
Color,
|
Color,
|
||||||
Container,
|
Container,
|
||||||
FlexExpander,
|
FlexExpander,
|
||||||
Icon,
|
|
||||||
Layout,
|
Layout,
|
||||||
PageBody,
|
PageBody,
|
||||||
PageHeader,
|
PageHeader,
|
||||||
@ -14,68 +13,42 @@ import {
|
|||||||
} from '@harness/uicore'
|
} from '@harness/uicore'
|
||||||
import cx from 'classnames'
|
import cx from 'classnames'
|
||||||
import type { CellProps, Column } from 'react-table'
|
import type { CellProps, Column } from 'react-table'
|
||||||
import Keywords from 'react-keywords'
|
import { useHistory, useParams } from 'react-router-dom'
|
||||||
import { useHistory } from 'react-router-dom'
|
import { useGet } from 'restful-react'
|
||||||
import { useStrings } from 'framework/strings'
|
import { useStrings } from 'framework/strings'
|
||||||
import { LoadingSpinner } from 'components/LoadingSpinner/LoadingSpinner'
|
import { LoadingSpinner } from 'components/LoadingSpinner/LoadingSpinner'
|
||||||
import { useAppContext } from 'AppContext'
|
import { useAppContext } from 'AppContext'
|
||||||
import { SearchInputWithSpinner } from 'components/SearchInputWithSpinner/SearchInputWithSpinner'
|
|
||||||
import { NoResultCard } from 'components/NoResultCard/NoResultCard'
|
import { NoResultCard } from 'components/NoResultCard/NoResultCard'
|
||||||
import { formatDate } from 'utils/Utils'
|
import { LIST_FETCHING_LIMIT, PageBrowserProps, formatDate, getErrorMessage, voidFn } from 'utils/Utils'
|
||||||
|
import type { CODEProps } from 'RouteDefinitions'
|
||||||
|
import type { TypesExecution } from 'services/code'
|
||||||
|
import { useGetSpaceParam } from 'hooks/useGetSpaceParam'
|
||||||
|
import { useQueryParams } from 'hooks/useQueryParams'
|
||||||
|
import { usePageIndex } from 'hooks/usePageIndex'
|
||||||
|
import { ResourceListingPagination } from 'components/ResourceListingPagination/ResourceListingPagination'
|
||||||
import noExecutionImage from '../RepositoriesListing/no-repo.svg'
|
import noExecutionImage from '../RepositoriesListing/no-repo.svg'
|
||||||
import css from './ExecutionList.module.scss'
|
import css from './ExecutionList.module.scss'
|
||||||
|
|
||||||
interface Execution {
|
|
||||||
id: number
|
|
||||||
uid: string
|
|
||||||
name: string
|
|
||||||
updated: number
|
|
||||||
description?: string
|
|
||||||
isPublic?: boolean
|
|
||||||
spaceUid: string
|
|
||||||
pipelineUid: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const executions: Execution[] = [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
uid: '1',
|
|
||||||
name: 'Exec 1',
|
|
||||||
updated: 1687234800,
|
|
||||||
description: 'This is a description',
|
|
||||||
isPublic: true,
|
|
||||||
spaceUid: 'root',
|
|
||||||
pipelineUid: 'pipeline-1'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
uid: '2',
|
|
||||||
name: 'Exec 2',
|
|
||||||
updated: 1730275200,
|
|
||||||
description: 'This is a description',
|
|
||||||
isPublic: true,
|
|
||||||
spaceUid: 'root',
|
|
||||||
pipelineUid: 'pipeline-2'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
uid: '3',
|
|
||||||
name: 'Exec 3',
|
|
||||||
updated: 1773315600,
|
|
||||||
description: 'This is a description',
|
|
||||||
isPublic: false,
|
|
||||||
spaceUid: 'root',
|
|
||||||
pipelineUid: 'pipeline-3'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
const loading = false
|
|
||||||
|
|
||||||
const ExecutionList = () => {
|
const ExecutionList = () => {
|
||||||
const { routes } = useAppContext()
|
const { routes } = useAppContext()
|
||||||
|
const space = useGetSpaceParam()
|
||||||
|
const { pipeline } = useParams<CODEProps>()
|
||||||
const history = useHistory()
|
const history = useHistory()
|
||||||
const { getString } = useStrings()
|
const { getString } = useStrings()
|
||||||
const [searchTerm, setSearchTerm] = useState<string | undefined>()
|
const pageBrowser = useQueryParams<PageBrowserProps>()
|
||||||
|
const pageInit = pageBrowser.page ? parseInt(pageBrowser.page) : 1
|
||||||
|
const [page, setPage] = usePageIndex(pageInit)
|
||||||
|
|
||||||
|
const {
|
||||||
|
data: executions,
|
||||||
|
error,
|
||||||
|
loading,
|
||||||
|
refetch,
|
||||||
|
response
|
||||||
|
} = useGet<TypesExecution[]>({
|
||||||
|
path: `/api/v1/pipelines/${space}/${pipeline}/+/executions`,
|
||||||
|
queryParams: { page, limit: LIST_FETCHING_LIMIT }
|
||||||
|
})
|
||||||
|
|
||||||
const NewExecutionButton = (
|
const NewExecutionButton = (
|
||||||
<Button
|
<Button
|
||||||
@ -85,21 +58,19 @@ const ExecutionList = () => {
|
|||||||
icon="plus"></Button>
|
icon="plus"></Button>
|
||||||
)
|
)
|
||||||
|
|
||||||
const columns: Column<Execution>[] = useMemo(
|
const columns: Column<TypesExecution>[] = useMemo(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
Header: getString('repos.name'),
|
Header: getString('repos.name'),
|
||||||
width: 'calc(100% - 180px)',
|
width: 'calc(100% - 180px)',
|
||||||
Cell: ({ row }: CellProps<Execution>) => {
|
Cell: ({ row }: CellProps<TypesExecution>) => {
|
||||||
const record = row.original
|
const record = row.original
|
||||||
return (
|
return (
|
||||||
<Container className={css.nameContainer}>
|
<Container className={css.nameContainer}>
|
||||||
<Layout.Horizontal spacing="small" style={{ flexGrow: 1 }}>
|
<Layout.Horizontal spacing="small" style={{ flexGrow: 1 }}>
|
||||||
<Layout.Vertical flex className={css.name}>
|
<Layout.Vertical flex className={css.name}>
|
||||||
<Text className={css.repoName}>
|
<Text className={css.repoName}>{record.number}</Text>
|
||||||
<Keywords value={searchTerm}>{record.uid}</Keywords>
|
{record.status && <Text className={css.desc}>{record.status}</Text>}
|
||||||
</Text>
|
|
||||||
{record.description && <Text className={css.desc}>{record.description}</Text>}
|
|
||||||
</Layout.Vertical>
|
</Layout.Vertical>
|
||||||
</Layout.Horizontal>
|
</Layout.Horizontal>
|
||||||
</Container>
|
</Container>
|
||||||
@ -109,63 +80,64 @@ const ExecutionList = () => {
|
|||||||
{
|
{
|
||||||
Header: getString('repos.updated'),
|
Header: getString('repos.updated'),
|
||||||
width: '180px',
|
width: '180px',
|
||||||
Cell: ({ row }: CellProps<Execution>) => {
|
Cell: ({ row }: CellProps<TypesExecution>) => {
|
||||||
return (
|
return (
|
||||||
<Layout.Horizontal style={{ alignItems: 'center' }}>
|
<Layout.Horizontal style={{ alignItems: 'center' }}>
|
||||||
<Text color={Color.BLACK} lineClamp={1} rightIconProps={{ size: 10 }} width={120}>
|
<Text color={Color.BLACK} lineClamp={1} rightIconProps={{ size: 10 }} width={120}>
|
||||||
{formatDate(row.original.updated as number)}
|
{formatDate(row.original.updated as number)}
|
||||||
</Text>
|
</Text>
|
||||||
{row.original.isPublic === false ? <Icon name="lock" size={10} /> : undefined}
|
|
||||||
</Layout.Horizontal>
|
</Layout.Horizontal>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
disableSortBy: true
|
disableSortBy: true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[getString, searchTerm]
|
[getString]
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container className={css.main}>
|
<Container className={css.main}>
|
||||||
<PageHeader title={getString('pageTitle.executions')} />
|
<PageHeader title={getString('pageTitle.executions')} />
|
||||||
<PageBody
|
<PageBody
|
||||||
|
className={cx({ [css.withError]: !!error })}
|
||||||
|
error={error ? getErrorMessage(error) : null}
|
||||||
|
retryOnError={voidFn(refetch)}
|
||||||
noData={{
|
noData={{
|
||||||
when: () => executions.length === 0,
|
when: () => executions?.length === 0,
|
||||||
image: noExecutionImage,
|
image: noExecutionImage,
|
||||||
message: getString('executions.noData'),
|
message: getString('executions.noData'),
|
||||||
button: NewExecutionButton
|
button: NewExecutionButton
|
||||||
}}>
|
}}>
|
||||||
<LoadingSpinner visible={loading && !searchTerm} />
|
<LoadingSpinner visible={loading} />
|
||||||
|
|
||||||
<Container padding="xlarge">
|
<Container padding="xlarge">
|
||||||
<Layout.Horizontal spacing="large" className={css.layout}>
|
<Layout.Horizontal spacing="large" className={css.layout}>
|
||||||
{NewExecutionButton}
|
{NewExecutionButton}
|
||||||
<FlexExpander />
|
<FlexExpander />
|
||||||
<SearchInputWithSpinner loading={loading} query={searchTerm} setQuery={setSearchTerm} />
|
|
||||||
</Layout.Horizontal>
|
</Layout.Horizontal>
|
||||||
|
|
||||||
<Container margin={{ top: 'medium' }}>
|
<Container margin={{ top: 'medium' }}>
|
||||||
{!!executions?.length && (
|
{!!executions?.length && (
|
||||||
<Table<Execution>
|
<Table<TypesExecution>
|
||||||
className={css.table}
|
className={css.table}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
data={executions || []}
|
data={executions || []}
|
||||||
onRowClick={executionInfo =>
|
onRowClick={executionInfo =>
|
||||||
history.push(
|
history.push(
|
||||||
routes.toCODEExecution({
|
routes.toCODEExecution({
|
||||||
space: executionInfo.spaceUid,
|
space,
|
||||||
pipeline: executionInfo.pipelineUid,
|
pipeline: pipeline as string,
|
||||||
execution: executionInfo.uid
|
execution: String(executionInfo.id)
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
getRowClassName={row => cx(css.row, !row.original.description && css.noDesc)}
|
getRowClassName={row => cx(css.row, !row.original.number && css.noDesc)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<NoResultCard showWhen={() => !!executions.length && !!searchTerm?.length} forSearch={true} />
|
<NoResultCard showWhen={() => !!executions && executions.length === 0} forSearch={true} />
|
||||||
</Container>
|
</Container>
|
||||||
{/* <ResourceListingPagination response={response} page={page} setPage={setPage} /> */}
|
<ResourceListingPagination response={response} page={page} setPage={setPage} />
|
||||||
</Container>
|
</Container>
|
||||||
</PageBody>
|
</PageBody>
|
||||||
</Container>
|
</Container>
|
||||||
|
@ -7,6 +7,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.withError {
|
||||||
|
display: grid;
|
||||||
|
}
|
||||||
|
|
||||||
.table {
|
.table {
|
||||||
[class*='TableV2--header'] [class*='variation-table-headers'] {
|
[class*='TableV2--header'] [class*='variation-table-headers'] {
|
||||||
text-transform: none;
|
text-transform: none;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
declare const styles: {
|
declare const styles: {
|
||||||
readonly main: string
|
readonly main: string
|
||||||
readonly layout: string
|
readonly layout: string
|
||||||
|
readonly withError: string
|
||||||
readonly table: string
|
readonly table: string
|
||||||
readonly row: string
|
readonly row: string
|
||||||
readonly noDesc: string
|
readonly noDesc: string
|
||||||
|
@ -5,7 +5,6 @@ import {
|
|||||||
Color,
|
Color,
|
||||||
Container,
|
Container,
|
||||||
FlexExpander,
|
FlexExpander,
|
||||||
Icon,
|
|
||||||
Layout,
|
Layout,
|
||||||
PageBody,
|
PageBody,
|
||||||
PageHeader,
|
PageHeader,
|
||||||
@ -16,62 +15,41 @@ import cx from 'classnames'
|
|||||||
import type { CellProps, Column } from 'react-table'
|
import type { CellProps, Column } from 'react-table'
|
||||||
import Keywords from 'react-keywords'
|
import Keywords from 'react-keywords'
|
||||||
import { useHistory } from 'react-router-dom'
|
import { useHistory } from 'react-router-dom'
|
||||||
|
import { useGet } from 'restful-react'
|
||||||
import { useStrings } from 'framework/strings'
|
import { useStrings } from 'framework/strings'
|
||||||
import { LoadingSpinner } from 'components/LoadingSpinner/LoadingSpinner'
|
import { LoadingSpinner } from 'components/LoadingSpinner/LoadingSpinner'
|
||||||
import { useAppContext } from 'AppContext'
|
|
||||||
import { SearchInputWithSpinner } from 'components/SearchInputWithSpinner/SearchInputWithSpinner'
|
import { SearchInputWithSpinner } from 'components/SearchInputWithSpinner/SearchInputWithSpinner'
|
||||||
import { NoResultCard } from 'components/NoResultCard/NoResultCard'
|
import { NoResultCard } from 'components/NoResultCard/NoResultCard'
|
||||||
import { formatDate } from 'utils/Utils'
|
import { LIST_FETCHING_LIMIT, PageBrowserProps, formatDate, getErrorMessage, voidFn } from 'utils/Utils'
|
||||||
|
import { useGetSpaceParam } from 'hooks/useGetSpaceParam'
|
||||||
|
import type { TypesPipeline } from 'services/code'
|
||||||
|
import { useQueryParams } from 'hooks/useQueryParams'
|
||||||
|
import { usePageIndex } from 'hooks/usePageIndex'
|
||||||
|
import { ResourceListingPagination } from 'components/ResourceListingPagination/ResourceListingPagination'
|
||||||
|
import { useAppContext } from 'AppContext'
|
||||||
import noPipelineImage from '../RepositoriesListing/no-repo.svg'
|
import noPipelineImage from '../RepositoriesListing/no-repo.svg'
|
||||||
import css from './PipelineList.module.scss'
|
import css from './PipelineList.module.scss'
|
||||||
|
|
||||||
interface Pipeline {
|
|
||||||
id: number
|
|
||||||
uid: string
|
|
||||||
name: string
|
|
||||||
updated: number
|
|
||||||
description?: string
|
|
||||||
isPublic?: boolean
|
|
||||||
spaceUid: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const pipelines: Pipeline[] = [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
uid: 'pipeline-1',
|
|
||||||
name: 'Pipeline 1',
|
|
||||||
updated: 1687234800,
|
|
||||||
description: 'This is a description',
|
|
||||||
isPublic: true,
|
|
||||||
spaceUid: 'root'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
uid: 'pipeline-2',
|
|
||||||
name: 'Pipeline 2',
|
|
||||||
updated: 1730275200,
|
|
||||||
description: 'This is a description',
|
|
||||||
isPublic: true,
|
|
||||||
spaceUid: 'root'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
uid: 'pipeline-3',
|
|
||||||
name: 'Pipeline 3',
|
|
||||||
updated: 1773315600,
|
|
||||||
description: 'This is a description',
|
|
||||||
isPublic: false,
|
|
||||||
spaceUid: 'root'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
const loading = false
|
|
||||||
|
|
||||||
const PipelineList = () => {
|
const PipelineList = () => {
|
||||||
const { routes } = useAppContext()
|
const { routes } = useAppContext()
|
||||||
|
const space = useGetSpaceParam()
|
||||||
const history = useHistory()
|
const history = useHistory()
|
||||||
const { getString } = useStrings()
|
const { getString } = useStrings()
|
||||||
const [searchTerm, setSearchTerm] = useState<string | undefined>()
|
const [searchTerm, setSearchTerm] = useState<string | undefined>()
|
||||||
|
const pageBrowser = useQueryParams<PageBrowserProps>()
|
||||||
|
const pageInit = pageBrowser.page ? parseInt(pageBrowser.page) : 1
|
||||||
|
const [page, setPage] = usePageIndex(pageInit)
|
||||||
|
|
||||||
|
const {
|
||||||
|
data: pipelines,
|
||||||
|
error,
|
||||||
|
loading,
|
||||||
|
refetch,
|
||||||
|
response
|
||||||
|
} = useGet<TypesPipeline[]>({
|
||||||
|
path: `/api/v1/spaces/${space}/pipelines`,
|
||||||
|
queryParams: { page, limit: LIST_FETCHING_LIMIT, query: searchTerm }
|
||||||
|
})
|
||||||
|
|
||||||
const NewPipelineButton = (
|
const NewPipelineButton = (
|
||||||
<Button
|
<Button
|
||||||
@ -81,12 +59,12 @@ const PipelineList = () => {
|
|||||||
icon="plus"></Button>
|
icon="plus"></Button>
|
||||||
)
|
)
|
||||||
|
|
||||||
const columns: Column<Pipeline>[] = useMemo(
|
const columns: Column<TypesPipeline>[] = useMemo(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
Header: getString('pipelines.name'),
|
Header: getString('pipelines.name'),
|
||||||
width: 'calc(100% - 180px)',
|
width: 'calc(100% - 180px)',
|
||||||
Cell: ({ row }: CellProps<Pipeline>) => {
|
Cell: ({ row }: CellProps<TypesPipeline>) => {
|
||||||
const record = row.original
|
const record = row.original
|
||||||
return (
|
return (
|
||||||
<Container className={css.nameContainer}>
|
<Container className={css.nameContainer}>
|
||||||
@ -105,13 +83,12 @@ const PipelineList = () => {
|
|||||||
{
|
{
|
||||||
Header: getString('repos.updated'),
|
Header: getString('repos.updated'),
|
||||||
width: '180px',
|
width: '180px',
|
||||||
Cell: ({ row }: CellProps<Pipeline>) => {
|
Cell: ({ row }: CellProps<TypesPipeline>) => {
|
||||||
return (
|
return (
|
||||||
<Layout.Horizontal style={{ alignItems: 'center' }}>
|
<Layout.Horizontal style={{ alignItems: 'center' }}>
|
||||||
<Text color={Color.BLACK} lineClamp={1} rightIconProps={{ size: 10 }} width={120}>
|
<Text color={Color.BLACK} lineClamp={1} rightIconProps={{ size: 10 }} width={120}>
|
||||||
{formatDate(row.original.updated as number)}
|
{formatDate(row.original.updated as number)}
|
||||||
</Text>
|
</Text>
|
||||||
{row.original.isPublic === false ? <Icon name="lock" size={10} /> : undefined}
|
|
||||||
</Layout.Horizontal>
|
</Layout.Horizontal>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@ -125,8 +102,11 @@ const PipelineList = () => {
|
|||||||
<Container className={css.main}>
|
<Container className={css.main}>
|
||||||
<PageHeader title={getString('pageTitle.pipelines')} />
|
<PageHeader title={getString('pageTitle.pipelines')} />
|
||||||
<PageBody
|
<PageBody
|
||||||
|
className={cx({ [css.withError]: !!error })}
|
||||||
|
error={error ? getErrorMessage(error) : null}
|
||||||
|
retryOnError={voidFn(refetch)}
|
||||||
noData={{
|
noData={{
|
||||||
when: () => pipelines.length === 0,
|
when: () => pipelines?.length === 0 && searchTerm === undefined,
|
||||||
image: noPipelineImage,
|
image: noPipelineImage,
|
||||||
message: getString('pipelines.noData'),
|
message: getString('pipelines.noData'),
|
||||||
button: NewPipelineButton
|
button: NewPipelineButton
|
||||||
@ -142,20 +122,23 @@ const PipelineList = () => {
|
|||||||
|
|
||||||
<Container margin={{ top: 'medium' }}>
|
<Container margin={{ top: 'medium' }}>
|
||||||
{!!pipelines?.length && (
|
{!!pipelines?.length && (
|
||||||
<Table<Pipeline>
|
<Table<TypesPipeline>
|
||||||
className={css.table}
|
className={css.table}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
data={pipelines || []}
|
data={pipelines || []}
|
||||||
onRowClick={pipelineInfo =>
|
onRowClick={pipelineInfo =>
|
||||||
history.push(routes.toCODEExecutions({ space: pipelineInfo.spaceUid, pipeline: pipelineInfo.uid }))
|
history.push(routes.toCODEExecutions({ space, pipeline: pipelineInfo.uid as string }))
|
||||||
}
|
}
|
||||||
getRowClassName={row => cx(css.row, !row.original.description && css.noDesc)}
|
getRowClassName={row => cx(css.row, !row.original.description && css.noDesc)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<NoResultCard showWhen={() => !!pipelines.length && !!searchTerm?.length} forSearch={true} />
|
<NoResultCard
|
||||||
|
showWhen={() => !!pipelines && pipelines?.length === 0 && !!searchTerm?.length}
|
||||||
|
forSearch={true}
|
||||||
|
/>
|
||||||
</Container>
|
</Container>
|
||||||
{/* <ResourceListingPagination response={response} page={page} setPage={setPage} /> */}
|
<ResourceListingPagination response={response} page={page} setPage={setPage} />
|
||||||
</Container>
|
</Container>
|
||||||
</PageBody>
|
</PageBody>
|
||||||
</Container>
|
</Container>
|
||||||
|
4
web/src/pages/Secret/Secret.module.scss
Normal file
4
web/src/pages/Secret/Secret.module.scss
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.main {
|
||||||
|
min-height: var(--page-min-height, 100%);
|
||||||
|
background-color: var(--primary-bg) !important;
|
||||||
|
}
|
6
web/src/pages/Secret/Secret.module.scss.d.ts
vendored
Normal file
6
web/src/pages/Secret/Secret.module.scss.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
// this is an auto-generated file
|
||||||
|
declare const styles: {
|
||||||
|
readonly main: string
|
||||||
|
}
|
||||||
|
export default styles
|
31
web/src/pages/Secret/Secret.tsx
Normal file
31
web/src/pages/Secret/Secret.tsx
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import { Container, PageHeader } from '@harness/uicore'
|
||||||
|
import { useParams } from 'react-router-dom'
|
||||||
|
import { useGet } from 'restful-react'
|
||||||
|
import type { CODEProps } from 'RouteDefinitions'
|
||||||
|
import { useGetSpaceParam } from 'hooks/useGetSpaceParam'
|
||||||
|
import type { TypesSecret } from 'services/code'
|
||||||
|
import css from './Secret.module.scss'
|
||||||
|
|
||||||
|
const Execution = () => {
|
||||||
|
const space = useGetSpaceParam()
|
||||||
|
const { secret: secretName } = useParams<CODEProps>()
|
||||||
|
|
||||||
|
const {
|
||||||
|
data: secret
|
||||||
|
// error,
|
||||||
|
// loading,
|
||||||
|
// refetch
|
||||||
|
// response
|
||||||
|
} = useGet<TypesSecret>({
|
||||||
|
path: `/api/v1/secrets/${space}/${secretName}/+`
|
||||||
|
})
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container className={css.main}>
|
||||||
|
<PageHeader title={`THIS IS A SECRET = ${secret?.uid}`} />
|
||||||
|
</Container>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Execution
|
@ -1,4 +1,86 @@
|
|||||||
.main {
|
.main {
|
||||||
min-height: var(--page-height);
|
min-height: var(--page-height);
|
||||||
background-color: var(--primary-bg) !important;
|
background-color: var(--primary-bg) !important;
|
||||||
|
|
||||||
|
.layout {
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.withError {
|
||||||
|
display: grid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
[class*='TableV2--header'] [class*='variation-table-headers'] {
|
||||||
|
text-transform: none;
|
||||||
|
color: var(--grey-400);
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row {
|
||||||
|
height: 80px;
|
||||||
|
box-shadow: 0px 0px 1px rgba(40, 41, 61, 0.08), 0px 0.5px 2px rgba(96, 97, 112, 0.16);
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
&.noDesc > div {
|
||||||
|
height: 44px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.nameContainer {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.name {
|
||||||
|
flex-grow: 1;
|
||||||
|
align-items: baseline !important;
|
||||||
|
width: calc(100% - 100px) !important;
|
||||||
|
|
||||||
|
> span {
|
||||||
|
width: 100%;
|
||||||
|
> span {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
& + span:last-of-type {
|
||||||
|
align-self: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.pinned {
|
||||||
|
transform: rotate(-90deg);
|
||||||
|
position: absolute;
|
||||||
|
top: 7px;
|
||||||
|
left: -43px;
|
||||||
|
font-size: var(--font-size-xsmall) !important;
|
||||||
|
padding: 6px 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.repoName {
|
||||||
|
font-weight: 600 !important;
|
||||||
|
font-size: 16px !important;
|
||||||
|
line-height: 24px !important;
|
||||||
|
color: var(--grey-800);
|
||||||
|
|
||||||
|
.repoScope {
|
||||||
|
color: var(--grey-400);
|
||||||
|
padding: 2px 6px;
|
||||||
|
font-size: var(--font-size-xsmall) !important;
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid var(--grey-200);
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: var(--spacing-medium);
|
||||||
|
text-transform: uppercase;
|
||||||
|
line-height: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.desc {
|
||||||
|
color: var(--grey-500);
|
||||||
|
font-size: var(--font-size-small);
|
||||||
|
padding-top: var(--spacing-xsmall) !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,5 +2,16 @@
|
|||||||
// this is an auto-generated file
|
// this is an auto-generated file
|
||||||
declare const styles: {
|
declare const styles: {
|
||||||
readonly main: string
|
readonly main: string
|
||||||
|
readonly layout: string
|
||||||
|
readonly withError: string
|
||||||
|
readonly table: string
|
||||||
|
readonly row: string
|
||||||
|
readonly noDesc: string
|
||||||
|
readonly nameContainer: string
|
||||||
|
readonly name: string
|
||||||
|
readonly pinned: string
|
||||||
|
readonly repoName: string
|
||||||
|
readonly repoScope: string
|
||||||
|
readonly desc: string
|
||||||
}
|
}
|
||||||
export default styles
|
export default styles
|
||||||
|
@ -1,16 +1,151 @@
|
|||||||
import React from 'react'
|
import React, { useMemo, useState } from 'react'
|
||||||
import { Container, PageHeader } from '@harness/uicore'
|
import {
|
||||||
|
ButtonVariation,
|
||||||
|
Color,
|
||||||
|
Container,
|
||||||
|
FlexExpander,
|
||||||
|
Layout,
|
||||||
|
PageBody,
|
||||||
|
PageHeader,
|
||||||
|
TableV2 as Table,
|
||||||
|
Text
|
||||||
|
} from '@harness/uicore'
|
||||||
|
import cx from 'classnames'
|
||||||
|
import type { CellProps, Column } from 'react-table'
|
||||||
|
import Keywords from 'react-keywords'
|
||||||
|
import { useHistory } from 'react-router-dom'
|
||||||
|
import { useGet } from 'restful-react'
|
||||||
import { useStrings } from 'framework/strings'
|
import { useStrings } from 'framework/strings'
|
||||||
|
import { LoadingSpinner } from 'components/LoadingSpinner/LoadingSpinner'
|
||||||
|
import { SearchInputWithSpinner } from 'components/SearchInputWithSpinner/SearchInputWithSpinner'
|
||||||
|
import { NoResultCard } from 'components/NoResultCard/NoResultCard'
|
||||||
|
import { LIST_FETCHING_LIMIT, PageBrowserProps, formatDate, getErrorMessage, voidFn } from 'utils/Utils'
|
||||||
|
import type { TypesSecret } from 'services/code'
|
||||||
|
import { usePageIndex } from 'hooks/usePageIndex'
|
||||||
|
import { useQueryParams } from 'hooks/useQueryParams'
|
||||||
|
import { useGetSpaceParam } from 'hooks/useGetSpaceParam'
|
||||||
|
import { ResourceListingPagination } from 'components/ResourceListingPagination/ResourceListingPagination'
|
||||||
|
import { NewSecretModalButton } from 'components/NewSecretModalButton/NewSecretModalButton'
|
||||||
|
import { useAppContext } from 'AppContext'
|
||||||
|
import noSecretsImage from '../RepositoriesListing/no-repo.svg'
|
||||||
import css from './SecretList.module.scss'
|
import css from './SecretList.module.scss'
|
||||||
|
|
||||||
const PipelineList = () => {
|
const SecretList = () => {
|
||||||
|
const { routes } = useAppContext()
|
||||||
|
const space = useGetSpaceParam()
|
||||||
|
const history = useHistory()
|
||||||
const { getString } = useStrings()
|
const { getString } = useStrings()
|
||||||
|
const [searchTerm, setSearchTerm] = useState<string | undefined>()
|
||||||
|
const pageBrowser = useQueryParams<PageBrowserProps>()
|
||||||
|
const pageInit = pageBrowser.page ? parseInt(pageBrowser.page) : 1
|
||||||
|
const [page, setPage] = usePageIndex(pageInit)
|
||||||
|
|
||||||
|
const {
|
||||||
|
data: secrets,
|
||||||
|
error,
|
||||||
|
loading,
|
||||||
|
refetch,
|
||||||
|
response
|
||||||
|
} = useGet<TypesSecret[]>({
|
||||||
|
path: `/api/v1/spaces/${space}/secrets`,
|
||||||
|
queryParams: { page, limit: LIST_FETCHING_LIMIT, query: searchTerm }
|
||||||
|
})
|
||||||
|
|
||||||
|
const NewSecretButton = (
|
||||||
|
<NewSecretModalButton
|
||||||
|
space={space}
|
||||||
|
modalTitle={getString('secrets.newSecretButton')}
|
||||||
|
text={getString('secrets.newSecretButton')}
|
||||||
|
variation={ButtonVariation.PRIMARY}
|
||||||
|
icon="plus"
|
||||||
|
onSubmit={secretInfo =>
|
||||||
|
history.push(routes.toCODESecret({ space, secret: secretInfo.uid as string }))
|
||||||
|
}></NewSecretModalButton>
|
||||||
|
)
|
||||||
|
|
||||||
|
const columns: Column<TypesSecret>[] = useMemo(
|
||||||
|
() => [
|
||||||
|
{
|
||||||
|
Header: getString('secrets.name'),
|
||||||
|
width: 'calc(100% - 180px)',
|
||||||
|
Cell: ({ row }: CellProps<TypesSecret>) => {
|
||||||
|
const record = row.original
|
||||||
|
return (
|
||||||
|
<Container className={css.nameContainer}>
|
||||||
|
<Layout.Horizontal spacing="small" style={{ flexGrow: 1 }}>
|
||||||
|
<Layout.Vertical flex className={css.name}>
|
||||||
|
<Text className={css.repoName}>
|
||||||
|
<Keywords value={searchTerm}>{record.uid}</Keywords>
|
||||||
|
</Text>
|
||||||
|
{record.description && <Text className={css.desc}>{record.description}</Text>}
|
||||||
|
</Layout.Vertical>
|
||||||
|
</Layout.Horizontal>
|
||||||
|
</Container>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Header: getString('repos.updated'),
|
||||||
|
width: '180px',
|
||||||
|
Cell: ({ row }: CellProps<TypesSecret>) => {
|
||||||
|
return (
|
||||||
|
<Layout.Horizontal style={{ alignItems: 'center' }}>
|
||||||
|
<Text color={Color.BLACK} lineClamp={1} rightIconProps={{ size: 10 }} width={120}>
|
||||||
|
{formatDate(row.original.updated as number)}
|
||||||
|
</Text>
|
||||||
|
</Layout.Horizontal>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
disableSortBy: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[getString, searchTerm]
|
||||||
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container className={css.main}>
|
<Container className={css.main}>
|
||||||
<PageHeader title={getString('pageTitle.secrets')} />
|
<PageHeader title={getString('pageTitle.secrets')} />
|
||||||
|
<PageBody
|
||||||
|
className={cx({ [css.withError]: !!error })}
|
||||||
|
error={error ? getErrorMessage(error) : null}
|
||||||
|
retryOnError={voidFn(refetch)}
|
||||||
|
noData={{
|
||||||
|
when: () => secrets?.length === 0 && searchTerm === undefined,
|
||||||
|
image: noSecretsImage,
|
||||||
|
message: getString('secrets.noData'),
|
||||||
|
button: NewSecretButton
|
||||||
|
}}>
|
||||||
|
<LoadingSpinner visible={loading && !searchTerm} />
|
||||||
|
|
||||||
|
<Container padding="xlarge">
|
||||||
|
<Layout.Horizontal spacing="large" className={css.layout}>
|
||||||
|
{NewSecretButton}
|
||||||
|
<FlexExpander />
|
||||||
|
<SearchInputWithSpinner loading={loading} query={searchTerm} setQuery={setSearchTerm} />
|
||||||
|
</Layout.Horizontal>
|
||||||
|
|
||||||
|
<Container margin={{ top: 'medium' }}>
|
||||||
|
{!!secrets?.length && (
|
||||||
|
<Table<TypesSecret>
|
||||||
|
className={css.table}
|
||||||
|
columns={columns}
|
||||||
|
data={secrets || []}
|
||||||
|
onRowClick={secretInfo =>
|
||||||
|
history.push(routes.toCODESecret({ space: 'root', secret: secretInfo.uid as string }))
|
||||||
|
}
|
||||||
|
getRowClassName={row => cx(css.row, !row.original.description && css.noDesc)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<NoResultCard
|
||||||
|
showWhen={() => !!secrets && secrets?.length === 0 && !!searchTerm?.length}
|
||||||
|
forSearch={true}
|
||||||
|
/>
|
||||||
|
</Container>
|
||||||
|
<ResourceListingPagination response={response} page={page} setPage={setPage} />
|
||||||
|
</Container>
|
||||||
|
</PageBody>
|
||||||
</Container>
|
</Container>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default PipelineList
|
export default SecretList
|
||||||
|
@ -45,6 +45,8 @@ export type EnumPullReqReviewerType = 'assigned' | 'requested' | 'self_assigned'
|
|||||||
|
|
||||||
export type EnumPullReqState = 'closed' | 'merged' | 'open'
|
export type EnumPullReqState = 'closed' | 'merged' | 'open'
|
||||||
|
|
||||||
|
export type EnumScmType = 'GITNESS' | 'GITHUB' | 'GITLAB' | 'UNKNOWN'
|
||||||
|
|
||||||
export type EnumTokenType = string
|
export type EnumTokenType = string
|
||||||
|
|
||||||
export type EnumWebhookExecutionResult = 'fatal_error' | 'retriable_error' | 'success' | null
|
export type EnumWebhookExecutionResult = 'fatal_error' | 'retriable_error' | 'success' | null
|
||||||
@ -67,13 +69,13 @@ export interface GitrpcBlamePart {
|
|||||||
lines?: string[] | null
|
lines?: string[] | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export type GitrpcCommit = {
|
export interface GitrpcCommit {
|
||||||
author?: GitrpcSignature
|
author?: GitrpcSignature
|
||||||
committer?: GitrpcSignature
|
committer?: GitrpcSignature
|
||||||
message?: string
|
message?: string
|
||||||
sha?: string
|
sha?: string
|
||||||
title?: string
|
title?: string
|
||||||
} | null
|
}
|
||||||
|
|
||||||
export type GitrpcFileAction = 'CREATE' | 'UPDATE' | 'DELETE' | 'MOVE'
|
export type GitrpcFileAction = 'CREATE' | 'UPDATE' | 'DELETE' | 'MOVE'
|
||||||
|
|
||||||
@ -82,6 +84,12 @@ export interface GitrpcIdentity {
|
|||||||
name?: string
|
name?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface GitrpcPathDetails {
|
||||||
|
last_commit?: GitrpcCommit
|
||||||
|
path?: string
|
||||||
|
size?: number
|
||||||
|
}
|
||||||
|
|
||||||
export interface GitrpcSignature {
|
export interface GitrpcSignature {
|
||||||
identity?: GitrpcIdentity
|
identity?: GitrpcIdentity
|
||||||
when?: string
|
when?: string
|
||||||
@ -150,10 +158,24 @@ export interface OpenapiCreateBranchRequest {
|
|||||||
target?: string
|
target?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface OpenapiCreateExecutionRequest {
|
||||||
|
status?: string
|
||||||
|
}
|
||||||
|
|
||||||
export interface OpenapiCreatePathRequest {
|
export interface OpenapiCreatePathRequest {
|
||||||
path?: string
|
path?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface OpenapiCreatePipelineRequest {
|
||||||
|
config_path?: string
|
||||||
|
default_branch?: string
|
||||||
|
description?: string
|
||||||
|
repo_ref?: string
|
||||||
|
repo_type?: EnumScmType
|
||||||
|
space_ref?: string
|
||||||
|
uid?: string
|
||||||
|
}
|
||||||
|
|
||||||
export interface OpenapiCreatePullReqRequest {
|
export interface OpenapiCreatePullReqRequest {
|
||||||
description?: string
|
description?: string
|
||||||
is_draft?: boolean
|
is_draft?: boolean
|
||||||
@ -179,6 +201,13 @@ export interface OpenapiCreateRepositoryRequest {
|
|||||||
uid?: string
|
uid?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface OpenapiCreateSecretRequest {
|
||||||
|
data?: string
|
||||||
|
description?: string
|
||||||
|
space_ref?: string
|
||||||
|
uid?: string
|
||||||
|
}
|
||||||
|
|
||||||
export interface OpenapiCreateSpaceRequest {
|
export interface OpenapiCreateSpaceRequest {
|
||||||
description?: string
|
description?: string
|
||||||
is_public?: boolean
|
is_public?: boolean
|
||||||
@ -243,6 +272,10 @@ export interface OpenapiMoveSpaceRequest {
|
|||||||
uid?: string | null
|
uid?: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface OpenapiPathsDetailsRequest {
|
||||||
|
paths?: string[] | null
|
||||||
|
}
|
||||||
|
|
||||||
export interface OpenapiRegisterRequest {
|
export interface OpenapiRegisterRequest {
|
||||||
display_name?: string
|
display_name?: string
|
||||||
email?: string
|
email?: string
|
||||||
@ -270,6 +303,16 @@ export interface OpenapiUpdateAdminRequest {
|
|||||||
admin?: boolean
|
admin?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface OpenapiUpdateExecutionRequest {
|
||||||
|
status?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OpenapiUpdatePipelineRequest {
|
||||||
|
config_path?: string
|
||||||
|
description?: string
|
||||||
|
uid?: string
|
||||||
|
}
|
||||||
|
|
||||||
export interface OpenapiUpdatePullReqRequest {
|
export interface OpenapiUpdatePullReqRequest {
|
||||||
description?: string
|
description?: string
|
||||||
title?: string
|
title?: string
|
||||||
@ -280,6 +323,12 @@ export interface OpenapiUpdateRepoRequest {
|
|||||||
is_public?: boolean | null
|
is_public?: boolean | null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface OpenapiUpdateSecretRequest {
|
||||||
|
data?: string
|
||||||
|
description?: string
|
||||||
|
uid?: string
|
||||||
|
}
|
||||||
|
|
||||||
export interface OpenapiUpdateSpaceRequest {
|
export interface OpenapiUpdateSpaceRequest {
|
||||||
description?: string | null
|
description?: string | null
|
||||||
is_public?: boolean | null
|
is_public?: boolean | null
|
||||||
@ -376,6 +425,10 @@ export interface RepoMergeCheck {
|
|||||||
mergeable?: boolean
|
mergeable?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface RepoPathsDetailsOutput {
|
||||||
|
details?: GitrpcPathDetails[] | null
|
||||||
|
}
|
||||||
|
|
||||||
export interface RepoSubmoduleContent {
|
export interface RepoSubmoduleContent {
|
||||||
commit_sha?: string
|
commit_sha?: string
|
||||||
url?: string
|
url?: string
|
||||||
@ -431,6 +484,44 @@ export interface TypesDiffStats {
|
|||||||
files_changed?: number
|
files_changed?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface TypesExecution {
|
||||||
|
action?: string
|
||||||
|
after?: string
|
||||||
|
author_avatar?: string
|
||||||
|
author_email?: string
|
||||||
|
author_login?: string
|
||||||
|
author_name?: string
|
||||||
|
before?: string
|
||||||
|
created?: number
|
||||||
|
cron?: string
|
||||||
|
debug?: boolean
|
||||||
|
deploy_id?: number
|
||||||
|
deploy_to?: string
|
||||||
|
error?: string
|
||||||
|
event?: string
|
||||||
|
finished?: number
|
||||||
|
id?: number
|
||||||
|
link?: string
|
||||||
|
message?: string
|
||||||
|
number?: number
|
||||||
|
params?: string
|
||||||
|
parent?: number
|
||||||
|
pipeline_id?: number
|
||||||
|
ref?: string
|
||||||
|
repo_id?: number
|
||||||
|
sender?: string
|
||||||
|
source?: string
|
||||||
|
source_repo?: string
|
||||||
|
started?: number
|
||||||
|
status?: string
|
||||||
|
target?: string
|
||||||
|
timestamp?: number
|
||||||
|
title?: string
|
||||||
|
trigger?: string
|
||||||
|
updated?: number
|
||||||
|
version?: number
|
||||||
|
}
|
||||||
|
|
||||||
export interface TypesIdentity {
|
export interface TypesIdentity {
|
||||||
email?: string
|
email?: string
|
||||||
name?: string
|
name?: string
|
||||||
@ -473,6 +564,22 @@ export interface TypesPath {
|
|||||||
value?: string
|
value?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface TypesPipeline {
|
||||||
|
config_path?: string
|
||||||
|
created?: number
|
||||||
|
default_branch?: string
|
||||||
|
description?: string
|
||||||
|
id?: number
|
||||||
|
repo_id?: number
|
||||||
|
repo_name?: string
|
||||||
|
repo_type?: EnumScmType
|
||||||
|
seq?: number
|
||||||
|
space_id?: number
|
||||||
|
uid?: string
|
||||||
|
updated?: number
|
||||||
|
version?: number
|
||||||
|
}
|
||||||
|
|
||||||
export interface TypesPrincipalInfo {
|
export interface TypesPrincipalInfo {
|
||||||
created?: number
|
created?: number
|
||||||
display_name?: string
|
display_name?: string
|
||||||
@ -574,6 +681,16 @@ export interface TypesRepository {
|
|||||||
updated?: number
|
updated?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface TypesSecret {
|
||||||
|
created?: number
|
||||||
|
description?: string
|
||||||
|
id?: number
|
||||||
|
space_id?: number
|
||||||
|
uid?: string
|
||||||
|
updated?: number
|
||||||
|
version?: number
|
||||||
|
}
|
||||||
|
|
||||||
export interface TypesServiceAccount {
|
export interface TypesServiceAccount {
|
||||||
admin?: boolean
|
admin?: boolean
|
||||||
blocked?: boolean
|
blocked?: boolean
|
||||||
@ -859,6 +976,274 @@ export type UseOpLogoutProps = Omit<UseMutateProps<void, UsererrorError, void, v
|
|||||||
export const useOpLogout = (props: UseOpLogoutProps) =>
|
export const useOpLogout = (props: UseOpLogoutProps) =>
|
||||||
useMutate<void, UsererrorError, void, void, void>('POST', `/logout`, { base: getConfig('code'), ...props })
|
useMutate<void, UsererrorError, void, void, void>('POST', `/logout`, { base: getConfig('code'), ...props })
|
||||||
|
|
||||||
|
export type CreatePipelineProps = Omit<
|
||||||
|
MutateProps<TypesPipeline, UsererrorError, void, OpenapiCreatePipelineRequest, void>,
|
||||||
|
'path' | 'verb'
|
||||||
|
>
|
||||||
|
|
||||||
|
export const CreatePipeline = (props: CreatePipelineProps) => (
|
||||||
|
<Mutate<TypesPipeline, UsererrorError, void, OpenapiCreatePipelineRequest, void>
|
||||||
|
verb="POST"
|
||||||
|
path={`/pipelines`}
|
||||||
|
base={getConfig('code')}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
export type UseCreatePipelineProps = Omit<
|
||||||
|
UseMutateProps<TypesPipeline, UsererrorError, void, OpenapiCreatePipelineRequest, void>,
|
||||||
|
'path' | 'verb'
|
||||||
|
>
|
||||||
|
|
||||||
|
export const useCreatePipeline = (props: UseCreatePipelineProps) =>
|
||||||
|
useMutate<TypesPipeline, UsererrorError, void, OpenapiCreatePipelineRequest, void>('POST', `/pipelines`, {
|
||||||
|
base: getConfig('code'),
|
||||||
|
...props
|
||||||
|
})
|
||||||
|
|
||||||
|
export type DeletePipelineProps = Omit<MutateProps<void, UsererrorError, void, string, void>, 'path' | 'verb'>
|
||||||
|
|
||||||
|
export const DeletePipeline = (props: DeletePipelineProps) => (
|
||||||
|
<Mutate<void, UsererrorError, void, string, void>
|
||||||
|
verb="DELETE"
|
||||||
|
path={`/pipelines`}
|
||||||
|
base={getConfig('code')}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
export type UseDeletePipelineProps = Omit<UseMutateProps<void, UsererrorError, void, string, void>, 'path' | 'verb'>
|
||||||
|
|
||||||
|
export const useDeletePipeline = (props: UseDeletePipelineProps) =>
|
||||||
|
useMutate<void, UsererrorError, void, string, void>('DELETE', `/pipelines`, { base: getConfig('code'), ...props })
|
||||||
|
|
||||||
|
export interface FindPipelinePathParams {
|
||||||
|
pipeline_ref: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type FindPipelineProps = Omit<GetProps<TypesPipeline, UsererrorError, void, FindPipelinePathParams>, 'path'> &
|
||||||
|
FindPipelinePathParams
|
||||||
|
|
||||||
|
export const FindPipeline = ({ pipeline_ref, ...props }: FindPipelineProps) => (
|
||||||
|
<Get<TypesPipeline, UsererrorError, void, FindPipelinePathParams>
|
||||||
|
path={`/pipelines/${pipeline_ref}`}
|
||||||
|
base={getConfig('code')}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
export type UseFindPipelineProps = Omit<
|
||||||
|
UseGetProps<TypesPipeline, UsererrorError, void, FindPipelinePathParams>,
|
||||||
|
'path'
|
||||||
|
> &
|
||||||
|
FindPipelinePathParams
|
||||||
|
|
||||||
|
export const useFindPipeline = ({ pipeline_ref, ...props }: UseFindPipelineProps) =>
|
||||||
|
useGet<TypesPipeline, UsererrorError, void, FindPipelinePathParams>(
|
||||||
|
(paramsInPath: FindPipelinePathParams) => `/pipelines/${paramsInPath.pipeline_ref}`,
|
||||||
|
{ base: getConfig('code'), pathParams: { pipeline_ref }, ...props }
|
||||||
|
)
|
||||||
|
|
||||||
|
export interface UpdatePipelinePathParams {
|
||||||
|
pipeline_ref: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type UpdatePipelineProps = Omit<
|
||||||
|
MutateProps<TypesPipeline, UsererrorError, void, OpenapiUpdatePipelineRequest, UpdatePipelinePathParams>,
|
||||||
|
'path' | 'verb'
|
||||||
|
> &
|
||||||
|
UpdatePipelinePathParams
|
||||||
|
|
||||||
|
export const UpdatePipeline = ({ pipeline_ref, ...props }: UpdatePipelineProps) => (
|
||||||
|
<Mutate<TypesPipeline, UsererrorError, void, OpenapiUpdatePipelineRequest, UpdatePipelinePathParams>
|
||||||
|
verb="PATCH"
|
||||||
|
path={`/pipelines/${pipeline_ref}`}
|
||||||
|
base={getConfig('code')}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
export type UseUpdatePipelineProps = Omit<
|
||||||
|
UseMutateProps<TypesPipeline, UsererrorError, void, OpenapiUpdatePipelineRequest, UpdatePipelinePathParams>,
|
||||||
|
'path' | 'verb'
|
||||||
|
> &
|
||||||
|
UpdatePipelinePathParams
|
||||||
|
|
||||||
|
export const useUpdatePipeline = ({ pipeline_ref, ...props }: UseUpdatePipelineProps) =>
|
||||||
|
useMutate<TypesPipeline, UsererrorError, void, OpenapiUpdatePipelineRequest, UpdatePipelinePathParams>(
|
||||||
|
'PATCH',
|
||||||
|
(paramsInPath: UpdatePipelinePathParams) => `/pipelines/${paramsInPath.pipeline_ref}`,
|
||||||
|
{ base: getConfig('code'), pathParams: { pipeline_ref }, ...props }
|
||||||
|
)
|
||||||
|
|
||||||
|
export interface ListExecutionsQueryParams {
|
||||||
|
/**
|
||||||
|
* The page to return.
|
||||||
|
*/
|
||||||
|
page?: number
|
||||||
|
/**
|
||||||
|
* The maximum number of results to return.
|
||||||
|
*/
|
||||||
|
limit?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ListExecutionsPathParams {
|
||||||
|
pipeline_ref: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ListExecutionsProps = Omit<
|
||||||
|
GetProps<TypesExecution[], UsererrorError, ListExecutionsQueryParams, ListExecutionsPathParams>,
|
||||||
|
'path'
|
||||||
|
> &
|
||||||
|
ListExecutionsPathParams
|
||||||
|
|
||||||
|
export const ListExecutions = ({ pipeline_ref, ...props }: ListExecutionsProps) => (
|
||||||
|
<Get<TypesExecution[], UsererrorError, ListExecutionsQueryParams, ListExecutionsPathParams>
|
||||||
|
path={`/pipelines/${pipeline_ref}/executions`}
|
||||||
|
base={getConfig('code')}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
export type UseListExecutionsProps = Omit<
|
||||||
|
UseGetProps<TypesExecution[], UsererrorError, ListExecutionsQueryParams, ListExecutionsPathParams>,
|
||||||
|
'path'
|
||||||
|
> &
|
||||||
|
ListExecutionsPathParams
|
||||||
|
|
||||||
|
export const useListExecutions = ({ pipeline_ref, ...props }: UseListExecutionsProps) =>
|
||||||
|
useGet<TypesExecution[], UsererrorError, ListExecutionsQueryParams, ListExecutionsPathParams>(
|
||||||
|
(paramsInPath: ListExecutionsPathParams) => `/pipelines/${paramsInPath.pipeline_ref}/executions`,
|
||||||
|
{ base: getConfig('code'), pathParams: { pipeline_ref }, ...props }
|
||||||
|
)
|
||||||
|
|
||||||
|
export interface CreateExecutionPathParams {
|
||||||
|
pipeline_ref: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type CreateExecutionProps = Omit<
|
||||||
|
MutateProps<TypesExecution, UsererrorError, void, OpenapiCreateExecutionRequest, CreateExecutionPathParams>,
|
||||||
|
'path' | 'verb'
|
||||||
|
> &
|
||||||
|
CreateExecutionPathParams
|
||||||
|
|
||||||
|
export const CreateExecution = ({ pipeline_ref, ...props }: CreateExecutionProps) => (
|
||||||
|
<Mutate<TypesExecution, UsererrorError, void, OpenapiCreateExecutionRequest, CreateExecutionPathParams>
|
||||||
|
verb="POST"
|
||||||
|
path={`/pipelines/${pipeline_ref}/executions`}
|
||||||
|
base={getConfig('code')}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
export type UseCreateExecutionProps = Omit<
|
||||||
|
UseMutateProps<TypesExecution, UsererrorError, void, OpenapiCreateExecutionRequest, CreateExecutionPathParams>,
|
||||||
|
'path' | 'verb'
|
||||||
|
> &
|
||||||
|
CreateExecutionPathParams
|
||||||
|
|
||||||
|
export const useCreateExecution = ({ pipeline_ref, ...props }: UseCreateExecutionProps) =>
|
||||||
|
useMutate<TypesExecution, UsererrorError, void, OpenapiCreateExecutionRequest, CreateExecutionPathParams>(
|
||||||
|
'POST',
|
||||||
|
(paramsInPath: CreateExecutionPathParams) => `/pipelines/${paramsInPath.pipeline_ref}/executions`,
|
||||||
|
{ base: getConfig('code'), pathParams: { pipeline_ref }, ...props }
|
||||||
|
)
|
||||||
|
|
||||||
|
export interface DeleteExecutionPathParams {
|
||||||
|
pipeline_ref: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type DeleteExecutionProps = Omit<
|
||||||
|
MutateProps<void, UsererrorError, void, string, DeleteExecutionPathParams>,
|
||||||
|
'path' | 'verb'
|
||||||
|
> &
|
||||||
|
DeleteExecutionPathParams
|
||||||
|
|
||||||
|
export const DeleteExecution = ({ pipeline_ref, ...props }: DeleteExecutionProps) => (
|
||||||
|
<Mutate<void, UsererrorError, void, string, DeleteExecutionPathParams>
|
||||||
|
verb="DELETE"
|
||||||
|
path={`/pipelines/${pipeline_ref}/executions`}
|
||||||
|
base={getConfig('code')}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
export type UseDeleteExecutionProps = Omit<
|
||||||
|
UseMutateProps<void, UsererrorError, void, string, DeleteExecutionPathParams>,
|
||||||
|
'path' | 'verb'
|
||||||
|
> &
|
||||||
|
DeleteExecutionPathParams
|
||||||
|
|
||||||
|
export const useDeleteExecution = ({ pipeline_ref, ...props }: UseDeleteExecutionProps) =>
|
||||||
|
useMutate<void, UsererrorError, void, string, DeleteExecutionPathParams>(
|
||||||
|
'DELETE',
|
||||||
|
(paramsInPath: DeleteExecutionPathParams) => `/pipelines/${paramsInPath.pipeline_ref}/executions`,
|
||||||
|
{ base: getConfig('code'), pathParams: { pipeline_ref }, ...props }
|
||||||
|
)
|
||||||
|
|
||||||
|
export interface FindExecutionPathParams {
|
||||||
|
pipeline_ref: string
|
||||||
|
execution_number: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type FindExecutionProps = Omit<GetProps<TypesExecution, UsererrorError, void, FindExecutionPathParams>, 'path'> &
|
||||||
|
FindExecutionPathParams
|
||||||
|
|
||||||
|
export const FindExecution = ({ pipeline_ref, execution_number, ...props }: FindExecutionProps) => (
|
||||||
|
<Get<TypesExecution, UsererrorError, void, FindExecutionPathParams>
|
||||||
|
path={`/pipelines/${pipeline_ref}/executions/${execution_number}`}
|
||||||
|
base={getConfig('code')}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
export type UseFindExecutionProps = Omit<
|
||||||
|
UseGetProps<TypesExecution, UsererrorError, void, FindExecutionPathParams>,
|
||||||
|
'path'
|
||||||
|
> &
|
||||||
|
FindExecutionPathParams
|
||||||
|
|
||||||
|
export const useFindExecution = ({ pipeline_ref, execution_number, ...props }: UseFindExecutionProps) =>
|
||||||
|
useGet<TypesExecution, UsererrorError, void, FindExecutionPathParams>(
|
||||||
|
(paramsInPath: FindExecutionPathParams) =>
|
||||||
|
`/pipelines/${paramsInPath.pipeline_ref}/executions/${paramsInPath.execution_number}`,
|
||||||
|
{ base: getConfig('code'), pathParams: { pipeline_ref, execution_number }, ...props }
|
||||||
|
)
|
||||||
|
|
||||||
|
export interface UpdateExecutionPathParams {
|
||||||
|
pipeline_ref: string
|
||||||
|
execution_number: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type UpdateExecutionProps = Omit<
|
||||||
|
MutateProps<TypesExecution, UsererrorError, void, OpenapiUpdateExecutionRequest, UpdateExecutionPathParams>,
|
||||||
|
'path' | 'verb'
|
||||||
|
> &
|
||||||
|
UpdateExecutionPathParams
|
||||||
|
|
||||||
|
export const UpdateExecution = ({ pipeline_ref, execution_number, ...props }: UpdateExecutionProps) => (
|
||||||
|
<Mutate<TypesExecution, UsererrorError, void, OpenapiUpdateExecutionRequest, UpdateExecutionPathParams>
|
||||||
|
verb="PATCH"
|
||||||
|
path={`/pipelines/${pipeline_ref}/executions/${execution_number}`}
|
||||||
|
base={getConfig('code')}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
export type UseUpdateExecutionProps = Omit<
|
||||||
|
UseMutateProps<TypesExecution, UsererrorError, void, OpenapiUpdateExecutionRequest, UpdateExecutionPathParams>,
|
||||||
|
'path' | 'verb'
|
||||||
|
> &
|
||||||
|
UpdateExecutionPathParams
|
||||||
|
|
||||||
|
export const useUpdateExecution = ({ pipeline_ref, execution_number, ...props }: UseUpdateExecutionProps) =>
|
||||||
|
useMutate<TypesExecution, UsererrorError, void, OpenapiUpdateExecutionRequest, UpdateExecutionPathParams>(
|
||||||
|
'PATCH',
|
||||||
|
(paramsInPath: UpdateExecutionPathParams) =>
|
||||||
|
`/pipelines/${paramsInPath.pipeline_ref}/executions/${paramsInPath.execution_number}`,
|
||||||
|
{ base: getConfig('code'), pathParams: { pipeline_ref, execution_number }, ...props }
|
||||||
|
)
|
||||||
|
|
||||||
export interface ListPrincipalsQueryParams {
|
export interface ListPrincipalsQueryParams {
|
||||||
/**
|
/**
|
||||||
* The substring by which the principals are filtered.
|
* The substring by which the principals are filtered.
|
||||||
@ -1637,6 +2022,69 @@ export const useMoveRepository = ({ repo_ref, ...props }: UseMoveRepositoryProps
|
|||||||
{ base: getConfig('code'), pathParams: { repo_ref }, ...props }
|
{ base: getConfig('code'), pathParams: { repo_ref }, ...props }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
export interface PathDetailsQueryParams {
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
git_ref?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PathDetailsPathParams {
|
||||||
|
repo_ref: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type PathDetailsProps = Omit<
|
||||||
|
MutateProps<
|
||||||
|
RepoPathsDetailsOutput,
|
||||||
|
UsererrorError,
|
||||||
|
PathDetailsQueryParams,
|
||||||
|
OpenapiPathsDetailsRequest,
|
||||||
|
PathDetailsPathParams
|
||||||
|
>,
|
||||||
|
'path' | 'verb'
|
||||||
|
> &
|
||||||
|
PathDetailsPathParams
|
||||||
|
|
||||||
|
export const PathDetails = ({ repo_ref, ...props }: PathDetailsProps) => (
|
||||||
|
<Mutate<
|
||||||
|
RepoPathsDetailsOutput,
|
||||||
|
UsererrorError,
|
||||||
|
PathDetailsQueryParams,
|
||||||
|
OpenapiPathsDetailsRequest,
|
||||||
|
PathDetailsPathParams
|
||||||
|
>
|
||||||
|
verb="POST"
|
||||||
|
path={`/repos/${repo_ref}/path-details`}
|
||||||
|
base={getConfig('code')}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
export type UsePathDetailsProps = Omit<
|
||||||
|
UseMutateProps<
|
||||||
|
RepoPathsDetailsOutput,
|
||||||
|
UsererrorError,
|
||||||
|
PathDetailsQueryParams,
|
||||||
|
OpenapiPathsDetailsRequest,
|
||||||
|
PathDetailsPathParams
|
||||||
|
>,
|
||||||
|
'path' | 'verb'
|
||||||
|
> &
|
||||||
|
PathDetailsPathParams
|
||||||
|
|
||||||
|
export const usePathDetails = ({ repo_ref, ...props }: UsePathDetailsProps) =>
|
||||||
|
useMutate<
|
||||||
|
RepoPathsDetailsOutput,
|
||||||
|
UsererrorError,
|
||||||
|
PathDetailsQueryParams,
|
||||||
|
OpenapiPathsDetailsRequest,
|
||||||
|
PathDetailsPathParams
|
||||||
|
>('POST', (paramsInPath: PathDetailsPathParams) => `/repos/${paramsInPath.repo_ref}/path-details`, {
|
||||||
|
base: getConfig('code'),
|
||||||
|
pathParams: { repo_ref },
|
||||||
|
...props
|
||||||
|
})
|
||||||
|
|
||||||
export interface ListRepositoryPathsQueryParams {
|
export interface ListRepositoryPathsQueryParams {
|
||||||
/**
|
/**
|
||||||
* The page to return.
|
* The page to return.
|
||||||
@ -2988,6 +3436,103 @@ export type UseListLicensesProps = Omit<UseGetProps<ListLicensesResponse, Userer
|
|||||||
export const useListLicenses = (props: UseListLicensesProps) =>
|
export const useListLicenses = (props: UseListLicensesProps) =>
|
||||||
useGet<ListLicensesResponse, UsererrorError, void, void>(`/resources/license`, { base: getConfig('code'), ...props })
|
useGet<ListLicensesResponse, UsererrorError, void, void>(`/resources/license`, { base: getConfig('code'), ...props })
|
||||||
|
|
||||||
|
export type CreateSecretProps = Omit<
|
||||||
|
MutateProps<TypesSecret, UsererrorError, void, OpenapiCreateSecretRequest, void>,
|
||||||
|
'path' | 'verb'
|
||||||
|
>
|
||||||
|
|
||||||
|
export const CreateSecret = (props: CreateSecretProps) => (
|
||||||
|
<Mutate<TypesSecret, UsererrorError, void, OpenapiCreateSecretRequest, void>
|
||||||
|
verb="POST"
|
||||||
|
path={`/secrets`}
|
||||||
|
base={getConfig('code')}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
export type UseCreateSecretProps = Omit<
|
||||||
|
UseMutateProps<TypesSecret, UsererrorError, void, OpenapiCreateSecretRequest, void>,
|
||||||
|
'path' | 'verb'
|
||||||
|
>
|
||||||
|
|
||||||
|
export const useCreateSecret = (props: UseCreateSecretProps) =>
|
||||||
|
useMutate<TypesSecret, UsererrorError, void, OpenapiCreateSecretRequest, void>('POST', `/secrets`, {
|
||||||
|
base: getConfig('code'),
|
||||||
|
...props
|
||||||
|
})
|
||||||
|
|
||||||
|
export type DeleteSecretProps = Omit<MutateProps<void, UsererrorError, void, string, void>, 'path' | 'verb'>
|
||||||
|
|
||||||
|
export const DeleteSecret = (props: DeleteSecretProps) => (
|
||||||
|
<Mutate<void, UsererrorError, void, string, void>
|
||||||
|
verb="DELETE"
|
||||||
|
path={`/secrets`}
|
||||||
|
base={getConfig('code')}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
export type UseDeleteSecretProps = Omit<UseMutateProps<void, UsererrorError, void, string, void>, 'path' | 'verb'>
|
||||||
|
|
||||||
|
export const useDeleteSecret = (props: UseDeleteSecretProps) =>
|
||||||
|
useMutate<void, UsererrorError, void, string, void>('DELETE', `/secrets`, { base: getConfig('code'), ...props })
|
||||||
|
|
||||||
|
export interface FindSecretPathParams {
|
||||||
|
secret_ref: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type FindSecretProps = Omit<GetProps<TypesSecret, UsererrorError, void, FindSecretPathParams>, 'path'> &
|
||||||
|
FindSecretPathParams
|
||||||
|
|
||||||
|
export const FindSecret = ({ secret_ref, ...props }: FindSecretProps) => (
|
||||||
|
<Get<TypesSecret, UsererrorError, void, FindSecretPathParams>
|
||||||
|
path={`/secrets/${secret_ref}`}
|
||||||
|
base={getConfig('code')}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
export type UseFindSecretProps = Omit<UseGetProps<TypesSecret, UsererrorError, void, FindSecretPathParams>, 'path'> &
|
||||||
|
FindSecretPathParams
|
||||||
|
|
||||||
|
export const useFindSecret = ({ secret_ref, ...props }: UseFindSecretProps) =>
|
||||||
|
useGet<TypesSecret, UsererrorError, void, FindSecretPathParams>(
|
||||||
|
(paramsInPath: FindSecretPathParams) => `/secrets/${paramsInPath.secret_ref}`,
|
||||||
|
{ base: getConfig('code'), pathParams: { secret_ref }, ...props }
|
||||||
|
)
|
||||||
|
|
||||||
|
export interface UpdateSecretPathParams {
|
||||||
|
secret_ref: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type UpdateSecretProps = Omit<
|
||||||
|
MutateProps<TypesSecret, UsererrorError, void, OpenapiUpdateSecretRequest, UpdateSecretPathParams>,
|
||||||
|
'path' | 'verb'
|
||||||
|
> &
|
||||||
|
UpdateSecretPathParams
|
||||||
|
|
||||||
|
export const UpdateSecret = ({ secret_ref, ...props }: UpdateSecretProps) => (
|
||||||
|
<Mutate<TypesSecret, UsererrorError, void, OpenapiUpdateSecretRequest, UpdateSecretPathParams>
|
||||||
|
verb="PATCH"
|
||||||
|
path={`/secrets/${secret_ref}`}
|
||||||
|
base={getConfig('code')}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
export type UseUpdateSecretProps = Omit<
|
||||||
|
UseMutateProps<TypesSecret, UsererrorError, void, OpenapiUpdateSecretRequest, UpdateSecretPathParams>,
|
||||||
|
'path' | 'verb'
|
||||||
|
> &
|
||||||
|
UpdateSecretPathParams
|
||||||
|
|
||||||
|
export const useUpdateSecret = ({ secret_ref, ...props }: UseUpdateSecretProps) =>
|
||||||
|
useMutate<TypesSecret, UsererrorError, void, OpenapiUpdateSecretRequest, UpdateSecretPathParams>(
|
||||||
|
'PATCH',
|
||||||
|
(paramsInPath: UpdateSecretPathParams) => `/secrets/${paramsInPath.secret_ref}`,
|
||||||
|
{ base: getConfig('code'), pathParams: { secret_ref }, ...props }
|
||||||
|
)
|
||||||
|
|
||||||
export type CreateSpaceProps = Omit<
|
export type CreateSpaceProps = Omit<
|
||||||
MutateProps<TypesSpace, UsererrorError, void, OpenapiCreateSpaceRequest, void>,
|
MutateProps<TypesSpace, UsererrorError, void, OpenapiCreateSpaceRequest, void>,
|
||||||
'path' | 'verb'
|
'path' | 'verb'
|
||||||
@ -3381,6 +3926,51 @@ export const useDeletePath = ({ space_ref, ...props }: UseDeletePathProps) =>
|
|||||||
{ base: getConfig('code'), pathParams: { space_ref }, ...props }
|
{ base: getConfig('code'), pathParams: { space_ref }, ...props }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
export interface ListPipelinesQueryParams {
|
||||||
|
/**
|
||||||
|
* The substring which is used to filter the repositories by their path name.
|
||||||
|
*/
|
||||||
|
query?: string
|
||||||
|
/**
|
||||||
|
* The page to return.
|
||||||
|
*/
|
||||||
|
page?: number
|
||||||
|
/**
|
||||||
|
* The maximum number of results to return.
|
||||||
|
*/
|
||||||
|
limit?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ListPipelinesPathParams {
|
||||||
|
space_ref: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ListPipelinesProps = Omit<
|
||||||
|
GetProps<TypesPipeline[], UsererrorError, ListPipelinesQueryParams, ListPipelinesPathParams>,
|
||||||
|
'path'
|
||||||
|
> &
|
||||||
|
ListPipelinesPathParams
|
||||||
|
|
||||||
|
export const ListPipelines = ({ space_ref, ...props }: ListPipelinesProps) => (
|
||||||
|
<Get<TypesPipeline[], UsererrorError, ListPipelinesQueryParams, ListPipelinesPathParams>
|
||||||
|
path={`/spaces/${space_ref}/pipelines`}
|
||||||
|
base={getConfig('code')}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
export type UseListPipelinesProps = Omit<
|
||||||
|
UseGetProps<TypesPipeline[], UsererrorError, ListPipelinesQueryParams, ListPipelinesPathParams>,
|
||||||
|
'path'
|
||||||
|
> &
|
||||||
|
ListPipelinesPathParams
|
||||||
|
|
||||||
|
export const useListPipelines = ({ space_ref, ...props }: UseListPipelinesProps) =>
|
||||||
|
useGet<TypesPipeline[], UsererrorError, ListPipelinesQueryParams, ListPipelinesPathParams>(
|
||||||
|
(paramsInPath: ListPipelinesPathParams) => `/spaces/${paramsInPath.space_ref}/pipelines`,
|
||||||
|
{ base: getConfig('code'), pathParams: { space_ref }, ...props }
|
||||||
|
)
|
||||||
|
|
||||||
export interface ListReposQueryParams {
|
export interface ListReposQueryParams {
|
||||||
/**
|
/**
|
||||||
* The substring which is used to filter the repositories by their path name.
|
* The substring which is used to filter the repositories by their path name.
|
||||||
@ -3434,6 +4024,51 @@ export const useListRepos = ({ space_ref, ...props }: UseListReposProps) =>
|
|||||||
{ base: getConfig('code'), pathParams: { space_ref }, ...props }
|
{ base: getConfig('code'), pathParams: { space_ref }, ...props }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
export interface ListSecretsQueryParams {
|
||||||
|
/**
|
||||||
|
* The substring which is used to filter the repositories by their path name.
|
||||||
|
*/
|
||||||
|
query?: string
|
||||||
|
/**
|
||||||
|
* The page to return.
|
||||||
|
*/
|
||||||
|
page?: number
|
||||||
|
/**
|
||||||
|
* The maximum number of results to return.
|
||||||
|
*/
|
||||||
|
limit?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ListSecretsPathParams {
|
||||||
|
space_ref: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ListSecretsProps = Omit<
|
||||||
|
GetProps<TypesSecret[], UsererrorError, ListSecretsQueryParams, ListSecretsPathParams>,
|
||||||
|
'path'
|
||||||
|
> &
|
||||||
|
ListSecretsPathParams
|
||||||
|
|
||||||
|
export const ListSecrets = ({ space_ref, ...props }: ListSecretsProps) => (
|
||||||
|
<Get<TypesSecret[], UsererrorError, ListSecretsQueryParams, ListSecretsPathParams>
|
||||||
|
path={`/spaces/${space_ref}/secrets`}
|
||||||
|
base={getConfig('code')}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
export type UseListSecretsProps = Omit<
|
||||||
|
UseGetProps<TypesSecret[], UsererrorError, ListSecretsQueryParams, ListSecretsPathParams>,
|
||||||
|
'path'
|
||||||
|
> &
|
||||||
|
ListSecretsPathParams
|
||||||
|
|
||||||
|
export const useListSecrets = ({ space_ref, ...props }: UseListSecretsProps) =>
|
||||||
|
useGet<TypesSecret[], UsererrorError, ListSecretsQueryParams, ListSecretsPathParams>(
|
||||||
|
(paramsInPath: ListSecretsPathParams) => `/spaces/${paramsInPath.space_ref}/secrets`,
|
||||||
|
{ base: getConfig('code'), pathParams: { space_ref }, ...props }
|
||||||
|
)
|
||||||
|
|
||||||
export interface ListServiceAccountsPathParams {
|
export interface ListServiceAccountsPathParams {
|
||||||
space_ref: string
|
space_ref: string
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user