import { get } from 'lodash'; import React from 'react'; import { Dropdown } from 'react-bootstrap'; import type { Application } from '../../application'; import { CreatePipelineButton } from '../create/CreatePipelineButton'; import type { IPipeline } from '../../domain'; import { Tooltip } from '../../presentation/Tooltip'; import { ReactInjector } from '../../reactShims'; import { logger } from '../../utils'; export interface ICreatePipelineProps { application: Application; } export class CreatePipeline extends React.Component { private dropdownToggled = (): void => { logger.log({ category: 'Pipelines', action: 'Configure (top level)' }); }; public render() { const { application } = this.props; const pipelineConfigs = get(application, 'pipelineConfigs.data', []); const hasPipelineConfigs = pipelineConfigs.length > 0; const hasStrategyConfigs = get(application, 'strategyConfigs.data', []).length > 0; const header = !(hasPipelineConfigs || hasStrategyConfigs) ? (
  • None yet, click Create
  • ) : hasPipelineConfigs ? (
  • PIPELINES
  • ) : hasStrategyConfigs ? (
  • DEPLOYMENT STRATEGIES
  • ) : null; return ( Configure {header} {pipelineConfigs.map((pipeline: IPipeline) => ( ))} {hasStrategyConfigs && application.strategyConfigs.data.map((pipeline: any) => ( ))} ); } } const Pipeline = (props: { pipeline: any; type: 'pipeline' | 'strategy' }): JSX.Element => { const clicked = () => { logger.log({ category: 'Pipelines', action: `Configure ${props.type} (via top level)` }); const { $state } = ReactInjector; if (!$state.current.name.includes('.executions.execution')) { $state.go('^.pipelineConfig', { pipelineId: props.pipeline.id }); } else { $state.go('^.^.pipelineConfig', { pipelineId: props.pipeline.id }); } }; return (
  • {props.pipeline.name} {props.pipeline.disabled && props.type === 'pipeline' && (disabled)}
  • ); };