lib/splash/webadmin/portal/views/processes.slim in prometheus-splash-0.8.3 vs lib/splash/webadmin/portal/views/processes.slim in prometheus-splash-0.8.4
- old
+ new
@@ -1,20 +1,79 @@
h2.uk-text-success <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> Processes configured in Splash
+- unless @process_saved.nil?
+ javascript:
+ UIkit.notify("Process record #{@process_saved} saved", {status:'success'});
+- unless @process_failed.nil?
+ javascript:
+ UIkit.notify("Process record #{@process_saved} not saved", {status:'danger'});
+
+
+javascript:
+ $(document).on( 'click','input.delete-process',function(){
+ var id = this.id;
+ var url = "/api/config/deleteprocess/" + id + ".json";
+ UIkit.modal.confirm('Are you sure?', function(){
+ console.debug(url)
+ $.ajax({
+ url: url,
+ type: 'DELETE',
+ success: function( data ) {
+ console.debug(data)
+ if (data['status'] == 'success') {
+ $('table#processrecords tr#' + id).remove();
+ UIkit.notify("Deleting process for " + id + " done", {status:'success'});
+ }
+ else
+ {
+ UIkit.notify("Deleting process for " + id + " failed !", {status:'danger'});
+ }
+ },
+ error: function(e) {
+ UIkit.notify("Deleting process for " + id + " failed !", {status:'danger'});
+ }
+ });
+ });
+ });
+
+ $(document).on( 'click','input.monitor-process',function(){
+ var url = "/api/processes/monitor.json";
+ UIkit.modal.confirm('Are you sure?', function(){
+ console.debug(url)
+ $.ajax({
+ url: url,
+ type: 'POST',
+ success: function( data ) {
+ console.debug(data)
+ if (data['status'] == 'success') {
+ UIkit.notify("Forced monitoring done", {status:'success'});
+ }
+ else
+ {
+ UIkit.notify("Forced monitoring failed !", {status:'danger'});
+ }
+ },
+ error: function(e) {
+ UIkit.notify("Forced monitoring failed !", {status:'danger'});
+ }
+ });
+ });
+ });
+
div.uk-width-medium-1-1
div.uk-panel.uk-panel-box
span.uk-text-large.uk-text-bold List of processes monitored
br
- table.uk-table.uk-table-hover.uk-table-striped
+ table#processrecords.uk-table.uk-table-hover.uk-table-striped
thead
tr
th Process record
th Patterns
th Status
tbody
- @data.each do |process|
- tr
+ tr id="#{process[:process].to_s}"
td <b>Process</b> : #{process[:process]}
td
span.uk-text-bold Patterns
ul
- process[:patterns].each do |pattern|
@@ -25,5 +84,16 @@
- if @result[process[:process]][:status] == :running
div.uk-badge.uk-badge-success running
ul
li <b>CPU usage</b> : #{@result[process[:process]][:cpu]}
li <b>MEM usage</b> : #{@result[process[:process]][:mem]}
+ td
+ input.delete-process.uk-button.uk-button-mini.uk-button-danger id="#{process[:process].to_s}" value="Delete"
+ br
+ input.modify-process.uk-button.uk-button-mini.uk-button-primary id="#{process[:process].to_s}" value="Modify" onclick="location.href='/add_modify_process/#{process[:process].to_s}';"
+ br
+ input.history-process.uk-button.uk-button-mini.uk-button-primary id="#{process[:process].to_s}" value="History" onclick="location.href='/get_process_history/#{process[:process].to_s}';"
+ div.uk-align-right
+ form.uk-form.uk-form-horizontal#query action="/add_modify_process" method="GET"
+ div
+ input.monitor-process.uk-button value="Force monitoring"
+ input.add-process.uk-button type="submit" value="Add new process"