Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency fields fromTask/toTask are not serialized #1229

Closed
pmiklashevych opened this issue Jul 22, 2020 · 0 comments
Closed

Dependency fields fromTask/toTask are not serialized #1229

pmiklashevych opened this issue Jul 22, 2020 · 0 comments
Assignees
Labels
bug Something isn't working forum Issues from forum premium resolved Fixed but not yet released (available in the nightly builds)
Milestone

Comments

@pmiklashevych
Copy link

https://www.bryntum.com/forum/viewtopic.php?p=74906#p74906

To reproduce:
Create Gantt/examples/advanced/data/sync.json

{
    "success" : true
}

Edit Gantt/examples/advanced/app.js

const project = new ProjectModel({

    // Let the Project know we want to use our own Task model with custom fields / methods
    taskModelClass : Task,
    transport      : {
        load : {
            url : '../_datasets/launch-saas.json'
        },
        sync : {
            url : 'data/sync.json'
        }
    }
});

Go to http://lh/bryntum-suite/gantt/examples/advanced/
Create a new dependency between Unit tests and UI unit tests / individual screens
Call gantt.project.sync()
Снимок экрана 2020-07-22 в 18 17 44

See Network: fromTask/toTask should be and ID
Снимок экрана 2020-07-22 в 18 18 44

=====================
If set a breakpoint into AbstractCrudManagerMixin.getCrudStoreChanges and step into prepareAdded

        if (store.id === 'dependencies') {
            debugger
        }
        if (added.length) added = this.prepareAdded(added, storeDescriptor);

you can see that record.persistableData returns that data. persistableData loops through the defined fields.

In Gantt/examples/_datasets/launch-saas.json the dependencies data is specified as:

    "dependencies" : {
        "rows" : [
            {
                "id"       : 1,
                "fromTask" : 11,
                "toTask"   : 15,
                "lag"      : 2
            },

So fromTask/toTask are specified and the fields are automatically exposed. If you change to fromEvent/toEvent (which are also valid fields), it will work. The request will contain fromEvent/toEvent with serialized ID value. Because they are defined in SchedulingEngine/lib/Engine/data/model/DependencyMixin.ts

=====================
Possible solution:

Add to SchedulingEngine/lib/Engine/data/model/DependencyMixin.ts fromTask/toTask definitions

@generic_field(
    {
        bucket : 'outgoingDeps',
        resolver : function (id : ModelId) { return this.getEventById(id) },
        modelFieldConfig : {
            persist   : true,
            serialize : event => event.id
        },
    },
    ModelReferenceField
)
fromTask           : HasDependencies

@generic_field(
    {
        bucket : 'incomingDeps',
        resolver : function (id : ModelId) { return this.getEventById(id) },
        modelFieldConfig : {
            persist   : true,
            serialize : event => event.id
        },
    },
    ModelReferenceField
)
toTask             : HasDependencies
@pmiklashevych pmiklashevych added bug Something isn't working premium forum Issues from forum labels Jul 22, 2020
@isglass isglass added this to the Gantt 4.0.3 milestone Nov 6, 2020
@isglass isglass modified the milestones: Gantt 4.0.3, 4.0.4 Nov 18, 2020
@fabiojpoli fabiojpoli self-assigned this Nov 24, 2020
@fabiojpoli fabiojpoli added in progress ready for review Issue is fixed, the pull request is being reviewed and removed in progress labels Nov 24, 2020
@isglass isglass added resolved Fixed but not yet released (available in the nightly builds) and removed ready for review Issue is fixed, the pull request is being reviewed labels Nov 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working forum Issues from forum premium resolved Fixed but not yet released (available in the nightly builds)
Projects
None yet
Development

No branches or pull requests

3 participants