Skip to content
Snippets Groups Projects
Commit a89deccd authored by Benjamin Bertrand's avatar Benjamin Bertrand
Browse files

Redirect to task view when creating a VM

parent 8eddab77
No related branches found
No related tags found
No related merge requests found
...@@ -90,12 +90,13 @@ def view_host(name): ...@@ -90,12 +90,13 @@ def view_host(name):
if form.validate_on_submit(): if form.validate_on_submit():
if not current_user.is_admin: if not current_user.is_admin:
flash(f'Only admin users are allowed to create a VM!', 'info') flash(f'Only admin users are allowed to create a VM!', 'info')
return redirect(url_for('network.view_host', name=name))
else: else:
interface = host.interfaces[0] interface = host.interfaces[0]
task = tasks.trigger_vm_creation(name, interface, int(form.memory.data) * 1000, form.cores.data) task = tasks.trigger_vm_creation(name, interface, int(form.memory.data) * 1000, form.cores.data)
current_app.logger.info(f'Creation of {name} requested: task {task.id}') current_app.logger.info(f'Creation of {name} requested: task {task.id}')
flash(f'Creation of {name} requested!', 'success') flash(f'Creation of {name} requested! Refresh the page to update the status.', 'success')
return redirect(url_for('network.view_host', name=name)) return redirect(url_for('task.view_task', id_=task.id))
return render_template('network/view_host.html', host=host, form=form) return render_template('network/view_host.html', host=host, form=form)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment