+ <div id="initscript">
+ <div>
+ <h4>Init Script on PLE</h4>
+ <i>This bash script will be deployed on all PLE nodes of your slice</i>
+ </div>
+ <textarea style="width:100%; height:100px;" id="initscript_code"></textarea><br>
+<!-- TODO !!!
+ <div>
+ <select>
+ <option>All</option>
+ <option>node1</option>
+ <option>node2</option>
+ </select>
+ </div>
+-->
+ <button name="deploy" class="btn btn-success btn-sm" onclick="deploy('{{slicename}}');">Deploy</button>
+ <button name="delete" class="btn btn-danger btn-xs" onclick="del('{{slicename}}');">Delete</button>
+ </div>
+ <script type="text/javascript">
+ $(document).ready(function() {
+ $.post("/initscript/get/",{'slice_hrn':'{{slicename}}'}, function( data ) {
+ jQuery('#initscript_code').val(data['initscript_code']);
+ });
+ });
+ function deploy(slice_hrn){
+ var initscript_code = jQuery('#initscript_code').val()
+ $.post("/initscript/update/",{'slice_hrn':slice_hrn, 'initscript_code':initscript_code}, function( data ) {
+ if (data['ret'] == 0) {
+ mysliceAlert('Success: initscript deployed','success', true);
+ }else{
+ mysliceAlert('Rest Error for: '+data.error,'warning', true);
+ }
+ //jQuery('#initscript_code').val(data['initscript_code']);
+ });
+ }
+ function del(slice_hrn){
+ $.post("/initscript/delete/",{'slice_hrn':slice_hrn}, function( data ) {
+ if (data['ret'] == 0) {
+ mysliceAlert('Success: initscript deleted','success', true);
+ jQuery('#initscript_code').val('');
+ }else{
+ mysliceAlert('Rest Error for: '+data.error,'warning', true);
+ }