open-consul/ui/javascripts/app/router.js

44 lines
1.3 KiB
JavaScript
Raw Normal View History

2014-04-25 17:49:36 +00:00
window.App = Ember.Application.create({
rootElement: "#app",
2014-04-30 18:02:20 +00:00
LOG_TRANSITIONS: true,
LOG_STACKTRACE_ON_DEPRECATION: true,
LOG_BINDINGS: true,
LOG_TRANSITIONS: true,
LOG_ACTIVE_GENERATION: true,
// The baseUrl for AJAX requests
// TODO implement in AJAX logic
2014-04-30 18:02:20 +00:00
baseUrl: 'http://localhost:8500'
2014-04-25 17:49:36 +00:00
});
2014-04-30 18:02:20 +00:00
2014-04-25 17:49:36 +00:00
App.Router.map(function() {
// Our parent datacenter resource sets the namespace
// for the entire application
2014-04-25 17:49:36 +00:00
this.resource("dc", {path: "/:dc"}, function() {
// Services represent a consul service
2014-04-25 17:49:36 +00:00
this.resource("services", { path: "/services" }, function(){
// Show an individual service
2014-04-25 17:49:36 +00:00
this.route("show", { path: "/:name" });
});
// Nodes represent a consul node
2014-04-25 17:49:36 +00:00
this.resource("nodes", { path: "/nodes" }, function() {
// Show an individual node
2014-04-25 17:49:36 +00:00
this.route("show", { path: "/:name" });
});
// Key/Value
2014-04-29 17:34:13 +00:00
this.resource("kv", { path: "/kv" }, function(){
// This route just redirects to /-
2014-04-29 18:49:07 +00:00
this.route("index", { path: "/" });
// List keys. This is more like an index
2014-04-29 17:34:13 +00:00
this.route("show", { path: "/:key" });
// Edit a specific key
2014-04-29 17:34:13 +00:00
this.route("edit", { path: "/:key/edit" });
})
2014-04-25 17:49:36 +00:00
});
// Shows a datacenter picker. If you only have one
// it just redirects you through.
2014-04-25 17:49:36 +00:00
this.route("index", { path: "/" });
});