Skip to content

Commit

Permalink
Only show clone button when user has clone or request clone
Browse files Browse the repository at this point in the history
capabilities for a dataset

Fixes #274
  • Loading branch information
nyalldawson committed Sep 14, 2023
1 parent f54d0a8 commit 350c241
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions koordinates/api/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class UserDatasetCapability(Enum):
"""
Star = 0
Clone = 1
RequestClone = 2


class DataType(Enum):
Expand Down
3 changes: 2 additions & 1 deletion koordinates/api/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def user_capabilities(self) -> Set[UserDatasetCapability]:

for capability_string, capability_flag in {
'can-star': UserDatasetCapability.Star,
'can-clone': UserDatasetCapability.Clone
'can-clone': UserDatasetCapability.Clone,
'can-request-clone': UserDatasetCapability.RequestClone
}.items():
if capability_string in self.definition.get(
'user_capabilities', []
Expand Down
3 changes: 2 additions & 1 deletion koordinates/gui/dataset_browser_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,8 @@ def __init__(self,
"""
self.setStyleSheet(base_style)

if Capability.Clone in self.dataset.capabilities:
if (Capability.Clone in self.dataset.capabilities
or Capability.RequestClone in self.dataset.capabilities):
self.btnClone = CloneButton(self.dataset)
buttons_layout.addWidget(self.btnClone)
else:
Expand Down
3 changes: 2 additions & 1 deletion koordinates/gui/dataset_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ def __init__(self, parent, dataset: Dataset):
self.star_button = StarButton(self.dataset)
title_hl.addWidget(self.star_button)

if Capability.Clone in self.dataset.capabilities:
if (Capability.Clone in self.dataset.capabilities
or Capability.RequestClone in self.dataset.capabilities):
self.clone_button = CloneButton(self.dataset,
close_parent_on_clone=True)
title_hl.addWidget(self.clone_button)
Expand Down

0 comments on commit 350c241

Please sign in to comment.