Search in sources :

Example 1 with GridActionsButtonLayout

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

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

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

the class ResourceAccessView method getGridRefreshButtonLayout.

private Component getGridRefreshButtonLayout() {
    GridActionMenu contextMenu = new GridActionMenu();
    contextMenu.addItem(new MenuButton(getTranslation("view.project-admin.resource-access.grid.context-menu.refresh"), REFRESH), e -> 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 4 with GridActionsButtonLayout

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

the class SitesView method fillGrid.

private void fillGrid() {
    grid.addHierarchyColumn(model -> Optional.ofNullable(model.siteName).orElse("")).setHeader(getTranslation("view.project-admin.sites.grid.1")).setSortable(true).setFlexGrow(25);
    grid.addComponentColumn(model -> new StatusLayout(model.status, model.message, getContent())).setHeader(getTranslation("view.project-admin.sites.grid.2")).setSortable(true).setFlexGrow(6);
    grid.addColumn(model -> model.userName).setHeader(getTranslation("view.project-admin.sites.grid.3")).setSortable(true).setFlexGrow(25);
    grid.addColumn(model -> model.userEmail).setHeader(getTranslation("view.project-admin.sites.grid.4")).setSortable(true).setFlexGrow(25);
    grid.addColumn(model -> Optional.ofNullable(model.userAccessStatus).map(status -> status.status.isEnabled() ? getTranslation("view.project-admin.sites.enabled") : getTranslation("view.project-admin.sites.disabled")).orElse("")).setHeader(getTranslation("view.project-admin.sites.grid.5")).setSortable(true).setFlexGrow(25);
    grid.addComponentColumn(model -> Optional.ofNullable(model.userAccessStatus).map(status -> (Component) new StatusLayout(getTranslation("view.project-admin.sites." + status.status.name()), status.message, getContent())).orElse(new Div())).setHeader(getTranslation("view.project-admin.sites.grid.6")).setSortable(true).setFlexGrow(25);
    grid.addComponentColumn(resourceAccessModel -> {
        if (resourceAccessModel.userAccessStatus == null || resourceAccessModel.userAccessStatus.status.isPending()) {
            IconButton iconButton = new IconButton(REFRESH.create());
            iconButton.addClickListener(event -> loadGridContent());
            return iconButton;
        } else {
            GridActionMenu contextMenu = new GridActionMenu();
            if (resourceAccessModel.userAccessStatus.status.isInstalled()) {
                contextMenu.addItem(new MenuButton(getTranslation("view.project-admin.sites.revoke"), MINUS_CIRCLE), event -> {
                    userSiteAccessService.removeAccess(resourceAccessModel.siteId, projectId, resourceAccessModel.userId);
                    loadGridContent();
                });
            } else {
                contextMenu.addItem(new MenuButton(getTranslation("view.project-admin.sites.grant"), PLUS_CIRCLE), event -> {
                    userSiteAccessService.addAccess(resourceAccessModel.siteId, projectId, resourceAccessModel.userId);
                    loadGridContent();
                });
            }
            return new GridActionsButtonLayout(contextMenu.getTarget());
        }
    }).setHeader(getTranslation("view.project-admin.sites.grid.7")).setTextAlign(ColumnTextAlign.END);
    grid.addThemeVariants(GridVariant.LUMO_NO_BORDER);
    loadGridContent();
}
Also used : ResourceGetter.getCurrentResourceId(io.imunity.furms.ui.utils.ResourceGetter.getCurrentResourceId) UsersSitesAccesses(io.imunity.furms.domain.user_site_access.UsersSitesAccesses) Component(com.vaadin.flow.component.Component) IconButton(io.imunity.furms.ui.components.IconButton) Div(com.vaadin.flow.component.html.Div) MenuButton(io.imunity.furms.ui.components.MenuButton) PageTitle(io.imunity.furms.ui.components.PageTitle) Route(com.vaadin.flow.router.Route) PLUS_CIRCLE(com.vaadin.flow.component.icon.VaadinIcon.PLUS_CIRCLE) REFRESH(com.vaadin.flow.component.icon.VaadinIcon.REFRESH) FurmsViewComponent(io.imunity.furms.ui.components.FurmsViewComponent) Map(java.util.Map) ProjectInstallationsService(io.imunity.furms.api.project_installation.ProjectInstallationsService) DenseTreeGrid(io.imunity.furms.ui.views.project.resource_access.DenseTreeGrid) ProjectUpdateJobStatus(io.imunity.furms.domain.project_installation.ProjectUpdateJobStatus) MINUS_CIRCLE(com.vaadin.flow.component.icon.VaadinIcon.MINUS_CIRCLE) UserSiteAccessService(io.imunity.furms.api.user_site_access.UserSiteAccessService) ProjectAdminMenu(io.imunity.furms.ui.views.project.ProjectAdminMenu) GridVariant(com.vaadin.flow.component.grid.GridVariant) Set(java.util.Set) GridActionMenu(io.imunity.furms.ui.components.GridActionMenu) GridActionsButtonLayout(io.imunity.furms.ui.components.GridActionsButtonLayout) Collectors(java.util.stream.Collectors) TreeGrid(com.vaadin.flow.component.treegrid.TreeGrid) ColumnTextAlign(com.vaadin.flow.component.grid.ColumnTextAlign) StatusLayout(io.imunity.furms.ui.components.StatusLayout) Optional(java.util.Optional) ViewHeaderLayout(io.imunity.furms.ui.components.ViewHeaderLayout) Div(com.vaadin.flow.component.html.Div) IconButton(io.imunity.furms.ui.components.IconButton) GridActionMenu(io.imunity.furms.ui.components.GridActionMenu) GridActionsButtonLayout(io.imunity.furms.ui.components.GridActionsButtonLayout) StatusLayout(io.imunity.furms.ui.components.StatusLayout) MenuButton(io.imunity.furms.ui.components.MenuButton) Component(com.vaadin.flow.component.Component) FurmsViewComponent(io.imunity.furms.ui.components.FurmsViewComponent)

Example 5 with GridActionsButtonLayout

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

the class PendingRequestsView method createContextMenu.

private Component createContextMenu(PendingMessageGridModel model) {
    CorrelationId id = model.id;
    GridActionMenu contextMenu = new GridActionMenu();
    contextMenu.addItem(new MenuButton(getTranslation("view.site-admin.pending-requests.page.grid.context-menu.refresh"), REFRESH), event -> refreshDetails(model));
    Dialog retryConfirmDialog = createConfirmDialog(() -> siteAgentConnectionService.retry(siteId, id), getTranslation("view.site-admin.pending-requests.page.grid.dialog.retry.confirmation"));
    contextMenu.addItem(new MenuButton(getTranslation("view.site-admin.pending-requests.page.grid.context-menu.retry"), PLAY), event -> retryConfirmDialog.open());
    IconButton retryButton = new IconButton(PLAY.create());
    retryButton.addClickListener(event -> retryConfirmDialog.open());
    Dialog deleteConfirmDialog = createConfirmDialog(() -> siteAgentConnectionService.delete(siteId, id), getTranslation("view.site-admin.pending-requests.page.grid.dialog.delete.confirmation"));
    contextMenu.addItem(new MenuButton(getTranslation("view.site-admin.pending-requests.page.grid.context-menu.delete"), TRASH), event -> deleteConfirmDialog.open());
    GridActionsButtonLayout gridActionsButtonLayout = new GridActionsButtonLayout(retryButton, contextMenu.getTarget());
    gridActionsButtonLayout.setAlignItems(CENTER);
    return gridActionsButtonLayout;
}
Also used : IconButton(io.imunity.furms.ui.components.IconButton) GridActionMenu(io.imunity.furms.ui.components.GridActionMenu) Dialog(com.vaadin.flow.component.dialog.Dialog) FurmsDialog(io.imunity.furms.ui.components.FurmsDialog) GridActionsButtonLayout(io.imunity.furms.ui.components.GridActionsButtonLayout) MenuButton(io.imunity.furms.ui.components.MenuButton) CorrelationId(io.imunity.furms.domain.site_agent.CorrelationId)

Aggregations

GridActionsButtonLayout (io.imunity.furms.ui.components.GridActionsButtonLayout)6 MenuButton (io.imunity.furms.ui.components.MenuButton)6 GridActionMenu (io.imunity.furms.ui.components.GridActionMenu)5 IconButton (io.imunity.furms.ui.components.IconButton)2 RouterGridLink (io.imunity.furms.ui.components.RouterGridLink)2 Component (com.vaadin.flow.component.Component)1 Dialog (com.vaadin.flow.component.dialog.Dialog)1 ColumnTextAlign (com.vaadin.flow.component.grid.ColumnTextAlign)1 GridVariant (com.vaadin.flow.component.grid.GridVariant)1 Div (com.vaadin.flow.component.html.Div)1 MINUS_CIRCLE (com.vaadin.flow.component.icon.VaadinIcon.MINUS_CIRCLE)1 PLUS_CIRCLE (com.vaadin.flow.component.icon.VaadinIcon.PLUS_CIRCLE)1 REFRESH (com.vaadin.flow.component.icon.VaadinIcon.REFRESH)1 TreeGrid (com.vaadin.flow.component.treegrid.TreeGrid)1 Route (com.vaadin.flow.router.Route)1 ProjectInstallationsService (io.imunity.furms.api.project_installation.ProjectInstallationsService)1 UserSiteAccessService (io.imunity.furms.api.user_site_access.UserSiteAccessService)1 ApplicationNotExistingException (io.imunity.furms.api.validation.exceptions.ApplicationNotExistingException)1 UserAlreadyInvitedException (io.imunity.furms.api.validation.exceptions.UserAlreadyInvitedException)1 ProjectUpdateJobStatus (io.imunity.furms.domain.project_installation.ProjectUpdateJobStatus)1