<li>
<a href="{% url 'projects:instances:ns_operations' project_id=project_id type=type instance_id=i|get:'_id' %}">
<i class="fa fa-list"></i>Active operations</a></li>
+ <li class="divider"></li>
+ <li>
+ <a href="javascript:deleteNs('{% url 'projects:instances:delete' instance_id=i|get:'_id' project_id=project_id type=type %}', true)">
+ <i class="fa fa-trash" style="color:red" ></i>Force delete</a></li>
</ul>
@login_required
def delete(request, project_id=None, instance_id=None, type=None):
+ force = bool(request.GET.get('force', False))
result = {}
client = Client()
- result = client.ns_delete(instance_id)
+ result = client.ns_delete(instance_id, force)
print result
return __response_handler(request, result, 'projects:instances:list', to_redirect=True, type='ns', project_id=project_id)
return self._send_get(_url, headers=self._headers)
return None
- def ns_delete(self, id):
+ def ns_delete(self, id, force=None):
token = self.get_token()
if token:
self._headers['Authorization'] = 'Bearer {}'.format(token)
- #self._headers['Content-Type'] = 'application/yaml'
self._headers['accept'] = 'application/json'
- _url = "{0}/nslcm/v1/ns_instances_content/{1}".format(self._base_path, id)
+ query_path = ''
+ if force:
+ query_path = '?FORCE=true'
+ _url = "{0}/nslcm/v1/ns_instances_content/{1}{2}".format(self._base_path, id, query_path)
+
return self._send_delete(_url, headers=self._headers)
return None
$('#modal_instance_new_action').modal('show');
}
-function deleteNs(url) {
+function deleteNs(url, force) {
bootbox.confirm("Are you sure want to delete?", function (result) {
if (result) {
+ if(force)
+ url = url + '?force=true';
location.href = url
}
})