lib/splash/webadmin/portal/views/logs.slim in prometheus-splash-0.8.1 vs lib/splash/webadmin/portal/views/logs.slim in prometheus-splash-0.8.2
- old
+ new
@@ -1,32 +1,79 @@
-h2 <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> Logs configured in Splash
+h2.uk-text-success <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> Logs configured in Splash
+
+- unless @log_saved.nil?
+ javascript:
+ UIkit.notify("Log record #{@log_saved} saved", {status:'success'});
+- unless @log_failed.nil?
+ javascript:
+ UIkit.notify("Log record #{@log_saved} not saved", {status:'danger'});
+
+
+javascript:
+ $(document).on( 'click','input.delete-log',function(){
+ var id = this.id;
+ var url = "/api/config/deletelog/" + 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#logrecords tr#' + id).remove();
+ UIkit.notify("Deleting log for " + id + " done", {status:'success'});
+ }
+ else
+ {
+ UIkit.notify("Deleting log for " + id + " failed !", {status:'danger'});
+ }
+ },
+ error: function(e) {
+ UIkit.notify("Deleting log for " + id + " failed !", {status:'danger'});
+ }
+ });
+ });
+ });
+
div.uk-width-medium-1-1
div.uk-panel.uk-panel-box
span.uk-text-large.uk-text-bold List of logs monitored
br
- table.uk-table.uk-table-hover.uk-table-striped
+ table#logrecords.uk-table.uk-table-hover.uk-table-striped
thead
tr
th Log record label
th Definition
th Status
- tbody
- - @data.each do |log|
- tr
- td <b>Label</b> : #{log[:label]}
- td
+ th Actions
+ tbody
+ - @data.each do |log|
+ tr id="#{log[:label].to_s}"
+ td <b>Label</b> : #{log[:label]}
+ td
+ ul
+ li <b>File</b> : #{log[:log]}
+ li <b>Pattern</b> : #{log[:pattern]}
+ td
+ - if @result[log[:label]][:status] == :missing
+ div.uk-badge.uk-badge-warning missing
+ - if @result[log[:label]][:status] == :clean
+ div.uk-badge.uk-badge-success success
ul
- li <b>File</b> : #{log[:log]}
- li <b>Pattern</b> : #{log[:pattern]}
- td
- - if @result[log[:label]][:status] == :missing
- div.uk-badge.uk-badge-warning missing
- - if @result[log[:label]][:status] == :clean
- div.uk-badge.uk-badge-success success
- ul
- li <b>Lines count</b> : #{@result[log[:label]][:lines]}
- - if @result[log[:label]][:status] == :matched
- div.uk-badge.uk-badge-danger matched
- ul
- li <b>Lines count</b> : #{@result[log[:label]][:lines]}
- li <b class="uk-text-danger">Matchs count : #{@result[log[:label]][:count]} </b>
+ li <b>Lines count</b> : #{@result[log[:label]][:lines]}
+ - if @result[log[:label]][:status] == :matched
+ div.uk-badge.uk-badge-danger matched
+ ul
+ li <b>Lines count</b> : #{@result[log[:label]][:lines]}
+ li <b class="uk-text-danger">Matchs count : #{@result[log[:label]][:count]} </b>
+ td
+ input.delete-log.uk-button.uk-button-mini.uk-button-danger id="#{log[:label].to_s}" value="Delete"
+ br
+ input.modify-log.uk-button.uk-button-mini.uk-button-primary id="#{log[:label].to_s}" value="Modify" onclick="location.href='/add_modify_log/#{log[:label].to_s}';"
+ br
+ input.history-log.uk-button.uk-button-mini.uk-button-primary id="#{log[:label].to_s}" value="History" onclick="location.href='/history/#{log[:label].to_s}';"
+ div.uk-align-right
+ form.uk-form.uk-form-horizontal#query action="/add_modify_log" method="GET"
+ div
+ input.add-log.uk-button type="submit" value="Add new log"