Skip to content

Commit 7496779

Browse files
authored
Merge pull request #469 from grycap/devel
Devel
2 parents 205088b + 76e4152 commit 7496779

8 files changed

Lines changed: 27 additions & 8 deletions

File tree

app/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,6 +1380,7 @@ def manage_inf(infid=None, op=None):
13801380
new_infra_id = new_im.import_inf(infra_data, auth_data)
13811381
if new_infra_id:
13821382
im.export_inf(infid, auth_data, delete=True)
1383+
infra.delete_infra(infid)
13831384
flash("Infrastructure successfully migrated to %s." % new_infra_id, "success")
13841385
else:
13851386
flash("Error migrating the infrastructure %s." % infid, "error")

app/im.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def export_inf(self, infid, auth_data, delete=False):
174174
url += "?delete=1"
175175
response = requests.get(url, headers=headers, timeout=self.timeout)
176176
response.raise_for_status()
177-
return response.text
177+
return response.json()['data']
178178

179179
def import_inf(self, data, auth_data):
180180
headers = {"Authorization": auth_data}

app/static/images/nomad.png

-735 Bytes
Loading

app/templates/home.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ <h1 class="display-4">Infrastructure Manager Dashboard.</p>
5252
<div class="col-lg-3"></div>
5353
<div class="col-lg-6">
5454
<h2 class="section-heading text-center">
55-
Available Topologies
55+
Some of the available topologies
5656
</h2>
5757
<hr class="style-seven"/>
5858
</div>
@@ -65,7 +65,7 @@ <h2 class="section-heading text-center">
6565
<a href="https://kubernetes.io/" target="_blank"><img class="img-fluid" src="{{ url_for('static', filename='images/kubernetes.png') }}" alt="Kubernetes"></a>
6666
</div>
6767
<div class="card p-2 text-center">
68-
<a href="http://mesos.apache.org/" target="_blank"><img class="img-fluid" src="{{ url_for('static', filename='images/mesos.png') }}" alt="Mesos"></a>
68+
<a href="https://oscar.grycap.net/" target="_blank"><img class="img-fluid" src="{{ url_for('static', filename='images/oscar.png') }}" alt="OSCAR"></a>
6969
</div>
7070
<div class="card p-2 text-center">
7171
<a href="https://slurm.schedmd.com/" target="_blank"><img class="img-fluid" src="{{ url_for('static', filename='images/slurm.png') }}" alt="SLURM"></a>
@@ -74,9 +74,11 @@ <h2 class="section-heading text-center">
7474

7575
<div class="card-group px-5 mx-5">
7676
<div class="card p-2 text-center">
77-
<a href="https://galaxyproject.org/" target="_blank"><img class="img-fluid" src="{{ url_for('static', filename='images/galaxy.png') }}" alt="Galaxy"></a> </div>
77+
<a href="https://jupyter.org/hub" target="_blank"><img class="img-fluid" src="{{ url_for('static', filename='images/jupyterhub.png') }}" alt="JupyterHub"></a>
78+
</div>
7879
<div class="card p-2 text-center">
79-
<a href="http://ophidia.cmcc.it/" target="_blank"><img class="img-fluid" src="{{ url_for('static', filename='images/ophidia.png') }}" alt="Ophidia"></a> </div>
80+
<a href="https://www.docker.com/" target="_blank"><img class="img-fluid" src="{{ url_for('static', filename='images/docker.png') }}" alt="Docker"></a>
81+
</div>
8082
<div class="card p-2">
8183
<p class="text-dark" style="text-align: center; font-size: x-large;">
8284
<br/>and more ...

app/templates/infrastructures.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,10 @@ <h4 class="font-weight-bold text-primary">My Infrastructures</h4>
214214
<a id="delete_{{infId}}_a" class="dropdown-item" href="#" onclick="$('#delete_confirm_{{infId}}').modal('show');"><span class="fas fa-trash-alt mr-2 grey-text"></span>Delete</a>
215215
<a id="reconfigure_{{infId}}_a" class="dropdown-item" href="#" onclick="$('#reconfigure_confirm_{{infId}}').modal('show');"><span class="fas fa-recycle mr-2 grey-text"></span>Reconfigure</a>
216216
<a id="change_auth_{{infId}}_a" class="dropdown-item" href="#" onclick="$('#change_auth_{{infId}}').modal('show');"><span class="fas fa-users mr-2 grey-text"></span>Change Owner</a>
217+
<!--
218+
Do not show it for now
217219
<a id="migrate_{{infId}}_a" class="dropdown-item" href="#" onclick="$('#migrate_{{infId}}').modal('show');"><span class="fas fa-file-export mr-2 grey-text"></span>Migrate</a>
220+
-->
218221
</div>
219222
</td>
220223
</tr>

app/templates/portfolio.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ <h5 class="card-title text-center">
8888
<h5>
8989
<strong>{% if tosca['metadata']['display_name'] is defined %}{{tosca['metadata']['display_name']}}{% else %}{{tosca_filename}}{% endif %}</strong>
9090
</h5>
91+
<p id="fullToscaDescription" class="d-none">{{tosca['description']}}</p>
9192
<p id="toscaDescription" class="card-text tosca-descr"><small>{{tosca['description']}}</small></p>
92-
<a selector="toscaDescription" class="text-left badge badge-pill badge-info read_more" tabindex="0" data-bs-toggle="popover" title="Full description" data-trigger="focus" data-content="{{tosca['description']}}">Read More</a>
93+
<a selector="toscaDescription" class="text-left badge badge-pill badge-info read_more" tabindex="0" data-bs-toggle="popover" title="Full description" data-bs-trigger="focus" data-bs-content="{{tosca['description']}}">Read More</a>
9394
{% if parent %}
9495
<a href="#!" onclick="AddChild(this, '{{tosca_filename}}')" class="badge badge-pill badge-primary"><span class='fas fa-plus mr-2'></span>Add</a>
9596
{% elif 'link' in tosca['metadata'] %}
@@ -292,7 +293,7 @@ <h5>
292293
cardContainer = document.getElementById("cardsContainer");
293294
cards = cardContainer.getElementsByClassName("card");
294295
for (i = 0; i < cards.length; i++) {
295-
title = cards[i].querySelector(".card-text");
296+
title = cards[i].querySelector("#fullToscaDescription");
296297
if (title.innerText.toUpperCase().indexOf(filter) > -1) {
297298
cards[i].style.display = "";
298299
} else {

app/tests/test_app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def get_response(url, params=None, **kwargs):
9696
elif url == "/im/infrastructures/infid/data":
9797
resp.ok = True
9898
resp.status_code = 200
99-
resp.text = '{"some": "value"}'
99+
resp.json.return_value = {'data': '{"some": "value"}'}
100100

101101
return resp
102102

app/utils.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,18 @@ def extractToscaInfo(toscaDir, tosca_pars_dir, toscaTemplates, tags_to_hide):
379379

380380
toscaInfoOrder = OrderedDict(sorted(toscaInfo.items(), key=lambda x: x[1]["metadata"]['order']))
381381

382+
# Add addons to description
383+
for tosca in toscaTemplates:
384+
if "childs" in toscaInfo[tosca]["metadata"] and toscaInfo[tosca]["metadata"]["childs"]:
385+
if 'description' not in toscaInfo[tosca]:
386+
toscaInfo[tosca]["description"] = ""
387+
child_names = []
388+
for child in toscaInfo[tosca]["metadata"]["childs"]:
389+
child_name = toscaInfo.get(child, {}).get("metadata", {}).get("name")
390+
if child_name:
391+
child_names.append(child_name)
392+
toscaInfo[tosca]["description"] += " Addons: %s" % ", ".join(child_names)
393+
382394
return toscaInfoOrder
383395

384396

0 commit comments

Comments
 (0)