Fix "Set as Active" button's display for replicas

Previously "Set as Active" button was displayed during replicas in
transitional states such as deleting or replication change which
is fixed with this patch.

Closes-Bug:  #1624425
Change-Id: I32ecf22ce1df0a752d0e66f989ad15fd776e4175
This commit is contained in:
Hassan Asghar 2023-02-10 18:08:21 +00:00
parent d3944f84d1
commit 6a2597007c
2 changed files with 7 additions and 1 deletions

3
manila_ui/dashboards/project/shares/replicas/tables.py Normal file → Executable file
View File

@ -64,7 +64,8 @@ class SetReplicaAsActive(tables.LinkAction):
policy_rules = (("share_replica", "share_replica:promote"),)
def allowed(self, request, replica=None):
return replica.replica_state == "in_sync"
return (replica.status == "available" and
replica.replica_state == "in_sync")
def get_policy_target(self, request, datum=None):
return {"project_id": getattr(datum, "project_id", None)}

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Visibility of Set as Active button for replicas in transitional states
such as Deleting and Replication Change is now fixed.