single_table template
This commit is contained in:
parent
00437462c1
commit
144490eba2
12
Gruntfile.js
12
Gruntfile.js
@ -110,9 +110,7 @@ module.exports = function (grunt) {
|
||||
'<%= project.app %>/components/table/cell_host_address/cell_host_address.js',
|
||||
'<%= project.app %>/components/table/cell_host_status/cell_host_status.js',
|
||||
'<%= project.app %>/dashboard/dashboard.js',
|
||||
'<%= project.app %>/hosts/hosts.js',
|
||||
'<%= project.app %>/services/services.js',
|
||||
'<%= project.app %>/custom_views/custom_views.js'
|
||||
'<%= project.app %>/single_table/single_table.js'
|
||||
]
|
||||
}],
|
||||
options: {
|
||||
@ -145,9 +143,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_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 %>/hosts/hosts.js': '<%= project.app %>/hosts/hosts.js',
|
||||
'<%= project.build %>/services/services.js': '<%= project.app %>/services/services.js',
|
||||
'<%= project.build %>/custom_views/custom_views.js' : '<%= project.app %>/custom_views/custom_views.js'
|
||||
'<%= project.build %>/single_table/single_table.js' : '<%= project.app %>/single_table/single_table.js'
|
||||
},
|
||||
{
|
||||
'<%= project.build %>/js/adagios.min.js' : [
|
||||
@ -174,9 +170,7 @@ module.exports = function (grunt) {
|
||||
'<%= project.build %>/components/table/cell_host_address/cell_host_address.js',
|
||||
'<%= project.build %>/components/table/cell_host_status/cell_host_status.js',
|
||||
'<%= project.build %>/dashboard/dashboard.js',
|
||||
'<%= project.build %>/hosts/hosts.js',
|
||||
'<%= project.build %>/services/services.js',
|
||||
'<%= project.build %>/custom_views/custom_views.js'
|
||||
'<%= project.build %>/single_table/single_table.js'
|
||||
]
|
||||
}
|
||||
],
|
||||
|
@ -19,9 +19,7 @@ angular.module('adagios', [
|
||||
'adagios.topbar',
|
||||
'adagios.config',
|
||||
'adagios.view.dashboard',
|
||||
'adagios.view.hosts',
|
||||
'adagios.view.services',
|
||||
'adagios.view.custom'
|
||||
'adagios.view.singleTable'
|
||||
])
|
||||
|
||||
.config(['$routeProvider', function ($routeProvider) {
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
<ul class="sidebar__sublist" id="shortcutList">
|
||||
<li class="sidebar__subitem"><a ng-class="getClass('/dashboard')" href="#/dashboard">Dashboard</a></li>
|
||||
<li class="sidebar__subitem"><a ng-class="getClass('/hosts')" href="#/hosts">Hosts</a></li>
|
||||
<li class="sidebar__subitem"><a ng-class="getClass('/services')" href="#/services">Services</a></li>
|
||||
<li class="sidebar__subitem"><a ng-class="getClass('/singleTable?view=hostsConfig')" href="#/singleTable?view=hostsConfig">Hosts</a></li>
|
||||
<li class="sidebar__subitem"><a ng-class="getClass('/singleTable?view=servicesConfig')" href="#/singleTable?view=servicesConfig">Services</a></li>
|
||||
<li class="sidebar__subitem"><a href="#">Networks parents</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
@ -6,7 +6,7 @@ angular.module('adagios.sidebar', [])
|
||||
$scope.getClass = function (path) {
|
||||
var class_name = "";
|
||||
|
||||
if ($location.path().substr(0, path.length) === path) {
|
||||
if ($location.url().substr(0, path.length) === path) {
|
||||
class_name = "state--current";
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ angular.module('adagios.table', ['adagios.live',
|
||||
'adagios.table.cell_host_status'
|
||||
])
|
||||
|
||||
.value('tableConfig', { 'cellToFieldsMap': {}, 'cellWrappableField': {}, 'index': 0})
|
||||
.value('tableConfig', {'cellToFieldsMap': {}, 'cellWrappableField': {}, 'index': 0})
|
||||
|
||||
.controller('TableCtrl', ['$scope', '$interval', 'getServices', 'tableConfig', 'processColumnRepeat',
|
||||
function ($scope, $interval, getServices, tableConfig, processColumnRepeat) {
|
||||
|
@ -1,56 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('adagios.view.custom', ['ngRoute',
|
||||
'adagios.tactical.status_overview',
|
||||
'adagios.tactical.current_health',
|
||||
'adagios.tactical.top_alert_producers',
|
||||
'adagios.table'
|
||||
])
|
||||
|
||||
.value('customViewsConfig', {})
|
||||
|
||||
.config(['$routeProvider', function ($routeProvider) {
|
||||
$routeProvider.when('/customViews', {
|
||||
templateUrl: 'custom_views/custom_views.html',
|
||||
controller: 'CustomViewsCtrl'
|
||||
});
|
||||
}])
|
||||
|
||||
.controller('CustomViewsCtrl', [ '$scope', '$routeParams', 'customViewsConfig', 'tableConfig',
|
||||
function ($scope, $routeParams, customViewsConfig, tableConfig) {
|
||||
var viewName = "";
|
||||
|
||||
tableConfig.index = 0;
|
||||
|
||||
if (!!$routeParams.view) {
|
||||
viewName = $routeParams.view;
|
||||
} else {
|
||||
console.error("ERROR : 'view' GET parameter must be the custom view name");
|
||||
return;
|
||||
}
|
||||
|
||||
function TableConfig(config) {
|
||||
this.title = config.title;
|
||||
this.CellsText = config.cells.text.join();
|
||||
this.CellsName = config.cells.name.join();
|
||||
this.ApiName = config.apiName;
|
||||
this.Filters = config.filters;
|
||||
this.IsWrappable = config.isWrappable;
|
||||
this.NoRepeatCell = config.noRepeatCell;
|
||||
}
|
||||
|
||||
$scope.tableConfig = new TableConfig(customViewsConfig[viewName].components[0].config);
|
||||
|
||||
$scope.singleTableTitle = customViewsConfig[viewName].title;
|
||||
$scope.singleTableRefreshInterval = customViewsConfig[viewName].refreshInterval;
|
||||
}])
|
||||
|
||||
.run(['readConfig', 'customViewsConfig', function (readConfig, customViewsConfig) {
|
||||
var viewsConfig = readConfig.data;
|
||||
|
||||
angular.forEach(viewsConfig, function (config, view) {
|
||||
if (config.template === "singleTable") {
|
||||
customViewsConfig[view] = config;
|
||||
}
|
||||
});
|
||||
}]);
|
@ -1,22 +0,0 @@
|
||||
<article ng-controller="HostsCtrl" id="tactical">
|
||||
|
||||
<section class="main__content tabpanel">
|
||||
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="problems tab-pane active" id="openProblems">
|
||||
<header class="main__content__header clearfix">
|
||||
<h2 class="main__content__title">{{hostsTitle}}</h2>
|
||||
</header>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<adg-table cells-name="{{hostsCellsName}}"
|
||||
cells-text="{{hostsCellsText}}"
|
||||
api-name="{{hostsApiName}}"
|
||||
filters="{{hostsFilters}}"
|
||||
is-wrappable="{{hostsIsWrappable}}"
|
||||
no-repeat-cell="{{hostsNoRepeatCell}}"
|
||||
refresh-interval="{{hostsRefreshInterval}}"></adg-table>
|
||||
|
||||
</section>
|
||||
</article>
|
@ -1,35 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('adagios.view.hosts', ['ngRoute',
|
||||
'adagios.table'
|
||||
])
|
||||
|
||||
.value('hostsConfig', {})
|
||||
|
||||
.config(['$routeProvider', function ($routeProvider) {
|
||||
$routeProvider.when('/hosts', {
|
||||
templateUrl: 'hosts/hosts.html',
|
||||
controller: 'HostsCtrl'
|
||||
});
|
||||
}])
|
||||
|
||||
.controller('HostsCtrl', ['$scope', 'hostsConfig', function ($scope, hostsConfig) {
|
||||
$scope.hostsTitle = hostsConfig.title;
|
||||
$scope.hostsCellsText = hostsConfig.cellsText.join();
|
||||
$scope.hostsCellsName = hostsConfig.cellsName.join();
|
||||
$scope.hostsApiName = hostsConfig.apiName;
|
||||
$scope.hostsFilters = hostsConfig.filters;
|
||||
$scope.hostsIsWrappable = hostsConfig.isWrappable;
|
||||
$scope.hostsRefreshInterval = hostsConfig.refreshInterval;
|
||||
}])
|
||||
|
||||
.run(['readConfig', 'hostsConfig', function (readConfig, hostsConfig) {
|
||||
hostsConfig.title = readConfig.data.hostsConfig.title;
|
||||
hostsConfig.cellsText = readConfig.data.hostsConfig.cells.text;
|
||||
hostsConfig.cellsName = readConfig.data.hostsConfig.cells.name;
|
||||
hostsConfig.apiName = readConfig.data.hostsConfig.apiName;
|
||||
hostsConfig.filters = readConfig.data.hostsConfig.filters;
|
||||
hostsConfig.isWrappable = readConfig.data.hostsConfig.isWrappable;
|
||||
hostsConfig.noRepeatCell = readConfig.data.hostsConfig.noRepeatCell;
|
||||
hostsConfig.refreshInterval = readConfig.data.hostsConfig.refreshInterval;
|
||||
}]);
|
@ -1,22 +0,0 @@
|
||||
<article ng-controller="ServicesCtrl" id="tactical">
|
||||
|
||||
<section class="main__content tabpanel">
|
||||
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="problems tab-pane active" id="openProblems">
|
||||
<header class="main__content__header clearfix">
|
||||
<h2 class="main__content__title">{{servicesTitle}}</h2>
|
||||
</header>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<adg-table cells-name="{{servicesCellsName}}"
|
||||
cells-text="{{servicesCellsText}}"
|
||||
api-name="{{servicesApiName}}"
|
||||
filters="{{servicesFilters}}"
|
||||
is-wrappable="{{servicesIsWrappable}}"
|
||||
no-repeat-cell="{{servicesNoRepeatCell}}"
|
||||
refresh-interval="{{servicesRefreshInterval}}"></adg-table>
|
||||
|
||||
</section>
|
||||
</article>
|
@ -1,36 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('adagios.view.services', ['ngRoute',
|
||||
'adagios.table'
|
||||
])
|
||||
|
||||
.value('servicesConfig', {})
|
||||
|
||||
.config(['$routeProvider', function ($routeProvider) {
|
||||
$routeProvider.when('/services', {
|
||||
templateUrl: 'services/services.html',
|
||||
controller: 'ServicesCtrl'
|
||||
});
|
||||
}])
|
||||
|
||||
.controller('ServicesCtrl', ['$scope', 'servicesConfig', function ($scope, servicesConfig) {
|
||||
$scope.servicesTitle = servicesConfig.title;
|
||||
$scope.servicesCellsText = servicesConfig.cellsText.join();
|
||||
$scope.servicesCellsName = servicesConfig.cellsName.join();
|
||||
$scope.servicesApiName = servicesConfig.apiName;
|
||||
$scope.servicesFilters = servicesConfig.filters;
|
||||
$scope.servicesIsWrappable = servicesConfig.isWrappable;
|
||||
$scope.servicesNoRepeatCell = servicesConfig.noRepeatCell;
|
||||
$scope.servicesRefreshInterval = servicesConfig.refreshInterval;
|
||||
}])
|
||||
|
||||
.run(['readConfig', 'servicesConfig', function (readConfig, servicesConfig) {
|
||||
servicesConfig.title = readConfig.data.servicesConfig.title;
|
||||
servicesConfig.cellsText = readConfig.data.servicesConfig.cells.text;
|
||||
servicesConfig.cellsName = readConfig.data.servicesConfig.cells.name;
|
||||
servicesConfig.apiName = readConfig.data.servicesConfig.apiName;
|
||||
servicesConfig.filters = readConfig.data.servicesConfig.filters;
|
||||
servicesConfig.isWrappable = readConfig.data.servicesConfig.isWrappable;
|
||||
servicesConfig.noRepeatCell = readConfig.data.servicesConfig.noRepeatCell;
|
||||
servicesConfig.refreshInterval = readConfig.data.servicesConfig.refreshInterval;
|
||||
}]);
|
@ -1,4 +1,4 @@
|
||||
<article ng-controller="CustomViewsCtrl" id="tactical">
|
||||
<article id="tactical">
|
||||
|
||||
<section class="main__content tabpanel">
|
||||
|
55
app/single_table/single_table.js
Normal file
55
app/single_table/single_table.js
Normal file
@ -0,0 +1,55 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('adagios.view.singleTable', ['ngRoute',
|
||||
'adagios.tactical.status_overview',
|
||||
'adagios.tactical.current_health',
|
||||
'adagios.tactical.top_alert_producers',
|
||||
'adagios.table'
|
||||
])
|
||||
|
||||
.value('singleTableConfig', {})
|
||||
|
||||
.config(['$routeProvider', function ($routeProvider) {
|
||||
$routeProvider.when('/singleTable', {
|
||||
templateUrl: 'single_table/single_table.html',
|
||||
controller: 'SingleTableCtrl'
|
||||
});
|
||||
}])
|
||||
|
||||
.controller('SingleTableCtrl', ['$scope', '$routeParams', 'singleTableConfig', 'tableConfig',
|
||||
function ($scope, $routeParams, singleTableConfig, tableConfig) {
|
||||
var viewName = "";
|
||||
|
||||
tableConfig.index = 0;
|
||||
|
||||
if (!!$routeParams.view) {
|
||||
viewName = $routeParams.view;
|
||||
} else {
|
||||
throw new Error("ERROR : 'view' GET parameter must be the custom view name");
|
||||
}
|
||||
|
||||
function TableConfig(config) {
|
||||
this.title = config.title;
|
||||
this.CellsText = config.cells.text.join();
|
||||
this.CellsName = config.cells.name.join();
|
||||
this.ApiName = config.apiName;
|
||||
this.Filters = config.filters;
|
||||
this.IsWrappable = config.isWrappable;
|
||||
this.NoRepeatCell = config.noRepeatCell;
|
||||
}
|
||||
|
||||
$scope.tableConfig = new TableConfig(singleTableConfig[viewName].components[0].config);
|
||||
|
||||
$scope.singleTableTitle = singleTableConfig[viewName].title;
|
||||
$scope.singleTableRefreshInterval = singleTableConfig[viewName].refreshInterval;
|
||||
}])
|
||||
|
||||
.run(['readConfig', 'singleTableConfig', function (readConfig, singleTableConfig) {
|
||||
var viewsConfig = readConfig.data;
|
||||
|
||||
angular.forEach(viewsConfig, function (config, view) {
|
||||
if (config.template === "singleTable") {
|
||||
singleTableConfig[view] = config;
|
||||
}
|
||||
});
|
||||
}]);
|
Loading…
Reference in New Issue
Block a user