Inherited collections and UI integration

Hi. I want to manage assets in a facility where there are multiple types of assets. Most assets are machines and there are inherited subtypes like gearbox, generator, machine, etc. This works so far.

When I display a list of assets, subtypes as gearboxes, generators, etc. are shown as expected. The problem is that when clicking on one of the entries, the window opens in the context of the generic asset, not in the context of the gearbox, generator, etc.

There is also the field type “collection name”, but for child collections it is not possible to set a default value.

Using JavaScript, it is possible to make the affected window (drawer, popup) open in the correct context, but this is cumbersome.

What would be helpful:

  • A dedicated field that sets the own collection name for inherited collections.
  • UI logic that evaluates this and opens the correct context on click.

What is your NocoBase version number? I’m not sure how your data table model is configured.
please provide a reproduction of the issue in the demo environment.

https://a_8hwne7u84ho.v13.demo.nocobase.com/admin/
(NocoBase default username and password)

I am using v2.0.0-beta.14.

In your demo site I have constructed a minimal example.

“generators” inherited from “machines”. When I click on ThisIsAMachine the corresponding Drawer opens. However, when I click on ThisIsAGenerator, also the same drawer opens.

It would be nice to have a mechanism which opens a drawer context based on the “real” collection name. Maybe, by a special field in the collection?

There is a workaround with javascript, but I would prefer to have this functionality built-in.

const typeKey = ctx.record?.ptrCollection;

const viewUid = 'view-uid-'+typeKey ?? 'unknownObjects';
const collectionName = typeKey ?? 'commonObjects';

const tk = Number(ctx.record?.ptr);

// console.log('DEBUG backend', typeof tk, viewUid, collectionName, tk);

ctx.openView(viewUid, {
        navigation: false,
        mode: 'dialog',
        collectionName,
        filterByTk: tk,
      });