Skip to content

Commit

Permalink
Replace legacy grid with grid list component in client router
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Dec 2, 2023
1 parent 7b65a63 commit 668b4d4
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions client/src/components/Grid/configs/adminGroups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const fields: FieldArray = [
type: "operations",
operations: [
{
title: "Edit Name/Description",
title: "Edit Name",
icon: faEdit,
condition: (data: GroupEntry) => !data.deleted,
handler: (data: GroupEntry) => {
Expand All @@ -67,7 +67,7 @@ const fields: FieldArray = [
icon: faKey,
condition: (data: GroupEntry) => !data.deleted,
handler: (data: GroupEntry) => {
emit(`/admin/form/manage_users_and_groups_for_role?id=${data.id}`);
emit(`/admin/form/manage_users_and_roles_for_group?id=${data.id}`);
},
},
{
Expand Down
5 changes: 3 additions & 2 deletions client/src/entry/analysis/routes/admin-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import NotificationsManagement from "components/admin/Notifications/Notification
import ResetMetadata from "components/admin/ResetMetadata";
import SanitizeAllow from "components/admin/SanitizeAllow";
import FormGeneric from "components/Form/FormGeneric";
import adminGroupsGridConfig from "components/Grid/configs/adminGroups";
import adminRolesGridConfig from "components/Grid/configs/adminRoles";
import adminUsersGridConfig from "components/Grid/configs/adminUsers";
import Grid from "components/Grid/Grid";
Expand Down Expand Up @@ -135,9 +136,9 @@ export default [
},
{
path: "groups",
component: Grid,
component: GridList,
props: {
urlBase: "admin/groups_list",
gridConfig: adminGroupsGridConfig,
},
},
{
Expand Down
9 changes: 5 additions & 4 deletions lib/galaxy/managers/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Conflict,
ObjectAttributeMissingException,
ObjectNotFound,
RequestParameterInvalidException,
)
from galaxy.managers.context import ProvidesAppContext
from galaxy.managers.roles import get_roles_by_ids
Expand Down Expand Up @@ -111,8 +112,8 @@ def delete(self, trans: ProvidesAppContext, group_id: int):
def purge(self, trans: ProvidesAppContext, group_id: int):
group = self._get_group(trans.sa_session, group_id)
if not group.deleted:
raise galaxy.exceptions.RequestParameterInvalidException(
f"Group '{groups.name}' has not been deleted, so it cannot be purged."
raise RequestParameterInvalidException(
f"Group '{group.name}' has not been deleted, so it cannot be purged."
)
# Delete UserGroupAssociations
for uga in group.users:
Expand All @@ -126,8 +127,8 @@ def purge(self, trans: ProvidesAppContext, group_id: int):
def undelete(self, trans: ProvidesAppContext, group_id: int):
group = self._get_group(trans.sa_session, group_id)
if not group.deleted:
raise galaxy.exceptions.RequestParameterInvalidException(
f"Group '{groups.name}' has not been deleted, so it cannot be undeleted."
raise RequestParameterInvalidException(
f"Group '{group.name}' has not been deleted, so it cannot be undeleted."
)
group.deleted = False
trans.sa_session.add(group)
Expand Down
9 changes: 3 additions & 6 deletions lib/galaxy/webapps/galaxy/api/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,12 @@ def update(

@router.delete("/api/groups/{id}", require_admin=True)
def delete(self, id: DecodedDatabaseIdField, trans: ProvidesAppContext = DependsOnTrans):
group = self.manager.get(trans, id)
self.manager.delete(trans, group)
self.manager.delete(trans, id)

@router.post("/api/groups/{id}/purge", require_admin=True)
def purge(self, id: DecodedDatabaseIdField, trans: ProvidesAppContext = DependsOnTrans):
group = self.manager.get(trans, id)
self.manager.purge(trans, group)
self.manager.purge(trans, id)

@router.post("/api/groups/{id}/undelete", require_admin=True)
def undelete(self, id: DecodedDatabaseIdField, trans: ProvidesAppContext = DependsOnTrans):
group = self.manager.get(trans, id)
self.manager.undelete(trans, group)
self.manager.undelete(trans, id)
2 changes: 1 addition & 1 deletion lib/galaxy/webapps/galaxy/controllers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def get_value(self, trans, grid, group):
UsersColumn("Users", key="users"),
RolesColumn("Roles", key="roles"),
grids.DeletedColumn("Deleted", key="deleted", escape=False),
grids.GridColumn("Last Updated", key="update_time", format=pretty_print_time_interval),
grids.GridColumn("Last Updated", key="update_time"),
]

def apply_query_filter(self, query, **kwargs):
Expand Down

0 comments on commit 668b4d4

Please sign in to comment.