Skip to content
On this page

ADMIN UI Interface

Vasat comes with its own administration UI interface to view and manage data as well as all Vasat modules.

It is a stand-alone Angular app that can be deployed on any webserver. It can also be embeded into a Vasat instance if you would like to have it alongside your project APIs. Moreover, if your vasat instance is accessible to the public you can use the already live Vadmin interface and simply provide the vasat URL.

Saas Admin UI

Simply login to our Saas Admin Url and provide your Vasat instance public URL or IP address

Embedded interface

You can embed the admin interface on your Vasat instance.

  • On your Vasat build.sbt file add the below dependency
lazy val vadminDep = System.getProperty("withBaseHref") match {
  case "true" =>
    println("Running with Vadmin baseHref")
    Seq(
      "io.vasat" % "vadmin" % "0.0.11-base", // Any -base version is for when vasat runs on a subfolder in the domain
    )
  case _ =>
    println("Running with Vadmin root")
    Seq(
      "io.vasat" % "vadmin" % "0.0.28", // Any normal version without -base is for when vasat runs in the root
    )
}

libraryDependencies ++= vadminDep
  • Make sure you specify the latest vadmin version
  • Use the sytem property withBaseHref if you want to install the Admin interface under the vadmin web route. Note the name of the subroute cannot be changed.
  • Add the admin site to the top of your routes file.
    • To serve the Admin interface under the root directory.
    # /public/lib/ is the path under the public directory where play places all webjars in the dependecies
    GET     /     controllers.Assets.at(path="/public/lib/vadmin", file="index.html")
    • To serve Admin interface udner vadmin subfolder.
    # /public/lib/ is the path under the public directory where play places all webjars in the dependecies
    GET     /vadmin     controllers.Assets.at(path="/public/lib/vadmin", file="index.html")
  • At the ends of your *routes file add the below to tell Vasat to redirect any unknown routes to Vasat Admin for the Angular app to work properly.
# This is for when vasat runs in the root domain
GET     /*path     controllers.HomeController.vadminRedirect(path, default = "index.html")
  • Add the above redirect method into your HomeController or your main Controller. If you add to your custom Controller make sure you update the above route.
scala
/**
   * This is so the angular vadmin routes can be resolved. First we check that the actual requested asset/path exists under /public/lib/vadmin/ which is the angualr project files.
   * If it does not exists then we assume it is an angular route thus we redirect to index so angular can try and serve the route.
   * @param path
   * @param default
   * @return
   */
  def vadminRedirect(path: String, default:String): Action[AnyContent] = defa.async( req => {
    assets.at(path="/public/lib/vadmin/",file = path).apply(req).flatMap(res => {
      //System.out.println(s"ENTER vadminRedirect path: $path Header Status: ${res.header.status} ContentType: ${res.body.contentType.getOrElse("NA")}")
      val contentType = res.body.contentType.getOrElse("NA")
      //log.info(s"ENTER vadminRedirect path: $path Header Status: ${res.header.status} ContentType: ${res.body.contentType.getOrElse("NA")}")
      // First check if asset exists. (Response code is 304 for some reason)
      if( (res.header.status == 304 || res.header.status == 200) && !contentType.equals("text/html") ) {
        //log.info(s"ENTER vadminRedirect asset found for path: $path")
        //System.out.println(s"ENTER vadminRedirect asset found for path: $path")
        // If found then serve it
        Future(res)
      }
      else {
        //log.info(s"ENTER vadminRedirect asset not found for path: $path")
        //System.out.println(s"ENTER vadminRedirect asset not found for path: $path")
        // If asset does not exists assume it is an angular route so redirect to index.html
        assets.at(path="/public/lib/vadmin/",file = default).apply(req)
      }
    })

  })

Deploy on external web server

Please contact us if you would like to deploy the Admin interface on your own web server.