Search in sources :

Example 1 with AdminUsersPlace

use of org.openremote.app.client.admin.users.AdminUsersPlace in project openremote by openremote.

the class AdminUserEditActivity method delete.

@Override
public void delete() {
    adminContent.showConfirmation(environment.getMessages().confirmation(), environment.getMessages().confirmationDelete(user.getUsername()), () -> {
        adminContent.setFormBusy(true);
        adminContent.clearFormMessages();
        clearViewFieldErrors();
        environment.getApp().getRequests().send(requestParams -> userResource.delete(requestParams, realm, userId), 204, () -> {
            adminContent.setFormBusy(false);
            environment.getEventBus().dispatch(new ShowSuccessEvent(environment.getMessages().userDeleted(user.getUsername())));
            environment.getPlaceController().goTo(new AdminUsersPlace(realm));
        });
    });
}
Also used : ShowSuccessEvent(org.openremote.app.client.event.ShowSuccessEvent) AdminUsersPlace(org.openremote.app.client.admin.users.AdminUsersPlace)

Example 2 with AdminUsersPlace

use of org.openremote.app.client.admin.users.AdminUsersPlace in project openremote by openremote.

the class AdminUserEditActivity method create.

@Override
public void create() {
    adminContent.setFormBusy(true);
    adminContent.clearFormMessages();
    clearViewFieldErrors();
    readFromView();
    environment.getApp().getRequests().sendWith(userMapper, requestParams -> userResource.create(requestParams, realm, user), 204, () -> {
        adminContent.setFormBusy(false);
        environment.getEventBus().dispatch(new ShowSuccessEvent(environment.getMessages().userCreated(user.getUsername())));
        environment.getPlaceController().goTo(new AdminUsersPlace(realm));
    }, validationErrorHandler);
}
Also used : ShowSuccessEvent(org.openremote.app.client.event.ShowSuccessEvent) AdminUsersPlace(org.openremote.app.client.admin.users.AdminUsersPlace)

Aggregations

AdminUsersPlace (org.openremote.app.client.admin.users.AdminUsersPlace)2 ShowSuccessEvent (org.openremote.app.client.event.ShowSuccessEvent)2