bug fixes

This commit is contained in:
Vardan Bansal 2023-09-18 21:22:57 -07:00
parent a96a55a75e
commit 2d918e1278
8 changed files with 65 additions and 33 deletions

View File

@ -10,7 +10,8 @@ import {
FormInput, FormInput,
FlexExpander, FlexExpander,
Text, Text,
Checkbox Checkbox,
ButtonVariation
} from '@harnessio/uicore' } from '@harnessio/uicore'
import { Icon } from '@harnessio/icons' import { Icon } from '@harnessio/icons'
import { FontVariation, Intent } from '@harnessio/design-system' import { FontVariation, Intent } from '@harnessio/design-system'
@ -85,7 +86,7 @@ export const NewTriggerModalButton: React.FC<NewTriggerModalButtonProps> = ({
onClose={hideModal} onClose={hideModal}
title={modalTitle} title={modalTitle}
style={{ width: 700, maxHeight: '95vh', overflow: 'auto' }}> style={{ width: 700, maxHeight: '95vh', overflow: 'auto' }}>
<Layout.Vertical padding={'large'} style={{ height: '100%' }} data-testid="add-trigger-modal"> <Layout.Vertical padding={{ top: 'xsmall' }} style={{ height: '100%' }} data-testid="add-trigger-modal">
<Container> <Container>
<Formik <Formik
initialValues={formInitialValues} initialValues={formInitialValues}
@ -138,9 +139,19 @@ export const NewTriggerModalButton: React.FC<NewTriggerModalButtonProps> = ({
</Container> </Container>
))} ))}
</Container> </Container>
<Layout.Horizontal spacing="small" padding={{ top: 'large' }} style={{ alignItems: 'center' }}> <Layout.Horizontal spacing="small" padding={{ top: 'xlarge' }} style={{ alignItems: 'center' }}>
<Button type="submit" text={getString('create')} intent={Intent.PRIMARY} disabled={loading} /> <Button
<Button text={cancelButtonTitle || getString('cancel')} minimal onClick={hideModal} /> type="submit"
text={getString('create')}
variation={ButtonVariation.PRIMARY}
disabled={loading}
/>
<Button
text={cancelButtonTitle || getString('cancel')}
variation={ButtonVariation.SECONDARY}
minimal
onClick={hideModal}
/>
<FlexExpander /> <FlexExpander />
{loading && <Icon intent={Intent.PRIMARY} name="steps-spinner" size={16} />} {loading && <Icon intent={Intent.PRIMARY} name="steps-spinner" size={16} />}
</Layout.Horizontal> </Layout.Horizontal>

View File

@ -147,6 +147,10 @@ const TriggerDetails = ({
disabled: initialDisabled disabled: initialDisabled
} }
if (loading) {
return <LoadingSpinner visible={true} />
}
return ( return (
<Layout.Vertical className={cx(css.generalContainer, css.editTriggerContainer)} padding={'large'}> <Layout.Vertical className={cx(css.generalContainer, css.editTriggerContainer)} padding={'large'}>
<Formik <Formik
@ -281,9 +285,12 @@ const PipelineTriggersTabs = ({ repoPath, pipeline }: PipelineTriggersTabsProps)
const [selectedTrigger, setSelectedTrigger] = React.useState<number>(0) const [selectedTrigger, setSelectedTrigger] = React.useState<number>(0)
if (loading) {
return <LoadingSpinner visible={true} />
}
return ( return (
<> <>
<LoadingSpinner visible={loading} />
<Layout.Horizontal padding={'large'}> <Layout.Horizontal padding={'large'}>
<Layout.Vertical padding={'large'}> <Layout.Vertical padding={'large'}>
<NewTriggerModalButton <NewTriggerModalButton

View File

@ -52,7 +52,14 @@ export function RepositoryPageHeader({
{extraBreadcrumbLinks.map(link => ( {extraBreadcrumbLinks.map(link => (
<Fragment key={link.url}> <Fragment key={link.url}>
<Icon name="main-chevron-right" size={8} color={Color.GREY_500} /> <Icon name="main-chevron-right" size={8} color={Color.GREY_500} />
<Link to={link.url}>{link.label}</Link> {/* This allows for outer most entities to not necessarily be links */}
{link.url ? (
<Link to={link.url}>{link.label}</Link>
) : (
<Text font={{ variation: FontVariation.SMALL }} color={Color.GREY_500}>
{link.label}
</Text>
)}
</Fragment> </Fragment>
))} ))}
</Layout.Horizontal> </Layout.Horizontal>

View File

@ -61,7 +61,11 @@ const useRunPipelineModal = () => {
hideModal() hideModal()
}) })
.catch(error => { .catch(error => {
showError(getErrorMessage(error), 0, 'pipelines.executionCouldNotStart') const errorMssg = getErrorMessage(error)
const pipelineDoesNotExistOnGit = errorMssg === getString('pipelines.failedToFindPath')
pipelineDoesNotExistOnGit
? showError(`${getString('pipelines.executionCouldNotStart')}, ${errorMssg}.`)
: showError(getErrorMessage(error), 0, 'pipelines.executionCouldNotStart')
}) })
} catch (exception) { } catch (exception) {
showError(getErrorMessage(exception), 0, 'pipelines.executionCouldNotStart') showError(getErrorMessage(exception), 0, 'pipelines.executionCouldNotStart')

View File

@ -403,6 +403,7 @@ export interface StringsMap {
'pipelines.executionCouldNotStart': string 'pipelines.executionCouldNotStart': string
'pipelines.executionStarted': string 'pipelines.executionStarted': string
'pipelines.failedToCreatePipeline': string 'pipelines.failedToCreatePipeline': string
'pipelines.failedToFindPath': string
'pipelines.failedToUpdatePipeline': string 'pipelines.failedToUpdatePipeline': string
'pipelines.lastExecution': string 'pipelines.lastExecution': string
'pipelines.name': string 'pipelines.name': string
@ -561,6 +562,7 @@ export interface StringsMap {
searchBranches: string searchBranches: string
searchResult: string searchResult: string
secret: string secret: string
'secrets.create': string
'secrets.createSecret': string 'secrets.createSecret': string
'secrets.createSuccess': string 'secrets.createSuccess': string
'secrets.deleteSecret': string 'secrets.deleteSecret': string

View File

@ -650,7 +650,7 @@ pipelines:
created: Pipeline created successfully created: Pipeline created successfully
updated: Pipeline updated successfully updated: Pipeline updated successfully
executionStarted: Pipeline execution started successfully executionStarted: Pipeline execution started successfully
executionCouldNotStart: Failure while starting Pipeline execution executionCouldNotStart: Failure while starting pipeline execution
deletePipelineWarning: This will permanently delete the {{pipeline}} pipeline and all executions. deletePipelineWarning: This will permanently delete the {{pipeline}} pipeline and all executions.
deletePipelineButton: Delete pipeline deletePipelineButton: Delete pipeline
deletePipelineConfirm: Are you sure you want to delete the pipeline <strong>{{pipeline}}</strong>? You can't undo this action. deletePipelineConfirm: Are you sure you want to delete the pipeline <strong>{{pipeline}}</strong>? You can't undo this action.
@ -661,6 +661,7 @@ pipelines:
settings: Pipeline Settings settings: Pipeline Settings
executionCancelled: Pipeline execution cancelled. executionCancelled: Pipeline execution cancelled.
executionCouldNotCancel: Failure while cancelling Pipeline execution. executionCouldNotCancel: Failure while cancelling Pipeline execution.
failedToFindPath: failed to find path
executions: executions:
noData: There are no executions noData: There are no executions
newExecutionButton: Run Pipeline newExecutionButton: Run Pipeline
@ -676,6 +677,7 @@ allCommits: All Commits
secrets: secrets:
noData: There are no secrets noData: There are no secrets
newSecretButton: New Secret newSecretButton: New Secret
create: Create a secret
name: Secret Name name: Secret Name
failedToCreate: Failed to create Secret. Please try again. failedToCreate: Failed to create Secret. Please try again.
enterSecretName: Enter Secret name enterSecretName: Enter Secret name

View File

@ -1,21 +1,10 @@
import React, { useCallback, useEffect, useMemo, useState } from 'react' import React, { useCallback, useEffect, useMemo, useState } from 'react'
import { useGet, useMutate } from 'restful-react' import { useGet, useMutate } from 'restful-react'
import { Link, useParams } from 'react-router-dom' import { useParams } from 'react-router-dom'
import { get, isEmpty, isUndefined, set } from 'lodash-es' import { get, isEmpty, isUndefined, set } from 'lodash-es'
import { parse, stringify } from 'yaml' import { parse, stringify } from 'yaml'
import { Menu, PopoverPosition } from '@blueprintjs/core' import { Menu, PopoverPosition } from '@blueprintjs/core'
import { import { Container, PageBody, Layout, ButtonVariation, Text, useToaster, SplitButton, Button } from '@harnessio/uicore'
Container,
PageHeader,
PageBody,
Layout,
ButtonVariation,
Text,
useToaster,
SplitButton,
Button
} from '@harnessio/uicore'
import { Icon } from '@harnessio/icons'
import { Color, FontVariation } from '@harnessio/design-system' import { Color, FontVariation } from '@harnessio/design-system'
import type { OpenapiCommitFilesRequest, RepoCommitFilesResponse, RepoFileContent, TypesPipeline } from 'services/code' import type { OpenapiCommitFilesRequest, RepoCommitFilesResponse, RepoFileContent, TypesPipeline } from 'services/code'
import { useStrings } from 'framework/strings' import { useStrings } from 'framework/strings'
@ -34,6 +23,7 @@ import pipelineSchemaV0 from './schema/pipeline-schema-v0.json'
import { V1_SCHEMA_YAML_FILE_REGEX, YamlVersion } from './Constants' import { V1_SCHEMA_YAML_FILE_REGEX, YamlVersion } from './Constants'
import css from './AddUpdatePipeline.module.scss' import css from './AddUpdatePipeline.module.scss'
import { RepositoryPageHeader } from 'components/RepositoryPageHeader/RepositoryPageHeader'
const StarterPipelineV1: Record<string, any> = { const StarterPipelineV1: Record<string, any> = {
version: 1, version: 1,
@ -334,16 +324,25 @@ const AddUpdatePipeline = (): JSX.Element => {
return ( return (
<> <>
<Container className={css.main}> <Container className={css.main}>
<PageHeader <RepositoryPageHeader
title={getString('pipelines.editPipeline', { pipeline })} repoMetadata={repoMetadata}
breadcrumbs={ title={getString('pageTitle.executions')}
<Container className={css.header}> dataTooltipId="repositoryExecutions"
<Layout.Horizontal spacing="small" className={css.breadcrumb}> extraBreadcrumbLinks={
<Link to={routes.toCODEPipelines({ repoPath })}>{getString('pageTitle.pipelines')}</Link> repoMetadata && [
<Icon name="main-chevron-right" size={8} color={Color.GREY_500} /> {
<Text font={{ size: 'small' }}>{pipeline}</Text> label: getString('pageTitle.pipelines'),
</Layout.Horizontal> url: routes.toCODEPipelines({ repoPath: repoMetadata.path as string })
</Container> },
...(pipeline
? [
{
label: pipeline,
url: ''
}
]
: [])
]
} }
content={<Layout.Horizontal flex={{ justifyContent: 'space-between' }}>{renderCTA()}</Layout.Horizontal>} content={<Layout.Horizontal flex={{ justifyContent: 'space-between' }}>{renderCTA()}</Layout.Horizontal>}
/> />

View File

@ -55,7 +55,7 @@ const SecretList = () => {
const NewSecretButton = ( const NewSecretButton = (
<NewSecretModalButton <NewSecretModalButton
space={space} space={space}
modalTitle={getString('secrets.newSecretButton')} modalTitle={getString('secrets.create')}
text={getString('secrets.newSecretButton')} text={getString('secrets.newSecretButton')}
variation={ButtonVariation.PRIMARY} variation={ButtonVariation.PRIMARY}
icon="plus" icon="plus"