Our state of the art Gantt chart


Post by glcark »

I am trying to import an MPP with AutoSync enabled and am running into some troubles. The initial import works without any issues, but the esuing sync only sends a request with calendars and tasks, but without everything else.
I am using v4.0.7

Import response:
https://jsonblob.com/03c9dcb6-5ff1-11eb-b905-8d576574595e

Sync request payload:
https://jsonblob.com/3b257689-5ff1-11eb-b905-d5e09466103f


Post by pmiklashevich »

Please set this flag to false: https://www.bryntum.com/docs/gantt/#Gantt/model/ProjectModel#config-silenceInitialCommit
We assume data is consistent on load. When you import the data and you're not sure if the data is consistent, it is recommended to enable initial commit. Let me know if this fixes the issue. Cheers!

Pavlo Miklashevych
Sr. Frontend Developer


Post by glcark »

Previously, after an import the sync would run with all of the information present in the mpp (dependencies, resources, etc). This allowed me to re-use the code on sync. However, now the only information that is synced are the rows.

What is the propsed way to deal with this?

This used to work in previous versions of the gantt and no longer works after updating.

I don't beleive that flag will have any impact because the gantt is loaded originally and then the user chooses to import their mpp file causing an ensuing sync. This doesn't seem like the initial commit to me.


Post by pmiklashevich »

You're right. There are 2 problems in this case.

The first one is misconfigured ProjectModel. It has to be set explicitly with silenceInitialCommit and transport:

async importData(data) {
        const me = this;
        
const project = new me.gantt.projectModelClass({ silenceInitialCommit: false // To save imported data provide `sync` url and set `autoSync` true, or call `gantt.project.sync()` manually after data is imported. autoSync: true, transport: { sync: { url: 'syncUrl' } } });

The other problem is how the data is set to the stores. In the importer data is set to the store.data property. Which is a valid approach, but there is a bug that records added this way are not considered to be added. They are loaded. There is alternative solution to add records to the store. Flat store supports store.add function, tree store supports store.rootNode.appendChild. We will get the importer fixed in scope of this ticket: https://github.com/bryntum/support/issues/1968
Note, adding dependency should be done after tasks are added.

You can replace ".data = " "with .add(...)" and move "importDependencies" after "appendChild" in the importer

me.importResources(data);
me.importAssignments(data);

me.taskStore.rootNode.appendChild(tasks[0].children);

me.importDependencies(data);

this.importProject(data);

Best wishes,
Pavel

Pavlo Miklashevych
Sr. Frontend Developer


Post by glcark »

Thanks @pmiklashevich this was a ton of help! This is almost working, except for the fact that the calendar is ignored upon import. Prior to import the non-working days are highlighted properly in the gantt, but post import the days are ignored and a task that was scheduled for 4 days that crosses over a weekend now ends during the weekend. This means that the task end date is incorrect and all dependencies are also a bit off.

I have tried ignoring the calendar portion of the import and set the data of the calendarMangerStore to the data of the default projec that is loaded.

project.calendarManagerStore.data = oldProject.calendarManagerStore.data;

However, this new project still seems to ignore the calendar data and after setting the new imported project on the gantt project variable, the working days seem to be disregarded.

Any help would be greatly appreciated!


Post by pmiklashevich »

Please use "add" when set data to calendar manager store. If you download 4.1.0-beta-2 from customer zone, you'll find a new Importer.js file in the MSProjectImport demo. It uses "add" to update calendars:

importCalendars(data) {
    this.calendarManager.add(this.processCalendarChildren(data.calendars
        .children));
}

If you open the demo in the browser, you can see initial weekends are Friday midnight - Sunday midnight:

Снимок экрана 2021-02-26 в 11.35.57.png
Снимок экрана 2021-02-26 в 11.35.57.png (89.5 KiB) Viewed 846 times

When import AdvancedExample.mpp file, you can see business hours are working only, so calendar changes are applied:

Снимок экрана 2021-02-26 в 11.36.15.png
Снимок экрана 2021-02-26 в 11.36.15.png (117.87 KiB) Viewed 846 times

Keep in mind, some non working intervals might be not drawn to keep readability. Please see this config: https://www.bryntum.com/docs/gantt/#Scheduler/feature/NonWorkingTime#config-maxTimeAxisUnit

You can try to zoom in to see if some hours are non working or not:

gantt.zoomIn(5); // in console of the demo
Снимок экрана 2021-02-26 в 11.43.59.png
Снимок экрана 2021-02-26 в 11.43.59.png (56.19 KiB) Viewed 846 times

Please try out the new importer and let us know if it works for you. If not, please produce mpp file you test against, so we can see the problem. Thanks!

Best wishes,
Pavel

Pavlo Miklashevych
Sr. Frontend Developer


Post Reply