Sha256: 77953543e5f9e59acc11f725fd4a8652e62a4383edda1b4f9ec4350e909d6f21

Contents?: true

Size: 1.7 KB

Versions: 1

Compression:

Stored size: 1.7 KB

Contents

class Admin<HTTPController
  layout :main

  def index
    @apps=@app.cluster.getLocalApplications
    @appTypes=@app.cluster.getApplicationTypes

    begin
      @servers=@app.cluster.getApp(:networkLookup).getServers
    rescue
      @servers=[]
    end
    @options=@app.cluster.options
  end

  def settings(req)
    @apps=@app.cluster.getLocalApplications
    id=req.path[0]
    app=@apps.select{|capp|capp.object_id.to_s==id}[0]
    @appSettings=app.settings
  end

  def start(req)
    appType=req.path[0]
    @app.cluster.runAndWait(appType.gsub(/App$/,""))
    redirect_to(url(:action=>:index))
  end
  def info(req)
    appName=req.path[0]
    @infoVar=@app.cluster.getAppByName(appName).info
  end
  
  def shutdown
    @app.cluster.shutdown
    redirect_to(url(:action=>:index))
  end
  
  def stop(req)
    @apps=@app.cluster.getLocalApplications
    id=req.path[0]
    app=@apps.select{|capp|capp.object_id.to_s==id}[0]
    @app.cluster.stopApp(app)
    redirect_to(url(:action=>:index))
  end
  def clone(id)
    @apps=@app.cluster.getLocalApplications
    app=@apps.select{|capp|capp.object_id.to_s==id}[0]
    @app.cluster.cloneApp(app)
    redirect_to(url(:action=>:index))
  end
  
  def _log
    logger=@app.getApp(:logger)
    if logger
      @loglist=logger.read(10000)
    end
    @loglist||=[]
  end

  def _settings_httpapp_instance
  end
  def _settings_string
  end
  
  # dummy
  
  def xy
    render_html "xy"
  end
  def blub
    render_html "xasdy"    
  end
  def helloasd
    "<html><body>MUH asd"+
    @app.cluster.getLocalApplications.map{|s|s.to_s}.join("<br>").to_h+
    @app.getService(:permaspace).load("../README.txt").to_h+
    "</body></html>"
    
    redirect_to(url(:action=>:index))
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
appswarm-0.0.1 apps/admin/controllers/admin.rb