open-consul/ui/javascripts/fixtures.js

313 lines
6.7 KiB
JavaScript
Raw Normal View History

2014-04-23 18:01:42 +00:00
//
// I intentionally am not using ember-data and the fixture
// adapter. I'm not confident the Consul UI API will be compatible
// without a bunch of wrangling, and it's really not enough updating
// of the models to justify the use of such a big component. getJSON
// *should* be enough.
//
window.fixtures = {}
2014-04-24 18:02:26 +00:00
//
2014-04-24 19:33:53 +00:00
// The array route, i.e /ui/<dc>/services, should return _all_ services
2014-04-24 18:02:26 +00:00
// in the DC
//
2014-04-23 18:01:42 +00:00
fixtures.services = [
{
"Name": "vagrant-cloud-http",
"Checks": [
{
"Name": "serfHealth",
"Status": "passing"
},
{
"Name": "fooHealth",
"Status": "critical"
},
{
"Name": "bazHealth",
"Status": "passing"
}
],
"Nodes": [
"node-10-0-1-109",
2014-04-24 19:25:28 +00:00
"node-10-0-1-102"
2014-04-23 18:01:42 +00:00
]
},
{
"Name": "vagrant-share-mux",
"Checks": [
{
"Name": "serfHealth",
2014-04-24 19:48:23 +00:00
"Status": "critical"
2014-04-23 18:01:42 +00:00
},
{
"Name": "fooHealth",
"Status": "passing"
},
{
"Name": "bazHealth",
"Status": "passing"
}
],
"Nodes": [
2014-04-24 19:25:28 +00:00
"node-10-0-1-109",
"node-10-0-1-102"
2014-04-23 18:01:42 +00:00
]
},
]
2014-04-24 18:02:26 +00:00
//
// This one is slightly more complicated to allow more UI interaction.
2014-04-24 19:33:53 +00:00
// It represents the route /ui/<dc>/services/<service> BUT it's what is
2014-04-24 18:02:26 +00:00
// BELOW the top-level key.
//
// So, what is actually returned should be similar to the /catalog/service/<service>
// endpoint.
fixtures.services_full = {
2014-04-24 18:02:26 +00:00
"vagrant-cloud-http":
// This array is what is actually expected from the API.
[
{
"ServicePort": 80,
"ServiceTags": null,
"ServiceName": "vagrant-cloud-http",
"ServiceID": "vagrant-cloud-http",
"Address": "10.0.1.109",
"Node": "node-10-0-1-109",
"Checks": [
{
"ServiceName": "",
"ServiceID": "",
"Notes": "",
"Status": "critical",
"Name": "Serf Health Status",
"CheckID": "serfHealth",
2014-04-24 19:25:28 +00:00
"Node": "node-10-0-1-109"
}
]
},
// A node
{
"ServicePort": 80,
"ServiceTags": null,
"ServiceName": "vagrant-cloud-http",
"ServiceID": "vagrant-cloud-http",
2014-04-24 19:25:28 +00:00
"Address": "10.0.1.102",
"Node": "node-10-0-1-102",
"Checks": [
{
"ServiceName": "",
"ServiceID": "",
"Notes": "",
"Status": "passing",
"Name": "Serf Health Status",
"CheckID": "serfHealth",
2014-04-24 19:25:28 +00:00
"Node": "node-10-0-1-102"
}
]
}
],
"vagrant-share-mux": [
// A node
{
"ServicePort": 80,
"ServiceTags": null,
"ServiceName": "vagrant-share-mux",
"ServiceID": "vagrant-share-mux",
2014-04-24 19:25:28 +00:00
"Address": "10.0.1.102",
"Node": "node-10-0-1-102",
"Checks": [
{
"ServiceName": "vagrant-share-mux",
"ServiceID": "vagrant-share-mux",
"Notes": "",
"Output": "200 ok",
"Status": "passing",
"Name": "Foo Heathly",
"CheckID": "fooHealth",
2014-04-24 19:25:28 +00:00
"Node": "node-10-0-1-102"
}
]
},
// A node
{
"ServicePort": 80,
"ServiceTags": null,
"ServiceName": "vagrant-share-mux",
"ServiceID": "vagrant-share-mux",
2014-04-24 19:25:28 +00:00
"Address": "10.0.1.109",
"Node": "node-10-0-1-109",
"Checks": [
{
"ServiceName": "",
"ServiceID": "",
"Notes": "",
"Output": "foobar baz",
"Status": "passing",
"Name": "Baz Status",
"CheckID": "bazHealth",
2014-04-24 19:25:28 +00:00
"Node": "node-10-0-1-109"
},
{
"ServiceName": "",
"ServiceID": "",
"Notes": "",
"Output": "foobar baz",
2014-04-24 19:48:23 +00:00
"Status": "critical",
"Name": "Serf Health Status",
"CheckID": "serfHealth",
2014-04-24 19:25:28 +00:00
"Node": "node-10-0-1-109"
}
]
}
]
}
2014-04-24 19:33:53 +00:00
//
// /ui/<dc>/nodes
// all the nodes
//
2014-04-24 19:18:11 +00:00
fixtures.nodes = [
{
"Address": "10.0.1.109",
"Name": "node-10-0-1-109",
"Services": [
2014-04-24 19:25:28 +00:00
"vagrant-share-mux",
2014-04-24 19:18:11 +00:00
"vagrant-cloud-http"
],
"Checks": [
{
"Name": "serfHealth",
2014-04-24 19:48:23 +00:00
"Status": "critical"
2014-04-24 19:18:11 +00:00
},
{
"Name": "bazHealth",
2014-04-24 19:48:23 +00:00
"Status": "passing"
2014-04-24 19:18:11 +00:00
}
]
},
{
"Address": "10.0.1.102",
"Name": "node-10-0-1-102",
"Services": [
2014-04-24 19:25:28 +00:00
"vagrant-share-mux",
2014-04-24 19:18:11 +00:00
"vagrant-cloud-http"
],
"Checks": [
{
"Name": "fooHealth",
2014-04-24 19:48:23 +00:00
"Status": "passing"
2014-04-24 19:18:11 +00:00
}
],
}
]
2014-04-24 19:33:53 +00:00
// These are for retrieving individual nodes. Same story as services,
// the top level key is just for the demo.
2014-04-24 19:18:11 +00:00
fixtures.nodes_full = {
2014-04-24 19:33:53 +00:00
"node-10-0-1-109":
// This is what would be returned.
{
2014-04-24 19:18:11 +00:00
"Services": [
{
"Port": 0,
"Tags": null,
2014-04-24 20:21:55 +00:00
"Service": "vagrant-share-mux",
"ID": "vagrant-share-mux"
2014-04-24 19:18:11 +00:00
},
{
"Port": 80,
"Tags": null,
"Service": "vagrant-cloud-http",
"ID": "vagrant-cloud-http"
}
],
"Node": {
"Address": "10.0.1.109",
"Node": "node-10-0-1-109"
},
"Checks": [
{
"ServiceName": "",
"ServiceID": "",
"Notes": "Checks the status of the serf agent",
2014-04-24 19:48:23 +00:00
"Status": "critical",
2014-04-24 19:18:11 +00:00
"Name": "Serf Health Status",
"CheckID": "serfHealth",
"Node": "node-10-0-1-109"
2014-04-24 19:48:23 +00:00
},
{
"ServiceName": "",
"ServiceID": "",
"Notes": "",
"Output": "foobar baz",
"Status": "passing",
"Name": "Baz Status",
"CheckID": "bazHealth",
"Node": "node-10-0-1-109"
2014-04-24 19:18:11 +00:00
}
]
},
"node-10-0-1-102": {
"Services": [
{
"Port": 0,
"Tags": null,
2014-04-24 20:21:55 +00:00
"Service": "vagrant-share-mux",
"ID": "vagrant-share-mux"
2014-04-24 19:18:11 +00:00
},
{
"Port": 80,
"Tags": null,
"Service": "vagrant-cloud-http",
"ID": "vagrant-cloud-http"
}
],
"Node": {
"Address": "10.0.1.102",
"Node": "node-10-0-1-102"
},
"Checks": [
{
"ServiceName": "",
"ServiceID": "",
2014-04-24 20:21:55 +00:00
"Notes": "Checks if the food is healthy",
2014-04-24 19:18:11 +00:00
"Output": "foobar baz",
"Status": "passing",
2014-04-24 19:48:23 +00:00
"Name": "Foo Healthy",
"CheckID": "fooStatus",
2014-04-24 19:18:11 +00:00
"Node": "node-10-0-1-102"
}
]
}
}
2014-04-23 18:01:42 +00:00
fixtures.dcs = ['nyc1', 'sf1', 'sg1']
2014-04-28 22:23:01 +00:00
fixtures.keys_full = {
2014-04-29 17:06:26 +00:00
"/": [
'foobar',
'application',
'web/'
],
2014-04-28 22:23:01 +00:00
"application": {
'key': 'application',
2014-04-29 17:06:26 +00:00
'value': 'foobarz'
2014-04-28 22:23:01 +00:00
},
2014-04-29 17:06:26 +00:00
"foobar": {
'key': 'foobar',
'value': 'baz'
},
"web/foo/bar": {
'key': 'web/foo/bar',
'value': 'baz'
},
"web/": [
"web/foo/"
],
"web/foo/": [
"web/foo/bar"
]
2014-04-28 22:23:01 +00:00
};