' <a href="/instances/ns/' +row["_id"] +'/operation">' +
' <i class="fa fa-list"></i> History of operations</a></li>' +
' <li class="divider"></li>' +
- ' <li><a href="#"' +
- ' onclick="javascript:newAlarmNs(\''+ row["short-name"] +'\', \''+row["_id"]+'\')">' +
- ' <i class="far fa-bell"></i> New Alarm</a></li>' +
- ' <li><a href="#"' +
- ' onclick="javascript:exportMetricNs(\''+ row["short-name"] +'\', \''+row["_id"]+ '\')">' +
- ' <i class="far fa-chart-bar"></i> Export metric</a></li>' +
- ' <li class="divider"></li>' +
' <li>' +
' <a href="javascript:deleteNs(\''+ row["short-name"] +'\', \''+row["_id"]+'\', true)">' +
' <i class="far fa-trash-alt" style="color:red" ></i> Force delete</a></li>' +
+++ /dev/null
-<div class="modal" id="modal_instance_export_metric" xmlns="http://www.w3.org/1999/html">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span></button>
- <h4 class="modal-title">Export metric</h4>
- </div>
-
- <form id="formExportMetricNS" action="" class="form-horizontal" method="post" enctype="multipart/form-data">
- {% csrf_token %}
- <div class="modal-body" id="modal_instance_export_metric">
-
-
- <div class="form-group">
- <label for="metric_name" class="col-sm-3">Name *</label>
- <div class="col-sm-3">
- <input class="form-control input-sm" id="metric_name" name="metric_name" required>
- </div>
- <label for="metric_name" class="col-sm-3">Metric Name *</label>
- <div class="col-sm-3">
- <input class="form-control input-sm" id="metric_name" name="metric_name" required>
- </div>
- </div>
-
-
- <div class="form-group">
- <label for="vnf_member_index" class="col-sm-3">VNF Member index *</label>
- <div class="col-sm-3">
- <input class="form-control input-sm" id="vnf_member_index" name="vnf_member_index" required>
- </div>
- <label for="vdu_name" class="col-sm-3">VDU Name *</label>
- <div class="col-sm-3">
- <input class="form-control input-sm" id="vdu_name" name="vdu_name" required>
- </div>
- </div>
-
- <div class="form-group">
-
-
- <label for="correlation_id" class="col-sm-3">Correlation</label>
- <div class="col-sm-3">
- <input class="form-control input-sm" id="correlation_id" name="correlation_id" >
- </div>
-
- </div>
- <div class="form-group">
- <label for="collection_unit" class="col-sm-3">Collection Unit</label>
- <div class="col-sm-3">
- <input class="form-control input-sm" id="collection_unit" name="collection_unit" >
- </div>
- <label for="collection_period" class="col-sm-3">Collection period </label>
- <div class="col-sm-3">
- <input class="form-control input-sm" id="collection_period" name="collection_period" >
- </div>
-
- </div>
- <div class="form-group">
-
-
- </div>
-
-
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Cancel</button>
- <button class="btn btn-primary pull-right">Create</button>
- </div>
- </form>
-
- </div>
- <!-- /.modal-content -->
- </div>
- <!-- /.modal-dialog -->
-</div>
+++ /dev/null
-<div class="modal" id="modal_instance_new_alarm" xmlns="http://www.w3.org/1999/html">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span></button>
- <h4 class="modal-title">Create Alarm</h4>
- </div>
-
- <form id="formAlarmNS" action="" class="form-horizontal" method="post" enctype="multipart/form-data">
- {% csrf_token %}
- <div class="modal-body" id="modal_instance_new_alarm_body">
-
-
- <div class="form-group">
- <label for="alarm_name" class="col-sm-3">Name *</label>
- <div class="col-sm-3">
- <input class="form-control input-sm" id="alarm_name" name="alarm_name" required>
- </div>
- <label for="metric_name" class="col-sm-3">Metric Name *</label>
- <div class="col-sm-3">
- <input class="form-control input-sm" id="metric_name" name="metric_name" required>
- </div>
- </div>
-
-
- <div class="form-group">
- <label for="vnf_member_index" class="col-sm-3">VNF Member index *</label>
- <div class="col-sm-3">
- <input class="form-control input-sm" id="vnf_member_index" name="vnf_member_index" required>
- </div>
- <label for="vdu_name" class="col-sm-3">VDU Name *</label>
- <div class="col-sm-3">
- <input class="form-control input-sm" id="vdu_name" name="vdu_name" required>
- </div>
- </div>
-
- <div class="form-group">
-
- <label for="statistic" class="col-sm-3">Statistic *</label>
- <div class="col-sm-3">
- <input class="form-control input-sm" id="statistic" name="statistic" required>
- </div>
- <label for="correlation_id" class="col-sm-3">Correlation</label>
- <div class="col-sm-3">
- <input class="form-control input-sm" id="correlation_id" name="correlation_id" >
- </div>
-
- </div>
- <div class="form-group">
- <label for="threshold_value" class="col-sm-3">Threshold Value *</label>
- <div class="col-sm-3">
- <input class="form-control input-sm" id="threshold_value" name="threshold_value" required>
- </div>
- <label for="statistic" class="col-sm-3">Severity</label>
- <div class="col-sm-3">
- <input class="form-control input-sm" id="severity" name="severity" >
- </div>
-
- </div>
- <div class="form-group">
- <label for="operation" class="col-sm-3">Operation</label>
- <div class="col-sm-3">
- <input class="form-control input-sm" id="operation" name="operation" >
- </div>
-
-
-
- </div>
-
-
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Cancel</button>
- <button class="btn btn-primary pull-right">Create</button>
- </div>
- </form>
-
- </div>
- <!-- /.modal-content -->
- </div>
- <!-- /.modal-dialog -->
-</div>
$('#modal_instance_new_action').modal('show');
}
-function exportMetricNs(instance_name, instance_id) {
- var url = '/instances/ns/'+instance_id+'/monitoring/metric';
- $("#formExportMetricNS").attr("action", url);
- $('#modal_instance_export_metric').modal('show');
-}
-
-function newAlarmNs(instance_name, instance_id) {
- var url = '/instances/ns/'+instance_id+'/monitoring/alarm';
- $("#formAlarmNS").attr("action", url);
- $('#modal_instance_new_alarm').modal('show');
-}
-
function deleteNs(instance_name, instance_id, force) {
var url = '/instances/ns/'+instance_id+'/delete';
bootbox.confirm("Are you sure want to delete " + instance_name + "?", function (result) {
});
});
- $("#formAlarmNS").submit(function (event) {
- event.preventDefault(); //prevent default action
- var post_url = $(this).attr("action"); //get form action url
- var request_method = $(this).attr("method"); //get form GET/POST method
- var form_data = new FormData(this); //Encode form elements for submission
- console.log(post_url);
- $.ajax({
- url: post_url,
- type: request_method,
- data: form_data,
- headers: {
- "Accept": 'application/json'
- },
- contentType: false,
- processData: false
- }).done(function (response, textStatus, jqXHR) {
- $('#modal_instance_new_action').modal('hide');
- bootbox.alert({
- title: "Metric",
- message: "Alarm created."
- });
- }).fail(function (result) {
- var data = result.responseJSON;
- var title = "Error " + (data.code ? data.code : 'unknown');
- var message = data.detail ? data.detail : 'No detail available.';
- bootbox.alert({
- title: title,
- message: message
- });
- });
- });
-
- $("#formExportMetricNS").submit(function (event) {
- event.preventDefault(); //prevent default action
- var post_url = $(this).attr("action"); //get form action url
- var request_method = $(this).attr("method"); //get form GET/POST method
- var form_data = new FormData(this); //Encode form elements for submission
- console.log(post_url);
- $.ajax({
- url: post_url,
- type: request_method,
- data: form_data,
- headers: {
- "Accept": 'application/json'
- },
- contentType: false,
- processData: false
- }).done(function (response, textStatus, jqXHR) {
- $('#modal_instance_new_action').modal('hide');
- bootbox.alert({
- title: "Metric",
- message: "Metric exported."
- });
- }).fail(function (result) {
- var data = result.responseJSON;
- var title = "Error " + (data.code ? data.code : 'unknown');
- var message = data.detail ? data.detail : 'No detail available.';
- bootbox.alert({
- title: title,
- message: message
- });
- });
- });
-
});
\ No newline at end of file