mirror of
https://github.com/harness/drone.git
synced 2025-05-09 05:00:06 +08:00
Merge branch 'CI-WIP' of _OKE5H2PQKOUfzFFDuD4FA/default/CODE/gitness (#398)
This commit is contained in:
commit
dc7b0a3d44
@ -0,0 +1,42 @@
|
|||||||
|
.pageHeader {
|
||||||
|
height: auto !important;
|
||||||
|
flex-direction: column !important;
|
||||||
|
align-items: flex-start !important;
|
||||||
|
gap: var(--spacing-small) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
width: 100% !important;
|
||||||
|
gap: var(--spacing-small) !important;
|
||||||
|
|
||||||
|
a {
|
||||||
|
font-size: var(--font-size-small);
|
||||||
|
color: var(--primary-7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumb {
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
a {
|
||||||
|
font-size: var(--font-size-small);
|
||||||
|
color: var(--primary-7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.hash {
|
||||||
|
color: var(--primary-7) !important;
|
||||||
|
font-family: Roboto Mono !important;
|
||||||
|
font-size: var(--font-size-small) !important;
|
||||||
|
font-weight: 500 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timer {
|
||||||
|
margin: 0 0 0 auto !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.executionInfo {
|
||||||
|
width: 100% !important;
|
||||||
|
align-items: center !important;
|
||||||
|
margin-left: 0 !important;
|
||||||
|
}
|
11
web/src/components/ExecutionPageHeader/ExecutionPageHeader.module.scss.d.ts
vendored
Normal file
11
web/src/components/ExecutionPageHeader/ExecutionPageHeader.module.scss.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
// this is an auto-generated file
|
||||||
|
declare const styles: {
|
||||||
|
readonly pageHeader: string
|
||||||
|
readonly header: string
|
||||||
|
readonly breadcrumb: string
|
||||||
|
readonly hash: string
|
||||||
|
readonly timer: string
|
||||||
|
readonly executionInfo: string
|
||||||
|
}
|
||||||
|
export default styles
|
121
web/src/components/ExecutionPageHeader/ExecutionPageHeader.tsx
Normal file
121
web/src/components/ExecutionPageHeader/ExecutionPageHeader.tsx
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
import React, { Fragment } from 'react'
|
||||||
|
import { Layout, Text, PageHeader, Utils, Avatar, FlexExpander } from '@harnessio/uicore'
|
||||||
|
import { Icon } from '@harnessio/icons'
|
||||||
|
import { Color } from '@harnessio/design-system'
|
||||||
|
import { Link, useParams } from 'react-router-dom'
|
||||||
|
import { Calendar, GitFork, Timer } from 'iconoir-react'
|
||||||
|
import { useStrings } from 'framework/strings'
|
||||||
|
import { useAppContext } from 'AppContext'
|
||||||
|
import { useGetSpaceParam } from 'hooks/useGetSpaceParam'
|
||||||
|
import type { CODEProps } from 'RouteDefinitions'
|
||||||
|
import type { GitInfoProps } from 'utils/GitUtils'
|
||||||
|
import { ExecutionStatus } from 'components/ExecutionStatus/ExecutionStatus'
|
||||||
|
import { getStatus } from 'utils/PipelineUtils'
|
||||||
|
import { PipeSeparator } from 'components/PipeSeparator/PipeSeparator'
|
||||||
|
import { timeDistance } from 'utils/Utils'
|
||||||
|
import css from './ExecutionPageHeader.module.scss'
|
||||||
|
|
||||||
|
interface BreadcrumbLink {
|
||||||
|
label: string
|
||||||
|
url: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ExecutionInfo {
|
||||||
|
message: string
|
||||||
|
authorName: string
|
||||||
|
authorEmail: string
|
||||||
|
source: string
|
||||||
|
hash: string
|
||||||
|
status: string
|
||||||
|
started: number
|
||||||
|
finished: number
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ExecutionPageHeaderProps extends Optional<Pick<GitInfoProps, 'repoMetadata'>, 'repoMetadata'> {
|
||||||
|
title: string | JSX.Element
|
||||||
|
dataTooltipId: string
|
||||||
|
extraBreadcrumbLinks?: BreadcrumbLink[]
|
||||||
|
executionInfo?: ExecutionInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ExecutionPageHeader({
|
||||||
|
repoMetadata,
|
||||||
|
title,
|
||||||
|
extraBreadcrumbLinks = [],
|
||||||
|
executionInfo
|
||||||
|
}: ExecutionPageHeaderProps) {
|
||||||
|
const { gitRef } = useParams<CODEProps>()
|
||||||
|
const { getString } = useStrings()
|
||||||
|
const space = useGetSpaceParam()
|
||||||
|
const { routes } = useAppContext()
|
||||||
|
|
||||||
|
if (!repoMetadata) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PageHeader
|
||||||
|
className={css.pageHeader}
|
||||||
|
title={title}
|
||||||
|
breadcrumbs={
|
||||||
|
<Layout.Horizontal
|
||||||
|
spacing="small"
|
||||||
|
className={css.breadcrumb}
|
||||||
|
padding={{ bottom: 0 }}
|
||||||
|
margin={{ bottom: 'small' }}>
|
||||||
|
<Link to={routes.toCODERepositories({ space })}>{getString('repositories')}</Link>
|
||||||
|
<Icon name="main-chevron-right" size={8} color={Color.GREY_500} />
|
||||||
|
<Link to={routes.toCODERepository({ repoPath: repoMetadata.path as string, gitRef })}>
|
||||||
|
{repoMetadata.uid}
|
||||||
|
</Link>
|
||||||
|
{extraBreadcrumbLinks.map(link => (
|
||||||
|
<Fragment key={link.url}>
|
||||||
|
<Icon name="main-chevron-right" size={8} color={Color.GREY_500} />
|
||||||
|
<Link to={link.url}>{link.label}</Link>
|
||||||
|
</Fragment>
|
||||||
|
))}
|
||||||
|
</Layout.Horizontal>
|
||||||
|
}
|
||||||
|
content={
|
||||||
|
executionInfo && (
|
||||||
|
// TODO - margin left not playing ball... why?
|
||||||
|
<Layout.Horizontal className={css.executionInfo} spacing="small" style={{ marginLeft: 0 }}>
|
||||||
|
<ExecutionStatus status={getStatus(executionInfo.status)} iconOnly noBackground iconSize={18} />
|
||||||
|
<Text inline color={Color.GREY_800} font={{ size: 'small' }}>
|
||||||
|
{executionInfo.message}
|
||||||
|
</Text>
|
||||||
|
<PipeSeparator height={7} />
|
||||||
|
<Avatar email={executionInfo.authorEmail} name={executionInfo.authorName} size="small" hoverCard={false} />
|
||||||
|
<Text inline color={Color.GREY_500} font={{ size: 'small' }}>
|
||||||
|
{executionInfo.authorName}
|
||||||
|
</Text>
|
||||||
|
<PipeSeparator height={7} />
|
||||||
|
<GitFork height={12} width={12} color={Utils.getRealCSSColor(Color.GREY_500)} />
|
||||||
|
<Text inline color={Color.GREY_500} font={{ size: 'small' }}>
|
||||||
|
{executionInfo.source}
|
||||||
|
</Text>
|
||||||
|
<PipeSeparator height={7} />
|
||||||
|
<Link
|
||||||
|
to={routes.toCODECommit({ repoPath: repoMetadata.path as string, commitRef: executionInfo.hash })}
|
||||||
|
className={css.hash}>
|
||||||
|
{executionInfo.hash?.slice(0, 6)}
|
||||||
|
</Link>
|
||||||
|
<FlexExpander />
|
||||||
|
<Layout.Horizontal spacing={'small'} style={{ alignItems: 'center' }} className={css.timer}>
|
||||||
|
<Timer height={16} width={16} color={Utils.getRealCSSColor(Color.GREY_500)} />
|
||||||
|
<Text inline color={Color.GREY_500} font={{ size: 'small' }}>
|
||||||
|
{timeDistance(executionInfo.started, executionInfo.finished)}
|
||||||
|
</Text>
|
||||||
|
</Layout.Horizontal>
|
||||||
|
<Layout.Horizontal spacing={'small'} style={{ alignItems: 'center' }}>
|
||||||
|
<Calendar height={16} width={16} color={Utils.getRealCSSColor(Color.GREY_500)} />
|
||||||
|
<Text inline color={Color.GREY_500} font={{ size: 'small' }}>
|
||||||
|
{timeDistance(executionInfo.finished, Date.now())} ago
|
||||||
|
</Text>
|
||||||
|
</Layout.Horizontal>
|
||||||
|
</Layout.Horizontal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
@ -1,9 +1,10 @@
|
|||||||
import React, { FC } from 'react'
|
import React, { FC } from 'react'
|
||||||
import { Container, Layout, Text } from '@harnessio/uicore'
|
import { Container, FlexExpander, Layout, Text } from '@harnessio/uicore'
|
||||||
import cx from 'classnames'
|
import cx from 'classnames'
|
||||||
import type { TypesStage } from 'services/code'
|
import type { TypesStage } from 'services/code'
|
||||||
import { ExecutionState, ExecutionStatus } from 'components/ExecutionStatus/ExecutionStatus'
|
import { ExecutionState, ExecutionStatus } from 'components/ExecutionStatus/ExecutionStatus'
|
||||||
import { getStatus } from 'utils/PipelineUtils'
|
import { getStatus } from 'utils/PipelineUtils'
|
||||||
|
import { timeDistance } from 'utils/Utils'
|
||||||
import css from './ExecutionStageList.module.scss'
|
import css from './ExecutionStageList.module.scss'
|
||||||
|
|
||||||
interface ExecutionStageListProps {
|
interface ExecutionStageListProps {
|
||||||
@ -37,6 +38,8 @@ const ExecutionStage: FC<ExecutionStageProps> = ({ stage, isSelected = false, se
|
|||||||
<Text className={css.uid} lineClamp={1}>
|
<Text className={css.uid} lineClamp={1}>
|
||||||
{stage.name}
|
{stage.name}
|
||||||
</Text>
|
</Text>
|
||||||
|
<FlexExpander />
|
||||||
|
<Text style={{ fontSize: '12px' }}>{timeDistance(stage.started, stage.stopped)}</Text>
|
||||||
</Layout.Horizontal>
|
</Layout.Horizontal>
|
||||||
</Container>
|
</Container>
|
||||||
)
|
)
|
||||||
|
@ -12,7 +12,7 @@ import { getErrorMessage, voidFn } from 'utils/Utils'
|
|||||||
import { useStrings } from 'framework/strings'
|
import { useStrings } from 'framework/strings'
|
||||||
import { LoadingSpinner } from 'components/LoadingSpinner/LoadingSpinner'
|
import { LoadingSpinner } from 'components/LoadingSpinner/LoadingSpinner'
|
||||||
import { useGetRepositoryMetadata } from 'hooks/useGetRepositoryMetadata'
|
import { useGetRepositoryMetadata } from 'hooks/useGetRepositoryMetadata'
|
||||||
import { RepositoryPageHeader } from 'components/RepositoryPageHeader/RepositoryPageHeader'
|
import { ExecutionPageHeader } from 'components/ExecutionPageHeader/ExecutionPageHeader'
|
||||||
import noExecutionImage from '../RepositoriesListing/no-repo.svg'
|
import noExecutionImage from '../RepositoriesListing/no-repo.svg'
|
||||||
import css from './Execution.module.scss'
|
import css from './Execution.module.scss'
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ const Execution = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Container className={css.main}>
|
<Container className={css.main}>
|
||||||
<RepositoryPageHeader
|
<ExecutionPageHeader
|
||||||
repoMetadata={repoMetadata}
|
repoMetadata={repoMetadata}
|
||||||
title={execution?.title as string}
|
title={execution?.title as string}
|
||||||
dataTooltipId="repositoryExecution"
|
dataTooltipId="repositoryExecution"
|
||||||
@ -51,6 +51,16 @@ const Execution = () => {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
executionInfo={{
|
||||||
|
message: execution?.message as string,
|
||||||
|
authorName: execution?.author_name as string,
|
||||||
|
authorEmail: execution?.author_email as string,
|
||||||
|
source: execution?.source as string,
|
||||||
|
hash: execution?.after as string,
|
||||||
|
status: execution?.status as string,
|
||||||
|
started: execution?.started as number,
|
||||||
|
finished: execution?.finished as number
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
<PageBody
|
<PageBody
|
||||||
className={cx({ [css.withError]: !!error })}
|
className={cx({ [css.withError]: !!error })}
|
||||||
|
@ -14,7 +14,7 @@ import {
|
|||||||
import { Color } from '@harnessio/design-system'
|
import { Color } from '@harnessio/design-system'
|
||||||
import cx from 'classnames'
|
import cx from 'classnames'
|
||||||
import type { CellProps, Column } from 'react-table'
|
import type { CellProps, Column } from 'react-table'
|
||||||
import { useHistory, useParams } from 'react-router-dom'
|
import { Link, useHistory, useParams } from 'react-router-dom'
|
||||||
import { useGet } from 'restful-react'
|
import { useGet } from 'restful-react'
|
||||||
import { Timer, Calendar } from 'iconoir-react'
|
import { Timer, Calendar } from 'iconoir-react'
|
||||||
import { useStrings } from 'framework/strings'
|
import { useStrings } from 'framework/strings'
|
||||||
@ -89,10 +89,17 @@ const ExecutionList = () => {
|
|||||||
{/* TODO need logic here for different trigger types */}
|
{/* TODO need logic here for different trigger types */}
|
||||||
<Text className={css.author}>{`${record.author_name} triggered manually`}</Text>
|
<Text className={css.author}>{`${record.author_name} triggered manually`}</Text>
|
||||||
<PipeSeparator height={7} />
|
<PipeSeparator height={7} />
|
||||||
{/* TODO Will need to replace this with commit component - wont match Yifan designs */}
|
<Link
|
||||||
<a rel="noreferrer noopener" className={css.hash}>
|
to={routes.toCODECommit({
|
||||||
{record.after}
|
repoPath: repoMetadata?.path as string,
|
||||||
</a>
|
commitRef: record.after as string
|
||||||
|
})}
|
||||||
|
className={css.hash}
|
||||||
|
onClick={e => {
|
||||||
|
e.stopPropagation()
|
||||||
|
}}>
|
||||||
|
{record.after?.slice(0, 6)}
|
||||||
|
</Link>
|
||||||
</Layout.Horizontal>
|
</Layout.Horizontal>
|
||||||
</Layout.Vertical>
|
</Layout.Vertical>
|
||||||
)
|
)
|
||||||
|
@ -15,7 +15,7 @@ import { Color } from '@harnessio/design-system'
|
|||||||
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 Keywords from 'react-keywords'
|
||||||
import { useHistory } from 'react-router-dom'
|
import { Link, useHistory } from 'react-router-dom'
|
||||||
import { useGet } from 'restful-react'
|
import { useGet } from 'restful-react'
|
||||||
import { Calendar, Timer, GitFork } from 'iconoir-react'
|
import { Calendar, Timer, GitFork } from 'iconoir-react'
|
||||||
import { useStrings } from 'framework/strings'
|
import { useStrings } from 'framework/strings'
|
||||||
@ -33,11 +33,13 @@ import { RepositoryPageHeader } from 'components/RepositoryPageHeader/Repository
|
|||||||
import { ExecutionStatus, ExecutionState } from 'components/ExecutionStatus/ExecutionStatus'
|
import { ExecutionStatus, ExecutionState } from 'components/ExecutionStatus/ExecutionStatus'
|
||||||
import { getStatus } from 'utils/PipelineUtils'
|
import { getStatus } from 'utils/PipelineUtils'
|
||||||
import { PipeSeparator } from 'components/PipeSeparator/PipeSeparator'
|
import { PipeSeparator } from 'components/PipeSeparator/PipeSeparator'
|
||||||
|
import { useGetSpaceParam } from 'hooks/useGetSpaceParam'
|
||||||
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'
|
||||||
|
|
||||||
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>()
|
||||||
@ -119,11 +121,18 @@ const PipelineList = () => {
|
|||||||
<GitFork height={12} width={12} color={Utils.getRealCSSColor(Color.GREY_500)} />
|
<GitFork height={12} width={12} color={Utils.getRealCSSColor(Color.GREY_500)} />
|
||||||
<Text className={css.author}>{record.source}</Text>
|
<Text className={css.author}>{record.source}</Text>
|
||||||
<PipeSeparator height={7} />
|
<PipeSeparator height={7} />
|
||||||
{/* TODO Will need to replace this with commit component - wont match Yifan designs */}
|
<Link
|
||||||
<a rel="noreferrer noopener" className={css.hash}>
|
to={routes.toCODECommit({
|
||||||
{/* {record.after} */}
|
repoPath: repoMetadata?.path as string,
|
||||||
hardcoded
|
commitRef: record.after as string
|
||||||
</a>
|
})}
|
||||||
|
className={css.hash}
|
||||||
|
onClick={e => {
|
||||||
|
e.stopPropagation()
|
||||||
|
}}>
|
||||||
|
{/* {record.after?.slice(0, 6)} */}
|
||||||
|
{'hardcoded'.slice(0, 6)}
|
||||||
|
</Link>
|
||||||
</Layout.Horizontal>
|
</Layout.Horizontal>
|
||||||
</Layout.Vertical>
|
</Layout.Vertical>
|
||||||
) : (
|
) : (
|
||||||
|
Loading…
Reference in New Issue
Block a user