lib/splash/webadmin/portal/views/commands.slim in prometheus-splash-0.8.4 vs lib/splash/webadmin/portal/views/commands.slim in prometheus-splash-0.8.5
- old
+ new
@@ -1,49 +1,99 @@
h2.uk-text-success <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> Commands configured in Splash
+- unless @log_saved.nil?
+ javascript:
+ UIkit.notify("Command definition #{@command_saved} saved", {status:'success'});
+- unless @log_failed.nil?
+ javascript:
+ UIkit.notify("Command definition #{@command_saved} not saved", {status:'danger'});
+
+javascript:
+ $(document).on( 'click','input.delete-command',function(){
+ var id = this.id;
+ var url = "/api/config/deletecommand/" + 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') {
+ $('div#commandrecords h3#' + id).remove();
+ $('div#commandrecords div#' + 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 commands availables
br
- div.uk-accordion(data-uk-accordion)
- - @data.each do |command,content|
- h3.uk-accordion-title <b>Name</b> : #{command}
- div.uk-accordion-content
+ div#commandrecords.uk-accordion(data-uk-accordion)
+ - @data.reverse.each do |command|
+ h3.uk-accordion-title id="#{command[:name].to_s}" <i class="uk-icon-play-circle-o"></i> <b>Name</b> : #{command[:name]}
+ div.uk-accordion-content id="#{command[:name].to_s} "
table.uk-table.uk-table-hover.uk-table-striped
thead
tr
th Definition
th Actions
tbody
tr
td
dl.uk-description-list-horizontal
dt <i class="uk-icon-th-list"></i> Description
- dd #{content[:desc]}
- - if content[:command]
+ dd #{command[:desc]}
+ - if command[:command]
dt <i class="uk-icon-cog"></i> Command Line
- dd #{content[:command]}
- - if content[:schedule]
+ - if command[:delegate_to]
+ dd.uk-text-danger #{command[:command]} <i>(ignored because delegate_to is set)</i>
+ - else
+ dd #{command[:command]}
+ - if command[:schedule]
dt <i class="uk-icon-calendar"></i> Schedule
dd
<ul>
- <li> <b><i>Type</b></i> : #{content[:schedule].keys.first}</li>
- <li> <b><i>Value</b></i> : #{content[:schedule].values.first}</li>
+ <li> <b><i>Type</b></i> : #{command[:schedule].keys.first}</li>
+ <li> <b><i>Value</b></i> : #{command[:schedule].values.first}</li>
</ul>
- - if content[:on_success]
+ - if command[:on_success]
dt <i class="uk-icon-check"></i> Execute on success
- dd #{content[:on_success]}
- - if content[:on_failure]
+ dd #{command[:on_success]}
+ - if command[:on_failure]
dt <i class="uk-icon-bolt"></i> Execute on failure
- dd #{content[:on_failure]}
- - if content[:user]
+ dd #{command[:on_failure]}
+ - if command[:user]
dt <i class="uk-icon-user"></i> become user
- dd #{content[:user]}
- - if content[:delegate_to]
+ dd #{command[:user]}
+ - if command[:delegate_to]
dt <i class="uk-icon-chevron-circle-right"></i> Remote delegation
dd
<ul>
- <li> <i><b>Host</b></i> : #{content[:delegate_to][:host]}</li>
- <li> <b><i>Remote Command</b></i> : #{content[:delegate_to][:remote_command]}</li>
+ <li> <i><b>Host</b></i> : #{command[:delegate_to][:host]}</li>
+ <li> <b><i>Remote Command</b></i> : #{command[:delegate_to][:remote_command]}</li>
</ul>
+ - if command[:retention].class == Hash
+ dt <i class="uk-icon-calendar-minus-o"></i> History retention
+ dd #{command[:retention].flatten.reverse.join(' ')}
td
+ input.delete-command.uk-button.uk-button-mini.uk-button-danger id="#{command[:name].to_s}" value="Delete"
+ br
+ input.modify-process.uk-button.uk-button-mini.uk-button-primary id="#{command[:name].to_s}" value="Modify" onclick="location.href='/add_modify_command/#{command[:name].to_s}';"
+ br
+ input.history-command.uk-button.uk-button-mini.uk-button-primary id="#{command[:name].to_s}" value="History" onclick="location.href='/get_command_history/#{command[:name].to_s}';"
+ div.uk-align-right
+ form.uk-form.uk-form-horizontal#query action="/add_modify_command" method="GET"
+ div
+ input.add-process.uk-button type="submit" value="Add new process"