Commit bb3b8593 authored by Leonardo Menezes's avatar Leonardo Menezes
Browse files

initial commit

parents
Loading
Loading
Loading
Loading

.gitignore

0 → 100644
+24 −0
Original line number Diff line number Diff line
# Extracted from https://github.com/ulrich/macaron-factory/blob/master/.gitignore
# Ignore all dotfiles...
.*
# except for .gitignore
!.gitignore

# Ignore Play! working directory #
db
eclipse
lib
log
logs
modules
precompiled
project/project
project/target
target
tmp
test-result
server.pid
*.iml
*.eml
activator-*.sbt
node_modules

Gruntfile.js

0 → 100644
+65 −0
Original line number Diff line number Diff line
module.exports = function(grunt) {

  grunt.initConfig({
    clean: {
      dist: {
        src: ['_site/dist']
      }
    },
    watch: {
      scripts: {
        files: ['src/**/*.*', 'src/*.*'],
        tasks: ['build'],
        options: {
          spawn: false
        }
      }
    },
    copy: {
      main: {
        files: [
        ]
      }
    },
    concat: {
      vendorjs: {
        src: [
        ],
        dest: 'public/lib.js'
      },
      vendorcss: {
        src: [
        ],
        dest: 'public/css/lib.css'
      },
      appjs: {
        src: [
          'src/main.js',
          'src/*/*.js'
        ],
        dest: 'public/app.js'
      },
    },
    jshint: {
      cerebro: {
        src: [

        ]
      }
    },
    qunit: {
      all: []
    }
  });
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks("grunt-jscs");
  grunt.registerTask('dev', ['watch'])
  grunt.registerTask('build',
      ['clean', 'copy', 'concat' ]);
};
+12 −0
Original line number Diff line number Diff line
package controllers

import play.api.mvc.{Action, Controller}
import play.api.http.MimeTypes

object Application extends Controller {

  def index = Action {
    Ok(views.html.Index())
  }
  
}
+33 −0
Original line number Diff line number Diff line
package controllers

import elastic.ElasticClient._
import models.overview.ClusterOverview
import play.api.mvc.{Action, Controller}

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future


object ClusterOverviewController extends Controller {

  def index = Action.async {
    request => {
      val host = request.queryString.getOrElse("host", Seq("http://localhost:9200")).head
      try {
        val response = Future.sequence(
          Seq(clusterState(host), nodesStats(host), indicesStats(host), clusterSettings(host), aliases(host), clusterHealth(host), nodes(host), main(host))
        ).map { f =>
          new ClusterOverview(f(0).body, f(1).body, f(2).body, f(3).body, f(4).body, f(5).body, f(6).body, f(7).body).json
        }.recover {
          case e =>
            throw e
        }
        response.map(Ok(_))
      } catch {
        case _ => Future.successful(Status(500)(s"Cannot connect to $host"))
      }
    }

  }

}
+20 −0
Original line number Diff line number Diff line
package controllers

import play.api.Play
import play.api.libs.json.{JsArray, JsString}
import play.api.mvc.{Action, Controller}


class HostsController extends Controller {

  def index = Action {
    request => {
      val hosts = Play.current.configuration.getConfigSeq("hosts") match {
        case Some(a) => a.map { b => b.getString("host").get }
        case None => Seq()
      }
      Ok(JsArray(hosts.map(JsString(_))))
    }
  }

}
Loading