Search in sources :

Example 1 with RouterGridLink

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

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

the class ProjectsView method createNameComponent.

private HorizontalLayout createNameComponent(ProjectViewGridModel projectViewModel) {
    HorizontalLayout nameComponent = new HorizontalLayout();
    if (projectViewModel.expired) {
        final Icon warningIcon = TIME_BACKWARD.create();
        final Tooltip warningTooltip = new Tooltip(warningIcon, TooltipPosition.BOTTOM, TooltipAlignment.CENTER);
        warningTooltip.add(getTranslation("view.community-admin.projects.grid.column.1.expired.project.tooltip"));
        getContent().add(warningTooltip);
        nameComponent.add(warningIcon);
    }
    nameComponent.add(new RouterGridLink(projectViewModel.name, projectViewModel.id, ProjectView.class, PARAM_NAME, ADMINISTRATORS_PARAM));
    return nameComponent;
}
Also used : RouterGridLink(io.imunity.furms.ui.components.RouterGridLink) Tooltip(com.vaadin.componentfactory.Tooltip) Icon(com.vaadin.flow.component.icon.Icon) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

Example 3 with RouterGridLink

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

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

the class ProjectsView method createContextMenu.

private Component createContextMenu(String projectId, String projectName, String communityId) {
    GridActionMenu contextMenu = new GridActionMenu();
    Dialog confirmDialog = createConfirmDialog(projectId, projectName, communityId);
    contextMenu.addItem(new MenuButton(getTranslation("view.user-settings.projects.context.menu.leave"), MINUS_CIRCLE), event -> confirmDialog.open());
    MenuButton allocationComponent = new MenuButton(getTranslation("view.user-settings.projects.menu.allocations"), PIE_CHART);
    RouterLink allocationsPool = new RouterGridLink(allocationComponent, projectId, ProjectView.class);
    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) FurmsDialog(io.imunity.furms.ui.components.FurmsDialog) Dialog(com.vaadin.flow.component.dialog.Dialog) MenuButton(io.imunity.furms.ui.components.MenuButton)

Example 5 with RouterGridLink

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

the class ProjectsView method createLastColumnContent.

private HorizontalLayout createLastColumnContent(ProjectGridModel project) {
    switch(project.status) {
        case ACTIVE:
            return new GridActionsButtonLayout(new RouterGridLink(PIE_CHART, project.id, ProjectView.class), createContextMenu(project.id, project.name, project.communityId));
        case NOT_ACTIVE:
            MenuButton applyButton = new MenuButton(PLUS_CIRCLE);
            applyButton.addClickListener(x -> {
                try {
                    projectApplicationsService.createForCurrentUser(project.id);
                    showSuccessNotification(getTranslation("view.user-settings.projects.applied.notification", project.name));
                    loadGridContent();
                } catch (UserAlreadyInvitedException e) {
                    showErrorNotification(getTranslation("user.already.invited"));
                } catch (Exception e) {
                    showErrorNotification(getTranslation("base.error.message"));
                    throw e;
                }
            });
            return new GridActionsButtonLayout(addApplyTooltip(applyButton));
        case REQUESTED:
            MenuButton removeApplicationButton = new MenuButton(TRASH);
            removeApplicationButton.addClickListener(x -> {
                try {
                    projectApplicationsService.removeForCurrentUser(project.id);
                } catch (ApplicationNotExistingException e) {
                    showErrorNotification(getTranslation("application.already.not.existing"));
                } catch (Exception e) {
                    showErrorNotification(getTranslation("base.error.message"));
                    throw e;
                }
                loadGridContent();
            });
            return new GridActionsButtonLayout(removeApplicationButton);
        default:
            throw new RuntimeException("This should not happened");
    }
}
Also used : RouterGridLink(io.imunity.furms.ui.components.RouterGridLink) ApplicationNotExistingException(io.imunity.furms.api.validation.exceptions.ApplicationNotExistingException) GridActionsButtonLayout(io.imunity.furms.ui.components.GridActionsButtonLayout) MenuButton(io.imunity.furms.ui.components.MenuButton) UserAlreadyInvitedException(io.imunity.furms.api.validation.exceptions.UserAlreadyInvitedException) ApplicationNotExistingException(io.imunity.furms.api.validation.exceptions.ApplicationNotExistingException) UserAlreadyInvitedException(io.imunity.furms.api.validation.exceptions.UserAlreadyInvitedException)

Aggregations

RouterGridLink (io.imunity.furms.ui.components.RouterGridLink)5 MenuButton (io.imunity.furms.ui.components.MenuButton)4 GridActionMenu (io.imunity.furms.ui.components.GridActionMenu)3 Dialog (com.vaadin.flow.component.dialog.Dialog)2 RouterLink (com.vaadin.flow.router.RouterLink)2 FurmsDialog (io.imunity.furms.ui.components.FurmsDialog)2 GridActionsButtonLayout (io.imunity.furms.ui.components.GridActionsButtonLayout)2 Tooltip (com.vaadin.componentfactory.Tooltip)1 Icon (com.vaadin.flow.component.icon.Icon)1 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)1 ApplicationNotExistingException (io.imunity.furms.api.validation.exceptions.ApplicationNotExistingException)1 UserAlreadyInvitedException (io.imunity.furms.api.validation.exceptions.UserAlreadyInvitedException)1