Test2 html replace
This commit is contained in:
parent
aa43f1a7cb
commit
0e92ad2e5d
@ -9,7 +9,10 @@
|
||||
"Last check"
|
||||
],
|
||||
"name": [
|
||||
"host"
|
||||
"host",
|
||||
"service_check",
|
||||
"duration",
|
||||
"last_check"
|
||||
]
|
||||
},
|
||||
"apiName": "services",
|
||||
|
@ -1 +1 @@
|
||||
<div class="data-table__duration">{{entry.last_state_change | timeElapsed}}</div>
|
||||
<td class="data-table__duration">{{entry.last_state_change | timeElapsed}}</td>
|
||||
|
@ -1,3 +1,3 @@
|
||||
<td class="data-table__{{ cell }} {{entry.state}}">
|
||||
<td class="data-table__{{ cell }} {{state}}" ng-controller="CellHostCtrl">
|
||||
<a class="data-table__data" href="#">{{entry.host_name}}</a>
|
||||
</td>
|
||||
|
@ -15,14 +15,4 @@ angular.module('adagios.table.cell_host', ['adagios.table'])
|
||||
.run(['tableConfig', function (tableConfig) {
|
||||
tableConfig.cellToFieldsMap.host = [ 'host_state', 'host_name' ];
|
||||
|
||||
tableConfig.cellToFunctionsMap.host = function(data) {
|
||||
if (data.host_state === 0) {
|
||||
data.state = 'state--ok';
|
||||
} else if (data.host_state === 1) {
|
||||
data.state = 'state--warning';
|
||||
} else {
|
||||
data.state = 'state--error';
|
||||
}
|
||||
return data
|
||||
};
|
||||
}]);
|
||||
|
@ -1 +1 @@
|
||||
<div class="data-table__lastcheck">{{entry.last_check * 1000 | date: medium}}</div>
|
||||
<td class="data-table__lastcheck">{{entry.last_check * 1000 | date: medium}}</td>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<div class="data-table__service {{state}}" ng-controller="CellServiceCheckCtrl">
|
||||
<td class="data-table__service {{state}}" ng-controller="CellServiceCheckCtrl">
|
||||
<dl class="data-table__data">
|
||||
<dt class="data-table__service__name">{{entry.description}}</dt>
|
||||
<dd class="data-table__service__summary">{{entry.plugin_output}}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</td>
|
||||
|
@ -14,7 +14,6 @@ angular.module('adagios.table', ['adagios.live',
|
||||
.value('tableConfig', { cells: { 'text': [], 'name': [] },
|
||||
apiName: '',
|
||||
filters: {},
|
||||
cellToFunctionsMap: {},
|
||||
cellToFieldsMap: {} })
|
||||
|
||||
.controller('TableCtrl', ['$scope', 'getServices', 'readConfig', 'tableConfig', function ($scope, getServices, readConfig, tableConfig) {
|
||||
@ -39,11 +38,6 @@ angular.module('adagios.table', ['adagios.live',
|
||||
|
||||
getServices(requestFields, filters, tableConfig.apiName)
|
||||
.success(function (data) {
|
||||
angular.forEach(data, function (d) {
|
||||
angular.forEach($scope.cellsName, function (key, value) {
|
||||
d = tableConfig.cellToFunctionsMap[key](d)
|
||||
})
|
||||
})
|
||||
$scope.entries = data;
|
||||
});
|
||||
}])
|
||||
@ -77,7 +71,6 @@ angular.module('adagios.table', ['adagios.live',
|
||||
return {
|
||||
restrict:'A',
|
||||
|
||||
transclude: 'element',
|
||||
compile: function() {
|
||||
return function postCompile(scope, element, attrs) {
|
||||
var template = 'components/table/cell_' + attrs.type + '/cell_' + attrs.type + '.html'
|
||||
@ -86,11 +79,9 @@ angular.module('adagios.table', ['adagios.live',
|
||||
.success(function(data) {
|
||||
$templateCache.put(template, data);
|
||||
var titi = $compile(data)(scope)
|
||||
console.log(titi)
|
||||
element.replaceWith(titi)
|
||||
});
|
||||
}
|
||||
}
|
||||
// template: '<span ></span>'
|
||||
};
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user