<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> <img width="540" alt="Screenshot 2024-07-03 at 5 29 12 PM" src="https://github.com/nrwl/nx/assets/16211801/bed98c56-3bd5-4170-893b-cefe5fe292f9"> <img width="1195" alt="Screenshot 2024-07-03 at 5 29 03 PM" src="https://github.com/nrwl/nx/assets/16211801/544a4c4e-299f-40fc-a767-215d9c758dd8"> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
69 lines
1.8 KiB
TypeScript
69 lines
1.8 KiB
TypeScript
import { PropertyInfoTooltip, Tooltip } from '@nx/graph/ui-tooltips';
|
|
import { CopyToClipboardButton } from '@nx/graph/ui-components';
|
|
import { TooltipTriggerText } from '../target-configuration-details/tooltip-trigger-text';
|
|
|
|
export function TargetExecutorTitle({
|
|
commands,
|
|
command,
|
|
script,
|
|
executor,
|
|
}: {
|
|
commands?: string[];
|
|
command?: string;
|
|
script?: string;
|
|
executor?: string;
|
|
}) {
|
|
if (commands && commands.length) {
|
|
return (
|
|
<span className="font-medium">
|
|
Commands
|
|
<span className="mb-1 ml-2 hidden group-hover:inline">
|
|
<CopyToClipboardButton
|
|
text={`"commands": [${commands.map((c) => `"${c}"`).join(', ')}]`}
|
|
tooltipText="Copy Commands"
|
|
/>
|
|
</span>
|
|
</span>
|
|
);
|
|
}
|
|
if (command) {
|
|
return (
|
|
<span className="font-medium">
|
|
Command
|
|
<span className="mb-1 ml-2 hidden group-hover:inline">
|
|
<CopyToClipboardButton
|
|
text={`"command": "${command}"`}
|
|
tooltipText="Copy Command"
|
|
/>
|
|
</span>
|
|
</span>
|
|
);
|
|
}
|
|
if (script) {
|
|
return (
|
|
<span className="font-medium">
|
|
Script
|
|
<span className="mb-1 ml-2 hidden group-hover:inline">
|
|
<CopyToClipboardButton text={script} tooltipText="Copy Script" />
|
|
</span>
|
|
</span>
|
|
);
|
|
}
|
|
return (
|
|
<Tooltip
|
|
openAction="hover"
|
|
content={(<PropertyInfoTooltip type="executors" />) as any}
|
|
>
|
|
<span className="font-medium">
|
|
<TooltipTriggerText>Executor</TooltipTriggerText>
|
|
<span className="mb-1 ml-2 hidden group-hover:inline">
|
|
<CopyToClipboardButton
|
|
text={executor ?? ''}
|
|
tooltipText="Copy Executor"
|
|
/>
|
|
</span>
|
|
</span>
|
|
</Tooltip>
|
|
);
|
|
}
|