new_machine.html 5.55 KB
Newer Older
joansp's avatar
joansp committed
1
<!--<h2>New Base</h2>
2
3
<form name="new_machine" method="post" action="#" 
    ng-controller="new_machine"
4
5
    novalidate
    >
6
7
    <label for "name">Name</label><input type="text" size="20" name="name" ><br/>

8
    <label for="id_iso">ISO image</label>
9
10
    <select name ="id_iso"
        ng-model="id_iso"
Francesc Guasch's avatar
Francesc Guasch committed
11
        ng-options="item.name for item in images track by item.id"
12
13
14
    >
    </select>
    <br/>
15
16
17
18
19
20
21
22
23
24
    <label for="backend">Backend</label>
    <select name="backend"
            ng-model="backend"
            ng-options="item for item in backends"
            >
    </select>
        <br/>
    Disk: <input type="text" name="disk" size="2"> Gb<br/>
    Ram: <input type="text" name="ram" size="2"> Gb<br/>
    <input type="submit" name="submit" value="create">
25
    
joansp's avatar
joansp committed
26
</form>-->
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
<div class="panel panel-default">
    <div class="panel-heading">
        <h2>New Base</h2>
    </div>
    <div class="panel-body">
        <form name="new_machineForm" role="form" method="post" action="#" ng-controller="new_machine" novalidate>
            <div class="from-group">
                <label for="name">Name</label>
                <input class="form-control" ng-model="name" type="text" ng-maxlength="20" name="name" required=""><br/>
            </div>
            
            <div class="from-group">
                <label for="backend">Backend</label>
                <select name="backend"
                        ng-model="backend"
                        ng-options="item for item in backends track by item"
                        required=""
                ></select>
            </div><br/>

            <div ng-if="backend == 'KVM'" class="from-group">
                <label for="id_iso">ISO image</label>
                <select name ="id_iso"
                        ng-model="id_iso"
                        ng-options="item.name for item in images track by item.id"
                        required=""
                ></select>
            </div>
55

56
57
58
59
            <div ng-if="backend == 'LXC'" class="from-group">
                <label for="id_template">Template</label>
                <select name ="id_template"
                        ng-model="id_template"
fv3rdugo's avatar
fv3rdugo committed
60
                        ng-options="item.name for item in templates_lxc track by item.id"
joansp's avatar
joansp committed
61
62
                        required="">
                </select>
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
            </div><br/>
            
            <div ng-if="backend == 'KVM'" class="from-group">
                <label for="disk">Disk Size: (GB)</label>
                <input class="form-control" ng-model="ddsize" type="number" name="ddsize" min="1" max="10" required="">
            </div>
            <div ng-show="backend == 'KVM' || backend == 'LXC'" class="from-group">
                <label fro="ram">Ram: (GB)</label>
                <input class="form-control" ng-model="ramsize" type="number" name="ramsize" min="1" max="4" required="">
            </div><br/>
            
            <div ng-show="new_machineForm.$submitted || new_machineForm.name.$touched">
                <div ng-show="new_machineForm.name.$error.required" class="alert alert-warning fade in">
                    <strong>Error</strong> Machine name is required.
                </div>
                <div ng-show="new_machineForm.name.$error.maxlength" class="alert alert-warning fade in">
                    <strong>Error</strong> Machine name can't exceed 20 characters.
                </div>
            </div>
joansp's avatar
joansp committed
82

83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
            <div ng-show="new_machineForm.$submitted || new_machineForm.backend.$touched">
                <div ng-show="new_machineForm.backend.$error.required" class="alert alert-warning fade in">
                    <strong>Error</strong> Backend selection is required.
                </div>
            </div>

            <div ng-show="new_machineForm.$submitted || new_machineForm.id_iso.$touched">
                <div ng-show="new_machineForm.id_iso.$error.required" class="alert alert-warning fade in">
                    <strong>Error</strong> ISO image selection is required
                </div>
            </div>

            <div ng-show="new_machineForm.$submitted || new_machineForm.id_template.$touched">
                <div ng-show="new_machineForm.id_template.$error.required" class="alert alert-warning fade in">
                    <strong>Error</strong> Template selection is required
                </div>
            </div>

            <div ng-show="new_machineForm.$submitted || new_machineForm.ddsize.$touched">
                <div ng-show="new_machineForm.ddsize.$error.required" class="alert alert-warning fade in">
                    <strong>Error</strong> Disk Size selection is required
                </div>
                <div ng-show="new_machineForm.ddsize.$error.min || new_machineForm.ddsize.$error.max" class="alert alert-warning">
                    <strong>Error</strong> Disk Size selection must be between 1GB and 10GB
                </div>
            </div>
            <div ng-show="new_machineForm.$submitted || new_machineForm.ramsize.$touched">
                <div ng-show="new_machineForm.ramsize.$error.required" class="alert alert-warning fade in">
                    <strong>Error</strong> Ram Size selection is required
                </div>
                <div ng-show="new_machineForm.ramsize.$error.min || new_machineForm.ramsize.$error.max" class="alert alert-warning fade in">
                    <strong>Error</strong> Ram Size selection must be between 1GB and 4GB
joansp's avatar
joansp committed
115
                </div>
116
            </div>
joansp's avatar
joansp committed
117
118


119
            <input type="submit" class="btn btn-default" name="submit" value="Create" ng-disabled="new_machineForm.$invalid">
joansp's avatar
joansp committed
120

121
        </form>
joansp's avatar
joansp committed
122
    </div>
fv3rdugo's avatar
fv3rdugo committed
123
</div>