Search in sources :

Example 1 with MenuButton

use of io.imunity.furms.ui.components.MenuButton 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 MenuButton

use of io.imunity.furms.ui.components.MenuButton 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 MenuButton

use of io.imunity.furms.ui.components.MenuButton 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 MenuButton

use of io.imunity.furms.ui.components.MenuButton 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 MenuButton

use of io.imunity.furms.ui.components.MenuButton 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

MenuButton (io.imunity.furms.ui.components.MenuButton)27 GridActionMenu (io.imunity.furms.ui.components.GridActionMenu)23 Dialog (com.vaadin.flow.component.dialog.Dialog)14 FurmsDialog (io.imunity.furms.ui.components.FurmsDialog)14 GridActionsButtonLayout (io.imunity.furms.ui.components.GridActionsButtonLayout)6 Route (com.vaadin.flow.router.Route)5 FurmsViewComponent (io.imunity.furms.ui.components.FurmsViewComponent)5 PageTitle (io.imunity.furms.ui.components.PageTitle)5 ViewHeaderLayout (io.imunity.furms.ui.components.ViewHeaderLayout)5 Collectors (java.util.stream.Collectors)5 NotificationUtils.showErrorNotification (io.imunity.furms.ui.utils.NotificationUtils.showErrorNotification)4 ResourceGetter.getCurrentResourceId (io.imunity.furms.ui.utils.ResourceGetter.getCurrentResourceId)4 Optional (java.util.Optional)4 Component (com.vaadin.flow.component.Component)3 CHECK_CIRCLE (com.vaadin.flow.component.icon.VaadinIcon.CHECK_CIRCLE)3 RouterGridLink (io.imunity.furms.ui.components.RouterGridLink)3 UserContextMenuFactory (io.imunity.furms.ui.components.administrators.UserContextMenuFactory)3 UserGrid (io.imunity.furms.ui.components.administrators.UserGrid)3 UsersGridComponent (io.imunity.furms.ui.components.administrators.UsersGridComponent)3 MethodHandles (java.lang.invoke.MethodHandles)3