Search in sources :

Example 1 with FurmsDialog

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

the class ProjectAllocationComponent method createConfirmDialog.

private Dialog createConfirmDialog(String projectAllocationId, String projectAllocationName) {
    FurmsDialog furmsDialog = new FurmsDialog(getTranslation("view.community-admin.project-allocation.dialog.text", projectAllocationName));
    furmsDialog.addConfirmButtonClickListener(event -> {
        try {
            service.delete(communityId, projectAllocationId);
            loadGridContent();
        } catch (RemovalOfConsumedProjectAllocationIsFirbiddenException e) {
            showErrorNotification(getTranslation("project.allocation.removing.message"));
        } catch (Exception e) {
            showErrorNotification(getTranslation("base.error.message"));
        }
    });
    return furmsDialog;
}
Also used : RemovalOfConsumedProjectAllocationIsFirbiddenException(io.imunity.furms.api.validation.exceptions.RemovalOfConsumedProjectAllocationIsFirbiddenException) RemovalOfConsumedProjectAllocationIsFirbiddenException(io.imunity.furms.api.validation.exceptions.RemovalOfConsumedProjectAllocationIsFirbiddenException) FurmsDialog(io.imunity.furms.ui.components.FurmsDialog)

Example 2 with FurmsDialog

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

the class CommunityAllocationComponent method createConfirmDialog.

private Dialog createConfirmDialog(String CommunityAllocationId, String communityAllocationName) {
    FurmsDialog furmsDialog = new FurmsDialog(getTranslation("view.fenix-admin.resource-credits-allocation.dialog.text", communityAllocationName));
    furmsDialog.addConfirmButtonClickListener(event -> {
        getResultOrException(() -> service.delete(CommunityAllocationId)).getException().ifPresent(t -> showErrorNotification(getTranslation(t.getMessage(), communityAllocationName)));
        loadGridContent();
    });
    return furmsDialog;
}
Also used : FurmsDialog(io.imunity.furms.ui.components.FurmsDialog)

Example 3 with FurmsDialog

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

the class ProjectsView method createConfirmDialog.

private Dialog createConfirmDialog(String projectId, String projectName, String communityId) {
    FurmsDialog furmsDialog = new FurmsDialog(getTranslation("view.user-settings.projects.dialog.text", projectName));
    furmsDialog.addConfirmButtonClickListener(event -> {
        try {
            projectService.resignFromMembership(communityId, projectId);
            loadGridContent();
        } catch (Exception e) {
            showErrorNotification("base.error.message");
        }
    });
    return furmsDialog;
}
Also used : ApplicationNotExistingException(io.imunity.furms.api.validation.exceptions.ApplicationNotExistingException) UserAlreadyInvitedException(io.imunity.furms.api.validation.exceptions.UserAlreadyInvitedException) FurmsDialog(io.imunity.furms.ui.components.FurmsDialog)

Example 4 with FurmsDialog

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

the class SSHKeysView method actionDeleteSSHKey.

private void actionDeleteSSHKey(SSHKeyViewModel key, Grid<SSHKeyViewModel> grid) {
    FurmsDialog cancelDialog = new FurmsDialog(getTranslation("view.user-settings.ssh-keys.main.confirmation.dialog.delete", key.name));
    cancelDialog.addConfirmButtonClickListener(event -> {
        try {
            sshKeysService.delete(key.id);
            showSuccessNotification(getTranslation("view.user-settings.ssh-keys.grid.item.menu.delete.success", key.name));
        } catch (RuntimeException e) {
            LOG.warn("Could not delete SSH key . ", e);
            showErrorNotification(getTranslation("view.user-settings.ssh-keys.form.error.unexpected", "delete"));
        } finally {
            loadGridContent();
        }
    });
    cancelDialog.open();
}
Also used : FurmsDialog(io.imunity.furms.ui.components.FurmsDialog)

Example 5 with FurmsDialog

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

the class ResourceCreditsView method createConfirmDialog.

private Dialog createConfirmDialog(String resourceTypeId, String resourceCreditName) {
    FurmsDialog furmsDialog = new FurmsDialog(getTranslation("view.site-admin.resource-credits.dialog.text", resourceCreditName));
    furmsDialog.addConfirmButtonClickListener(event -> {
        handleExceptions(() -> resourceCreditService.delete(resourceTypeId, getCurrentResourceId()), Map.of(ResourceCreditHasAllocationException.class, "view.site-admin.resource-credits.form.error.resourceCreditHasAllocations"));
        loadGridContent();
    });
    return furmsDialog;
}
Also used : ResourceCreditHasAllocationException(io.imunity.furms.api.validation.exceptions.ResourceCreditHasAllocationException) FurmsDialog(io.imunity.furms.ui.components.FurmsDialog)

Aggregations

FurmsDialog (io.imunity.furms.ui.components.FurmsDialog)18 Component (com.vaadin.flow.component.Component)2 Checkbox (com.vaadin.flow.component.checkbox.Checkbox)2 Dialog (com.vaadin.flow.component.dialog.Dialog)2 ColumnTextAlign (com.vaadin.flow.component.grid.ColumnTextAlign)2 Grid (com.vaadin.flow.component.grid.Grid)2 Label (com.vaadin.flow.component.html.Label)2 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)2 Route (com.vaadin.flow.router.Route)2 AssignedPolicyRemovingException (io.imunity.furms.api.validation.exceptions.AssignedPolicyRemovingException)2 InvitationNotExistingException (io.imunity.furms.api.validation.exceptions.InvitationNotExistingException)2 DenseGrid (io.imunity.furms.ui.components.DenseGrid)2 FurmsViewComponent (io.imunity.furms.ui.components.FurmsViewComponent)2 GridActionMenu (io.imunity.furms.ui.components.GridActionMenu)2 MenuButton (io.imunity.furms.ui.components.MenuButton)2 PageTitle (io.imunity.furms.ui.components.PageTitle)2 ViewHeaderLayout (io.imunity.furms.ui.components.ViewHeaderLayout)2 UIContext (io.imunity.furms.ui.user_context.UIContext)2 NotificationUtils.showErrorNotification (io.imunity.furms.ui.utils.NotificationUtils.showErrorNotification)2 UTCTimeUtils.convertToZoneTime (io.imunity.furms.utils.UTCTimeUtils.convertToZoneTime)2