Skip to content

Commit

Permalink
frontend: cloud list not shown if it contains only one cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
tcrivat committed Jul 21, 2016
1 parent 7676168 commit 0b79d0e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
6 changes: 5 additions & 1 deletion conpaas-frontend/www/js/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,15 @@ conpaas.ui = (function (this_module) {

onClickStartApp: function(event){
var page = event.data;
var cloud = $('input[name=available_clouds]:checked').val();
if (cloud == null) {
cloud = 'default';
}
page.startingApp = true;
$("#btnStartApp").hide();
$("#cloudProviders").hide();
page.server.req('ajax/startApplication.php', {
cloud: $('input[name=available_clouds]:checked').val()
cloud: cloud
}, 'post',
function(){
page.displayInfo_('starting application manager...');
Expand Down
9 changes: 7 additions & 2 deletions conpaas-frontend/www/js/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,15 @@ $(document).ready(function() {
});

$('#deploy').click(function() {
var cloud = $('input[name=available_clouds]:checked').val();
if (cloud == null) {
cloud = 'default';
}

if ($('input:file').val() != '') {
$('#fileForm').ajaxForm({
data: {
cloud: $('input[name=available_clouds]:checked').val()
cloud: cloud
},
dataType: 'json',
success: function(response) {
Expand Down Expand Up @@ -91,7 +96,7 @@ $(document).ready(function() {
url: "ajax/uploadManifest.php",
data: {
json: manifest[type],
cloud: $('input[name=available_clouds]:checked').val()
cloud: cloud
},
dataType: 'json'
}).done(function(response) {
Expand Down
18 changes: 10 additions & 8 deletions conpaas-frontend/www/js/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,13 @@ conpaas.ui = (function (this_module) {
onSuccess, onError);
},
start: function (onSuccess, onError) {
var cloud = $('input[name=available_clouds]:checked').val();
if (cloud == null) {
cloud = 'default';
}
this.server.req('ajax/requestStartup.php',
{sid: this.service.sid,
cloud: $('input[name=available_clouds]:checked').val(),
cloud: cloud,
mode: $('input[name=available_modes]:checked').val(),
type: $('input[name=available_types]:checked').val()
},
Expand All @@ -130,14 +134,12 @@ conpaas.ui = (function (this_module) {
'post', onSuccess, onError);
},
addNodes: function (params, onSuccess, onError) {
params.sid = this.service.sid;
radio = $('input[name=available_clouds]:checked');
if (!radio.size()==1){
alert("For adding nodes a cloud must be selected");
page.freezeInput(false);
return;
var cloud = $('input[name=available_clouds]:checked').val();
if (cloud == null) {
cloud = 'default';
}
params.cloud = radio.val();
params.sid = this.service.sid;
params.cloud = cloud;
this.server.req('ajax/addServiceNodes.php', params, 'post',
onSuccess, onError);
},
Expand Down
5 changes: 4 additions & 1 deletion conpaas-frontend/www/lib/ui/page/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,11 @@ public function renderFooter() {

public function renderCloudProviders($default, $visible) {
$clouds = json_decode(HTTPS::get(Conf::DIRECTOR . '/available_clouds'));
$clouds_html = '';
if (count($clouds) <= 1) {
return '';
}

$clouds_html = '';
foreach($clouds as $cloud) {
if ($cloud === $default)
$checked = 'checked';
Expand Down

0 comments on commit 0b79d0e

Please sign in to comment.