Search in sources :

Example 1 with ViewHeaderLayout

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

the class SitesAdminsView method init.

private void init(String siteId) {
    InviteUserComponent inviteUser = new InviteUserComponent(userService::getAllUsers, () -> siteService.findAllAdministrators(siteId));
    MembershipChangerComponent membershipLayout = new MembershipChangerComponent(getTranslation("view.fenix-admin.sites.button.join"), getTranslation("view.fenix-admin.sites.button.demit"), () -> siteService.isCurrentUserAdminOf(siteId));
    membershipLayout.addJoinButtonListener(event -> {
        siteService.addAdmin(siteId, currentUserId);
        gridReload();
        inviteUser.reload();
    });
    membershipLayout.addDemitButtonListener(event -> {
        if (siteService.findAllAdministrators(siteId).size() > 1) {
            handleExceptions(() -> siteService.removeSiteUser(siteId, currentUserId));
            gridReload();
        } else {
            showErrorNotification(getTranslation("component.administrators.error.validation.remove"));
        }
        inviteUser.reload();
        membershipLayout.loadAppropriateButton();
    });
    inviteUser.addInviteAction(event -> doInviteAction(siteId, inviteUser, membershipLayout));
    UserContextMenuFactory userContextMenuFactory = UserContextMenuFactory.builder().withCurrentUserId(currentUserId).withRemoveUserAction(userId -> siteService.removeSiteUser(siteId, userId)).withPostRemoveUserAction(userId -> {
        membershipLayout.loadAppropriateButton();
        inviteUser.reload();
    }).withRemoveInvitationAction(invitationId -> {
        siteService.removeInvitation(siteId, invitationId);
        gridReload();
    }).withResendInvitationAction(invitationId -> {
        siteService.resendInvitation(siteId, invitationId);
        gridReload();
    }).build();
    UserGrid.Builder userGrid = UserGrid.defaultInit(userContextMenuFactory);
    grid = UsersGridComponent.defaultInit(() -> siteService.findAllAdministrators(siteId), () -> siteService.findSiteAdminInvitations(siteId), userGrid);
    Site site = handleExceptions(() -> siteService.findById(siteId)).flatMap(identity()).orElseThrow(IllegalStateException::new);
    ViewHeaderLayout viewHeaderLayout = new ViewHeaderLayout(getTranslation("view.sites.administrators.title", site.getName()), membershipLayout);
    getContent().add(viewHeaderLayout, inviteUser, grid);
}
Also used : VaadinExceptionHandler.handleExceptions(io.imunity.furms.ui.utils.VaadinExceptionHandler.handleExceptions) NotificationUtils.showErrorNotification(io.imunity.furms.ui.utils.NotificationUtils.showErrorNotification) UserContextMenuFactory(io.imunity.furms.ui.components.administrators.UserContextMenuFactory) LoggerFactory(org.slf4j.LoggerFactory) PageTitle(io.imunity.furms.ui.components.PageTitle) BeforeEvent(com.vaadin.flow.router.BeforeEvent) Route(com.vaadin.flow.router.Route) MembershipChangerComponent(io.imunity.furms.ui.components.MembershipChangerComponent) DuplicatedInvitationError(io.imunity.furms.api.validation.exceptions.DuplicatedInvitationError) UserGrid(io.imunity.furms.ui.components.administrators.UserGrid) FurmsViewComponent(io.imunity.furms.ui.components.FurmsViewComponent) SiteService(io.imunity.furms.api.sites.SiteService) UserService(io.imunity.furms.api.users.UserService) UsersGridComponent(io.imunity.furms.ui.components.administrators.UsersGridComponent) PersistentId(io.imunity.furms.domain.users.PersistentId) Logger(org.slf4j.Logger) MethodHandles(java.lang.invoke.MethodHandles) Site(io.imunity.furms.domain.sites.Site) BreadCrumbParameter(io.imunity.furms.ui.components.layout.BreadCrumbParameter) OptionalParameter(com.vaadin.flow.router.OptionalParameter) FenixAdminMenu(io.imunity.furms.ui.views.fenix.menu.FenixAdminMenu) UserAlreadyHasRoleError(io.imunity.furms.api.validation.exceptions.UserAlreadyHasRoleError) AuthzService(io.imunity.furms.api.authz.AuthzService) InviteUserComponent(io.imunity.furms.ui.components.InviteUserComponent) Function.identity(java.util.function.Function.identity) Optional(java.util.Optional) ViewHeaderLayout(io.imunity.furms.ui.components.ViewHeaderLayout) Site(io.imunity.furms.domain.sites.Site) UserGrid(io.imunity.furms.ui.components.administrators.UserGrid) MembershipChangerComponent(io.imunity.furms.ui.components.MembershipChangerComponent) ViewHeaderLayout(io.imunity.furms.ui.components.ViewHeaderLayout) InviteUserComponent(io.imunity.furms.ui.components.InviteUserComponent) UserContextMenuFactory(io.imunity.furms.ui.components.administrators.UserContextMenuFactory)

Example 2 with ViewHeaderLayout

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

the class DashboardView method addTitle.

private void addTitle() {
    final ViewHeaderLayout headerLayout = new ViewHeaderLayout(getTranslation("view.fenix-admin.dashboard.title"));
    getContent().add(headerLayout);
}
Also used : ViewHeaderLayout(io.imunity.furms.ui.components.ViewHeaderLayout)

Example 3 with ViewHeaderLayout

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

the class SitesView method addHeader.

private void addHeader() {
    Button addButton = new Button(getTranslation("view.sites.main.add.button"), new Icon(PLUS_CIRCLE));
    addButton.addClickListener(this::actionOpenSiteFormAdd);
    getContent().add(new ViewHeaderLayout(getTranslation("view.sites.main.title"), addButton));
}
Also used : MenuButton(io.imunity.furms.ui.components.MenuButton) Button(com.vaadin.flow.component.button.Button) ViewHeaderLayout(io.imunity.furms.ui.components.ViewHeaderLayout) Icon(com.vaadin.flow.component.icon.Icon)

Example 4 with ViewHeaderLayout

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

the class GroupsView method loadPageContent.

private void loadPageContent() {
    grid = createPolicyDocumentGrid();
    searchLayout.addValueChangeGridReloader(this::loadGridContent);
    loadGridContent();
    ViewHeaderLayout viewHeaderLayout = new ViewHeaderLayout(getTranslation("view.community-admin.groups.page.header"), createAddButton());
    getContent().add(viewHeaderLayout, searchLayout, grid);
}
Also used : ViewHeaderLayout(io.imunity.furms.ui.components.ViewHeaderLayout)

Example 5 with ViewHeaderLayout

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

the class SitesView method addTitle.

private void addTitle() {
    final ViewHeaderLayout layout = new ViewHeaderLayout(getTranslation("view.user-settings.sites.page.title"));
    getContent().add(layout);
}
Also used : ViewHeaderLayout(io.imunity.furms.ui.components.ViewHeaderLayout)

Aggregations

ViewHeaderLayout (io.imunity.furms.ui.components.ViewHeaderLayout)11 Route (com.vaadin.flow.router.Route)5 PageTitle (io.imunity.furms.ui.components.PageTitle)5 UserContextMenuFactory (io.imunity.furms.ui.components.administrators.UserContextMenuFactory)5 UserGrid (io.imunity.furms.ui.components.administrators.UserGrid)5 UsersGridComponent (io.imunity.furms.ui.components.administrators.UsersGridComponent)5 NotificationUtils.showErrorNotification (io.imunity.furms.ui.utils.NotificationUtils.showErrorNotification)5 BeforeEvent (com.vaadin.flow.router.BeforeEvent)4 OptionalParameter (com.vaadin.flow.router.OptionalParameter)4 FurmsViewComponent (io.imunity.furms.ui.components.FurmsViewComponent)4 MenuButton (io.imunity.furms.ui.components.MenuButton)4 BreadCrumbParameter (io.imunity.furms.ui.components.layout.BreadCrumbParameter)4 MethodHandles (java.lang.invoke.MethodHandles)4 Optional (java.util.Optional)4 AuthzService (io.imunity.furms.api.authz.AuthzService)3 DuplicatedInvitationError (io.imunity.furms.api.validation.exceptions.DuplicatedInvitationError)3 UserAlreadyHasRoleError (io.imunity.furms.api.validation.exceptions.UserAlreadyHasRoleError)3 PersistentId (io.imunity.furms.domain.users.PersistentId)3 InviteUserComponent (io.imunity.furms.ui.components.InviteUserComponent)3 MembershipChangerComponent (io.imunity.furms.ui.components.MembershipChangerComponent)3