1313 $ composeProjects = array ();
1414}
1515$ o = "" ;
16- foreach ($ composeProjects as $ script ) {
17- if ( ( ! is_file ("$ compose_root/ $ script /docker-compose.yml " ) ) &&
18- ( ! is_file ("$ compose_root/ $ script /indirect " ) ) ) {
16+ foreach ($ composeProjects as $ project ) {
17+ if ( ( ! is_file ("$ compose_root/ $ project /docker-compose.yml " ) ) &&
18+ ( ! is_file ("$ compose_root/ $ project /indirect " ) ) ) {
1919 continue ;
2020 }
2121
22- $ scriptName = $ script ;
23- if ( is_file ("$ compose_root/ $ script /name " ) ) {
24- $ scriptName = trim (file_get_contents ("$ compose_root/ $ script /name " ));
22+ $ projectName = $ project ;
23+ if ( is_file ("$ compose_root/ $ project /name " ) ) {
24+ $ projectName = trim (file_get_contents ("$ compose_root/ $ project /name " ));
2525 }
26- $ id = str_replace (". " ,"- " ,$ script );
26+ $ id = str_replace (". " ,"- " ,$ project );
2727 $ id = str_replace (" " ,"" ,$ id );
2828
2929 $ isrunning = FALSE ;
3333 $ isup = FALSE ;
3434 foreach ( $ stackstate as $ entry )
3535 {
36- if ( strcasecmp ($ entry ["Name " ], sanitizeStr ($ scriptName )) == 0 ) {
36+ if ( strcasecmp ($ entry ["Name " ], sanitizeStr ($ projectName )) == 0 ) {
3737 $ isup = TRUE ;
3838 if ( strpos ($ entry ["Status " ], 'running ' ) !== false ) {
3939 $ isrunning = TRUE ;
5353 }
5454 }
5555
56- if ( is_file ("$ compose_root/ $ script /description " ) ) {
57- $ description = @file_get_contents ("$ compose_root/ $ script /description " );
56+ if ( is_file ("$ compose_root/ $ project /description " ) ) {
57+ $ description = @file_get_contents ("$ compose_root/ $ project /description " );
5858 $ description = str_replace ("\r" ,"" ,$ description );
5959 $ description = str_replace ("\n" ,"<br> " ,$ description );
6060 } else {
61- $ description = isset ($ variables ['description ' ]) ? $ variables ['description ' ] : "No description<br>( $ compose_root/ $ script ) " ;
61+ $ description = isset ($ variables ['description ' ]) ? $ variables ['description ' ] : "No description<br>( $ compose_root/ $ project ) " ;
6262 }
6363
6464 $ autostart = '' ;
65- if ( is_file ("$ compose_root/ $ script /autostart " ) ) {
66- $ autostarttext = @file_get_contents ("$ compose_root/ $ script /autostart " );
65+ if ( is_file ("$ compose_root/ $ project /autostart " ) ) {
66+ $ autostarttext = @file_get_contents ("$ compose_root/ $ project /autostart " );
6767 if ( strpos ($ autostarttext , 'true ' ) !== false ) {
6868 $ autostart = 'checked ' ;
6969 }
7070 }
7171
7272 $ o .= "<tr><td width='30%' style='text-align:initial'> " ;
73- $ o .= "<font size='2'><span class='ca_nameEdit' id='name $ id' data-nameName=' $ scriptName ' data-isup=' $ isup' data-scriptName= " .escapeshellarg ($ script )." style='font-size:1.9rem;cursor:pointer;color:#ff8c2f;'><i class='fa fa-gear'></i></span> <b><span style='color:#ff8c2f;'> $ scriptName </span> </b></font> " ;
73+ $ o .= "<font size='2'><span class='ca_nameEdit' id='name $ id' data-nameName=' $ projectName ' data-isup=' $ isup' data-scriptName= " .escapeshellarg ($ project )." style='font-size:1.9rem;cursor:pointer;color:#ff8c2f;'><i class='fa fa-gear'></i></span> <b><span style='color:#ff8c2f;'> $ projectName </span> </b></font> " ;
7474 if ( $ isup ) {
7575 if ( $ isexited && !$ isrunning ) {
7676 $ o .= "<i class='fa fa-square stopped red-text' style='margin-left: 5px;'></i> " ;
9494 }
9595 }
9696 $ o .= "<br> " ;
97- $ o .= "<span class='ca_descEdit' data-scriptName= " .escapeshellarg ($ script )." id='desc $ id'> $ description</span> " ;
97+ $ o .= "<span class='ca_descEdit' data-scriptName= " .escapeshellarg ($ project )." id='desc $ id'> $ description</span> " ;
9898 $ o .= "</td> " ;
9999 $ o .= "<td width=25%></td> " ;
100- $ o .= "<td width=5%><input type='button' value='Compose Up' class='up $ id' id=' $ id' onclick='ComposeUp(" $ compose_root/ $ script ");'></td> " ;
101- $ o .= "<td width=5%><input type='button' value='Compose Down' class='down $ id' id=' $ id' onclick='ComposeDown(" $ compose_root/ $ script ");'></td> " ;
102- $ o .= "<td width=5%><input type='button' value='Update Stack' class='update $ id' id=' $ id' onclick='UpdateStack(" $ compose_root/ $ script ");'></td> " ;
103- $ o .= "<td width=5%><input type='checkbox' class='auto_start' data-scriptName= " .escapeshellarg ($ script )." id=' $ id' style='display:none' $ autostart></td> " ;
100+ $ o .= "<td width=5%><input type='button' value='Compose Up' class='up $ id' id=' $ id' onclick='ComposeUp(" $ compose_root/ $ project ");'></td> " ;
101+ $ o .= "<td width=5%><input type='button' value='Compose Down' class='down $ id' id=' $ id' onclick='ComposeDown(" $ compose_root/ $ project ");'></td> " ;
102+ $ o .= "<td width=5%><input type='button' value='Update Stack' class='update $ id' id=' $ id' onclick='UpdateStack(" $ compose_root/ $ project ");'></td> " ;
103+ $ o .= "<td width=5%><input type='checkbox' class='auto_start' data-scriptName= " .escapeshellarg ($ project )." id=' $ id' style='display:none' $ autostart></td> " ;
104104 $ o .= "</tr> " ;
105105}
106106?>
@@ -235,9 +235,9 @@ function(data) {
235235
236236function deleteStack(myID) {
237237 var stackName = $("#"+myID).attr("data-scriptname");
238- var script = $("#"+myID).attr("data-namename");
238+ var project = $("#"+myID).attr("data-namename");
239239 var element = document.createElement("div")
240- element.innerHTML = "Are you sure you want to delete <font color='red'><b>"+script +"</b></font> (<font color='green'>"+compose_root+"/"+stackName+"</font>)?";
240+ element.innerHTML = "Are you sure you want to delete <font color='red'><b>"+project +"</b></font> (<font color='green'>"+compose_root+"/"+stackName+"</font>)?";
241241 swal2({
242242 content: element,
243243 title: "Delete Stack?",
@@ -294,11 +294,11 @@ function editDesc(myID) {
294294
295295function applyName(myID) {
296296 var newName = $("#newName"+myID).val();
297- var script = $("#"+myID).attr("data-scriptname");
297+ var project = $("#"+myID).attr("data-scriptname");
298298 $("#"+myID).html(newName);
299299 $("#"+myID).tooltipster("enable");
300300 $("#"+myID).tooltipster("close");
301- $.post(caURL,{action:'changeName',script:script ,newName:newName},function(data) {
301+ $.post(caURL,{action:'changeName',script:project ,newName:newName},function(data) {
302302 window.location.reload();
303303 });
304304}
@@ -321,9 +321,9 @@ function cancelDesc(myID) {
321321function applyDesc(myID) {
322322 var newDesc = $("#newDesc"+myID).val();
323323 newDesc = newDesc.replace(/\n/g, "<br>");
324- var script = $("#"+myID).attr("data-scriptname");
324+ var project = $("#"+myID).attr("data-scriptname");
325325 $("#"+myID).html(newDesc);
326- $.post(caURL,{action:'changeDesc',script:script ,newDesc:newDesc});
326+ $.post(caURL,{action:'changeDesc',script:project ,newDesc:newDesc});
327327}
328328
329329function editStack(myID) {
@@ -381,17 +381,17 @@ function override_find_labels( primary, secondary, label ) {
381381 return value;
382382}
383383
384- function generateOverride(myID, myScript =null) {
385- var script = myScript ;
384+ function generateOverride(myID, myProject =null) {
385+ var project = myProject ;
386386 if( myID ) {
387387 $("#"+myID).tooltipster("close");
388- script = $("#"+myID).attr("data-scriptname");
388+ project = $("#"+myID).attr("data-scriptname");
389389 }
390390
391- $.post(caURL,{action:'getOverride',script:script },function(rawOverride) {
391+ $.post(caURL,{action:'getOverride',script:project },function(rawOverride) {
392392 if (rawOverride) {
393393 var rawOverride = jQuery.parseJSON(rawOverride);
394- $.post(caURL,{action:'getYml',script:script },function(rawComposefile) {
394+ $.post(caURL,{action:'getYml',script:project },function(rawComposefile) {
395395 if (rawComposefile) {
396396 var rawComposefile = jQuery.parseJSON(rawComposefile);
397397
@@ -480,7 +480,7 @@ function generateOverride(myID, myScript=null) {
480480
481481 rawOverride = jsyaml.dump(override_doc, {'forceQuotes': true});
482482 // console.log(rawOverride);
483- $.post(caURL,{action:"saveOverride",script:script ,scriptContents:rawOverride},function(data) {
483+ $.post(caURL,{action:"saveOverride",script:project ,scriptContents:rawOverride},function(data) {
484484 if (!data) {
485485 swal2({
486486 title: "Failed to update labels.",
@@ -500,16 +500,16 @@ function generateOverride(myID, myScript=null) {
500500function editComposeFile(myID) {
501501 var origID = myID;
502502 $("#"+myID).tooltipster("close");
503- var script = $("#"+myID).attr("data-scriptname");
504- $.post(caURL,{action:'getYml',script:script },function(data) {
503+ var project = $("#"+myID).attr("data-scriptname");
504+ $.post(caURL,{action:'getYml',script:project },function(data) {
505505 if (data) {
506506 var response = jQuery.parseJSON(data);
507507 var editor = ace.edit("itemEditor");
508508 editor.getSession().setValue(response.content);
509509 editor.getSession().setMode("ace/mode/yaml");
510510 editor.getSession().setOptions({ tabSize: 2, useSoftTabs: true });
511511
512- $('#editorFileName').data("stackname", script );
512+ $('#editorFileName').data("stackname", project );
513513 $('#editorFileName').data("stackfilename", "docker-compose.yml")
514514 $('#editorFileName').html(response.fileName)
515515 $(".editing").show();
@@ -521,15 +521,15 @@ function editComposeFile(myID) {
521521function editEnv(myID) {
522522 var origID = myID;
523523 $("#"+myID).tooltipster("close");
524- var script = $("#"+myID).attr("data-scriptname");
525- $.post(caURL,{action:'getEnv',script:script },function(data) {
524+ var project = $("#"+myID).attr("data-scriptname");
525+ $.post(caURL,{action:'getEnv',script:project },function(data) {
526526 if (data) {
527527 var response = jQuery.parseJSON(data);
528528 var editor = ace.edit("itemEditor");
529529 editor.getSession().setValue(response.content);
530530 editor.getSession().setMode("ace/mode/sh");
531531
532- $('#editorFileName').data("stackname", script );
532+ $('#editorFileName').data("stackname", project );
533533 $('#editorFileName').data("stackfilename", ".env")
534534 $('#editorFileName').html(response.fileName)
535535 $(".editing").show();
@@ -543,7 +543,7 @@ function cancelEdit() {
543543}
544544
545545function saveEdit() {
546- var script = $("#editorFileName").data("stackname");
546+ var project = $("#editorFileName").data("stackname");
547547 var fileName = $("#editorFileName").data("stackfilename");
548548 var editor = ace.edit("itemEditor");
549549 var scriptContents = editor.getValue();
@@ -563,21 +563,21 @@ function saveEdit() {
563563 return;
564564 }
565565
566- $.post(caURL,{action:actionStr,script:script ,scriptContents:scriptContents},function(data) {
566+ $.post(caURL,{action:actionStr,script:project ,scriptContents:scriptContents},function(data) {
567567 if (data) {
568568 $(".editing").hide();
569569 if (actionStr == 'saveYml') {
570- generateOverride(null,script );
570+ generateOverride(null,project );
571571 }
572572 }
573573 });
574574
575575}
576576
577577function editStackSettings(myID) {
578- var script = $("#"+myID).attr("data-scriptname");
578+ var project = $("#"+myID).attr("data-scriptname");
579579
580- $.post(caURL,{action:'getEnvPath',script:script },function(rawEnvPath) {
580+ $.post(caURL,{action:'getEnvPath',script:project },function(rawEnvPath) {
581581 if (rawEnvPath) {
582582 var rawEnvPath = jQuery.parseJSON(rawEnvPath);
583583 if(rawEnvPath.result == 'success') {
@@ -594,7 +594,7 @@ function editStackSettings(myID) {
594594 }).then((inputValue) => {
595595 if (inputValue) {
596596 var new_env_path = document.getElementById("env_path").value;
597- $.post(caURL,{action:'setEnvPath',envPath:new_env_path,script:script },function(data) {
597+ $.post(caURL,{action:'setEnvPath',envPath:new_env_path,script:project },function(data) {
598598 var title = "Failed to set stack settings.";
599599 var message = "";
600600 var icon = "error";
@@ -658,8 +658,8 @@ function ComposeLogs(myID) {
658658 var height = 800;
659659 var width = 1200;
660660 $("#"+myID).tooltipster("close");
661- var script = $("#"+myID).attr("data-scriptname");
662- var path = compose_root + "/" + script ;
661+ var project = $("#"+myID).attr("data-scriptname");
662+ var path = compose_root + "/" + project ;
663663 console.log(path);
664664 $.post(compURL,{action:'composeLogs',path:path},function(data) {
665665 if (data) {
0 commit comments