Skip to content

Commit 30e7df3

Browse files
committed
Hide the "View as draft" option when a version is not in DRAFT status
1 parent 8a68961 commit 30e7df3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ui/ui-app/src/app/pages/artifact/components/versions/VersionsTable.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export const VersionsTable: FunctionComponent<VersionsTableProps> = (props: Vers
9797
const actionsFor = (version: SearchedVersion): (VersionAction | VersionActionSeparator)[] => {
9898
const vhash: number = shash(version.version!);
9999
return [
100-
{ label: "View as draft", onClick: () => props.onViewAsDraft(version), testId: `view-as-draft-${vhash}` },
100+
{ label: "View as draft", onClick: () => props.onViewAsDraft(version), testId: `view-as-draft-${vhash}`, isVisible: () => version.state === "DRAFT" },
101101
{ label: "View in Registry", onClick: () => props.onViewInRegistry(version), testId: `view-in-registry-${vhash}`, isVisible: isRegistryUIConfigured },
102102
{ label: "Create new draft", onClick: () => props.onCreateNewDraft(version), testId: `create-new-version-${vhash}` },
103103
];
@@ -159,6 +159,7 @@ export const VersionsTable: FunctionComponent<VersionsTableProps> = (props: Vers
159159
itemToString={item => item.label}
160160
itemToTestId={item => item.testId}
161161
itemIsDivider={item => item.isSeparator}
162+
itemIsVisible={item => item.isVisible ? item.isVisible() : true}
162163
onSelect={item => item.onClick()}
163164
testId={`version-actions-${shash(row.version!)}`}
164165
popperProps={{

0 commit comments

Comments
 (0)