Premium support for our pure JavaScript UI components


Post by tulioassis »

Hey!
We are overriding the ResourceAllocationInfo class.
It's working good on a dev server but not on a production build.

On prod build we are able to get the resource histogram template but all the ticks are empty (no color).

Did someone face something similar?
Any ideas on what could be the issue?


Post by tulioassis »

I did some tests here and seems that generator function cannot be overridden.

Works:

export class ResourceAllocationInfoOverride {
	static get target() {
		return {
			class: ResourceAllocationInfo,
		};
	}

calculateAllocation() {
	alert('Test');
}
}

Does not work:

export class ResourceAllocationInfoOverride {
	static get target() {
		return {
			class: ResourceAllocationInfo,
		};
	}

*calculateAllocation() {
	alert('Test');
}
}

But we do need to keep it as a generator function...


Post by arcady »

You can extend ResourceAllocationInfo and provide the subclass to project:

class MyResourceAllocationInfo extend ResourceAllocationInfo {
    *calculateAllocation() {
        ...
    }
}

new ResourceHistogram({
    project : {
        resourceAllocationInfoClass : MyResourceAllocationInfo,
        ...
    },
    ...
})

Docs:
https://www.bryntum.com/products/gantt/docs/engine/classes/_lib_engine_quark_model_scheduler_pro_schedulerproprojectmixin_.schedulerproprojectmixin.html#resourceallocationinfoclass
https://www.bryntum.com/products/gantt/docs/engine/classes/_lib_engine_quark_model_scheduler_pro_schedulerproresourcemixin_.resourceallocationinfo.html


Post by tulioassis »

Hey arcady,
That's weird, but this way you provided is not working for me when I use the * (generator function).

Working:

export class ResourceAllocationInfoOverride extends ResourceAllocationInfo {
	// @ts-expect-error
	calculateAllocation(): CalculationIterator<this['allocation']> {
		alert('calculateAllocation test');
	}
}

Not working:

export class ResourceAllocationInfoOverride extends ResourceAllocationInfo {
	// @ts-expect-error
	*calculateAllocation(): CalculationIterator<this['allocation']> {
		alert('calculateAllocation test');
	}
}

As project model:

	projectRef.current = new ProjectModel({
		...
		// @ts-expect-error
		resourceAllocationInfoClass: ResourceAllocationInfoOverride,
	});

Post by arcady »

Please provide a test case demonstrating the problem and we'll investigate what happens.


Post by tulioassis »

Do you know if is it possible to apply overrides on any available demo/example?


Post by arcady »

Not sure. I haven't tried to override all of the demos. Why?


Post Reply