Merge branch 'small-execution-fixes' of _OKE5H2PQKOUfzFFDuD4FA/default/CODE/gitness (#451)

This commit is contained in:
Dan Wilson 2023-09-13 09:23:23 +00:00 committed by Harness
commit 9c0edb5010
9 changed files with 14 additions and 24 deletions

View File

@ -10,7 +10,7 @@ import { useGetSpaceParam } from 'hooks/useGetSpaceParam'
import type { CODEProps } from 'RouteDefinitions' import type { CODEProps } from 'RouteDefinitions'
import type { GitInfoProps } from 'utils/GitUtils' import type { GitInfoProps } from 'utils/GitUtils'
import { ExecutionStatus } from 'components/ExecutionStatus/ExecutionStatus' import { ExecutionStatus } from 'components/ExecutionStatus/ExecutionStatus'
import { getStatus } from 'utils/PipelineUtils' import { getStatus } from 'utils/ExecutionUtils'
import { PipeSeparator } from 'components/PipeSeparator/PipeSeparator' import { PipeSeparator } from 'components/PipeSeparator/PipeSeparator'
import { timeDistance } from 'utils/Utils' import { timeDistance } from 'utils/Utils'
import css from './ExecutionPageHeader.module.scss' import css from './ExecutionPageHeader.module.scss'

View File

@ -3,7 +3,7 @@ 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/ExecutionUtils'
import { timeDistance } from 'utils/Utils' import { timeDistance } from 'utils/Utils'
import css from './ExecutionStageList.module.scss' import css from './ExecutionStageList.module.scss'

View File

@ -3,7 +3,7 @@ import { useEffect, useRef } from 'react'
type UseSpaceSSEProps = { type UseSpaceSSEProps = {
space: string space: string
events: string[] events: string[]
onEvent: (type: string, data: any) => void onEvent: (data: any, type: string) => void
onError?: (event: Event) => void onError?: (event: Event) => void
shouldRun?: boolean shouldRun?: boolean
} }
@ -20,7 +20,7 @@ const useSpaceSSE = ({ space, events, onEvent, onError, shouldRun = true }: UseS
const handleMessage = (event: MessageEvent) => { const handleMessage = (event: MessageEvent) => {
const data = JSON.parse(event.data) const data = JSON.parse(event.data)
onEvent(event.type, data) onEvent(data, event.type)
} }
const handleError = (event: Event) => { const handleError = (event: Event) => {

View File

@ -627,7 +627,7 @@ repoDelete:
deleteToastSuccess: Repository deleted successfully deleteToastSuccess: Repository deleted successfully
deleteConfirmButton2: Delete this repository deleteConfirmButton2: Delete this repository
pipelines: pipelines:
noData: There are no pipelines :( noData: There are no pipelines
newPipelineButton: New Pipeline newPipelineButton: New Pipeline
name: Pipeline Name name: Pipeline Name
createNewPipeline: Create New Pipeline createNewPipeline: Create New Pipeline
@ -645,7 +645,7 @@ pipelines:
executionStarted: Pipeline execution started successfully executionStarted: Pipeline execution started successfully
executionCouldNotStart: Failure while starting Pipeline execution executionCouldNotStart: Failure while starting Pipeline execution
executions: executions:
noData: There are no executions :( noData: There are no executions
newExecutionButton: Run Pipeline newExecutionButton: Run Pipeline
name: Execution Name name: Execution Name
description: Description description: Description
@ -657,7 +657,7 @@ executions:
selectRange: Shift-click to select a range selectRange: Shift-click to select a range
allCommits: All Commits allCommits: All Commits
secrets: secrets:
noData: There are no secrets :( noData: There are no secrets
newSecretButton: New Secret newSecretButton: New Secret
name: Secret Name name: Secret Name
failedToCreate: Failed to create Secret. Please try again. failedToCreate: Failed to create Secret. Please try again.

View File

@ -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 && ( {!standalone && (
<NavMenuItem <NavMenuItem

View File

@ -48,7 +48,7 @@ const Execution = () => {
useSpaceSSE({ useSpaceSSE({
space, space,
events: ['execution_updated', 'execution_completed'], events: ['execution_updated', 'execution_completed'],
onEvent: (_: string, data: any) => { onEvent: data => {
if ( if (
data?.repo_id === execution?.repo_id && data?.repo_id === execution?.repo_id &&
data?.pipeline_id === execution?.pipeline_id && data?.pipeline_id === execution?.pipeline_id &&

View File

@ -29,7 +29,7 @@ import { ResourceListingPagination } from 'components/ResourceListingPagination/
import { useGetRepositoryMetadata } from 'hooks/useGetRepositoryMetadata' import { useGetRepositoryMetadata } from 'hooks/useGetRepositoryMetadata'
import { RepositoryPageHeader } from 'components/RepositoryPageHeader/RepositoryPageHeader' import { RepositoryPageHeader } from 'components/RepositoryPageHeader/RepositoryPageHeader'
import { ExecutionStatus } from 'components/ExecutionStatus/ExecutionStatus' import { ExecutionStatus } from 'components/ExecutionStatus/ExecutionStatus'
import { getStatus } from 'utils/PipelineUtils' import { getStatus } from 'utils/ExecutionUtils'
import useSpaceSSE from 'hooks/useSpaceSSE' import useSpaceSSE from 'hooks/useSpaceSSE'
import { ExecutionText, ExecutionTrigger } from 'components/ExecutionText/ExecutionText' import { ExecutionText, ExecutionTrigger } from 'components/ExecutionText/ExecutionText'
import useRunPipelineModal from 'components/RunPipelineModal/RunPipelineModal' import useRunPipelineModal from 'components/RunPipelineModal/RunPipelineModal'
@ -70,7 +70,7 @@ const ExecutionList = () => {
useSpaceSSE({ useSpaceSSE({
space, space,
events: ['execution_updated', 'execution_completed'], 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? // 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 ( if (
executions?.some( executions?.some(

View File

@ -32,7 +32,7 @@ import { useAppContext } from 'AppContext'
import { useGetRepositoryMetadata } from 'hooks/useGetRepositoryMetadata' import { useGetRepositoryMetadata } from 'hooks/useGetRepositoryMetadata'
import { RepositoryPageHeader } from 'components/RepositoryPageHeader/RepositoryPageHeader' import { RepositoryPageHeader } from 'components/RepositoryPageHeader/RepositoryPageHeader'
import { ExecutionStatus, ExecutionState } from 'components/ExecutionStatus/ExecutionStatus' import { ExecutionStatus, ExecutionState } from 'components/ExecutionStatus/ExecutionStatus'
import { getStatus } from 'utils/PipelineUtils' import { getStatus } from 'utils/ExecutionUtils'
import { PipeSeparator } from 'components/PipeSeparator/PipeSeparator' import { PipeSeparator } from 'components/PipeSeparator/PipeSeparator'
import useNewPipelineModal from 'components/NewPipelineModal/NewPipelineModal' import useNewPipelineModal from 'components/NewPipelineModal/NewPipelineModal'
import { useGetSpaceParam } from 'hooks/useGetSpaceParam' import { useGetSpaceParam } from 'hooks/useGetSpaceParam'
@ -77,11 +77,9 @@ const PipelineList = () => {
useSpaceSSE({ useSpaceSSE({
space, space,
events: ['execution_updated', 'execution_completed'], 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? // 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 ( if (pipelines?.some(pipeline => pipeline.repo_id === data?.repo_id && pipeline.id === data?.pipeline_id)) {
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? //TODO - revisit full refresh - can I use the message to update the execution?
pipelinesRefetch() pipelinesRefetch()
} }

View File

@ -4,7 +4,7 @@ export const getStatus = (status: string | undefined): ExecutionState => {
switch (status) { switch (status) {
case 'success': case 'success':
return ExecutionState.SUCCESS return ExecutionState.SUCCESS
case 'failed': case 'failure':
return ExecutionState.FAILURE return ExecutionState.FAILURE
case 'running': case 'running':
return ExecutionState.RUNNING return ExecutionState.RUNNING