Commit 3bff1bcd by Csók Tamás

button changed into a link

parent 64cb3660
...@@ -594,6 +594,13 @@ function clientInstalledAction(location) { ...@@ -594,6 +594,13 @@ function clientInstalledAction(location) {
$('#confirmation-modal').modal("hide"); $('#confirmation-modal').modal("hide");
} }
$(function() {
$(document).on("click", "#client-check-button", function(event) {
var connectUri = $('#connect-uri').val();
clientInstalledAction(connectUri); return false;
return false;
});
});
// for AJAX calls // for AJAX calls
/** /**
* Getter for user cookies * Getter for user cookies
......
...@@ -389,12 +389,12 @@ function checkNewActivity(runs) { ...@@ -389,12 +389,12 @@ function checkNewActivity(runs) {
$("#vm-details-state span").html(data['human_readable_status'].toUpperCase()); $("#vm-details-state span").html(data['human_readable_status'].toUpperCase());
if(data['status'] == "RUNNING") { if(data['status'] == "RUNNING") {
if(data['connect_uri']) { if(data['connect_uri']) {
$("#dashboard-vm-details-connect-button").prop("disabled", false); $("#dashboard-vm-details-connect-button").removeClass('disabled');
} }
$("[data-target=#_console]").attr("data-toggle", "pill").attr("href", "#console").parent("li").removeClass("disabled"); $("[data-target=#_console]").attr("data-toggle", "pill").attr("href", "#console").parent("li").removeClass("disabled");
} else { } else {
if(data['connect_uri']) { if(data['connect_uri']) {
$("#dashboard-vm-details-connect-button").prop("disabled", true); $("#dashboard-vm-details-connect-button").addClass('disabled');
} }
$("[data-target=#_console]").attr("data-toggle", "_pill").attr("href", "#").parent("li").addClass("disabled"); $("[data-target=#_console]").attr("data-toggle", "_pill").attr("href", "#").parent("li").addClass("disabled");
} }
......
...@@ -13,18 +13,14 @@ ...@@ -13,18 +13,14 @@
</p> </p>
<br> <br>
<div class="pull-right"> <div class="pull-right">
<form method="POST" id="dashboard-vm-details-connect" action=""> <form method="POST" id="dashboard-client-check" action="">
{% csrf_token %} {% csrf_token %}
<a class="btn btn-default" href="{% url "dashboard.views.detail" pk=instance.pk %}" data-dismiss="modal">{% trans "Cancel" %}</a> <a class="btn btn-default" href="{% url "dashboard.views.detail" pk=instance.pk %}" data-dismiss="modal">{% trans "Cancel" %}</a>
<a class="btn btn-info" href="http://circlecloud.org/client/download" data-dismiss="modal">{% trans "Download the Client" %}</a> <a class="btn btn-info" href="http://circlecloud.org/client/download" data-dismiss="modal">{% trans "Download the Client" %}</a>
<button data-dismiss="modal" id="client-check-button" type="submit" class="btn btn-success" title="{% trans "I downloaded and installed the client and I want to connect using it. This choice will be saved to your compuer" %}"> <button data-dismiss="modal" id="client-check-button" type="submit" class="btn btn-success" title="{% trans "I downloaded and installed the client and I want to connect using it. This choice will be saved to your compuer" %}">
<i class="fa fa-external-link"></i> {% trans "I have the Client installed" %} <i class="fa fa-external-link"></i> {% trans "I have the Client installed" %}
</button> </button>
<input name="connect-uri" type="hidden" value="{% if instance.get_connect_uri %}{{ instance.get_connect_uri}}{% endif %}" /> <input id="connect-uri" name="connect-uri" type="hidden" value="{% if instance.get_connect_uri %}{{ instance.get_connect_uri}}{% endif %}" />
<input name="vm" type="hidden" value="{% if instance.get_connect_uri %}{{ instance.pk}}{% endif %}" /> <input name="vm" type="hidden" value="{% if instance.get_connect_uri %}{{ instance.pk}}{% endif %}" />
</form> </form>
</div> </div>
\ No newline at end of file
<script>
addOnClickToInput('client-check-button', clientInstalledAction, '{% if instance.get_connect_uri %}{{ instance.get_connect_uri}}{% endif %}');
</script>
\ No newline at end of file
...@@ -121,15 +121,10 @@ ...@@ -121,15 +121,10 @@
<i class="fa fa-copy" title="{% trans "Select all" %}"></i> <i class="fa fa-copy" title="{% trans "Select all" %}"></i>
</span> </span>
</div> </div>
<div id="dashboard-vm-details-connect" class="operation-wrapper"> <div id="dashboard-vm-details-connect" class="operation-wrapper">
<form method="{% if not client_download %}GET{% else %} POST{% endif %}" action="{% if not client_download %}{% url "dashboard.views.client-check" %}{% else %}{% if instance.get_connect_uri %}{{ instance.get_connect_uri}}{% endif %}{% endif %}"> <a id="dashboard-vm-details-connect-button" class="btn btn-xs btn-default{% if not client_download %} operation{% endif %}{% if instance.status != "RUNNING" or not instance.get_connect_uri %} disabled{% endif %}" {% if client_download %}target="_blank"{% endif %} href="{% if not client_download %}{% url "dashboard.views.client-check" %}?vm={{ instance.pk }}{% else %}{{ instance.get_connect_uri}}{% endif %}" title="{% trans "Connect via the CIRCLE Client" %}">
<button id="dashboard-vm-details-connect-button" type="submit" class="btn btn-xs btn-default {% if not client_download %}operation{% endif %}" href="{% url "dashboard.views.client-check" %}?vm={{ instance.pk }}" {% if instance.status != "RUNNING" or not instance.get_connect_uri %}disabled{% endif %} title="{% trans "Connect via the CIRCLE Client" %}">
<i class="fa fa-external-link"></i> {% trans "Connect" %} <i class="fa fa-external-link"></i> {% trans "Connect" %}
</button> </a>
{% if not client_download %}
<input type="hidden" name="vm" value="{{ instance.pk }}" />
{% endif %}
</form>
</div> </div>
</div> </div>
<div class="col-md-8" id="vm-detail-pane"> <div class="col-md-8" id="vm-detail-pane">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment