Skip to content

Commit

Permalink
Merge pull request #38 from grycap/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
micafer authored Jul 7, 2020
2 parents f2a4b1b + 4a584ec commit 81212eb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
5 changes: 2 additions & 3 deletions app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,9 @@ def infoutputs(infid=None):

return render_template('outputs.html', infid=infid, outputs=outputs)

@app.route('/delete/<infid>')
@app.route('/delete/<infid>/<force>')
@authorized_with_valid_token
def infdel(infid=None, force=False):

def infdel(infid=None, force=0):
access_token = oidc_blueprint.session.token['access_token']
auth_data = utils.getUserAuthData(access_token, cred, session["userid"])
headers = {"Authorization": auth_data}
Expand Down
4 changes: 2 additions & 2 deletions app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
class Settings:
def __init__(self, config):
"""Creator function."""
self.toscaDir = config['TOSCA_TEMPLATES_DIR'] + "/"
self.toscaParamsDir = config.get('TOSCA_PARAMETERS_DIR') + "/"
self.toscaDir = config.get('TOSCA_TEMPLATES_DIR', '') + "/"
self.toscaParamsDir = config.get('TOSCA_PARAMETERS_DIR', '') + "/"
self.imUrl = config['IM_URL']
self.oidcUrl = config['OIDC_BASE_URL']
self.tempSlamUrl = config.get('SLAM_URL') if config.get('SLAM_URL') else ""
Expand Down
4 changes: 2 additions & 2 deletions app/templates/infrastructures.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ <h5 class="modal-title" id="delete_confirm_label_{{infId}}">Confirm Infrastructu
</div>
<div class="modal-footer">
<a class="btn btn-primary cancelBtn" role="button" data-dismiss="modal">Cancel</a>
<a class="btn btn-danger deleteBtn" role="button" href="{{ url_for("infdel", infid=infId) }}">Delete</a>
<a class="btn btn-danger foceDeleteBtn" role="button" title="The infrastructure will be deleted even if sonme resources are not correctly deleted" href="{{ url_for("infdel", infid=infId, force=True) }}"><span class="fas fa-exclamation-triangle mr-2"></span>Force Delete</a>
<a class="btn btn-danger deleteBtn" role="button" href="{{ url_for('infdel', infid=infId, force=0) }}">Delete</a>
<a class="btn btn-danger foceDeleteBtn" role="button" title="The infrastructure will be deleted even if sonme resources are not correctly deleted" href="{{ url_for('infdel', infid=infId, force=1) }}"><span class="fas fa-exclamation-triangle mr-2"></span>Force Delete</a>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def test_delete(self, flash, avatar, delete, user_data):
user_data.return_value = "type = InfrastructureManager; token = access_token"
delete.side_effect = self.delete_response
self.login(avatar)
res = self.client.get('/delete/infid')
res = self.client.get('/delete/infid/0')
self.assertEqual(302, res.status_code)
self.assertIn('http://localhost/infrastructures', res.headers['location'])
self.assertEquals(flash.call_args_list[0][0], ("Infrastructure 'infid' successfuly deleted.", 'info'))
Expand Down

0 comments on commit 81212eb

Please sign in to comment.