Search in sources :

Example 1 with GridActionMenu

use of io.imunity.furms.ui.components.GridActionMenu in project furms by unity-idm.

the class ProjectsView method createContextMenu.

private Component createContextMenu(String projectId, String projectName, String communityId) {
    GridActionMenu contextMenu = new GridActionMenu();
    if (projectService.isProjectInTerminalState(communityId, projectId)) {
        contextMenu.addItem(new MenuButton(getTranslation("view.community-admin.projects.menu.edit"), EDIT), event -> UI.getCurrent().navigate(ProjectFormView.class, projectId));
        Dialog confirmDialog = createConfirmDialog(projectId, projectName, communityId);
        contextMenu.addItem(new MenuButton(getTranslation("view.community-admin.projects.menu.delete"), TRASH), event -> confirmDialog.open());
    }
    MenuButton adminComponent = new MenuButton(getTranslation("view.community-admin.projects.menu.administrators"), USERS);
    RouterLink administratorsPool = new RouterGridLink(adminComponent, projectId, ProjectView.class, PARAM_NAME, ADMINISTRATORS_PARAM);
    contextMenu.addItem(administratorsPool);
    MenuButton allocationComponent = new MenuButton(getTranslation("view.community-admin.projects.menu.allocations"), PIE_CHART);
    RouterLink allocationsPool = new RouterGridLink(allocationComponent, projectId, ProjectView.class, PARAM_NAME, ALLOCATIONS_PARAM);
    contextMenu.addItem(allocationsPool);
    getContent().add(contextMenu);
    return contextMenu.getTarget();
}
Also used : RouterLink(com.vaadin.flow.router.RouterLink) RouterGridLink(io.imunity.furms.ui.components.RouterGridLink) GridActionMenu(io.imunity.furms.ui.components.GridActionMenu) Dialog(com.vaadin.flow.component.dialog.Dialog) FurmsDialog(io.imunity.furms.ui.components.FurmsDialog) MenuButton(io.imunity.furms.ui.components.MenuButton)

Example 2 with GridActionMenu

use of io.imunity.furms.ui.components.GridActionMenu in project furms by unity-idm.

the class ProjectsView method createLastColumnContent.

private HorizontalLayout createLastColumnContent(ProjectViewGridModel projectViewModel) {
    if (projectViewModel.communityId == null) {
        GridActionMenu contextMenu = new GridActionMenu();
        contextMenu.addItem(new MenuButton(getTranslation("view.community-admin.projects.menu.refresh"), REFRESH), event -> loadGridContent());
        return new GridActionsButtonLayout(contextMenu.getTarget());
    }
    return new GridActionsButtonLayout(new RouterGridLink(USERS, projectViewModel.projectId, ProjectView.class, PARAM_NAME, ADMINISTRATORS_PARAM), new RouterGridLink(PIE_CHART, projectViewModel.projectId, ProjectView.class, PARAM_NAME, ALLOCATIONS_PARAM), createContextMenu(projectViewModel.projectId, projectViewModel.name, projectViewModel.communityId));
}
Also used : RouterGridLink(io.imunity.furms.ui.components.RouterGridLink) GridActionMenu(io.imunity.furms.ui.components.GridActionMenu) GridActionsButtonLayout(io.imunity.furms.ui.components.GridActionsButtonLayout) MenuButton(io.imunity.furms.ui.components.MenuButton)

Example 3 with GridActionMenu

use of io.imunity.furms.ui.components.GridActionMenu in project furms by unity-idm.

the class ProjectAllocationComponent method createContextMenu.

private Component createContextMenu(ProjectAllocationGridModel model) {
    GridActionMenu contextMenu = new GridActionMenu();
    if (hasTerminalStatus(model)) {
        contextMenu.addItem(new MenuButton(getTranslation("view.community-admin.project-allocation.menu.edit"), EDIT), event -> UI.getCurrent().navigate(ProjectAllocationFormView.class, model.id));
    }
    Dialog confirmDialog = createConfirmDialog(model.id, model.name);
    final MenuItem deleteItem = contextMenu.addItem(new MenuButton(getTranslation("view.community-admin.project-allocation.menu.delete"), TRASH), event -> confirmDialog.open());
    deleteItem.setEnabled(projectInTerminalState && !projectExpired);
    getRefreshMenuItem(contextMenu);
    getContent().add(contextMenu);
    return contextMenu.getTarget();
}
Also used : GridActionMenu(io.imunity.furms.ui.components.GridActionMenu) FurmsDialog(io.imunity.furms.ui.components.FurmsDialog) Dialog(com.vaadin.flow.component.dialog.Dialog) MenuButton(io.imunity.furms.ui.components.MenuButton) MenuItem(com.vaadin.flow.component.contextmenu.MenuItem)

Example 4 with GridActionMenu

use of io.imunity.furms.ui.components.GridActionMenu in project furms by unity-idm.

the class ResourceAccessView method getGridActionsButtonLayout.

private GridActionsButtonLayout getGridActionsButtonLayout(ResourceAccessModel resourceAccessModel) {
    GridActionMenu contextMenu = new GridActionMenu();
    if (resourceAccessViewService.isRevokeAvailable(resourceAccessModel)) {
        contextMenu.addItem(new MenuButton(getTranslation("view.project-admin.resource-access.grid.context-menu.revoke"), MINUS_CIRCLE), event -> {
            resourceAccessViewService.revokeAccess(resourceAccessModel);
            reloadGrid();
        });
    } else {
        contextMenu.addItem(new MenuButton(getTranslation("view.project-admin.resource-access.grid.context-menu.grant"), PLUS_CIRCLE), event -> {
            resourceAccessViewService.grantAccess(resourceAccessModel);
            reloadGrid();
        });
    }
    return new GridActionsButtonLayout(contextMenu.getTarget());
}
Also used : GridActionMenu(io.imunity.furms.ui.components.GridActionMenu) GridActionsButtonLayout(io.imunity.furms.ui.components.GridActionsButtonLayout) MenuButton(io.imunity.furms.ui.components.MenuButton)

Example 5 with GridActionMenu

use of io.imunity.furms.ui.components.GridActionMenu in project furms by unity-idm.

the class CommunityAllocationComponent method createContextMenu.

private Component createContextMenu(String CommunityAllocationId, String CommunityAllocation) {
    GridActionMenu contextMenu = new GridActionMenu();
    contextMenu.addItem(new MenuButton(getTranslation("view.fenix-admin.resource-credits-allocation.menu.edit"), EDIT), event -> UI.getCurrent().navigate(CommunityAllocationFormView.class, CommunityAllocationId));
    Dialog confirmDialog = createConfirmDialog(CommunityAllocationId, CommunityAllocation);
    contextMenu.addItem(new MenuButton(getTranslation("view.fenix-admin.resource-credits-allocation.menu.delete"), TRASH), event -> confirmDialog.open());
    getContent().add(contextMenu);
    return contextMenu.getTarget();
}
Also used : GridActionMenu(io.imunity.furms.ui.components.GridActionMenu) FurmsDialog(io.imunity.furms.ui.components.FurmsDialog) Dialog(com.vaadin.flow.component.dialog.Dialog) MenuButton(io.imunity.furms.ui.components.MenuButton)

Aggregations

GridActionMenu (io.imunity.furms.ui.components.GridActionMenu)24 MenuButton (io.imunity.furms.ui.components.MenuButton)24 FurmsDialog (io.imunity.furms.ui.components.FurmsDialog)15 Dialog (com.vaadin.flow.component.dialog.Dialog)14 GridActionsButtonLayout (io.imunity.furms.ui.components.GridActionsButtonLayout)5 Component (com.vaadin.flow.component.Component)4 Div (com.vaadin.flow.component.html.Div)3 FurmsViewComponent (io.imunity.furms.ui.components.FurmsViewComponent)3 RouterGridLink (io.imunity.furms.ui.components.RouterGridLink)3 ColumnTextAlign (com.vaadin.flow.component.grid.ColumnTextAlign)2 Label (com.vaadin.flow.component.html.Label)2 MINUS_CIRCLE (com.vaadin.flow.component.icon.VaadinIcon.MINUS_CIRCLE)2 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)2 Route (com.vaadin.flow.router.Route)2 RouterLink (com.vaadin.flow.router.RouterLink)2 InvitationNotExistingException (io.imunity.furms.api.validation.exceptions.InvitationNotExistingException)2 InvitationId (io.imunity.furms.domain.invitations.InvitationId)2 IconButton (io.imunity.furms.ui.components.IconButton)2 PageTitle (io.imunity.furms.ui.components.PageTitle)2 ViewHeaderLayout (io.imunity.furms.ui.components.ViewHeaderLayout)2