Commit c1c31ca4 authored by Gwenael Cattez's avatar Gwenael Cattez
Browse files

New functionality : start/stop components (previous functionality worked only for composites)

parent 5380e502
......@@ -214,7 +214,7 @@
}
var count=0;
var name;
var name,status;
this.components = new Array();
var componentsXML=this.XMLNode.getElementsByTagName("component");
......@@ -223,7 +223,8 @@
{
componentXML=componentsXML[i];
name=componentXML.getAttribute("name");
componentJSON=new JSONTreeComponentNode(this,count,name);
status=componentXML.getAttribute("status");
componentJSON=new JSONTreeComponentNode(this,count,name,status);
this.addItem(componentJSON);
count++;
}
......@@ -239,10 +240,13 @@
this.status=status;
}
function JSONTreeComponentNode(JSONParent,index,name,position)
function JSONTreeComponentNode(JSONParent,index,name,status)
{
JSONTreeCompositeAndComponentNode.call(this,JSONParent.getNextId(index),name,"component","scaComponent.png",JSONParent.getChildPath(name));
this.position=index;
var img;
if(status=="STARTED") img="scaComponentStarted.png";
else img="scaComponentStopped.png";
JSONTreeCompositeAndComponentNode.call(this,JSONParent.getNextId(index),name,"component",img,JSONParent.getChildPath(name));
this.status=status;
}
function JSONTreeServiceAndReferenceNode(JSONParent,index,text,type,image,XMLNode,menu,position)
......@@ -345,7 +349,6 @@
this.kind=kind;
this.attributes=new Array();
var attributesXML=XMLBinding.getElementsByTagName("attribute");
var attributeXML,attributeJSON;
for(var i=0;i<attributesXML.length;i++)
......
......@@ -178,12 +178,21 @@
currentJSONTreeNode.reload();
parent.mainPanel.setText(currentJSONTreeNode.path);
document.getElementById("composite_name").innerHTML="composite name : "+currentJSONTreeNode.getJSONTreeComposite().text;
if(currentJSONTreeNode.type!="composite") document.getElementById("component_name").innerHTML="component name : "+currentJSONTreeNode.getJSONTreeComponent().text;
var statusButton=document.getElementById("startstop_composite");
if(currentJSONTreeNode.getJSONTreeComposite().status=="STARTED") statusButton.value="stop";
else statusButton.value="start";
var componentType="component";
var currentComponent=currentJSONTreeNode.getJSONTreeComponent();
if(currentJSONTreeNode.type=="composite")
{
componentType="composite";
currentComponent=currentJSONTreeNode;
}
var currentJSONTreeNodeDom=document.getElementById("component_name");
currentJSONTreeNodeDom.innerHTML=componentType+" : "+currentComponent.text;
var statusButton=document.getElementById("startstop_component");
if(currentComponent.status=="STARTED") statusButton.value="stop";
else statusButton.value="start";
slide=new Fx.Slide('panel',{mode:'horizontal',resetHeight:true});
panel=document.getElementById("panel");
......@@ -925,31 +934,41 @@
/*******************************************MainPanel Utils************************************************************/
function setCompositeStatus()
function setComponentStatus()
{
parent.DHTMLXLayout.cells("b").progressOn();
var statusButton=document.getElementById("startstop_composite");
var statusButton=document.getElementById("startstop_component");
var img;
if(currentJSONTreeNode.type=="composite")
{
img="scaComposite"
}
else
{
img="scaComponent"
}
var method,img,newValue,newStatus;
var method,newValue,newStatus;
if(statusButton.value=="start")
{
method="start";
img="scaCompositeStarted.png";
img+="Started.png";
newValue="stop";
newStatus="STARTED";
}
else
{
method="stop";
img="scaCompositeStopped.png";
img+="Stopped.png";
newValue="start";
newStatus="STOPPED";
}
currentJSONTreeNode.getJSONTreeComposite().status=newStatus;
currentJSONTreeNode.status=newStatus;
statusButton.value=newValue;
parent.IntrospectionAjaxCall("POST","component",currentJSONTreeNode.getJSONTreeComposite().text+"/"+method);
parent.DHTMLXTree.setItemImage(currentJSONTreeNode.getJSONTreeComposite().id,img,img);
parent.IntrospectionAjaxCall("POST","component",currentJSONTreeNode.path+"/"+method);
parent.DHTMLXTree.setItemImage(currentJSONTreeNode.id,img,img);
parent.DHTMLXLayout.cells("b").progressOff();
}
......
......@@ -14,12 +14,11 @@
<body onload="doOnLoadMainPanel();">
<div id=header>
<b id="composite_name" style="float:left"></b>
<b id="component_name" style="float:left"></b>
<form name="composite_status_form" method="get" action="" onsubmit="return false;" style="float:left;">
<input type="button" name="startstop_composite" id="startstop_composite" value="" onClick="setCompositeStatus();" style="margin-left: 10px">
<input type="button" name="startstop_composite" id="startstop_component" value="" onClick="setComponentStatus();" style="margin-left: 10px">
</form>
<b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>
<b id="component_name"></b><br>
<ul id="nav">
<li><a id="components_menu" href="#" onClick="setPanelContent(id);"><img src="images/scaComponent.png" class="menu_icon">Components</a></li>
......
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 to comment