It would appear that the pump is at fault. It is situated underneath the toilet roll holder. It may be as simple as a sticking rotor. Remove the pump from the toilet without disconnecting it and turn the rotor with a small screwdriver to make sure that it turns freely. Then press the flush knob to see if the pump will operate without dimming the lights.
If you have the older toilet with the glass fuse then this is removed by unscrewing the black plastic cap.