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));
}
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());
}
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());
}
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();
}
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;
}
Aggregations