import React from 'react'; import { ArtifactIconService } from '../../artifact'; import type { IArtifact } from '../../domain'; import './artifact.less'; export interface IArtifactProps { artifact: IArtifact; isDefault?: boolean; sequence?: number; } export class Artifact extends React.Component { private tooltip(artifact: IArtifact, isDefault: boolean): string { const tooltipEntries = []; if (isDefault) { tooltipEntries.push('Default Artifact'); } if (artifact.name) { tooltipEntries.push(`Name: ${artifact.name}`); } if (artifact.type) { tooltipEntries.push(`Type: ${artifact.type}`); } if (artifact.version) { tooltipEntries.push(`Version: ${artifact.version}`); } if (artifact.reference) { tooltipEntries.push(`Reference: ${artifact.reference}`); } return tooltipEntries.join('\n'); } public render() { const { artifact, isDefault } = this.props; const { name, reference, version, type } = artifact; return (
{ArtifactIconService.getPath(type) ? ( ) : ( [{type}] )}
{name || reference}
{version &&
- {version}
}
); } }