irie 0.0.16__py3-none-any.whl → 0.0.17__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of irie might be problematic. Click here for more details.

@@ -46,9 +46,7 @@ Claudio Perez, Summer 2023
46
46
  {% for predictor in asset.predictors.values %}
47
47
  <div class="accordion-item">
48
48
  <button class="btn {%if predictor.active %}btn-outline-success{%else%}btn-outline-dark{%endif%}" type="button">Active</button>
49
- {% if False %}
50
- <button class="btn btn-outline-danger" type="button">Delete</button>
51
- {% endif %}
49
+
52
50
  <button class="btn" type="button"
53
51
  data-bs-toggle="collapse"
54
52
  data-bs-target="#flush-collapse{{forloop.counter}}"
@@ -56,9 +54,11 @@ Claudio Perez, Summer 2023
56
54
  Details</button>
57
55
  &nbsp;
58
56
  <h6 class="accordion-header" style="display:inline" id="flush-heading{{forloop.counter}}">
57
+ <a href="./{{predictor.id}}" >
59
58
  {{predictor.name}}
59
+ </a>
60
60
  </h6>
61
- (<code>{{predictor.platform}}</code>)
61
+ (<code>{{ predictor.platform }}</code>)
62
62
  {% if False %}
63
63
  <button class="accordion-button btn collapsed" type="button"
64
64
  data-bs-toggle="collapse"
@@ -88,6 +88,8 @@ Claudio Perez, Summer 2023
88
88
  <script src="https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/jsoneditor.min.js"></script>
89
89
  <script>
90
90
 
91
+ const csrftoken = document.querySelector('[name=csrfmiddlewaretoken]').value;
92
+
91
93
  for (const element of document.querySelectorAll("form")) {
92
94
  let editor_elem = element.querySelector(`#${element.id}-editor`);
93
95
  let config = {
@@ -103,7 +105,38 @@ Claudio Perez, Summer 2023
103
105
 
104
106
  editor.on('change', function () {
105
107
  element.querySelector('#editor-input').value = JSON.stringify(editor.getValue())
106
- })
108
+ });
109
+
110
+
111
+ element.addEventListener('submit', async function (event) {
112
+ event.preventDefault(); // Prevent the default form submission
113
+
114
+ // Get the form data
115
+ // const formData = new FormData(event.target);
116
+ // const data = Object.fromEntries(formData.entries());
117
+
118
+ // Send the data to the API
119
+ try {
120
+ const response = await fetch(`./create?runner=${editor_elem.dataset.protocol}`, {
121
+ method: 'POST',
122
+ headers: {
123
+ 'Content-Type': 'application/json',
124
+ 'X-CSRFToken': csrftoken,
125
+ },
126
+ body: JSON.stringify(editor.getValue()),
127
+ });
128
+
129
+ // Handle the response
130
+ if (response.ok) {
131
+ document.getElementById('status').textContent = 'Form submitted successfully!';
132
+ } else {
133
+ document.getElementById('status').textContent = 'Error submitting the form.';
134
+ }
135
+ } catch (error) {
136
+ document.getElementById('status').textContent = 'An error occurred while submitting the form.';
137
+ }
138
+ });
139
+
107
140
  }
108
141
  </script>
109
142
  {% endblock %}
@@ -43,7 +43,7 @@
43
43
  {# form.as_p #}
44
44
 
45
45
  <div class="form-group"></div>
46
- <form id="{{runner.name}}" action="./" method="post" >
46
+ <form id="{{runner.name}}" action="./create/" method="post" >
47
47
  {% csrf_token %}
48
48
  <input id="editor-input" type="hidden" name="json">
49
49
  <div id="{{runner.name}}-editor"
@@ -132,9 +132,20 @@
132
132
  <div class="col-12 mb-4">
133
133
  </div>
134
134
  </div>
135
+
135
136
  </details>
136
137
  <hr>
137
138
 
139
+ <div class="col-10 card bg-white-100 border-0 shadow mb-4">
140
+ <div class="card-body">
141
+ <div class="crop">
142
+ <img src="data:image/jpeg;base64,{{ predictor.render }}" alt="Spectral content">
143
+ </div>
144
+ </div>
145
+ <div class="card-footer">
146
+ Powered by <a href="https://chrystalchern.github.io/mdof"><em>mdof</em></a>
147
+ </div>
148
+ </div>
138
149
  </div>
139
150
  {% endblock content %}
140
151
 
irie/init/__main__.py CHANGED
@@ -16,15 +16,18 @@ def init(settings):
16
16
  "migrate"
17
17
  ])
18
18
 
19
- call_command("makemigrations")
19
+ # call_command("makemigrations")
20
20
 
21
- call_command("migrate")
21
+ # call_command("migrate")
22
22
 
23
- call_command("init_assets")
23
+ # call_command("init_assets")
24
24
 
25
- call_command("init_corridors")
25
+ call_command("init_cesmd")
26
+
27
+ # call_command("init_corridors")
28
+
29
+ # call_command("init_predictors")
26
30
 
27
- call_command("init_predictors")
28
31
 
29
32
 
30
33