open-consul/ui/javascripts/app/router.js
James Phillips 0a17a8284f Cleans up web UI and fixes ACL token "stuckness" issue. (#3245)
* Removes GitHub reference.

* Doesn't display ACL token on the unauthorized page.

* Removes useless fetch for nodes and cleans up comments.

* Provides a path to reset the ACL token when it's invalid.

This included making the settings page global so it's reachable, and adding
some more information about an error on the error page.

* Updates built-in web assets.
2017-07-08 17:16:05 -07:00

60 lines
1.8 KiB
JavaScript

window.App = Ember.Application.create({
rootElement: "#app",
currentPath: ''
});
Ember.Application.initializer({
name: 'settings',
initialize: function(container, application) {
application.set('settings', App.Settings.create());
if (App.get('settings.token') === undefined) {
App.set('settings.token', '');
}
}
});
App.Router.map(function() {
// Our parent datacenter resource sets the namespace
// for the entire application
this.resource("dc", {path: "/:dc"}, function() {
// Services represent a consul service
this.resource("services", { path: "/services" }, function(){
// Show an individual service
this.route("show", { path: "/*name" });
});
// Nodes represent a consul node
this.resource("nodes", { path: "/nodes" }, function() {
// Show an individual node
this.route("show", { path: "/:name" });
});
// Key/Value
this.resource("kv", { path: "/kv" }, function(){
this.route("index", { path: "/" });
// List keys. This is more like an index
this.route("show", { path: "/*key" });
// Edit a specific key
this.route("edit", { path: "/*key/edit" });
});
// ACLs
this.resource("acls", { path: "/acls" }, function(){
this.route("show", { path: "/:id" });
});
// Shows a page explaining that ACLs haven't been set-up
this.route("aclsdisabled", { path: "/aclsdisabled" });
// Shows a page explaining that the ACL token being used isn't
// authorized
this.route("unauthorized", { path: "/unauthorized" });
});
// Shows a datacenter picker. If you only have one
// it just redirects you through.
this.route("index", { path: "/" });
// The settings page is global.
this.resource("settings", { path: "/settings" });
});