aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates/base/workflow/design_a_pod.html
blob: c23e5a81b7703a01ce57c8809fb6471f889059f9 (plain)
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
{% extends "base.html" %}
{% load staticfiles %}
{% load bootstrap4 %}
{% block extrahead %}
<script src="/static/js/workflows/common-models.js"></script>
<script src="/static/js/workflows/workflow.js"></script>
<script src="/static/js/workflows/design-a-pod.js"></script>
{% endblock %}
{% block content %}
{% if dashboard == 'laas' %}

<!-- Main Content -->
<body>

  <div class="workflow-container">
    <div id="prev" class="row w-100 m-0">
      <button class="btn btn-workflow-nav stretched-link m-0 p-0 mt-3" hidden="true" onclick="workflow.goPrev()" id="workflow-prev">
        <div class="arrow arrow-up"></div>
      </button>
    </div>
  
    <div id="next" class="row w-100 m-0">
      <button class="btn btn-workflow-nav stretched-link m-0 p-0 mb-3" onclick="workflow.goNext()" id="workflow-next">
        <div class="arrow arrow-down"></div>
      </button>
    </div>
  
    <div class="scroll-container w-100 h-100 p-0">

      <!-- Select Lab -->
      <div class="scroll-area pt-5 mx-5" id="select_lab">
        <!-- Ideally the 'Design a Pod' header would be anchored to the top of the page below the arrow -->
        <h1 class="mt-4"><u>Design a Pod</u></h1>
        <p>To get started, select a lab. Then use the navigation arrows or scroll to advance through the workflow.</p>
        <h2 class="mt-4 mb-3">Select a Lab<span class="text-danger">*</span></h2>
        <div class="row card-deck" id="lab_cards">
        </div>
      </div>

      <!-- Add Resources -->
      <div class="scroll-area pt-5 mx-5" id="add_resources">
        <h2 class="mt-4 mb-3">Add Resources<span class="text-danger">*</span></h2>
        <p>Add up to 8 configurable resources to your pod, then use the navigation arrows to proceed to the next step.</p>
        <div class="row card-deck align-items-center" id="host_cards">
          <div class="col-xl-3 col-md-6 col-12" id="add_resource_plus_card">
            <div class="card align-items-center border-0">
              <span class="" id="resource-count">0 / 8</span>
              <button class="btn btn-success add-button p-0" onclick="workflow.onclickAddResource()">+</button>
            </div>
          </div>
        </div>
      </div>

      <!-- Add Networks --> 
    <div class="scroll-area pt-5 mx-5" id="add_networks">
      <h2 class="mt-4 mb-3">Add Networks<span class="text-danger">*</span></h2>
      <p>Define networks to use in your pod. A network may be set as public or private.</p>
        <div class="row card-deck align-items-center" id="network_card_deck">
          <div class="col-xl-3 col-md-6 col-12" id="add_network_plus_card">
            <div class="card align-items-center border-0">
              <button class="btn btn-success add-button p-0" onclick="workflow.onclickAddNetwork()">+</button>
            </div>
          </div>
        </div>
    </div>


   <!-- Configure Connections-->
   <div class="scroll-area pt-5 mx-5" id="configure_connections">
      <h2 class="mt-4 mb-3">Configure Connections<span class="text-danger">*</span></h2>
      <p>Configure the connections for each host in your pod to your defined networks.</p>
      <div class="row card-deck align-items-center" id="connection_cards">
      </div>
  </div>

  <!-- Pod Details-->
  <div class="scroll-area pt-5 mx-5" id="pod_details">
    <h2 class="mt-4 mb-3">Pod Details<span class="text-danger">*</span></h2>
    <p>Add a pod name and description to refer to later.</p>
    <div class="form-group">
      <div class="row align-items-center my-4">
        <div class="col-xl-6 col-md-8 col-11">
          <input id="pod-name-input" class="form-control form-control-lg border border-dark p-3" type="text" placeholder="Pod Name">
        </div>
      </div>
      <div class="row align-items-center my-4">
        <div class="col-xl-6 col-md-8 col-11">
          <textarea id="pod-desc-input" class="form-control form-control-lg border border-dark pt-3 pl-3" rows="5" placeholder="Pod Description"></textarea>
        </div>
      </div>
      <!-- <div class="row align-items-center my-4">
        <div class="col-xl-6 col-md-8 col-11">
          <div class="custom-control custom-switch">
            <input type="checkbox" class="custom-control-input" id="pod-public-input">
            <label class="custom-control-label" for="pod-public-input">Make pod template public?</label>
          </div>
        </div>
      </div> -->
      <div class="row align-items-center my-4">
        <div class="col-xl-6 col-md-8 col-11">
          <span id="pod_details_error" class="text-danger"></span>
        </div>
      </div>
    </div>
  </div>


  <!-- Pod Summary-->
  <div class="scroll-area pt-5 mx-5" id="pod_summary">
    <h2 class="mt-4 mb-3">Pod Summary</h2>
    <p>Confirm the specifications below, and select 'create' to save this pod. Otherwise, navigate upwards and modify it as needed.</p>
    <div class="row align-items-center">
      <div class="col-xl-6 col-md-8 col-11">
        <div class="card border-0">
          <ul class="list-group">
            <li class="list-group-item">Pod Details
              <ul id="pod_summary_pod_details">
              </ul>
            </li>
            <li class="list-group-item">Resources
              <ul id="pod_summary_hosts">
              </ul>
            </li>
          </ul>
        </div>
      </div>
    </div>
    <div class="row align-items-center mt-5">
      <!-- <div class="col-xl-2 col-md-3 col-5"><button class="btn btn-danger cancel-book-button p-0 w-100" onclick="workflow.onclickDiscardTemplate()">Discard</button></div> -->
      <div class="col-xl-2 col-md-3 col-5"><button class="btn btn-success cancel-book-button p-0 w-100" onclick = "workflow.onclickSubmitTemplate()">Create</button></div>
    </div>
  </div>


  <!-- End of workflow container and scroll container -->
    </div>
  </div>



  <!-- Modals -->

  <!-- Add Host Modal -->
  <div class="modal fade" id="resource_modal" tabindex="-1">
    <div class="modal-dialog modal-xl">
      <div class="modal-content">
        <div class="modal-header">
          <h5 class="modal-title">Add Resource</h5>
          <button class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span></button>
        </div>
        <div class="modal-body" id="add_resource_modal_body">
          <p>Select a resource, then configure the image, hostname and cloud-init (optional).</p>
          <p>For multi-node resources, select a tab to modify each individual node.</p>
          <h2>Resource<span class="text-danger">*</span></h2>
          <div id="template-cards" class="row flex-grow-1">
          </div>

          <div id="template-config-section">
            <ul class="nav nav-tabs" role="tablist" id="add_resource_tablist">
              <!-- add a tab per host in template -->
            </ul>
            <!-- tabs -->
            <div id="resource_config_section">
              <h2>Image<span class="text-danger">*</span></h2>
              <div id="image-cards" class="row justify-content-start align-items-center">
              </div>
              <div class="form-group">
                <h2>Hostname<span class="text-danger">*</span></h2>
                <input type="text" class="form-control" id="hostname-input" placeholder="Enter Hostname">
                <h2>Cloud Init</h2>
                <div class="d-flex justify-content-center align-items-center">
                  <textarea name="ci-textarea" id="ci-textarea" rows="5" class="w-100"></textarea>
                </div>
              </div>
            </div>
          </div>
          <p id="add-host-error-msg" class="text-danger"></p>
        </div>
        <div class="modal-footer">
          <button class="btn btn-danger" data-dismiss="modal">Cancel</button>
          <button class="btn btn-success" onclick="workflow.onclickSubmitHostConfig()">Submit</button>
        </div>
      </div>
    </div>
  </div>

<!-- Configure Connections modal -->
<div class="modal fade" id="connection_modal" tabindex="-1">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title">Configure Connections</h5>
        <button class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span></button>
      </div>
      <ul>
        <li>Select an interface and a frame type to add a connection to a network.</li>
        <li>An interface may send tagged or untagged frames on a single network, but not both.</li>
        <li>Each interface may only be untagged on one network.</li>
        <li>Reselect a connection to remove it.</li>
      </ul>
      <div class="modal-body text-center">
        <ul class="nav nav-tabs" role="tablist" id="configure-connections-tablist">
        </ul>
        <table id="connections_widget" class="table table-bordered">
        </table>
      </div>
      <div class="modal-footer">
        <button class="btn btn-success" data-dismiss="modal" id="connection-modal-submit" onclick="workflow.onclickSubmitConnectionConfig()">Confirm</button>
      </div>
    </div>
  </div>
</div>

<!-- Alert Modal -->
<div class="modal fade" id="alert_modal" tabindex="-1">
  <div class="modal-dialog modal-sm">
    <div class="modal-content">
      <div class="modal-header">
        <button class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span></button>
      </div>
      <div class="modal-body text-center">
        <h5 id="alert_modal_message"></h5>
      </div>
      <div class="modal-footer d-flex justify-content-center">
        <button class="btn btn-success" data-dismiss="modal" id="alert-modal-submit" onclick="workflow.goTo(alert_destination)">Confirm</button>
      </div>
    </div>
  </div>
</div>

<div class="hidden_form d-none">
  <form id="token">
      {% csrf_token %}
  </form>
</div>

</body>

<script>
  const user = "{{user}}"
  const workflow = new DesignWorkflow();
  workflow.startWorkflow();
</script>
{% endif %}
{% endblock %}