JS refactor - button for publishing graph