Skip to content

Commit

Permalink
Removed generated config and default development config, added defaul…
Browse files Browse the repository at this point in the history
…t production config.
  • Loading branch information
jackgr committed May 26, 2015
1 parent 3ed9b42 commit 366b1bb
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 64 deletions.
32 changes: 14 additions & 18 deletions www/master/gulpfile.js
Expand Up @@ -142,8 +142,6 @@ var source = {

config: {
watch: [
'shared/config/development.json',
'shared/config/production.json',
'shared/config/development.json',
'shared/config/production.json'
],
Expand Down Expand Up @@ -341,23 +339,21 @@ gulp.task('config:base', function() {
});

gulp.task('config:copy', function() {
var environment = argv.env || 'development'; // change this to whatever default environment you need.

var environment = argv.env || (isProduction ? 'production' : 'development');
return gulp.src(['shared/config/' + environment + '.json', 'components/**/config/' + environment + '.json'])
.pipe(jsoncombine('generated-config.js',
function(data) {
var env = Object.keys(data).reduce(function(result, key) {
// Map the key "environment" to "/" and the keys "component/config/environment" to
// "component".
var newKey = key.replace(environment, '/').replace(/\/config\/\/$/, '');
result[newKey] = data[key];
return result;
}, {});

return new Buffer(JSON.stringify({'ENV': env}));
}))
.pipe(ngConstant({name: 'kubernetesApp.config', deps: [], constants: {ngConstant: true}}))
.pipe(gulp.dest(source.config.dest));
.pipe(jsoncombine('generated-config.js',
function(data) {
var env = Object.keys(data).reduce(function(result, key) {
// Map the key "environment" to "/" and the keys "component/config/environment" to "component".
var newKey = key.replace(environment, '/').replace(/\/config\/\/$/, '');
result[newKey] = data[key];
return result;
}, {});

return new Buffer(JSON.stringify({'ENV': env}));
}))
.pipe(ngConstant({name: 'kubernetesApp.config', deps: [], constants: {ngConstant: true}}))
.pipe(gulp.dest(source.config.dest));
});

gulp.task('copy:components', function() {
Expand Down
149 changes: 123 additions & 26 deletions www/master/js/app.config.js
@@ -1,31 +1,128 @@

angular.module('kubernetesApp.config', []);
angular.module('kubernetesApp.services', ['kubernetesApp.config']);

app.config([
'$routeProvider',
function($routeProvider) {
$routeProvider.when("/404", {templateUrl: "views/partials/404.html"})
'$routeProvider',
function($routeProvider) {
$routeProvider.when("/404", {
templateUrl: "views/partials/404.html"
})
// else 404
.otherwise({redirectTo: "/404"});
}
])
.config([
'$routeProvider',
'manifestRoutes',
function($routeProvider, manifestRoutes) {
angular.forEach(manifestRoutes, function(r) {
var route = {
templateUrl: r.templateUrl
};
if (r.controller) {
route.controller = r.controller;
}
if (r.css) {
route.css = r.css;
}
$routeProvider.when(r.url, route);
.otherwise({
redirectTo: "/404"
});
}
]);

app.value("sections", [{"name":"Dashboard","url":"/dashboard","type":"link","templateUrl":"/components/dashboard/pages/home.html"},{"name":"Dashboard","type":"heading","children":[{"name":"Dashboard","type":"toggle","url":"/dashboard","templateUrl":"/components/dashboard/pages/home.html","pages":[{"name":"Pods","url":"/dashboard/pods","templateUrl":"/components/dashboard/views/listPods.html","type":"link"},{"name":"Pod Visualizer","url":"/dashboard/visualpods","templateUrl":"/components/dashboard/views/listPodsVisualizer.html","type":"link"},{"name":"Services","url":"/dashboard/services","templateUrl":"/components/dashboard/views/listServices.html","type":"link"},{"name":"Replication Controllers","url":"/dashboard/replicationcontrollers","templateUrl":"/components/dashboard/views/listReplicationControllers.html","type":"link"},{"name":"Events","url":"/dashboard/events","templateUrl":"/components/dashboard/views/listEvents.html","type":"link"},{"name":"Nodes","url":"/dashboard/nodes","templateUrl":"/components/dashboard/views/listMinions.html","type":"link"},{"name":"Replication Controller","url":"/dashboard/replicationcontrollers/:replicationControllerId","templateUrl":"/components/dashboard/views/replication.html","type":"link"},{"name":"Service","url":"/dashboard/services/:serviceId","templateUrl":"/components/dashboard/views/service.html","type":"link"},{"name": "Node","url": "/dashboard/nodes/:nodeId","templateUrl": "/components/dashboard/views/node.html","type": "link"},{"name":"Explore","url":"/dashboard/groups/:grouping*?/selector/:selector*?","templateUrl":"/components/dashboard/views/groups.html","type":"link"},{"name":"Pod","url":"/dashboard/pods/:podId","templateUrl":"/components/dashboard/views/pod.html","type":"link"}]}]},{"name":"Graph","url":"/graph","type":"link","templateUrl":"/components/graph/pages/home.html"},{"name":"Graph","url":"/graph/inspect","type":"link","templateUrl":"/components/graph/pages/inspect.html","css":"/components/graph/css/show-details-table.css"},{"name":"Graph","type":"heading","children":[{"name":"Graph","type":"toggle","url":"/graph","templateUrl":"/components/graph/pages/home.html","pages":[{"name":"Test","url":"/graph/test","type":"link","templateUrl":"/components/graph/pages/home.html"}]}]}]);
}])
.config([
'$routeProvider',
'manifestRoutes',
function($routeProvider, manifestRoutes) {
angular.forEach(manifestRoutes, function(r) {
var route = {
templateUrl: r.templateUrl
};
if (r.controller) {
route.controller = r.controller;
}
if (r.css) {
route.css = r.css;
}
$routeProvider.when(r.url, route);
});
}]);
app.value("sections", [{
"name": "Dashboard",
"url": "/dashboard",
"type": "link",
"templateUrl": "/components/dashboard/pages/home.html"
}, {
"name": "Dashboard",
"type": "heading",
"children": [{
"name": "Dashboard",
"type": "toggle",
"url": "/dashboard",
"templateUrl": "/components/dashboard/pages/home.html",
"pages": [{
"name": "Pods",
"url": "/dashboard/pods",
"templateUrl": "/components/dashboard/views/listPods.html",
"type": "link"
}, {
"name": "Pod Visualizer",
"url": "/dashboard/visualpods",
"templateUrl": "/components/dashboard/views/listPodsVisualizer.html",
"type": "link"
}, {
"name": "Services",
"url": "/dashboard/services",
"templateUrl": "/components/dashboard/views/listServices.html",
"type": "link"
}, {
"name": "Replication Controllers",
"url": "/dashboard/replicationcontrollers",
"templateUrl": "/components/dashboard/views/listReplicationControllers.html",
"type": "link"
}, {
"name": "Events",
"url": "/dashboard/events",
"templateUrl": "/components/dashboard/views/listEvents.html",
"type": "link"
}, {
"name": "Nodes",
"url": "/dashboard/nodes",
"templateUrl": "/components/dashboard/views/listMinions.html",
"type": "link"
}, {
"name": "Replication Controller",
"url": "/dashboard/replicationcontrollers/:replicationControllerId",
"templateUrl": "/components/dashboard/views/replication.html",
"type": "link"
}, {
"name": "Service",
"url": "/dashboard/services/:serviceId",
"templateUrl": "/components/dashboard/views/service.html",
"type": "link"
}, {
"name": "Node",
"url": "/dashboard/nodes/:nodeId",
"templateUrl": "/components/dashboard/views/node.html",
"type": "link"
}, {
"name": "Explore",
"url": "/dashboard/groups/:grouping*?/selector/:selector*?",
"templateUrl": "/components/dashboard/views/groups.html",
"type": "link"
}, {
"name": "Pod",
"url": "/dashboard/pods/:podId",
"templateUrl": "/components/dashboard/views/pod.html",
"type": "link"
}]
}]
}, {
"name": "Graph",
"url": "/graph",
"type": "link",
"templateUrl": "/components/graph/pages/home.html"
}, {
"name": "Graph",
"url": "/graph/inspect",
"type": "link",
"templateUrl": "/components/graph/pages/inspect.html",
"css": "/components/graph/css/show-details-table.css"
}, {
"name": "Graph",
"type": "heading",
"children": [{
"name": "Graph",
"type": "toggle",
"url": "/graph",
"templateUrl": "/components/graph/pages/home.html",
"pages": [{
"name": "Test",
"url": "/graph/test",
"type": "link",
"templateUrl": "/components/graph/pages/home.html"
}]
}]
}]);
18 changes: 0 additions & 18 deletions www/master/shared/config/generated-config.js

This file was deleted.

9 changes: 9 additions & 0 deletions www/master/shared/config/production.example.json
@@ -0,0 +1,9 @@
{
"k8sApiServer": "ENV_K8S_API_SERVER",
"k8sDataServer": "ENV_K8S_DATA_SERVER",
"k8sDataPollMinIntervalSec": "ENV_K8S_DATA_POLL_MIN_INTERVAL_SEC",
"k8sDataPollMaxIntervalSec": "ENV_K8S_DATA_POLL_MAX_INTERVAL_SEC",
"k8sDataPollErrorThreshold": "ENV_K8S_DATA_POLL_ERROR_THRESHOLD",
"cAdvisorProxy": "ENV_C_ADVISOR_PROXY",
"cAdvisorPort": "ENV_C_ADVISOR_PORT"
}
@@ -1,6 +1,6 @@
{
"k8sApiServer": "http://127.0.0.1:8080/api/v1beta2",
"k8sApiv1beta3Server": "http://127.0.0.1:8080/api/v1beta3",
"k8sApiServer": "/api/v1beta2",
"k8sApiv1beta3Server": "/api/v1beta3",
"k8sDataServer": "/cluster",
"k8sDataPollMinIntervalSec": 10,
"k8sDataPollMaxIntervalSec": 120,
Expand Down

0 comments on commit 366b1bb

Please sign in to comment.