Introduces dynamic routing
This commit is contained in:
parent
5d3e632a48
commit
4bd1253337
@ -110,6 +110,7 @@ module.exports = function (grunt) {
|
|||||||
'<%= project.app %>/components/table/cell_host_address/cell_host_address.js',
|
'<%= project.app %>/components/table/cell_host_address/cell_host_address.js',
|
||||||
'<%= project.app %>/components/table/cell_host_status/cell_host_status.js',
|
'<%= project.app %>/components/table/cell_host_status/cell_host_status.js',
|
||||||
'<%= project.app %>/dashboard/dashboard.js',
|
'<%= project.app %>/dashboard/dashboard.js',
|
||||||
|
'<%= project.app %>/routing_view/routing_view.js',
|
||||||
'<%= project.app %>/single_table/single_table.js'
|
'<%= project.app %>/single_table/single_table.js'
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
@ -143,6 +144,7 @@ module.exports = function (grunt) {
|
|||||||
'<%= project.build %>/components/table/cell_host_address/cell_host_address.js': '<%= project.app %>/components/table/cell_host_address/cell_host_address.js',
|
'<%= project.build %>/components/table/cell_host_address/cell_host_address.js': '<%= project.app %>/components/table/cell_host_address/cell_host_address.js',
|
||||||
'<%= project.build %>/components/table/cell_host_status/cell_host_status.js': '<%= project.app %>/components/table/cell_host_status/cell_host_status.js',
|
'<%= project.build %>/components/table/cell_host_status/cell_host_status.js': '<%= project.app %>/components/table/cell_host_status/cell_host_status.js',
|
||||||
'<%= project.build %>/dashboard/dashboard.js': '<%= project.app %>/dashboard/dashboard.js',
|
'<%= project.build %>/dashboard/dashboard.js': '<%= project.app %>/dashboard/dashboard.js',
|
||||||
|
'<%= project.build %>/routing_view/routing_view.js': '<%= project.app %>/routing_view/routing_view.js',
|
||||||
'<%= project.build %>/single_table/single_table.js' : '<%= project.app %>/single_table/single_table.js'
|
'<%= project.build %>/single_table/single_table.js' : '<%= project.app %>/single_table/single_table.js'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -170,6 +172,7 @@ module.exports = function (grunt) {
|
|||||||
'<%= project.build %>/components/table/cell_host_address/cell_host_address.js',
|
'<%= project.build %>/components/table/cell_host_address/cell_host_address.js',
|
||||||
'<%= project.build %>/components/table/cell_host_status/cell_host_status.js',
|
'<%= project.build %>/components/table/cell_host_status/cell_host_status.js',
|
||||||
'<%= project.build %>/dashboard/dashboard.js',
|
'<%= project.build %>/dashboard/dashboard.js',
|
||||||
|
'<%= project.build %>/routing_view/routing_view.js',
|
||||||
'<%= project.build %>/single_table/single_table.js'
|
'<%= project.build %>/single_table/single_table.js'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,8 @@ angular.module('adagios', [
|
|||||||
'adagios.topbar',
|
'adagios.topbar',
|
||||||
'adagios.config',
|
'adagios.config',
|
||||||
'adagios.view.dashboard',
|
'adagios.view.dashboard',
|
||||||
'adagios.view.singleTable'
|
'adagios.view.singleTable',
|
||||||
|
'adagios.view'
|
||||||
])
|
])
|
||||||
|
|
||||||
.config(['$routeProvider', function ($routeProvider) {
|
.config(['$routeProvider', function ($routeProvider) {
|
||||||
|
30
app/routing_view/routing_view.js
Normal file
30
app/routing_view/routing_view.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('adagios.view', ['ngRoute',
|
||||||
|
'adagios.config'
|
||||||
|
])
|
||||||
|
|
||||||
|
.value('viewsTemplate', {})
|
||||||
|
|
||||||
|
.config(['$routeProvider', function ($routeProvider) {
|
||||||
|
$routeProvider.when('/view', {
|
||||||
|
controller: 'ViewCtrl',
|
||||||
|
template: '<div ng-include="templateUrl">Loading...</div>'
|
||||||
|
});
|
||||||
|
}])
|
||||||
|
|
||||||
|
.controller('ViewCtrl', ['$scope', '$routeParams', 'viewsTemplate',
|
||||||
|
function ($scope, $routeParams, viewsTemplate) {
|
||||||
|
var templateName = viewsTemplate[$routeParams.view],
|
||||||
|
templateUrl = templateName + '/' + templateName + '.html';
|
||||||
|
|
||||||
|
$scope.templateUrl = templateUrl;
|
||||||
|
}])
|
||||||
|
|
||||||
|
.run(['readConfig', 'viewsTemplate', function (readConfig, viewsTemplate) {
|
||||||
|
var viewsConfig = readConfig.data;
|
||||||
|
|
||||||
|
angular.forEach(viewsConfig, function (config, view) {
|
||||||
|
viewsTemplate[view] = config.template;
|
||||||
|
});
|
||||||
|
}]);
|
Loading…
Reference in New Issue
Block a user