Giter Club home page Giter Club logo

jmix's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jmix's Issues

Add debug messages to help find cause for unwanted "unsaved changes"

see forum topic: https://www.cuba-platform.ru/discuss/t/neyavnye-izmeneniya-redaktiruemoj-sushhnosti/3859

Developer meets "Unsaved changes" dialog in a screen but there were no changes made by user.
Currently it is hard to find the cause of the problem - you need to know places in the GUI framework code where to put breakpoints.

My suggestion:
Add debug log messages that help to find when data context was modified.

  • message every time when data context is "modified": entity is changed, added, removed. With details: which entity, which container?
  • message when dataContext.isChanged() is checked. If there are changes, add details what containers and entities are in the changes.

Document these log categories in the developers manual.

Provide ability to serialize AccessConstraint objects

In some cases it would be very helpful to have an ability to serialize AccessConstraint objects.
For exaple, see jmix-data#2. To solve this problem we need to save list of constraints as part of load context. But entities can be serialized, so list of constants will be lost in the process.

Set X-Frame-Options to SAMEORIGIN by default

By default X-Frame-Options is set to DENY in spring security. But we need it to be set to SAMEORIGIN for the file downloading support.
As for now this setting is hardcoded in JmixCoreSecurityConfiguration and StandardSecurityConfiguration. But if clients want to provide their own security configuration, they should add this setting as well.
So it would be better to think about more generic approach.

Implement design-time audit for entites

Take https://hibernate.org/orm/envers/ as a canonical way.

@Table(name = "PETCLINIC_OWNER")
@Entity(name = "petclinic_Owner")
@Audited // all fields of the entity will be audited
public class Owner extends Person {
    ...
}

@Entity(name = "petclinic_Pet")
// only some fields will be audited
public class Pet extends NamedEntity {
    private static final long serialVersionUID = -3431453457784831240L;

    @NotNull
    @Column(name = "IDENTIFICATION_NUMBER", nullable = false)
    @Audited
    protected String identificationNumber;

    @Temporal(TemporalType.DATE)
    @Column(name = "BIRTH_DATE")
    @Audited
    protected Date birthDate;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "TYPE_ID")
    protected PetType type;

    ...
}

Built-in filtering for StandardLookup / PickerField.Lookup chain

See forum topic: https://www.cuba-platform.com/discuss/t/lookup-field-choose-particular-values/11339/4

If I am not wrong, we have received such requests several times: "user should can choose only particular values in the lookup screen".
Alexey has been talking about it for some time.

It looks like a generic functionality: add filtering capability to standard lookup action and standard lookup screen.
E.g. PickerField.LookupAction can have a install delegate to supply lookup screen filter parameters.
StandardLookup obtains these parameters and adds them to dataLoader query.

If I were using this, I would also modify lookup screen's caption (another customization point). E.g. lookup screen called by CUBA's "Move user to another group" action could have caption "Select new Access Group for user Administrator".

Provide an ability to define custom DataGrid.Renderer for the column declaratively

Description of the bug or enhancement

In Jmix project the DataGrid.Rendereres have become prototype beans (#509). But user cannot define custom DataGrid.Renderer for the column declaratively.
Maybe we can add <custom bean="bean_name" /> element to <renderers/> to allow the user to define a custom DataGrid.Renderer for the column declaratively.

See Vaadin documentation for information on implementing custom renderers.

REST API: expose only specified fetch plans

Motivation

Currently it's possible to fetch entities with any global view (fetch plan) through REST API. Also all views(fetch plans) are being sent through metadata endpoint (thus, payload increases accordingly). It's not only may result in unwanted data leakage (in case of security misconfiguration) but also does not make sense since only specific views are used on clients.

Add InputDialog compatible with FileDescriptor to cuba module

Add InputDialog and InputParametersclasses compatible with FileDescriptor to cuba module.
This implies overriding these classes:
io.jmix.ui.app.inputdialog.InputDialog
io.jmix.ui.app.inputdialog.InputParameter
io.jmix.ui.sys.WebDialogs
io.jmix.ui.AppUI

Entity Projections

  1. If dataManager returns an entity, not a projection - always load all local attributes and enable lazy loading for fields (or as annotated)
  2. Loading a projection - load only defined attributes
  3. Support @instanceName for Projections

Investigate into Kotlin data class usage

From the forum thread

I have a bunch of Kotlin data class which I use for loading data from an ugly external source, then show it to the user to do some simple manipulations to ultimately save that data into the real Entities.

Right now I’m abusing the KeyValueCollection and KeyValueEntity for the UI part but reading the documentation it appears that CUBA does create some runtime metaclass for these things. So…

Is it possible to create a metaclass for a Kotlin data class (ie: define it at runtime?)

I know I could just use @Metaclass, but the main point here is to benefit from the concise syntax of data classes which is lost otherwise

DataManager's fluent loader improvement

  • Add explicit all() method to load all entities.
  • Eliminate possibility to invoke condition() multiple times.
  • Add method accepting Sort and use it in EntityFieldCreationSupport#createCollectionContainer.

Support for Spring Data repositories

By using DataManager under the hood.

CUBA Prototype: https://github.com/cuba-rnd/cuba-jpa-repositories
https://www.cuba-platform.com/blog/spring-query-interfaces-in-cuba/

Done

  • (2d)Analyse, discuss
  • (1w)Move code to Jmix, make it work.
  • (3d) Refactor, move tests.
  • (1w3d) Deal with JpqlQueryGenerator implementaion.
  • (1w)Get rid of limitations (see readme in cuba-jpa-repositories).
  • (2d)Paging support
  • (2d)Finish test coverage
  • (3d)Packages/modules refactoring, UI dependency from data.
  • (1d+) Class Annotation to use UnsafeDataManagerImpl instead of DataManagerImpl
  • (2d) Implement repository proxy post processor in order to pass method metadata to CRUD repositories
  • (2d) Rework @Unsafe into @ApplyConstraints with spring-like logic
  • (summ: 2d) Improvements
    • (4h) Improve javadocs
    • (1d) Add boot autoconfiguration like org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration

Unfinished:

  • (4h)Use @FetchPlan for repository class to set default fetch plan. Extracted into issue #186
  • (summ:1w)Jmix-features support
    • (2d)Dynamic attributes support in repository API. Extracted into issue: #183
    • (2d)Soft deletion support in repository API. Extracted into issue: #184
    • (?) LoadContext#cacheable (To be discussed: rework through hints in Jmix and implement as other features?) Extracted into issue #185

Usage:

Create interface that extends JmixDataRepository and add query methods you need:

  • use keywords from documentation to build your query name;
  • use io.jmix.core.repository.Query to explicitly specify jpql query:
    • named and positional parameters allowed,
    • special parameters like Pageable and Sort are not counted at positional parameters resolving process;
  • use io.jmix.core.repository.FetchPlan to specify fetch plan for loaded entities;
Example:

see data model at: https://github.com/Haulmont/jmix-data/tree/master/eclipselink/src/test/java/test_support/entity/repository
Repository:

public interface OrderRepository extends JmixDataRepository<SalesOrder, UUID> {

    List<SalesOrder> findByCustomerNameAndCustomerAddressCity(String name, String city);

    long countSalesOrdersByCustomer(Customer customer);

    boolean existsSalesOrdersByCustomerAddressCity(String city);

    void removeSalesOrdersByCustomerAddressCity(String city);

    List<SalesOrder> findSalesOrderByDateBeforeOrderByDateAsc(Date date);

    Page<SalesOrder> findByDateAfterAndNumberIn(Date date, Pageable pageable, List<String> numbers);

    @Query("select o from repository$SalesOrder o where (o.date> ?1 and o.number in ?2)")
    List<SalesOrder> findByQuery(Sort sort, Date date, List<String> numbers);

    @Query("select o from repository$SalesOrder o where (o.date> :date and o.number in :numbers)")
    Page<SalesOrder> findByQueryWithPaging(@Param("date") Date date,
                                                @Param("numbers") List<String> numbers,
                                                Pageable pageable);

    @FetchPlan("SalesOrder.full")
    List<SalesOrder> findByCustomerNotNullOrderByCustomerAddressCityAscDateAsc();
}

Delegate methods for DataContainer query parameters in UI Controller

When using query parameters in a data loader, the parameter value has to be set in order to let the query be performed. Setting this parameter currently requires to programmatically inject the data loader and add the parameter value to it.

Taking this query as an example:

<loader id="defaultTreatmentRoomLc">
  <query>
    <![CDATA[select e from alabastiapetclinic_DefaultTreatmentRoom e where e.user = :currentUser]]>
  </query>
</loader>

In order to resolve this parameter before the query is performed, the parameter has to be set like this:

    @Subscribe
    protected void onInit(InitEvent event) {
        // provide the declarative dataContainer with required parameter
        defaultTreatmentRoomLc.setParameter("currentUser", userSession.getCurrentOrSubstitutedUser());
    }

This programmatic setting is not really aligned with the way the majority of the UI APIs work through its @Subscribe and @Install method delegates.

For the data loading, it would be good to have the ability to resolve the parameter values also via a method delegate like this:

@Install(to = "defaultTreatmentRoomLc", subject = "currentUser")
protected User currentUserParameterResolver() {
    return userSession.getCurrentOrSubstitutedUser();
}

This way the developer does not have to think about controller lifecycle anymore (like which Event to subscribe in order to programmatically add the parameter).

Cache generated column components

e.g. see these topics

https://www.cuba-platform.ru/discuss/t/7-1-chrezmernoe-srabatyvanie-generatorov-kolonok-pri-izmenenii-zapisi/4187/2

https://www.cuba-platform.com/discuss/t/generated-columns-are-re-calculated-every-time-when-i-scroll-in-browse-screen/9917/2

It is one of common CUBA GUI library performance/usability problems.
Every developer who codes generated columns - implements them wrong for the first time.
People make heavy calculations or requests to database in column generation methods.

Note that even CUBA documentation says nothing about this problem.

In Sherlock I had to instruct every newbie developer to load / calculate data beforehand, not inside of column generator (in desktop client problem becomes even worse because of the network lag).

With time it becomes obvious that if 90% of developers make mistake in one particular API place - then problem is not with developers, the problem is in this place.

Asking every developer to implement his/her own caching solution is not fair.

CUBA tables should use some caching rules and re-use results of column generators.
E.g. until item is changed, or collection is refreshed or entity's property used as column ID is changed.

Make ability to define custom message sources via annotation

Customization
An application can have multiple resource bundles. For example, if you want to place some messages to the com/sample/app/some_messages.properties file, redefine the MessageSource bean in the application as follows:

@Bean
MessageSource messageSource(JmixModules modules, Resources resources) {
    JmixMessageSource messageSource = new JmixMessageSource(modules, resources);
   messageSource.addBasenames("com/sample/app/some_messages");
   return messageSource;
}

This approach is too hard to support in Jmix Studio. Special annotation would be more convenient.

Refactor FetchPlanSerialization and make FetchPlanBuilder modifiable after build

FetchPlanBuilder becames unmodifiable after build() invocation in order to avoid FetchPlanSerialization refactoring in #3

TODO:

Refactor io.jmix.core.impl.serialization.FetchPlanSerializationImpl.ViewDeserializer#fetchPlanBuilders in order to avoid multiply build() invocations and/or using of same builder instances as parts of different parent builders.

Refactor FetchPlan in core module

#Make FetchPlan immutable data class
#Move copy, partialView, systemProperties from FetchPlan to FetchPlanBuilder API. This will remove AppBeans from FetchPlan.
#Remove FetchPlanParams
#The CUBA View should keep the old API

Additional:

Remove includeSystemProperties parameter from FetchPlan and move to legacy View.

  • From now all audit and soft-delete attributes should be specified explicitly to appear in FetchPlan
  • 'LOCAL' FetchPlan contains all local properties without distinction to system or not

Support FileUploadField generation for dynamic attributes

In cuba FileUploadField was generated for attributes of type FileDescriptor.

In Jmix we need to:

  1. Generate FileUploadField for attributes of type byte[].
  2. Generate FileStorageUploadField for attributes of type URI.

To support this, it is needed to introduce new value in io.jmix.dynattr.AttributeType enum for files (byte[]/URI).

Rework TextArea and resizable feature

Description

Investigate native ability to resize TextArea:

  • it works in all supported browsers (Safari, Chrome, Opera, Firefox, Edge, IE11?)
  • we can add listener on resize event.

If native resizing meets our requirements:

  1. Remove ResizableTextArea component
  2. Rework TextArea with native resizing

If it does not:

  1. move attributes from TextArea: resizable, resizeDirection to CUBA module;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.