$ cnpm install predix-apphub-config-service
A simple implementation of a nav service as required by the UI AppHub.
After cloning this repo, install runtime dependencies:
% npm install
To start:
% node app.js
In CF:
cf cs predix-apphub Beta js-apphub-beta \
--config '{"uaa":{"uaaUri":"https://js-uaa-prod.predix-uaa.run.aws-usw02-pr.ice.predix.io","clientID":"apphub","clientSecret":"apphub"},"appConfigURL":"","routeInfo":{"hostName”:”js-apphub-beta","context":"","shared":false},"applicationChrome":true, "customHeader": {}}'
A very basic, but correct and useful, prometheus.yml can look like this.
scrape_configs:
- job_name: PrometheusApp
scrape_interval: 5s
scrape_timeout: 5s
metrics_path: /ijdc72jg2ugg2dikkkl236f2rhma6qaz/metrics
scheme: https
static_configs:
- targets:
- integration.cloud.tibcoapps.com
labels:
app: PrometheusApp
sandbox: MyDefaultSandbox
This service exposes two routes: /
and /nav/<app id>
. The root route returns the entire config object for a hub instance, for example: Your Hub configuration service should return some JSON response such as this below: Start with your Main AppHub name, it appears at the top left corner of the view port. the apps property holds information regarding to all the micro apps that you intend to bundle with your main App.
For example:
Calling /
, this service return this JSON.
{
"name":"AppHub Demo",
"user": { "name": "hubpocuser", "firstName": "First", "lastName": "Last", "picture": "https://user.ge.com/avatar"},
"apps":[
{
"id":"dashboard",
"location": "main",
"host":"http://dashboard.com",
"path":"/dash",
"template":"/content.html",
"navService":"/nav",
"default":"true"
},
{
"id":"analytics",
"location": "main",
"host":"http://analytics.com",
"path":"/analytics",
"template":"/content.html",
"navService":"/nav"
},
{
id:'user',
location: 'profile',
host: 'http://<your-use-profile-domain>',
path:'/user',
template:'/index.html',
navService:'/nav'
},
{
id:'settings',
location:'settings',
host: 'http://<your-settings-domain>',
path:"/settings",
template:"/index.html",
navService:'/nav/settings'
}
]
}
Calling the /nav/<app id>
route returns the navigation details for a single micro app:
{
"id":"analytics",
"path":"/analytics",
"items":[
{
"label":"Analytics",
"icon":"fa-gauge",
"path":"/analytics/#/",
"items":[
{
"label":"New",
"path":"/analytics/#/create"
}
]
}
]
}
Note: Each navService specified under above apps e.g. /nav/
/nav/settings
route returns the navigation details for a single micro app. ui-app-hub uses will make call to these navServices when server is started. It is vital to provide these links for routing of micro app should it offer many routes and url path for user to navigate.
This example is mainly the same as the above except that some of the micro apps whose navigation item object are defined already. As a result, ui-app-hub will not make request to fetch the navigation item object for that particular micro app. For instance:
{
"name":"AppHub Demo",
"user": { "name": "hubpocuser", "firstName": "First", "lastName": "Last", "picture": "https://user.ge.com/avatar"},
"apps":[
{
"id":"dashboard",
"location": "main",
"host":"http://dashboard.com",
"path":"/dash",
"template":"/content.html",
"default":"true",
"items":[
{
"label":"Dashboard",
"icon":"fa-dashboard",
"path":"/dash/#/",
"items":[
{
"label":"Notifications",
"path":"/dash/#/notifications",
"badge":{
"status":"info",
"count":1
}
}
]
}
]
},
{
"id":"analytics",
"location": "main",
"host":"http://analytics.com",
"path":"/analytics",
"template":"/content.html",
"items":[
{
"label":"Analytics",
"icon":"fa-gauge",
"path":"/analytics/#/",
"items":[
{
"label":"New",
"path":"/analytics/#/create"
}
]
}
]
},
{
id:'user',
location: 'profile',
host: 'http://<your-use-profile-domain>',
path:'/user',
template:'/index.html',
navService:'/nav'
},
{
id:'settings',
location:'settings',
host: 'http://<your-settings-domain>',
path:"/settings",
template:"/index.html",
"items":[
{
"label":"Settings",
"icon":"fa-gauge",
"path":"/settings/#/"
},
{
"label":"Help",
"icon":"fa-gauge",
"path":"https://www.predix.io/resources"
}
]
}
]
}
The UI Config Service should properly authorize against any bearer token passed in the request. If a user doesn't have access to a microapp, that microapp shouldn't appear in the "apps" array.
##Other Questions
Do you still have questions? If so, post them on http://stackoverflow.apps.ge.com/ tagged with apphub or app-hub. Our team checks there every so often.
1000 POST requests 1000 GET requests
Copyright 2014 - 2016 © taobao.org |