fix(research): preserve strategy work before backtest handoff (RP09)
This commit is contained in:
parent
c24410e5dd
commit
49da701aa7
5 changed files with 258 additions and 7 deletions
|
|
@ -60,6 +60,7 @@ function StrategyDetail({ strategyId, versionId }: { strategyId: string; version
|
|||
parameterEdits ||
|
||||
publicationDirty ||
|
||||
(cloneOpen && Boolean(cloneName || cloneDescription));
|
||||
const handoffBlocked = publicationDirty || cloneOpen || cloning || cloneFrozen;
|
||||
useUnsavedWarning(dirty);
|
||||
useEffect(() => {
|
||||
mounted.current = true;
|
||||
|
|
@ -207,6 +208,7 @@ function StrategyDetail({ strategyId, versionId }: { strategyId: string; version
|
|||
parentVersionId={versionId ?? null}
|
||||
disabled={
|
||||
strategy.archived ||
|
||||
cloneOpen ||
|
||||
cloning ||
|
||||
cloneFrozen ||
|
||||
versionLoading ||
|
||||
|
|
@ -303,8 +305,11 @@ function StrategyDetail({ strategyId, versionId }: { strategyId: string; version
|
|||
/>
|
||||
<button
|
||||
className={actionClass}
|
||||
disabled={!validParameters || strategy.archived}
|
||||
disabled={!validParameters || strategy.archived || handoffBlocked}
|
||||
onClick={() => {
|
||||
if (!validParameters || strategy.archived || handoffBlocked) {
|
||||
return;
|
||||
}
|
||||
if (confirmDiscard(metadataDirty)) {
|
||||
navigate(`/backtests?strategyVersionId=${version.id}`, {
|
||||
state: { strategyParameters: parameters },
|
||||
|
|
@ -314,6 +319,13 @@ function StrategyDetail({ strategyId, versionId }: { strategyId: string; version
|
|||
>
|
||||
Use in backtest
|
||||
</button>
|
||||
{handoffBlocked && (
|
||||
<p role="status" className="text-sm text-text-secondary">
|
||||
Finish or retry the publication or clone before using this version in a
|
||||
backtest. Clear an unpublished package or discard the clone to continue without
|
||||
it.
|
||||
</p>
|
||||
)}
|
||||
{strategy.archived && (
|
||||
<p className="text-sm text-text-secondary">
|
||||
Restore this family before selecting its versions for a new backtest.
|
||||
|
|
@ -321,8 +333,11 @@ function StrategyDetail({ strategyId, versionId }: { strategyId: string; version
|
|||
)}
|
||||
<button
|
||||
className={actionClass}
|
||||
disabled={cloneOpen}
|
||||
disabled={cloneOpen || publicationDirty}
|
||||
onClick={() => {
|
||||
if (cloneOpen || publicationDirty) {
|
||||
return;
|
||||
}
|
||||
setCloneOpen(true);
|
||||
setCloneName(`${strategy.name} (copy)`);
|
||||
setCloneDescription(strategy.description);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue