 
     on_submit: (event) =>
         env = @envs.get_active()
-        $.ajax({
-            url: "/api/env/#{env.get('name')}/plan",
-            type: 'POST',
-            contentType: 'application/json',
-            dataType: 'json',
-            data: JSON.stringify({specs: [@pkg.get('name')]}),
-            success: @on_plan,
-        })
+        api("env/#{env.get('name')}/plan", {specs: [@pkg.get('name')]}, @on_plan)
 
     on_plan: (data) =>
         new PlanModalView({pkg: @pkg, envs: @envs, pkgs: @pkgs, actions: data.actions}).show()


    on_activate_click: (event) =>
        env = @envs.get_active()
        $.ajax({url: "/api/env/#{env.get('name')}/activate", type: 'POST'})

    on_delete_click: (event) =>
        new DeleteEnvView(envs: @envs).show()

    submit_text: () -> "Clone"

    doit: (new_name) ->
        api("env/#{@envs.get_active()}/clone/#{new_name}", {}, @on_env_clone)

    on_env_clone: (data) =>
        # TODO

class NewEnvView extends EnvModalView

