import classNames from 'classnames'; import React from 'react'; import { SETTINGS } from '../../config/settings'; import type { IPipelineTemplate } from '../config/templates/PipelineTemplateReader'; import type { IPipelineTemplateV2 } from '../../domain/IPipelineTemplateV2'; import { Spinner } from '../../widgets/spinners/Spinner'; import './TemplateDescription.less'; export interface ITemplateDescriptionProps { template: IPipelineTemplate | IPipelineTemplateV2; loading: boolean; loadingError: boolean; } export class TemplateDescription extends React.Component { private isV1Template(template: IPipelineTemplate | IPipelineTemplateV2): template is IPipelineTemplate { return template.schema === '1'; } public render() { const { loading, loadingError, template } = this.props; return (
{loading && (
)} {template && (
{template.metadata.name} {this.isV1Template(template) && template.selfLink && (

{template.selfLink}

)} {template.metadata.owner &&

{template.metadata.owner}

}

{template.metadata.description || 'No template description provided.'}

)} {loadingError && (

There was an error loading the template.

)}
); } private buildTemplateResolutionLink(templateLink: string): string { return `${SETTINGS.gateUrl}/pipelineTemplates/resolve?source=${templateLink}`; } }