import { cloneDeep } from 'lodash'; import React from 'react'; import { ArtifactEditor } from '../ArtifactEditor'; import { ArtifactTypePatterns } from '../../../../../artifact/ArtifactTypes'; import type { IArtifactEditorProps, IArtifactKindConfig } from '../../../../../domain'; import { singleFieldArtifactEditor } from '../singleFieldArtifactEditor'; import { StageConfigField } from '../../../stages/common'; import { SpelText } from '../../../../../widgets/spelText/SpelText'; const TYPE = 'bitbucket/file'; export const BitbucketMatch: IArtifactKindConfig = { label: 'Bitbucket', typePattern: ArtifactTypePatterns.BITBUCKET_FILE, type: TYPE, description: 'A file stored in git, hosted by Bitbucket.', key: 'bitbucket', isDefault: false, isMatch: true, editCmp: singleFieldArtifactEditor( 'name', TYPE, 'File path', 'manifests/frontend.yaml', 'pipeline.config.expectedArtifact.git.name', ), }; export const BitbucketDefault: IArtifactKindConfig = { label: 'Bitbucket', typePattern: ArtifactTypePatterns.BITBUCKET_FILE, type: TYPE, description: 'A file stored in git, hosted by Bitbucket.', key: 'default.bitbucket', isDefault: true, isMatch: false, editCmp: class extends ArtifactEditor { constructor(props: IArtifactEditorProps) { super(props, TYPE); } private onReferenceChanged = (reference: string) => { const clonedArtifact = cloneDeep(this.props.artifact); clonedArtifact.reference = reference; this.props.onChange(clonedArtifact); }; private onFilePathChanged = (name: string) => { const clonedArtifact = cloneDeep(this.props.artifact); clonedArtifact.name = name; this.props.onChange(clonedArtifact); }; public render() { return ( <> ); } }, };