Gooey soil substance – String of pearls

What’s this gooey substance that has appeared on the surface of the soil? I noticed it after re-potting, fortunately, my strings of pearls appear unaffected. Also, I’ve noticed gnats. Any suggestions on how to get rid of them?…