mirror of
https://github.com/harness/drone.git
synced 2025-05-10 05:01:41 +08:00
Merge branch 'small-execution-fixes' of _OKE5H2PQKOUfzFFDuD4FA/default/CODE/gitness (#451)
This commit is contained in:
commit
9c0edb5010
@ -10,7 +10,7 @@ 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 { getStatus } from 'utils/ExecutionUtils'
|
||||
import { PipeSeparator } from 'components/PipeSeparator/PipeSeparator'
|
||||
import { timeDistance } from 'utils/Utils'
|
||||
import css from './ExecutionPageHeader.module.scss'
|
||||
|
@ -3,7 +3,7 @@ import { Container, FlexExpander, Layout, Text } from '@harnessio/uicore'
|
||||
import cx from 'classnames'
|
||||
import type { TypesStage } from 'services/code'
|
||||
import { ExecutionState, ExecutionStatus } from 'components/ExecutionStatus/ExecutionStatus'
|
||||
import { getStatus } from 'utils/PipelineUtils'
|
||||
import { getStatus } from 'utils/ExecutionUtils'
|
||||
import { timeDistance } from 'utils/Utils'
|
||||
import css from './ExecutionStageList.module.scss'
|
||||
|
||||
|
@ -3,7 +3,7 @@ import { useEffect, useRef } from 'react'
|
||||
type UseSpaceSSEProps = {
|
||||
space: string
|
||||
events: string[]
|
||||
onEvent: (type: string, data: any) => void
|
||||
onEvent: (data: any, type: string) => void
|
||||
onError?: (event: Event) => void
|
||||
shouldRun?: boolean
|
||||
}
|
||||
@ -20,7 +20,7 @@ const useSpaceSSE = ({ space, events, onEvent, onError, shouldRun = true }: UseS
|
||||
|
||||
const handleMessage = (event: MessageEvent) => {
|
||||
const data = JSON.parse(event.data)
|
||||
onEvent(event.type, data)
|
||||
onEvent(data, event.type)
|
||||
}
|
||||
|
||||
const handleError = (event: Event) => {
|
||||
|
@ -627,7 +627,7 @@ repoDelete:
|
||||
deleteToastSuccess: Repository deleted successfully
|
||||
deleteConfirmButton2: Delete this repository
|
||||
pipelines:
|
||||
noData: There are no pipelines :(
|
||||
noData: There are no pipelines
|
||||
newPipelineButton: New Pipeline
|
||||
name: Pipeline Name
|
||||
createNewPipeline: Create New Pipeline
|
||||
@ -645,7 +645,7 @@ pipelines:
|
||||
executionStarted: Pipeline execution started successfully
|
||||
executionCouldNotStart: Failure while starting Pipeline execution
|
||||
executions:
|
||||
noData: There are no executions :(
|
||||
noData: There are no executions
|
||||
newExecutionButton: Run Pipeline
|
||||
name: Execution Name
|
||||
description: Description
|
||||
@ -657,7 +657,7 @@ executions:
|
||||
selectRange: Shift-click to select a range
|
||||
allCommits: All Commits
|
||||
secrets:
|
||||
noData: There are no secrets :(
|
||||
noData: There are no secrets
|
||||
newSecretButton: New Secret
|
||||
name: Secret Name
|
||||
failedToCreate: Failed to create Secret. Please try again.
|
||||
|
@ -126,14 +126,6 @@ export const DefaultMenu: React.FC = () => {
|
||||
})}
|
||||
/>
|
||||
)}
|
||||
<NavMenuItem
|
||||
data-code-repo-section="pipelines"
|
||||
isSubLink
|
||||
label={getString('pageTitle.pipelines')}
|
||||
to={routes.toCODEPipelines({
|
||||
repoPath
|
||||
})}
|
||||
/>
|
||||
|
||||
{!standalone && (
|
||||
<NavMenuItem
|
||||
|
@ -48,7 +48,7 @@ const Execution = () => {
|
||||
useSpaceSSE({
|
||||
space,
|
||||
events: ['execution_updated', 'execution_completed'],
|
||||
onEvent: (_: string, data: any) => {
|
||||
onEvent: data => {
|
||||
if (
|
||||
data?.repo_id === execution?.repo_id &&
|
||||
data?.pipeline_id === execution?.pipeline_id &&
|
||||
|
@ -29,7 +29,7 @@ import { ResourceListingPagination } from 'components/ResourceListingPagination/
|
||||
import { useGetRepositoryMetadata } from 'hooks/useGetRepositoryMetadata'
|
||||
import { RepositoryPageHeader } from 'components/RepositoryPageHeader/RepositoryPageHeader'
|
||||
import { ExecutionStatus } from 'components/ExecutionStatus/ExecutionStatus'
|
||||
import { getStatus } from 'utils/PipelineUtils'
|
||||
import { getStatus } from 'utils/ExecutionUtils'
|
||||
import useSpaceSSE from 'hooks/useSpaceSSE'
|
||||
import { ExecutionText, ExecutionTrigger } from 'components/ExecutionText/ExecutionText'
|
||||
import useRunPipelineModal from 'components/RunPipelineModal/RunPipelineModal'
|
||||
@ -70,7 +70,7 @@ const ExecutionList = () => {
|
||||
useSpaceSSE({
|
||||
space,
|
||||
events: ['execution_updated', 'execution_completed'],
|
||||
onEvent: (_: string, data: any) => {
|
||||
onEvent: data => {
|
||||
// ideally this would include number - so we only check for executions on the page - but what if new executions are kicked off? - could check for ids that are higher than the lowest id on the page?
|
||||
if (
|
||||
executions?.some(
|
||||
|
@ -32,7 +32,7 @@ import { useAppContext } from 'AppContext'
|
||||
import { useGetRepositoryMetadata } from 'hooks/useGetRepositoryMetadata'
|
||||
import { RepositoryPageHeader } from 'components/RepositoryPageHeader/RepositoryPageHeader'
|
||||
import { ExecutionStatus, ExecutionState } from 'components/ExecutionStatus/ExecutionStatus'
|
||||
import { getStatus } from 'utils/PipelineUtils'
|
||||
import { getStatus } from 'utils/ExecutionUtils'
|
||||
import { PipeSeparator } from 'components/PipeSeparator/PipeSeparator'
|
||||
import useNewPipelineModal from 'components/NewPipelineModal/NewPipelineModal'
|
||||
import { useGetSpaceParam } from 'hooks/useGetSpaceParam'
|
||||
@ -77,11 +77,9 @@ const PipelineList = () => {
|
||||
useSpaceSSE({
|
||||
space,
|
||||
events: ['execution_updated', 'execution_completed'],
|
||||
onEvent: (_: string, data: any) => {
|
||||
onEvent: data => {
|
||||
// should I include pipeline id here? what if a new pipeline is created? coould check for ids that are higher than the lowest id on the page?
|
||||
if (
|
||||
pipelines?.some(pipeline => pipeline.repo_id === data?.repo_id && pipeline.id === data?.pipeline_id)
|
||||
) {
|
||||
if (pipelines?.some(pipeline => pipeline.repo_id === data?.repo_id && pipeline.id === data?.pipeline_id)) {
|
||||
//TODO - revisit full refresh - can I use the message to update the execution?
|
||||
pipelinesRefetch()
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ export const getStatus = (status: string | undefined): ExecutionState => {
|
||||
switch (status) {
|
||||
case 'success':
|
||||
return ExecutionState.SUCCESS
|
||||
case 'failed':
|
||||
case 'failure':
|
||||
return ExecutionState.FAILURE
|
||||
case 'running':
|
||||
return ExecutionState.RUNNING
|
Loading…
Reference in New Issue
Block a user