mirror of https://github.com/status-im/consul.git
Included support to override the assumed location of the consul so you can run the UI on a normal web server potentially on a different host to your consul servers.
This commit is contained in:
parent
b7b46f9e3a
commit
795554e7a4
|
@ -9,6 +9,13 @@
|
||||||
<link rel="stylesheet" href="static/base.css">
|
<link rel="stylesheet" href="static/base.css">
|
||||||
<link rel="shortcut icon" href="static/favicon.png">
|
<link rel="shortcut icon" href="static/favicon.png">
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
// Change this value to your consul host if you are not running
|
||||||
|
// the UI on the same host as a consul instance.
|
||||||
|
// e.g. "http://myserver.com:8500"
|
||||||
|
var consulHost = ''
|
||||||
|
</script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ KvBaseController = Ember.ObjectController.extend({
|
||||||
var token = App.get('settings.token');
|
var token = App.get('settings.token');
|
||||||
|
|
||||||
Ember.$.ajax({
|
Ember.$.ajax({
|
||||||
url: (formatUrl('/v1/kv/' + parent + '?keys', dc, token)),
|
url: (formatUrl(consulHost + '/v1/kv/' + parent + '?keys', dc, token)),
|
||||||
type: 'GET'
|
type: 'GET'
|
||||||
}).then(function(data) {
|
}).then(function(data) {
|
||||||
controller.transitionToRoute('kv.show', parent);
|
controller.transitionToRoute('kv.show', parent);
|
||||||
|
@ -127,7 +127,7 @@ App.KvShowController = KvBaseController.extend(Ember.Validations.Mixin, {
|
||||||
|
|
||||||
// Put the Key and the Value retrieved from the form
|
// Put the Key and the Value retrieved from the form
|
||||||
Ember.$.ajax({
|
Ember.$.ajax({
|
||||||
url: (formatUrl("/v1/kv/" + newKey.get('Key'), dc, token)),
|
url: (formatUrl(consulHost + "/v1/kv/" + newKey.get('Key'), dc, token)),
|
||||||
type: 'PUT',
|
type: 'PUT',
|
||||||
data: newKey.get('Value')
|
data: newKey.get('Value')
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
|
@ -155,7 +155,7 @@ App.KvShowController = KvBaseController.extend(Ember.Validations.Mixin, {
|
||||||
if (window.confirm("Are you sure you want to delete this folder?")) {
|
if (window.confirm("Are you sure you want to delete this folder?")) {
|
||||||
// Delete the folder
|
// Delete the folder
|
||||||
Ember.$.ajax({
|
Ember.$.ajax({
|
||||||
url: (formatUrl("/v1/kv/" + controller.get('parentKey') + '?recurse', dc, token)),
|
url: (formatUrl(consulHost + "/v1/kv/" + controller.get('parentKey') + '?recurse', dc, token)),
|
||||||
type: 'DELETE'
|
type: 'DELETE'
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
controller.transitionToNearestParent(grandParent);
|
controller.transitionToNearestParent(grandParent);
|
||||||
|
@ -186,7 +186,7 @@ App.KvEditController = KvBaseController.extend({
|
||||||
// Put the key and the decoded (plain text) value
|
// Put the key and the decoded (plain text) value
|
||||||
// from the form.
|
// from the form.
|
||||||
Ember.$.ajax({
|
Ember.$.ajax({
|
||||||
url: (formatUrl("/v1/kv/" + key.get('Key'), dc, token)),
|
url: (formatUrl(consulHost + "/v1/kv/" + key.get('Key'), dc, token)),
|
||||||
type: 'PUT',
|
type: 'PUT',
|
||||||
data: key.get('valueDecoded')
|
data: key.get('valueDecoded')
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
|
@ -215,7 +215,7 @@ App.KvEditController = KvBaseController.extend({
|
||||||
|
|
||||||
// Delete the key
|
// Delete the key
|
||||||
Ember.$.ajax({
|
Ember.$.ajax({
|
||||||
url: (formatUrl("/v1/kv/" + key.get('Key'), dc, token)),
|
url: (formatUrl(consulHost + "/v1/kv/" + key.get('Key'), dc, token)),
|
||||||
type: 'DELETE'
|
type: 'DELETE'
|
||||||
}).then(function(data) {
|
}).then(function(data) {
|
||||||
controller.transitionToNearestParent(parent);
|
controller.transitionToNearestParent(parent);
|
||||||
|
@ -285,7 +285,7 @@ App.NodesShowController = Ember.ObjectController.extend({
|
||||||
if (window.confirm("Are you sure you want to deregister this node?")) {
|
if (window.confirm("Are you sure you want to deregister this node?")) {
|
||||||
// Deregister node
|
// Deregister node
|
||||||
Ember.$.ajax({
|
Ember.$.ajax({
|
||||||
url: formatUrl('/v1/catalog/deregister', dc, token),
|
url: formatUrl(consulHost + '/v1/catalog/deregister', dc, token),
|
||||||
type: 'PUT',
|
type: 'PUT',
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
'Datacenter': dc,
|
'Datacenter': dc,
|
||||||
|
@ -313,10 +313,10 @@ App.NodesShowController = Ember.ObjectController.extend({
|
||||||
if (window.confirm("Are you sure you want to invalidate this session?")) {
|
if (window.confirm("Are you sure you want to invalidate this session?")) {
|
||||||
// Delete the session
|
// Delete the session
|
||||||
Ember.$.ajax({
|
Ember.$.ajax({
|
||||||
url: (formatUrl("/v1/session/destroy/" + sessionId, dc, token)),
|
url: (formatUrl(consulHost + "/v1/session/destroy/" + sessionId, dc, token)),
|
||||||
type: 'PUT'
|
type: 'PUT'
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
return Ember.$.getJSON(formatUrl('/v1/session/node/' + node.Node, dc, token)).then(function(data) {
|
return Ember.$.getJSON(formatUrl(consulHost + '/v1/session/node/' + node.Node, dc, token)).then(function(data) {
|
||||||
controller.set('sessions', data);
|
controller.set('sessions', data);
|
||||||
});
|
});
|
||||||
}).fail(function(response) {
|
}).fail(function(response) {
|
||||||
|
@ -381,7 +381,7 @@ App.AclsController = Ember.ArrayController.extend({
|
||||||
|
|
||||||
// Create the ACL
|
// Create the ACL
|
||||||
Ember.$.ajax({
|
Ember.$.ajax({
|
||||||
url: formatUrl('/v1/acl/create', dc, token),
|
url: formatUrl(consulHost + '/v1/acl/create', dc, token),
|
||||||
type: 'PUT',
|
type: 'PUT',
|
||||||
data: JSON.stringify(newAcl)
|
data: JSON.stringify(newAcl)
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
|
@ -389,7 +389,7 @@ App.AclsController = Ember.ArrayController.extend({
|
||||||
controller.transitionToRoute('acls.show', response.ID);
|
controller.transitionToRoute('acls.show', response.ID);
|
||||||
|
|
||||||
// Get the ACL again, including the newly created one
|
// Get the ACL again, including the newly created one
|
||||||
Ember.$.getJSON(formatUrl('/v1/acl/list', dc, token)).then(function(data) {
|
Ember.$.getJSON(formatUrl(consulHost + '/v1/acl/list', dc, token)).then(function(data) {
|
||||||
var objs = [];
|
var objs = [];
|
||||||
data.map(function(obj){
|
data.map(function(obj){
|
||||||
objs.push(App.Acl.create(obj));
|
objs.push(App.Acl.create(obj));
|
||||||
|
@ -441,7 +441,7 @@ App.AclsShowController = Ember.ObjectController.extend({
|
||||||
controller.transitionToRoute('services');
|
controller.transitionToRoute('services');
|
||||||
|
|
||||||
Ember.$.ajax({
|
Ember.$.ajax({
|
||||||
url: formatUrl('/v1/acl/clone/'+ acl.ID, dc, token),
|
url: formatUrl(consulHost + '/v1/acl/clone/'+ acl.ID, dc, token),
|
||||||
type: 'PUT'
|
type: 'PUT'
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
controller.transitionToRoute('acls.show', response.ID);
|
controller.transitionToRoute('acls.show', response.ID);
|
||||||
|
@ -464,10 +464,10 @@ App.AclsShowController = Ember.ObjectController.extend({
|
||||||
|
|
||||||
if (window.confirm("Are you sure you want to delete this token?")) {
|
if (window.confirm("Are you sure you want to delete this token?")) {
|
||||||
Ember.$.ajax({
|
Ember.$.ajax({
|
||||||
url: formatUrl('/v1/acl/destroy/'+ acl.ID, dc, token),
|
url: formatUrl(consulHost + '/v1/acl/destroy/'+ acl.ID, dc, token),
|
||||||
type: 'PUT'
|
type: 'PUT'
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
Ember.$.getJSON(formatUrl('/v1/acl/list', dc, token)).then(function(data) {
|
Ember.$.getJSON(formatUrl(consulHost + '/v1/acl/list', dc, token)).then(function(data) {
|
||||||
objs = [];
|
objs = [];
|
||||||
data.map(function(obj){
|
data.map(function(obj){
|
||||||
if (obj.ID === "anonymous") {
|
if (obj.ID === "anonymous") {
|
||||||
|
@ -500,7 +500,7 @@ App.AclsShowController = Ember.ObjectController.extend({
|
||||||
|
|
||||||
// Update the ACL
|
// Update the ACL
|
||||||
Ember.$.ajax({
|
Ember.$.ajax({
|
||||||
url: formatUrl('/v1/acl/update', dc, token),
|
url: formatUrl(consulHost + '/v1/acl/update', dc, token),
|
||||||
type: 'PUT',
|
type: 'PUT',
|
||||||
data: JSON.stringify(acl)
|
data: JSON.stringify(acl)
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
|
|
|
@ -69,7 +69,7 @@ App.BaseRoute = Ember.Route.extend({
|
||||||
App.IndexRoute = App.BaseRoute.extend({
|
App.IndexRoute = App.BaseRoute.extend({
|
||||||
// Retrieve the list of datacenters
|
// Retrieve the list of datacenters
|
||||||
model: function(params) {
|
model: function(params) {
|
||||||
return Ember.$.getJSON('/v1/catalog/datacenters').then(function(data) {
|
return Ember.$.getJSON(consulHost + '/v1/catalog/datacenters').then(function(data) {
|
||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -94,8 +94,8 @@ App.DcRoute = App.BaseRoute.extend({
|
||||||
// dcs and nodes used in the header
|
// dcs and nodes used in the header
|
||||||
return Ember.RSVP.hash({
|
return Ember.RSVP.hash({
|
||||||
dc: params.dc,
|
dc: params.dc,
|
||||||
dcs: Ember.$.getJSON('/v1/catalog/datacenters'),
|
dcs: Ember.$.getJSON(consulHost + '/v1/catalog/datacenters'),
|
||||||
nodes: Ember.$.getJSON(formatUrl('/v1/internal/ui/nodes', params.dc, token)).then(function(data) {
|
nodes: Ember.$.getJSON(formatUrl(consulHost + '/v1/internal/ui/nodes', params.dc, token)).then(function(data) {
|
||||||
var objs = [];
|
var objs = [];
|
||||||
|
|
||||||
// Merge the nodes into a list and create objects out of them
|
// Merge the nodes into a list and create objects out of them
|
||||||
|
@ -132,7 +132,7 @@ App.KvShowRoute = App.BaseRoute.extend({
|
||||||
// and the original key requested in params
|
// and the original key requested in params
|
||||||
return Ember.RSVP.hash({
|
return Ember.RSVP.hash({
|
||||||
key: key,
|
key: key,
|
||||||
keys: Ember.$.getJSON(formatUrl('/v1/kv/' + key + '?keys&seperator=/', dc, token)).then(function(data) {
|
keys: Ember.$.getJSON(formatUrl(consulHost + '/v1/kv/' + key + '?keys&seperator=/', dc, token)).then(function(data) {
|
||||||
var objs = [];
|
var objs = [];
|
||||||
data.map(function(obj){
|
data.map(function(obj){
|
||||||
objs.push(App.Key.create({Key: obj}));
|
objs.push(App.Key.create({Key: obj}));
|
||||||
|
@ -167,11 +167,11 @@ App.KvEditRoute = App.BaseRoute.extend({
|
||||||
return Ember.RSVP.hash({
|
return Ember.RSVP.hash({
|
||||||
dc: dc,
|
dc: dc,
|
||||||
token: token,
|
token: token,
|
||||||
key: Ember.$.getJSON(formatUrl('/v1/kv/' + key, dc, token)).then(function(data) {
|
key: Ember.$.getJSON(formatUrl(consulHost + '/v1/kv/' + key, dc, token)).then(function(data) {
|
||||||
// Convert the returned data to a Key
|
// Convert the returned data to a Key
|
||||||
return App.Key.create().setProperties(data[0]);
|
return App.Key.create().setProperties(data[0]);
|
||||||
}),
|
}),
|
||||||
keys: keysPromise = Ember.$.getJSON(formatUrl('/v1/kv/' + parentKeys.parent + '?keys&seperator=/', dc, token)).then(function(data) {
|
keys: keysPromise = Ember.$.getJSON(formatUrl(consulHost + '/v1/kv/' + parentKeys.parent + '?keys&seperator=/', dc, token)).then(function(data) {
|
||||||
var objs = [];
|
var objs = [];
|
||||||
data.map(function(obj){
|
data.map(function(obj){
|
||||||
objs.push(App.Key.create({Key: obj}));
|
objs.push(App.Key.create({Key: obj}));
|
||||||
|
@ -184,7 +184,7 @@ App.KvEditRoute = App.BaseRoute.extend({
|
||||||
// Load the session on the key, if there is one
|
// Load the session on the key, if there is one
|
||||||
afterModel: function(models) {
|
afterModel: function(models) {
|
||||||
if (models.key.get('isLocked')) {
|
if (models.key.get('isLocked')) {
|
||||||
return Ember.$.getJSON(formatUrl('/v1/session/info/' + models.key.Session, models.dc, models.token)).then(function(data) {
|
return Ember.$.getJSON(formatUrl(consulHost + '/v1/session/info/' + models.key.Session, models.dc, models.token)).then(function(data) {
|
||||||
models.session = data[0];
|
models.session = data[0];
|
||||||
return models;
|
return models;
|
||||||
});
|
});
|
||||||
|
@ -214,7 +214,7 @@ App.ServicesRoute = App.BaseRoute.extend({
|
||||||
var token = App.get('settings.token');
|
var token = App.get('settings.token');
|
||||||
|
|
||||||
// Return a promise to retrieve all of the services
|
// Return a promise to retrieve all of the services
|
||||||
return Ember.$.getJSON(formatUrl('/v1/internal/ui/services', dc, token)).then(function(data) {
|
return Ember.$.getJSON(formatUrl(consulHost + '/v1/internal/ui/services', dc, token)).then(function(data) {
|
||||||
var objs = [];
|
var objs = [];
|
||||||
data.map(function(obj){
|
data.map(function(obj){
|
||||||
objs.push(App.Service.create(obj));
|
objs.push(App.Service.create(obj));
|
||||||
|
@ -235,7 +235,7 @@ App.ServicesShowRoute = App.BaseRoute.extend({
|
||||||
|
|
||||||
// Here we just use the built-in health endpoint, as it gives us everything
|
// Here we just use the built-in health endpoint, as it gives us everything
|
||||||
// we need.
|
// we need.
|
||||||
return Ember.$.getJSON(formatUrl('/v1/health/service/' + params.name, dc, token)).then(function(data) {
|
return Ember.$.getJSON(formatUrl(consulHost + '/v1/health/service/' + params.name, dc, token)).then(function(data) {
|
||||||
var objs = [];
|
var objs = [];
|
||||||
data.map(function(obj){
|
data.map(function(obj){
|
||||||
objs.push(App.Node.create(obj));
|
objs.push(App.Node.create(obj));
|
||||||
|
@ -266,10 +266,10 @@ App.NodesShowRoute = App.BaseRoute.extend({
|
||||||
return Ember.RSVP.hash({
|
return Ember.RSVP.hash({
|
||||||
dc: dc,
|
dc: dc,
|
||||||
token: token,
|
token: token,
|
||||||
node: Ember.$.getJSON(formatUrl('/v1/internal/ui/node/' + params.name, dc, token)).then(function(data) {
|
node: Ember.$.getJSON(formatUrl(consulHost + '/v1/internal/ui/node/' + params.name, dc, token)).then(function(data) {
|
||||||
return App.Node.create(data);
|
return App.Node.create(data);
|
||||||
}),
|
}),
|
||||||
nodes: Ember.$.getJSON(formatUrl('/v1/internal/ui/node/' + params.name, dc, token)).then(function(data) {
|
nodes: Ember.$.getJSON(formatUrl(consulHost + '/v1/internal/ui/node/' + params.name, dc, token)).then(function(data) {
|
||||||
return App.Node.create(data);
|
return App.Node.create(data);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
@ -277,7 +277,7 @@ App.NodesShowRoute = App.BaseRoute.extend({
|
||||||
|
|
||||||
// Load the sessions for the node
|
// Load the sessions for the node
|
||||||
afterModel: function(models) {
|
afterModel: function(models) {
|
||||||
return Ember.$.getJSON(formatUrl('/v1/session/node/' + models.node.Node, models.dc, models.token)).then(function(data) {
|
return Ember.$.getJSON(formatUrl(consulHost + '/v1/session/node/' + models.node.Node, models.dc, models.token)).then(function(data) {
|
||||||
models.sessions = data;
|
models.sessions = data;
|
||||||
return models;
|
return models;
|
||||||
});
|
});
|
||||||
|
@ -301,7 +301,7 @@ App.NodesRoute = App.BaseRoute.extend({
|
||||||
var token = App.get('settings.token');
|
var token = App.get('settings.token');
|
||||||
|
|
||||||
// Return a promise containing the nodes
|
// Return a promise containing the nodes
|
||||||
return Ember.$.getJSON(formatUrl('/v1/internal/ui/nodes', dc, token)).then(function(data) {
|
return Ember.$.getJSON(formatUrl(consulHost + '/v1/internal/ui/nodes', dc, token)).then(function(data) {
|
||||||
var objs = [];
|
var objs = [];
|
||||||
data.map(function(obj){
|
data.map(function(obj){
|
||||||
objs.push(App.Node.create(obj));
|
objs.push(App.Node.create(obj));
|
||||||
|
@ -320,7 +320,7 @@ App.AclsRoute = App.BaseRoute.extend({
|
||||||
var dc = this.modelFor('dc').dc;
|
var dc = this.modelFor('dc').dc;
|
||||||
var token = App.get('settings.token');
|
var token = App.get('settings.token');
|
||||||
// Return a promise containing the ACLS
|
// Return a promise containing the ACLS
|
||||||
return Ember.$.getJSON(formatUrl('/v1/acl/list', dc, token)).then(function(data) {
|
return Ember.$.getJSON(formatUrl(consulHost + '/v1/acl/list', dc, token)).then(function(data) {
|
||||||
var objs = [];
|
var objs = [];
|
||||||
data.map(function(obj){
|
data.map(function(obj){
|
||||||
if (obj.ID === "anonymous") {
|
if (obj.ID === "anonymous") {
|
||||||
|
@ -361,7 +361,7 @@ App.AclsShowRoute = App.BaseRoute.extend({
|
||||||
// Return a promise hash of the node and nodes
|
// Return a promise hash of the node and nodes
|
||||||
return Ember.RSVP.hash({
|
return Ember.RSVP.hash({
|
||||||
dc: dc,
|
dc: dc,
|
||||||
acl: Ember.$.getJSON(formatUrl('/v1/acl/info/'+ params.id, dc, token)).then(function(data) {
|
acl: Ember.$.getJSON(formatUrl(consulHost + '/v1/acl/info/'+ params.id, dc, token)).then(function(data) {
|
||||||
return App.Acl.create(data[0]);
|
return App.Acl.create(data[0]);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue