<commit_before>require "/opt/mpas/lib/ruby/ManagedContainer.rb"
require "/opt/mpas/lib/ruby/ManagedService.rb"

class ServicesController < ApplicationController
  def index
    @services = ManagedService.getManagedServices()
           if @services == nil
             @result =false
           else
             @result = true
           end
  end
  def show
      @service = ManagedService.load(params[:id])
        if @service == nil
          @result =false
        else
          @result =true
        end
    end
    
    def stop
      @service = ManagedService.load(params[:id])
          @result = @service.stop_container
          redirect_to service_path(@service.containerName)
    end
   def start
       @service = ManagedService.load(params[:id])
           @result = @service.start_container
           redirect_to service_path(@service.containerName)
   end
     
    def pause
      @service = ManagedService.load(params[:id])
      @result = @service.pause_container
      redirect_to service_path(@service.containerName)
    end
    
    def unpause
      @service = ManagedService.load(params[:id])
      @result = @service.unpause_container
      redirect_to service_path(@service.containerName)
    end
    
    def recreate <commit_msg>register site (with nginx) support in the gui for services (monit needs it)<commit_after>require "/opt/mpas/lib/ruby/ManagedContainer.rb"
require "/opt/mpas/lib/ruby/ManagedService.rb"

class ServicesController < ApplicationController
  def index
    @services = ManagedService.getManagedServices()
           if @services == nil
             @result =false
           else
             @result = true
           end
  end
  def show
      @service = ManagedService.load(params[:id])
        if @service == nil
          @result =false
        else
          @result =true
        end
    end
    
    def stop
      @service = ManagedService.load(params[:id])
          @result = @service.stop_container
          redirect_to service_path(@service.containerName)
    end
   def start
       @service = ManagedService.load(params[:id])
           @result = @service.start_container
           redirect_to service_path(@service.containerName)
   end
     
    def pause
      @service = ManagedService.load(params[:id])
      @result = @service.pause_container
      redirect_to service_path(@service.containerName)
    end
    
    def unpause
      @service = ManagedService.load(params[:id])
      @result = @service.unpause_container
      redirect_to service_path(@service.containerName)
    end
    
  def register_site
        @service = ManagedService.load(params[:id])
                 @result = @service.register_site
                 redirect_to service_path(@service.containerName)
   end
   
   def deregister_site
        @service = ManagedService.load(params[:id])
                 @result = @service.deregister_site
                 redirect_to service_path(@service.containerName)
   end
   
    
    def recreate 
{'fraction_non_alphanumeric': 0.0862876254180602, 'fraction_numerical': 0.0, 'mean_word_length': 2.2688524590163937, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '6704136', 'n_tokens_mistral': 822, 'n_tokens_neox': 811, 'n_words': 176}