Jmix 1.5 released

Hi everyone,

The release 1.5 of the Jmix framework and Studio is out! The framework is available in our artifact repositories, Jmix Studio plugin is ready for update in your IntelliJ IDEA.

Please see what’s new for upgrade instructions and the list of new features and backwards incompatible changes.

The documentation now shows information about version 1.5 by default. You can switch to previous versions using the selection controls at the bottom left corner or in the page header.

Community add-ons are not yet included in the Jmix BOM, so if you want to use them with Jmix 1.5, specify the add-on version explicitly in your build.gradle. Refer to add-on READMEs for information about available versions.

We’re looking forward to your feedback!

7 Likes

Hi Jmix team
Congratulations! This is a good milestone toward the maturity of the new generation of the tool, especially for FlowUI.

I have a few pieces of feedback and hope it will help toward the stabilization of the tool further -

  1. In the 1.5.0 plugin version, Testing connection to the database, especially when you add a new connection doesn’t show a success or failure message.

  2. The Multitenant add-on is still not compatible with FlowUI though it is expected to be working already. Eager to start using this add-on in my composite FlowUI project.

  3. The setSession attribute value is lost before I can use it in another view for the same user session. For example, I have a default company selection window from where I let the user select the company, it successfully sets the company ID to the session attribute as I see in debugging…

here is my code in setting attribute:

MainView controller:

@Subscribe
    public void onBeforeShow(BeforeShowEvent event) {
        User user = (User) currentAuthentication.getUser();
        if(user.getCompany()!=null)
            sessionData.setAttribute("companyId", user.getCompany().getId());
        if(user.getEmplProfile()!=null)
            sessionData.setAttribute("emplProfileId", user.getEmplProfile().getId());
    }

 @Subscribe("selectCompanyBtn")
    public void onSelectCompanyBtnClick(ClickEvent<Button> event) {
        dialogWindows.lookup(this, Company.class)
                .withSelectHandler(e -> {
                    UUID id = e.stream().findFirst().get().getId();
                    sessionData.setAttribute("companyId", e.stream().findFirst().get().getId());
                })
                .open();
    }

However, when I try to use this attribute as changed by the user, then I see the attribute is still what was originally loaded at the time of log-in but not the one user selected during run-time.

EmployeeProfile controller

@Subscribe
    public void onBeforeShow(BeforeShowEvent event) {
        if(company!=null) {
            employeeProfilesDl.setParameter("company", company);
        }else{
            UUID id = (UUID) sessionData.getAttribute("companyId");
            if (id != null) {
                Company company1 = dataManager.load(Company.class).id(id).one();
                employeeProfilesDl.setParameter("company", company1);
            }
        }
        employeeProfilesDl.load();

    }
  1. Adding collection to the dataContainer
    In earlier releases, the collection items used to be selectable from the property where the ID used to be populated automatically but in this (FlowUI) release, we do not see any option to select the property from for the collection element of the data source.
    image

It’s not lost, it’s overridden it every time a new view is opened, because (by Vaadin design) the BeforeEnter event is sent to MainView either, hence BeforeShowEvent is also sent. Plus, if you refresh the page (F5) then both MainView and currently opened view will be re-cretead, so BeforeShowEvent is really a bad place for setting initial value of session attribute. I’d recommend using InteractiveAuthenticationSuccessEvent handler, e.g.:

@Component
public class AuthenticationEventListener {

    private final ObjectProvider<SessionData> sessionDataProvider;

    public AuthenticationEventListener(ObjectProvider<SessionData> sessionDataProvider) {
        this.sessionDataProvider = sessionDataProvider;
    }

    @EventListener
    public void onInteractiveAuthenticationSuccess(InteractiveAuthenticationSuccessEvent event) {
        User user = (User) event.getAuthentication().getPrincipal();
        sessionDataProvider.ifAvailable(sessionData -> {
            // set session attribute
        });
    }
}

Regards,
Gleb

Hi Gleb
Thanks for your reply to question #3. I’ve two follow-up questions in this regard:

a. Where do I save the code snippets, anywhere in the login controller or somewhere?
b. The code snipped you shared will only help keep the session attribute at the time of logging in. However, in my case, my software has the option to change such attributes after logging in, say for example, the user changes the default company so that after changing it, the software will load that default company to any screen opened.

it just a bean, you can place it where you like or create using Studio
Screenshot 2023-03-16 at 11.06.56

I’ve just fixed your bug with overriding the value that is set by a user, because MainView is not a suitable place for that. The code above doesn’t prevent you from any further modification of session attribute.

Gleb

A post was split to a new topic: FlowUI view stopped display in Studio 1.5.0