Remove the dependencie to fix it.
Add the edit dialog and its edit js.
Clean the code.
Move the api function in common.js