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