<commit_before>module Jesus
  module Helpers
    def class_if_current(link)
      link = '^/$' if link == '/'
      'class="current"' if request.path_info =~ Regexp.new(link)
    end
    def tab(name, link)
      "<li #{class_if_current(link)}><a href='#{link}'>#{name}</a></li>"
    end
    
    def flash_tag(type)
      "<div id='flash'>#{session.delete(type)}</div>" unless session[type].nil?
    end
    def flash(type, message)
      session[type] = message
    end
    
    
    def show(page, layout = true)
      erb page.to_sym, {:layout => layout}
    end
    
    def process_action(process)
      case process[1][:state]
        when :up
          return '<li><a href="/command/stop/' + process[0] + '">Stop Process</a></li>' +
                  '<li><a href="/command/restart/' + process[0] + '">Restart Process</a></li>'
      when :unmonitored
          return '<li><a href="/command/start/' + process[0] + '">Start Process</a></li>'
      end
    end
  end
end<commit_msg>javascript confirmation when stopping or restarting service<commit_after>module Jesus
  module Helpers
    def class_if_current(link)
      link = '^/$' if link == '/'
      'class="current"' if request.path_info =~ Regexp.new(link)
    end
    def tab(name, link)
      "<li #{class_if_current(link)}><a href='#{link}'>#{name}</a></li>"
    end
    
    def flash_tag(type)
      "<div id='flash'>#{session.delete(type)}</div>" unless session[type].nil?
    end
    def flash(type, message)
      session[type] = message
    end
    def confirm(message='Are you sure you want to do this ?')
      return "javascript:return confirm('" + message + "');"
    end
    
    
    def show(page, layout = true)
      erb page.to_sym, {:layout => layout}
    end
    
    def process_action(process)
      case process[1][:state]
        when :up
          return '<li><a href="/command/stop/' + process[0] + '" onclick="' + confirm + '">Stop Process</a></li>' +
                  '<li><a href="/command/restart/' + process[0] + '" onclick="' + confirm + '">Restart Process</a></li>'
      when :unmonitored
          return '<li><a href="/command/start/' + process[0] + '">Start Process</a></li>'
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.17489805165382874, 'fraction_numerical': 0.0036248300860897147, 'mean_word_length': 2.5902439024390245, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2732054', 'n_tokens_mistral': 720, 'n_tokens_neox': 721, 'n_words': 167}