Extract tactical and table config object
This commit is contained in:
parent
144490eba2
commit
9c41efbf26
@ -129,6 +129,16 @@ angular.module('adagios.table', ['adagios.live',
|
|||||||
};
|
};
|
||||||
}])
|
}])
|
||||||
|
|
||||||
|
.value('TableConfigObj', function (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;
|
||||||
|
})
|
||||||
|
|
||||||
.service('processColumnRepeat', function () {
|
.service('processColumnRepeat', function () {
|
||||||
|
|
||||||
function clearFields(entry, fields) {
|
function clearFields(entry, fields) {
|
||||||
|
@ -7,6 +7,13 @@ angular.module('adagios.tactical', ['adagios.tactical.status_overview',
|
|||||||
|
|
||||||
.value('tacticalConfig', {})
|
.value('tacticalConfig', {})
|
||||||
|
|
||||||
|
.value('TacticalConfigObj', function (config) {
|
||||||
|
this.title = config.title;
|
||||||
|
this.statusOverview = config.components.statusOverview;
|
||||||
|
this.currentHealth = config.components.currentHealth;
|
||||||
|
this.topAlertProducers = config.components.topAlertProducers;
|
||||||
|
})
|
||||||
|
|
||||||
.controller('TacticalCtrl', ['$scope', 'tacticalConfig', function ($scope, tacticalConfig) {
|
.controller('TacticalCtrl', ['$scope', 'tacticalConfig', function ($scope, tacticalConfig) {
|
||||||
|
|
||||||
$scope.statusOverview = tacticalConfig.statusOverview;
|
$scope.statusOverview = tacticalConfig.statusOverview;
|
||||||
|
@ -15,8 +15,8 @@ angular.module('adagios.view.dashboard', ['ngRoute',
|
|||||||
});
|
});
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.controller('DashboardCtrl', ['$scope', 'dashboardConfig', 'getServices', 'tableConfig',
|
.controller('DashboardCtrl', ['$scope', 'dashboardConfig', 'getServices', 'tableConfig', 'TableConfigObj', 'TacticalConfigObj',
|
||||||
function ($scope, dashboardConfig, getServices, tableConfig) {
|
function ($scope, dashboardConfig, getServices, tableConfig, TableConfigObj, TacticalConfigObj) {
|
||||||
|
|
||||||
var fields = ['state'],
|
var fields = ['state'],
|
||||||
filters = {'isnot' : { 'state' : ['0'] }},
|
filters = {'isnot' : { 'state' : ['0'] }},
|
||||||
@ -36,32 +36,14 @@ angular.module('adagios.view.dashboard', ['ngRoute',
|
|||||||
|
|
||||||
components = dashboardConfig.data.components;
|
components = dashboardConfig.data.components;
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
function TacticalConfig(config) {
|
|
||||||
this.title = config.title;
|
|
||||||
this.statusOverview = config.components.statusOverview;
|
|
||||||
this.currentHealth = config.components.currentHealth;
|
|
||||||
this.topAlertProducers = config.components.topAlertProducers;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < components.length; i += 1) {
|
for (i = 0; i < components.length; i += 1) {
|
||||||
component = components[i];
|
component = components[i];
|
||||||
config = component.config;
|
config = component.config;
|
||||||
|
|
||||||
if (component.type === 'table') {
|
if (component.type === 'table') {
|
||||||
$scope.dashboardTables.push(new TableConfig(config));
|
$scope.dashboardTables.push(new TableConfigObj(config));
|
||||||
} else if (component.type === 'tactical') {
|
} else if (component.type === 'tactical') {
|
||||||
$scope.dashboardTactical.push(new TacticalConfig(config));
|
$scope.dashboardTactical.push(new TacticalConfigObj(config));
|
||||||
console.log($scope.dashboardTactical[0].statusOverview);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@ angular.module('adagios.view.singleTable', ['ngRoute',
|
|||||||
});
|
});
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.controller('SingleTableCtrl', ['$scope', '$routeParams', 'singleTableConfig', 'tableConfig',
|
.controller('SingleTableCtrl', ['$scope', '$routeParams', 'singleTableConfig', 'tableConfig', 'TableConfigObj',
|
||||||
function ($scope, $routeParams, singleTableConfig, tableConfig) {
|
function ($scope, $routeParams, singleTableConfig, tableConfig, TableConfigObj) {
|
||||||
var viewName = "";
|
var viewName = "";
|
||||||
|
|
||||||
tableConfig.index = 0;
|
tableConfig.index = 0;
|
||||||
@ -28,17 +28,7 @@ angular.module('adagios.view.singleTable', ['ngRoute',
|
|||||||
throw new Error("ERROR : 'view' GET parameter must be the custom view name");
|
throw new Error("ERROR : 'view' GET parameter must be the custom view name");
|
||||||
}
|
}
|
||||||
|
|
||||||
function TableConfig(config) {
|
$scope.tableConfig = new TableConfigObj(singleTableConfig[viewName].components[0].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.singleTableTitle = singleTableConfig[viewName].title;
|
||||||
$scope.singleTableRefreshInterval = singleTableConfig[viewName].refreshInterval;
|
$scope.singleTableRefreshInterval = singleTableConfig[viewName].refreshInterval;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user