File size: 4,679 Bytes
3b0a9a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{% extends "base.html" %}

{% block title %}Create Environment - PyRunner{% endblock %}

{% block content %}
<div class="flex">
    {% include "cpanel/_sidebar.html" %}

    <div class="flex-1 p-8">
        <!-- Header -->
        <div class="mb-8">
            <nav class="flex items-center space-x-2 text-sm text-code-muted mb-4">
                <a href="{% url 'cpanel:environment_list' %}" class="hover:text-code-accent">Environments</a>
                <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
                </svg>
                <span class="text-code-text">Create</span>
            </nav>
            <h1 class="text-2xl font-bold text-code-text">Create New Environment</h1>
            <p class="text-code-muted">Create an isolated Python virtual environment</p>
        </div>

        <!-- Form -->
        <div class="bg-code-surface border border-code-border rounded-xl p-6 max-w-2xl">
            <form method="post">
                {% csrf_token %}

                <!-- Name -->
                <div class="mb-6">
                    <label for="id_name" class="block text-sm font-medium text-code-text mb-2">
                        {{ form.name.label }}
                    </label>
                    {{ form.name }}
                    {% if form.name.errors %}
                    <p class="mt-1 text-sm text-code-red">{{ form.name.errors.0 }}</p>
                    {% endif %}
                </div>

                <!-- Description -->
                <div class="mb-6">
                    <label for="id_description" class="block text-sm font-medium text-code-text mb-2">
                        {{ form.description.label }}
                    </label>
                    {{ form.description }}
                    {% if form.description.errors %}
                    <p class="mt-1 text-sm text-code-red">{{ form.description.errors.0 }}</p>
                    {% endif %}
                </div>

                <!-- Python Version -->
                <div class="mb-6">
                    <label for="id_python_path" class="block text-sm font-medium text-code-text mb-2">
                        {{ form.python_path.label }}
                    </label>
                    {{ form.python_path }}
                    {% if form.python_path.help_text %}
                    <p class="mt-1 text-sm text-code-muted">{{ form.python_path.help_text }}</p>
                    {% endif %}
                    {% if form.python_path.errors %}
                    <p class="mt-1 text-sm text-code-red">{{ form.python_path.errors.0 }}</p>
                    {% endif %}
                </div>

                <!-- Info Box -->
                <div class="mb-6 p-4 bg-code-bg border border-code-border rounded-lg">
                    <div class="flex items-start space-x-3">
                        <svg class="w-5 h-5 text-code-accent mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
                        </svg>
                        <div class="text-sm text-code-muted">
                            <p class="font-medium text-code-text">What happens when you create an environment?</p>
                            <ul class="mt-2 space-y-1 list-disc list-inside">
                                <li>A new Python virtual environment will be created</li>
                                <li>The environment will be isolated from other environments</li>
                                <li>You can install packages specific to this environment</li>
                            </ul>
                        </div>
                    </div>
                </div>

                <!-- Actions -->
                <div class="flex items-center justify-end space-x-4 pt-6 border-t border-code-border">
                    <a href="{% url 'cpanel:environment_list' %}"
                       class="px-4 py-2 bg-code-surface border border-code-border hover:border-code-accent text-code-text rounded-lg transition-colors">
                        Cancel
                    </a>
                    <button type="submit"
                            class="px-4 py-2 bg-code-accent hover:bg-code-accent/90 text-white font-semibold rounded-lg transition-colors">
                        Create Environment
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
{% endblock %}